473,513 Members | 2,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fix my c++ code please Error C1075

1 New Member
Heres the code my error is C1075 please fix it, also "return dwReturn" wont work so any hekp would be great!

Expand|Select|Wrap|Line Numbers
  1.     #include "stdafx.h"
  2.     #include <Windows.h>
  3.     #include <TlHelp32.h>
  4.  
  5.     HMODULE GetModuleHandle (char *,DWORD);
  6.     DWORD GetModuleBase(const char *,const DWORD);
  7.     static size_t WriteMemoryCallback(void *,size_t,size_t,void *);
  8.  
  9.     // Structures
  10.     struct MemoryStruct {
  11.         char *memory;
  12.         size_t size;
  13.     };
  14.  
  15.     int main()    {
  16.         // Create the memory structure to store data in.
  17.         struct MemoryStruct MOTD;
  18.  
  19.         // Create the memory needed for the MOTD.
  20.         MOTD.memory = (char *)malloc(1);
  21.         MOTD.size = 0;
  22.  
  23.         printf("*****************************\n");
  24.         printf("****** External Bhop  *******\n");
  25.         printf("******* by cLeansify ********\n");
  26.         printf("*****************************\n\n");
  27.  
  28.         HANDLE hProcess;
  29.         HWND AppHWND;
  30.         DWORD AppPID;
  31.  
  32.         DWORD GroundOffset;
  33.         DWORD WaterOffset;
  34.         DWORD UIOpen;
  35.  
  36.         DWORD ClientDLL;
  37.         DWORD EngineDLL;
  38.         DWORD VGUIDLL;
  39.  
  40.         printf("Waiting for Counter Strike Source\n");
  41.  
  42.             AppHWND = NULL;
  43.  
  44.  
  45.             while(AppHWND==NULL)    {
  46.                 if(FindWindowA(NULL,"Counter-Strike Source") != 0) {
  47.                     printf("\nGame: Counter-Strike Source\n");
  48.                     AppHWND = FindWindowA(NULL,"Counter-Strike Source");
  49.                 } else if(FindWindowA(NULL,"Team Fortress 2") != 0)    {
  50.                     printf("\nGame: Team Fortress 2\n");
  51.                     AppHWND = FindWindowA(NULL,"Team Fortress 2)");
  52.                 } else {
  53.                     Sleep(1000);
  54.                 }
  55.             }
  56.  
  57.             GetWindowThreadProcessId(AppHWND,&AppPID);
  58.  
  59.             do {
  60.  
  61.                 hProcess  = OpenProcess (PROCESS_ALL_ACCESS, 0, AppPID);
  62.                 // Client.dll adress
  63.                 ClientDLL = GetModuleBase("client.dll",AppPID);
  64.                 // Engine.dll adress
  65.                 EngineDLL = GetModuleBase("engine.dll",AppPID);
  66.                 // vguimatsurface adress
  67.                 VGUIDLL = GetModuleBase("vguimatsurface.dll",AppPID);
  68.  
  69.                 // OnGround Offset
  70.                 GroundOffset = ClientDLL + 0x782158;
  71.                 // Chat/Console Offset
  72.                 UIOpen = VGUIDLL + 0x1153B8;
  73.                 // Water Offset
  74.                 WaterOffset = ClientDLL + 0x77FE3C;
  75.  
  76.  
  77.                 Sleep(20);
  78.             } while(!VGUIDLL);
  79.  
  80.             printf("Client.dll: %p\n",ClientDLL);
  81.             printf("Engine.dll: %p\n",EngineDLL);
  82.             printf("VGUIMatSurface.dll: %p\n",VGUIDLL);
  83.  
  84.             printf("On Ground Address: %p\n",GroundOffset);
  85.             printf("VGUI Address: %p\n",UIOpen);
  86.             printf("In Water Adress: %p\n",WaterOffset);
  87.  
  88.  
  89.             printf("\nHold down Space and have fun :D\n");
  90.  
  91.             int BhopVal = 0;
  92.  
  93.  
  94.             while(1) {
  95.  
  96.             ReadProcessMemory(hProcess, (LPCVOID)GroundOffset,&BhopVal,1,NULL);
  97.             if(GetAsyncKeyState(VK_SPACE)&0x80000000) {
  98.                 if(BhopVal != 255) {
  99.                     SendMessage(AppHWND, WM_KEYDOWN, VK_SPACE, 0x390000);
  100.                     Sleep(10);
  101.                     SendMessage(AppHWND, WM_KEYUP, VK_SPACE, 0x390000);
  102.  
  103.                 }
  104.             }
  105.  
  106.             Sleep(5);
  107.         }
  108.  
  109.         return 0;
  110.     }
  111.  
  112.     static size_t WriteMemoryCallback(void *contents, size_t, size_t nmemb, void  *userp) {
  113.     int size = 0;
  114.     size_t realsize = size * nmemb;
  115.     struct MemoryStruct *mem = (struct MemoryStruct *)userp;
  116.  
  117.     mem->memory = (char *)realloc(mem->memory,mem->size + realsize + 1);
  118.     if (mem->memory == NULL) {
  119.         printf("not enough memory (realloc returned NULL\n");
  120.         exit(EXIT_FAILURE);
  121.     }
  122.  
  123.     memcpy(&(mem->memory[mem->size]), contents, realsize);
  124.     mem->size += realsize;
  125.     mem->memory[mem->size] = 0;
  126.  
  127.     return realsize;
  128.     }
  129.  
  130.     HMODULE GetModuleBase( char *szModuleName, DWORD dwProcessId ) {
  131.     if( !szModuleName || !dwProcessId ) {
  132.         return NULL;
  133.     }
  134.  
  135.     HANDLE hSnap = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwProcessId );
  136.  
  137.     if(hSnap == INVALID_HANDLE_VALUE ) {
  138.         return NULL;
  139.     }
  140.  
  141.     MODULEENTRY32 me;
  142.     me.dwSize = sizeof( MODULEENTRY32 );
  143.  
  144.     if(Module32First( hSnap, &me )) {
  145.         while(Module32Next(hSnap,&me )) {
  146.             if(!strcmp(reinterpret_cast<const char *>(me.szModule), szModuleName)) {
  147.             if(!strcmp(reinterpret_cast<const char *>(me.szModule), szModuleName)) {
  148.                 CloseHandle(hSnap);
  149.                 return me.hModule;
  150.             }
  151.         }
  152.     }
  153.  
  154.     CloseHandle( hSnap );
  155.     return NULL;
  156.     }
  157.  
  158.     DWORD GetModuleBase(const char *szModuleName,const DWORD dwProcessId);    {
  159.         if ((dwProcessId) || (!szModuleName)) {
  160.             return 0;
  161.         }
  162.  
  163.         HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, dwProcessId);
  164.  
  165.  
  166.         if (hSnap == INVALID_HANDLE_VALUE) {
  167.             return 0;
  168.         }
  169.  
  170.         MODULEENTRY32 me;
  171.         me.dwSize = sizeof(MODULEENTRY32);
  172.  
  173.         DWORD dwReturn = 0;
  174.  
  175.         if(Module32First(hSnap, &me)) {
  176.             while (Module32Next(hSnap, &me)) {
  177.                 if( !strcmp(reinterpret_cast<const char *>(me.szModule), szModuleName)) {
  178.                     CloseHandle (hSnap);
  179.                     dwReturn = (DWORD)me.modBaseAddr;
  180.                     return dwReturn;
  181.                 }
  182.             }
  183.         }
  184.  
  185.         CloseHandle(hSnap);
  186.         return dwReturn;
  187.     }
