Read Process memory in Conquer.exe

04/11/2006 08:11 RagnaBaby#1
Any of you coders here could help me out?

From my program, I'm trying to retrieve/get the SERVER_NAME of the memory of the game. Ex, Conquer-online's Conquer.exe

ReadProcessMemory() could help, but still it confuses me.

Anybody can share detailed info about this?
04/11/2006 10:06 S.A.L.O.M.O.N.#2
#moved.....
wrong forum ><
04/11/2006 16:51 unknownone#3
Use FindWindow to search for "[Conquer2.0]". This will retreive the window handle for the topmost window matching that name. If you have multiple windows with the same caption, use FindWindowEx with the desktop as the parent window, then loop through placing any found handle as the next parent, until the handle is zero.

After finding the window handle, use GetWindowThreadProcessId to return the process Id, You can then use OpenProcess with the process ID in order to read/write to its memory.

Code:
#include &#60;windows.h>

const ServerNameAddr = 0x57f21c;

char* GetServerNameFromMemory&#40;&#41;
{
	char* buffer;
	buffer = new char&#91;16&#93;;
  HWND hWnd;
	DWORD pID;
	HANDLE hProcess;

	if &#40;!&#40;hWnd = FindWindow&#40;NULL, &#34;&#91;Conquer2.0&#93;&#34;&#41;&#41;&#41; return NULL;
	GetWindowThreadProcessId&#40;hWnd, &pID&#41;;
	hProcess = OpenProcess&#40;PROCESS_VM_READ, FALSE, pID&#41;;
	ReadProcessMemory&#40;hProcess, &#40;void*&#41;ServerNameAddr, buffer, 16, NULL&#41;;
	CloseHandle&#40;hProcess&#41;;

	return buffer;
}
04/12/2006 11:20 RagnaBaby#4
I've already have the FindWindow() and get process handle.

Is this the actual server offset of the serverAddressName? If it is, Thanks alot.

Could I possibly have more info on how u did get the offset?


I just didn't get why it's transferred to the main section. But still somebody found to help me.

Thanks alot.
04/12/2006 12:27 tsu#5
Quote:
Originally posted by RagnaBaby@Apr 12 2006, 11:20
I just didn't get why it's transferred to the main section. But still somebody found to help me.

Thanks alot.
That is because, [ NO QUESTIONS ] are allowed in subforums, only releases!
04/12/2006 16:04 unknownone#6
Quote:
Originally posted by RagnaBaby@Apr 12 2006, 10:20
I've already have the FindWindow() and get process handle.

Is this the actual server offset of the serverAddressName? If it is, Thanks alot.

Could I possibly have more info on how u did get the offset?


I just didn't get why it's transferred to the main section. But still somebody found to help me.

Thanks alot.
Yeah, that is the offset for the server name. I found it by attaching OllyDbg to a running client, open the memory map and press Ctrl+B, search for the server name there.
04/13/2006 06:18 RagnaBaby#7
Oh thanks again, I'll try use OllyDbg again. Last time I used it is 5yrs ago. I Hope this things will get a lil bit easier.