This code seems to be crashing , can anyone help why
Code:#include <windows.h> #include <stdio.h> //const char findme[8] = "PRIVMSG"; int main() { HANDLE ThisProc = OpenProcess(PROCESS_ALL_ACCESS,true,GetCurrentProcessId()); MEMORY_BASIC_INFORMATION mbi; SYSTEM_INFO si; GetSystemInfo(&si); DWORD dwStart = 0; SIZE_T v; char *p; DWORD lpRead; const char* regionp; BYTE s = 't'; char *memchrp; int memcmpr; const char findme[8] = "PRIVMSG"; HANDLE Term; while(dwStart < (DWORD)si.lpMaximumApplicationAddress) { v = VirtualQueryEx(ThisProc, (void *)dwStart, &mbi, sizeof(MEMORY_BASIC_INFORMATION)); if(v == 0) { printf("%s\n","breaking"); break; } if(mbi.State == MEM_COMMIT) { printf("%s\n","mem_commit"); p = (char *)malloc(mbi.RegionSize); printf("Memory at %02x, size %d\n", mbi.BaseAddress, mbi.RegionSize); if(ReadProcessMemory(ThisProc,(void *)dwStart,p,mbi.RegionSize,&lpRead)) { const char* offset = regionp; while ((offset = (const char*)memchr(offset, findme[0], regionp+mbi.RegionSize-offset)) != 0) { if (memcmp(offset, findme, 7) == 0) { printf("%s\n","found"); Sleep(5000); break; } ++offset; } } } if(dwStart + mbi.RegionSize < dwStart) { printf("%s\n","breaking"); break; } if(mbi.RegionSize != lpRead) { printf("Not enough bytes read %d != %d\n",mbi.RegionSize,lpRead); } dwStart += mbi.RegionSize; Sleep(5); }



LinkBack URL
About LinkBacks




