ReadMemory C++

07/20/2012 10:17 LogLife#1
i got everthing working please delete this thread thank you for all.
07/20/2012 14:25 HellSpider#2
Quote:
Originally Posted by LogLife View Post
Code:
void ReadMem(char *window, LPCVOID dAddr)
{	int cout;
	int tbuf;
	HWND hWnd = FindWindow(0, window);
	DWORD proc_id; 
	GetWindowThreadProcessId(hWnd, &proc_id); 
	HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proc_id); 
	ReadProcessMemory(hProcess, dAddr, &tbuf, 4, NULL);
	cout=tbuf;
}

Code:
int main()
{
	
	ReadMem("iexplorer", (LPCVOID)0x100579C);
MessageBoxA(NULL,ReadMem, "Notice", MB_OK | MB_ICONSTOP); 
	system("PAUSE");
}
if i want to show memory values from "ReadMem" function for show on messagebox how to show it , the above code in main() it's right ?
Change the ReadMem function to uint instead of void (to return a value).

Code:
[B]uint[/B] ReadMem(char *window, LPCVOID dAddr)
{	[B]uint value;[/B]
	HWND hWnd = FindWindow(0, window);
	DWORD proc_id; 
	GetWindowThreadProcessId(hWnd, &proc_id); 
	HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proc_id); 
	ReadProcessMemory(hProcess, dAddr, &value, 4, NULL);
	CloseHandle(hProcess);
	[B]return value;[/B]
}
Code:
int main()
{
	[B]char buffer [20];[/B]
	
	[B]sprintf(&buffer,"%04X",(ReadMem("iexplorer", (LPCVOID)0x100579C)));[/B]
	MessageBoxA(NULL,[B]&buffer[/B], "Notice", MB_OK | MB_ICONSTOP); 
	system("PAUSE");
}
There might pop up some errors as I haven't written anything in C++ since 2009.

Btw, you don't need to write in a huge font, if people can't read the default font they need to get their eyes checked.
07/20/2012 15:11 LogLife#3
When complie got this error:

Quote:
antihack.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\antihack\antihack.cpp(248) : error C2146: syntax error : missing ';' before identifier 'ReadMem'
C:\Program Files\Microsoft Visual Studio\MyProjects\antihack\antihack.cpp(248) : error C2501: 'uint' : missing storage-class or type specifiers
C:\Program Files\Microsoft Visual Studio\MyProjects\antihack\antihack.cpp(248) : fatal error C1004: unexpected end of file found
i'm using VC++ 6.0
07/20/2012 15:30 freeskier4lif3#4
uint is not a default typename in c++. use: unsigned int

and find your missing semi-colon to fix the other error.
07/20/2012 16:41 LogLife#5
i got everthing working please delete this thread thank you for all.