Err I completly rewrote the code and still nadda.
I used tsearch to get the offsets and here it is:
As you can see the ending is always constant, but the beginning is dynamic and it's just such a pain in the ass. ERRRRR
Return Value:
---------------------------
Testing
---------------------------
Base Address: 00274F90 Value: 0
---------------------------
OK
---------------------------
Syntax
Set Globally:
Code:
typedef NTSTATUS (NTAPI *_NtQueryInformationProcess)
(
HANDLE ProcessHandle,
DWORD ProcessInformationClass,
PVOID ProcessInformation,
DWORD ProcessInformationLength,
PDWORD ReturnLength
);
PVOID GetPebAddress(HANDLE Process)
{
DWORD ProcessID;
GetWindowThreadProcessId( hWnd2, &ProcessID );
Process = OpenProcess( PROCESS_VM_READ|PROCESS_VM_OPERATION, FALSE, ProcessID );
_NtQueryInformationProcess NtQueryInformationProcess = (_NtQueryInformationProcess)GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtQueryInformationProcess");
PROCESS_BASIC_INFORMATION pbi;
NtQueryInformationProcess(Process, 0, &pbi, sizeof(pbi), NULL);
return pbi.PebBaseAddress;
}
And in LRESULT WINAPI myProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
in a timer
Code:
if(hWnd1 && hWnd2)
{
DWORD ProcessID;
GetWindowThreadProcessId( hWnd2, &ProcessID );
HANDLE ProcessX = OpenProcess( PROCESS_VM_READ|PROCESS_VM_OPERATION, FALSE, ProcessID );
PROCESS_BASIC_INFORMATION pbi = { 0 };
DWORD dwRead = 0;
GetPebAddress(ProcessX);
PEB peb = {0};
dwRead = 0;
BYTE data;
DWORD datasize = sizeof(data);
char buffer [512];
ReadProcessMemory( ProcessX, (LPCVOID)pbi.PebBaseAddress, &peb, sizeof(peb), &dwRead );
sprintf (buffer, "Base Address: %p Value: %i", GetPebAddress(ProcessX), peb);
if(ProcessX)
{
if((int)data == 1)
{
if(GetAsyncKeyState(VK_RBUTTON))
{
//MessageBox(0, "Value is 1", "Testing", MB_OK);
MessageBox(0, buffer, "Testing", MB_OK);
}
}
else if((int)data == 0)
{
if(GetAsyncKeyState(VK_RBUTTON))
{
//MessageBox(0, "Value is 0", "Testing", MB_OK);
MessageBox(0, buffer, "Testing", MB_OK);
}
}
CloseHandle(ProcessX);
}
}