| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		Danielb Cheater
  Reputation: 0
  Joined: 22 Jul 2007 Posts: 30
 
  | 
		
			
				 Posted: Wed Feb 25, 2009 7:58 pm    Post subject: [C++] Help find adress api | 
				       | 
			 
			
				
  | 
			 
			
				I need to find the address of "WriteProcessMemory" then with the help of a friend made the following program that is full of errors. Help fix please!
 
 
 	  | Code: | 	 		  
 
#include <tchar.h>
 
 
DWORD ADRESS = NULL;
 
 
int _tmain(int argc, TCHAR *argv[])
 
{
 
_ADRESS = (DWORD)GetProcAddress(LoadLibrary(_T("KERNEL32.dll")), "WriteProcessMemory") + 5;
 
if (_ADRESS == 5)
 
{
 
_tprintf(_T("Erro no Progama."));
 
return 0;
 
}
 
else
 
{
 
_tprintf(_T("WriteProcessMemory: 0x%08X"), _ADRESS;
 
}
 
return 0;
 
}
 
 | 	  
 
 
	
 
Sorry for my English. I am Brazilian   
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		dnsi0 I post too much
  Reputation: 0
  Joined: 04 Jan 2007 Posts: 2674
 
  | 
		
			
				 Posted: Wed Feb 25, 2009 8:03 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				| Get Cheatengine.
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		BanMe Master Cheater
  Reputation: 0
  Joined: 29 Nov 2005 Posts: 375 Location: Farmington NH, USA
  | 
		
			
				 Posted: Wed Feb 25, 2009 9:01 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				 	  | Code: | 	 		  
 
#include <windows.h> 
 
 
DWORD ADDRESS = NULL; 
 
 
int main(int argc, TCHAR *argv[]) 
 
{ 
 
ADDRESS = (DWORD)GetProcAddress(LoadLibrary"KERNEL32.dll"), "WriteProcessMemory") + 5; 
 
if (ADDRESS == 5) 
 
{ 
 
      return 0; 
 
} 
 
else 
 
{ 
 
   printf(("WriteProcessMemory: 0x%08X"),ADDRESS);
 
   return 1; 
 
} 
 
return 0;
 
} | 	  
 
regards BanMe
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Danielb Cheater
  Reputation: 0
  Joined: 22 Jul 2007 Posts: 30
 
  | 
		
			
				 Posted: Wed Feb 25, 2009 9:08 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				 	  | BanMe wrote: | 	 		   	  | Code: | 	 		  
 
#include <windows.h> 
 
 
DWORD ADDRESS = NULL; 
 
 
int main(int argc, TCHAR *argv[]) 
 
{ 
 
ADDRESS = (DWORD)GetProcAddress(LoadLibrary"KERNEL32.dll"), "WriteProcessMemory") + 5; 
 
if (ADDRESS == 5) 
 
{ 
 
      return 0; 
 
} 
 
else 
 
{ 
 
   printf(("WriteProcessMemory: 0x%08X"),ADDRESS);
 
   return 1; 
 
} 
 
return 0;
 
} | 	  
 
regards BanMe | 	  
 
 
Errors:
 
 
4 C:\Dev-Cpp\main.cpp [Warning] converting to non-pointer type `DWORD' from NULL 
 
 
 C:\Dev-Cpp\main.cpp In function `int main(int, TCHAR**)': 
 
 
