[HELP] Why does this fail?

Posts 1–5 of 5 · Page 1 of 1
[HELP] Why does this fail?
I'm stuck in the process of making a memory searcher
(Yes I do realize this is my 3rd thread in 2 days..., who cares?)

Code:
#include <windows.h>

MEMORY_BASIC_INFORMATION* pMBI;
int main(){
	while(1){
		if(GetAsyncKeyState(VK_HOME)){
DWORD* address = (DWORD *)0x00068778;
//char* buffer = "Node7Priority";
char* buffer1 = "checkhate2";

if ( VirtualQuery((void *)address, pMBI, strlen(buffer1)) == 0 ){
MessageBoxA(NULL, (LPCSTR) GetLastError(), "SCHiM - ERROR", NULL);
}

if(pMBI->Protect == PAGE_EXECUTE_READWRITE && pMBI->State == 0x10000 || 0x1000){
if( strcmp(buffer1, (char *)address )  == 0){
	MessageBoxA(NULL, "Equal", "SCHiM", NULL);
	MessageBoxA(NULL, (LPCSTR)address, "SCHiM", NULL);
} else {
	MessageBoxA(NULL, "Not equal", "SCHiM", NULL);
	MessageBoxA(NULL, (LPCSTR)address, "SCHiM", NULL);
}
} else {
	MessageBoxA(NULL, "Memory is protected", "SCHiM", NULL);
}
		}
		Sleep(100);
	}
}


BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
	DisableThreadLibraryCalls(hDll);

	if ( dwReason == DLL_PROCESS_ATTACH )
	{
		CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)main, NULL, NULL, NULL);
	}
	return TRUE;
}
Once I press 'home' with this injector my game disconnects
The reason I think it has something to do with the memory I'm trying to access is because I'm able to access other addresses ( 0x10868778 works flawlessly)

Does anyone spot any faults, or is my code detected?
-SCHiM
Probably too low addy(protected range)
Quote Originally Posted by Hell_Demon View Post
Probably too low addy(protected range)
But why doesn't Virutalquery warn me about it?

That's not it
With virual querry it fails on: 0x10868778, and without it doesn't fail on that address

Am I doing something wrong?
Try:

Code:
if(!strcmp(buffer1, (char *)address )){
because for few weeks i had a problem with strcmp, i have wrote it like you and everytime my windows is crashed ( bluescreen ). Maybe thats your error, too ?

Regards
Quote Originally Posted by inmate View Post
Try:

Code:
if(!strcmp(buffer1, (char *)address )){
because for few weeks i had a problem with strcmp, i have wrote it like you and everytime my windows is crashed ( bluescreen ). Maybe thats your error, too ?

Regards
I don't think that is the problem because my code works fine without virtual querry, but I don't want to put it away since I'm planning on scanning the whole program's memory so I'll have to know if I can access the address

But virtualquerry isn't working
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us