Serious problem, 2 days still cannot figure it out

Oct 5, 2010 at 2:25pm
Hey!

Sorry i re-posted but i thought windows programming would better suit this problem

Here's my problem.

Say i have the address:

0x00000000 (The address im trying to change is this long.)

now heres what i do.

1
2
3
4
DWORD dw, dw2;
VirtualProtect((PVOID)0x00000000, sizeof(0x00000000), PAGE_EXECUTE_READWRITE, &dw);
strcpy((PCHAR)0x00000000, "DR2MP");
VirtualProtect((PVOID)0x00000000, sizeof(0x00000000), dw, &dw2);


I've also tried:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
HANDLE hProcessSnap;
    HANDLE hProcess = NULL;
	PROCESSENTRY32 pe32; 
   
    hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
    pe32.dwSize = sizeof(PROCESSENTRY32);
    Process32First(hProcessSnap, &pe32);
    do
    {          
        if(!strcmp(pe32.szExeFile, "deadrising2.exe"))
        {
             hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID);
             break;
        }
    }
    while(Process32Next(hProcessSnap, &pe32));
    CloseHandle(hProcessSnap);
    if(hProcess != NULL)
    {
        WriteProcessMemory(hProcess, (void *)0x00000000, "DR2MP", sizeof(0x00000000), NULL);        
        CloseHandle(hProcess);    
        return true;
    }


I'm trying to set the address:

 
0x1C9B57B3


which is the text of a button in a game, I've injected my .dll and it works, i just cannot change the text, i can change it in cheat engine, and it changes to DR2MP perfectly. fyi in CheatEngine it's text[15].

So does anyone know how i can possibly set this addresses value to DR2MP?

I have seriously tried so many options it's just not funny anymore, im deadbeat on ideas.

Thank you!
Last edited on Oct 5, 2010 at 2:53pm
Oct 7, 2010 at 12:19pm
Hello Ravskie,

still not enough information...

so let me guess what you want to do. hm, you want to find a window (in another process?) and change it's text?
As far as i know button is a window. so why don't you use the FindWindow() function and then using SetWindowText() to change the text?

if you really want to access the memory of another process this http://www.woodmann.com/fravia/natz_mp2.htm might help

just out of curiosity. how do you come to that address?
Oct 7, 2010 at 5:31pm
The first code-snippet you posted should work fine if you've already injected a DLL into the target process.. what do you mean it isn't working? Is it crashing, or is the text at the address simply not changing?

1
2
3
4
static const CHAR szNewText [] = "DR2MP";
const ULONG_PTR ulTextAddress = 0x1C9B57B3;

StringCchCopy((LPTSTR) ulTextAddress, STRSAFE_MAX_CCH, szNewText);


@coder777: Since it looks like he's hacking a game, there's a chance the button in question may not be a valid window handle & thus SetWindowText might not be the best idea. Actually, I'm pretty sure the game he's trying to hack uses manually paints its controls via DirectX.
Oct 9, 2010 at 12:15pm
I actually managed to set the game buttons text successfully using my code with a few hefty modifications.

Actually @coder777, FindWindow() does not work when i tried it.

1
2
3
HWND gamewindow;
gamewindow = FindWindow(NULL, "windowname");
SetWindowText(gamewindow, "NEWWINDOWTEXT");


That doesnt work, no idea why.
Topic archived. No new replies allowed.