Dec 7 '12 #1
1 3103
Banfa
9,065 Recognized Expert Moderator Expert
If you read the error code then you would see that you have an unmatch brace, bracket, square bracket or angle bracket.

It is then a simple exercise to scan you program and count your braces/brackets etc open and closed, most 1/2 decent editors help with this by highlighting bracket pairs and if you had bothered to do any of that you would have found (or rather not found I guess) a missing brace around line 150.
Dec 7 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
9830
by: geronimo_me | last post by:
Hi, I am trying to run an Excel macro from an Access module, however when I run the code the macro runs but then I get an error in Access. The error is: Run-time error "440", Automation error. ...
8
1718
by: Doug Bell | last post by:
Hi, I have been debugging a new VB.Net Application and today, I have been getting an error that I have not seen before This error is now appearing on a line with the following code: lnGUID =...
1
2025
by: xian2 | last post by:
Hi All, I have been using this guide http://www.compasscomputing.co.uk/code/AcceesReportsToPDFandEmail.htm to create a command button that automatically saves and e-mails your report and have...
7
5384
by: JewelsT | last post by:
Hello, I'm new to both RSS & XML and I am trying to create a ColdFusion RSS feed. I have my cfm file with all my code and at the end of the file I am writing that output to an XML file. At the top...
1
1719
by: TSalm | last post by:
Hi, After sending a request, I would get the possible error message. Not the code @@error, nor the exact content of sysmessages, but the message like it could be in the log file. TIA, TSalm
13
4713
by: problem. | last post by:
#include <stdio.h> #include <stdlib.h> int main(void) { int a, b; float result = 0.0f; char symbol = '\0'; int loop = 0;
1
4048
by: yasoof0wnz | last post by:
I tried a lot of things to fix this statement but every time i try fixing it, i get more errors, so i undo. Heres the error: fatal error C1075: end of file found before the left brace '{' at...
0
2808
by: vagueante | last post by:
Hi, I have a windows service that i connecto to a iSeries Dataqueue, i can write and read from it. The purpose of this service it's to keep reading the dataqueue and when it has some data i run...
2
5638
by: Jerusha | last post by:
This is what I've got in my program so far. /*********************************************************************************/ #include <iostream> // include standard I/O library...
1
1510
by: Dan Oren | last post by:
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <conio.h> void main () { int month,year; int days,weeks,left; char x; float a,b,c; do
0
7259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7158
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7380
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7523
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5683
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3232
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1592
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.