Quote:
Originally Posted by LogLife
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.