I've got a C++ Issue about Pattern,why won't work when OLLYDBG not workCode:Functions.h #include <iostream> #include <Windows.h> #include <tlhelp32.h> #include <Psapi.h> void MsgBoxAddy(DWORD addy) { char szBuffer[1024]; sprintf(szBuffer, "Addy: %02x", addy); MessageBox(NULL, szBuffer, "Title", MB_OK); } MODULEINFO GetModuleInfo( char *szModule ) { MODULEINFO modinfo = {0}; HMODULE hModule = GetModuleHandle(szModule); if(hModule == 0) return modinfo; GetModuleInformation(GetCurrentProcess(), hModule, &modinfo, sizeof(MODULEINFO)); return modinfo; } void WriteToMemory(uintptr_t addressToWrite, char* valueToWrite, int byteNum) { unsigned long OldProtection; VirtualProtect((LPVOID)(addressToWrite), byteNum, PAGE_EXECUTE_READWRITE, &OldProtection); memcpy( (LPVOID)addressToWrite, valueToWrite, byteNum); VirtualProtect((LPVOID)(addressToWrite), byteNum, OldProtection, NULL); } DWORD FindPattern(char *module, char *pattern, char *mask) { MODULEINFO mInfo = GetModuleInfo(module); DWORD base = (DWORD)mInfo.lpBaseOfDll; DWORD size = (DWORD)mInfo.SizeOfImage; DWORD patternLength = (DWORD)strlen(mask); for(DWORD i = 0; i < size - patternLength; i++) { bool found = true; for(DWORD j = 0; j < patternLength; j++) { found &= mask[j] == '?' || pattern[j] == *(char*)(base + i + j); } if(found) { return base + i; } } return NULL; } Source.cpp #include <Windows.h> #include <iostream> #include "Functions.h" using namespace std; char OpCode[] = "\xDB\x45"; void InitiateHooks() { DWORD aAddy = FindPattern("s4client.exe", "\xD9\x45\x57\x8B\x7C\x24\x14\x8D\x74\x24\x28\xE8\x00\x00\x00\x00\x5F\x5E\xB0\x01", "xxxxxxxxxxxx????xxxx"); aAddy += 5; MsgBoxAddy(aAddy); WriteToMemory(aAddy, OpCode, 4); } #pragma endregion BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) { switch(fdwReason) { case DLL_PROCESS_ATTACH: InitiateHooks(); break; } return TRUE; }