8 C:\Dev-Cpp\main.cpp cannot convert `HINSTANCE__*(*)(const CHAR*)' to `HINSTANCE__*' for argument `1' to `int (* GetProcAddress(HINSTANCE__*, const CHAR*))()' 
 
 
8 C:\Dev-Cpp\main.cpp expected primary-expression before ')' token 
 
 
8 C:\Dev-Cpp\main.cpp expected `;' before "GetProcAddress" 
 
 
15 C:\Dev-Cpp\main.cpp `printf' undeclared (first use this function) 
 
 
  (Each undeclared identifier is reported only once for each function it appears in.) 
 
 
 C:\Dev-Cpp\Makefile.win [Build Error]  [main.o] Error 1 
 
 
  
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		smartz993 I post too much
  Reputation: 2
  Joined: 20 Jun 2006 Posts: 2013 Location: USA
  | 
		
			
				 Posted: Wed Feb 25, 2009 9:19 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				 	  | BanMe wrote: | 	 		   	  | Code: | 	 		  
 
#include <windows.h> 
 
 
DWORD ADDRESS = NULL; 
 
 
int main(int argc, TCHAR *argv[]) 
 
{ 
 
ADDRESS = (DWORD)GetProcAddress(LoadLibrary"KERNEL32.dll"), "WriteProcessMemory") + 5; 
 
if (ADDRESS == 5) 
 
{ 
 
      return 0; 
 
} 
 
else 
 
{ 
 
   printf(("WriteProcessMemory: 0x%08X"),ADDRESS);
 
   return 1; 
 
} 
 
return 0;
 
} | 	  
 
regards BanMe | 	  
 
 
Errors:
 
 
4 C:\Dev-Cpp\main.cpp [Warning] converting to non-pointer type `DWORD' from NULL 
 
 
 C:\Dev-Cpp\main.cpp In function `int main(int, TCHAR**)': 
 
 
8 C:\Dev-Cpp\main.cpp cannot convert `HINSTANCE__*(*)(const CHAR*)' to `HINSTANCE__*' for argument `1' to `int (* GetProcAddress(HINSTANCE__*, const CHAR*))()' 
 
 
8 C:\Dev-Cpp\main.cpp expected primary-expression before ')' token 
 
 
8 C:\Dev-Cpp\main.cpp expected `;' before "GetProcAddress" 
 
 
15 C:\Dev-Cpp\main.cpp `printf' undeclared (first use this function) 
 
 
  (Each undeclared identifier is reported only once for each function it appears in.) 
 
 
 C:\Dev-Cpp\Makefile.win [Build Error]  [main.o] Error 1 
 
 
 	  | Code: | 	 		  
 
#include <windows.h> 
 
 
DWORD ADDRESS = NULL; 
 
 
int main(int argc, TCHAR *argv[]) 
 
{ 
 
ADDRESS = (DWORD)GetProcAddress(LoadLibrary("KERNEL32.dll"), "WriteProcessMemory") + 5; 
 
if (ADDRESS == 5) 
 
{ 
 
      return 0; 
 
} 
 
else 
 
{ 
 
   printf(("WriteProcessMemory: 0x%08X"),ADDRESS);
 
   return 1; 
 
} 
 
return 0;
 
} | 	  
 
 
he was missing a parenthase.
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Danielb Cheater
  Reputation: 0
  Joined: 22 Jul 2007 Posts: 30
 
  | 
		
			
				 Posted: Wed Feb 25, 2009 9:26 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				 	  | smartz993 wrote: | 	 		   	  | BanMe wrote: | 	 		   	  | Code: | 	 		  
 
#include <windows.h> 
 
 
DWORD ADDRESS = NULL; 
 
 
int main(int argc, TCHAR *argv[]) 
 
{ 
 
ADDRESS = (DWORD)GetProcAddress(LoadLibrary"KERNEL32.dll"), "WriteProcessMemory") + 5; 
 
if (ADDRESS == 5) 
 
{ 
 
      return 0; 
 
} 
 
else 
 
{ 
 
   printf(("WriteProcessMemory: 0x%08X"),ADDRESS);
 
   return 1; 
 
} 
 
return 0;
 
} | 	  
 
regards BanMe | 	  
 
 
Errors:
 
 
4 C:\Dev-Cpp\main.cpp [Warning] converting to non-pointer type `DWORD' from NULL 
 
 
 C:\Dev-Cpp\main.cpp In function `int main(int, TCHAR**)': 
 
 
