[HELP] Pointer to Memory [C++]

01/24/2013 05:26 Smackthat218#1
Hello,

i try to get a Value of a Memory -> Pointer

thats what I do in Cheat Engine:
[Only registered and activated users can see links. Click Here To Register...]


How do I get this Work in my C++ Function:

Code:
void _sendchat(char* text)
{
        int ProcessID = 0, Len = strlen(text) + 1;
        for (ProcessID = 0; !ProcessID; ProcessID = GetProcessID("gta_sa.exe"))
                ;
        HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, ProcessID);
 
        if (hProcess)
        {
                PVOID cmd = VirtualAllocEx(hProcess, 0, Len, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
                WriteProcessMemory(hProcess, cmd, text, Len, 0);
 
                DWORD func = (DWORD)GetModuleHandleExtern("samp.dll", ProcessID) + 0x4A10;
 
                HANDLE hThread = CreateRemoteThread(hProcess, 0, 0, (LPTHREAD_START_ROUTINE)func, cmd, 0, 0);
 
                DWORD dwExitCode = 0;
                if (hThread)
                {
                        WaitForSingleObject(hThread, INFINITE);
                        GetExitCodeThread(hThread, &dwExitCode);
                }
 
                VirtualFreeEx(hProcess, cmd, Len, MEM_RELEASE);
                CloseHandle(hThread);
        }
        CloseHandle(hProcess);
}
It dont work in this Function, please help...


Thanks
Dennis
01/25/2013 12:57 Jeoni#2
Quote:
Code:
(...)
DWORD func = (DWORD)GetModuleHandleExtern("samp.dll", ProcessID) + 0x4A10;
(...)
I don't get it how you came to the 0x4A10!? There is no other attempt to read something from the process.
I'm not sure about it, but I guess it's working this way (if func is not required for this, just rename the variable):
Code:
(...)
DWORD func = ReadDWORD(ProcessID, (DWORD)GetModuleHandleExtern("samp.dll", ProcessID) + 0x20DFA0) + 0x28;
(...)
I guess it's clear, what ReadDWORD does ;)

With best regards
Jeoni