8 C:\Dev-Cpp\main.cpp cannot convert `HINSTANCE__*(*)(const CHAR*)' to `HINSTANCE__*' for argument `1' to `int (* GetProcAddress(HINSTANCE__*, const CHAR*))()' 
 
 
8 C:\Dev-Cpp\main.cpp expected primary-expression before ')' token 
 
 
8 C:\Dev-Cpp\main.cpp expected `;' before "GetProcAddress" 
 
 
15 C:\Dev-Cpp\main.cpp `printf' undeclared (first use this function) 
 
 
  (Each undeclared identifier is reported only once for each function it appears in.) 
 
 
 C:\Dev-Cpp\Makefile.win [Build Error]  [main.o] Error 1 
 
 
 	  | Code: | 	 		  
 
#include <windows.h> 
 
 
DWORD ADDRESS = NULL; 
 
 
int main(int argc, TCHAR *argv[]) 
 
{ 
 
ADDRESS = (DWORD)GetProcAddress(LoadLibrary("KERNEL32.dll"), "WriteProcessMemory") + 5; 
 
if (ADDRESS == 5) 
 
{ 
 
      return 0; 
 
} 
 
else 
 
{ 
 
   printf(("WriteProcessMemory: 0x%08X"),ADDRESS);
 
   return 1; 
 
} 
 
return 0;
 
} | 	  
 
 
he was missing a parenthase. | 	  
 
 
	
 
Thanks, decreased the amount of error. Still have some more:
 
3 C:\Dev-Cpp\Untitled2.cpp [Warning] converting to non-pointer type `DWORD' from NULL 
 
 
 C:\Dev-Cpp\Untitled2.cpp In function `int main(int, TCHAR**)': 
 
 
14 C:\Dev-Cpp\Untitled2.cpp `printf' undeclared (first use this function) 
 
 
  (Each undeclared identifier is reported only once for each function it appears in.) 
 
 
17 C:\Dev-Cpp\Untitled2.cpp expected `}' at end of input
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		sponge I'm a spammer
  Reputation: 1
  Joined: 07 Nov 2006 Posts: 6009
 
  | 
		
			
				 Posted: Wed Feb 25, 2009 9:28 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				Here's a better suggestion. Stop using DEV-C++. MingW is old.
 _________________
  | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Danielb Cheater
  Reputation: 0
  Joined: 22 Jul 2007 Posts: 30
 
  | 
		
			
				 Posted: Wed Feb 25, 2009 9:30 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				 	  | sponge wrote: | 	 		  | Here's a better suggestion. Stop using DEV-C++. MingW is old. | 	  
 
 
I tried to install Visual C + + was no more problem to connect. Can you recommend any other?
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		BanMe Master Cheater
  Reputation: 0
  Joined: 29 Nov 2005 Posts: 375 Location: Farmington NH, USA
  | 
		
			
				 Posted: Wed Feb 25, 2009 9:32 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				I agrees with sponge  
 
and damn man im sorry.. ;p I don always code perfect using this posting  mechanism ;{ pls excuse minor mistakes  
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		&Vage Grandmaster Cheater Supreme
  Reputation: 0
  Joined: 25 Jul 2008 Posts: 1053
 
  | 
		
			
				 Posted: Wed Feb 25, 2009 9:41 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				| Urhm... why are you guys adding 5 bytes... He just wants the address...
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		rapion124 Grandmaster Cheater Supreme
  Reputation: 0
  Joined: 25 Mar 2007 Posts: 1095
 
  | 
		
			
				 Posted: Thu Feb 26, 2009 2:19 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				You're missing some header files.
 
 
 	  | Code: | 	 		  
 
#include <windows.h>
 
#include <stdio.h>
 
#include <tchar.h>
 
 | 	  
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Zerith Master Cheater
  Reputation: 1
  Joined: 07 Oct 2007 Posts: 468
 
  | 
		
			
				 Posted: Fri Feb 27, 2009 4:15 am    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				Like Irwin demonstrated, there is no need to call LoadLibrary if you need the address of WriteProcessMemory in your own address space.
 
(considering you included windows.h)
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		 |