From fc6f5c576ae5bb1bc8c7ad00524b58d1aa90f3f1 Mon Sep 17 00:00:00 2001 From: Silent Date: Sat, 21 Feb 2015 16:53:58 +0100 Subject: [PATCH] Faster string comparing --- ResSock/dllmain.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ResSock/dllmain.cpp b/ResSock/dllmain.cpp index 36d1bae..3ceb4bb 100644 --- a/ResSock/dllmain.cpp +++ b/ResSock/dllmain.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "MemoryMgr.h" extern "C" HRESULT WINAPI DirectDrawCreateEx(GUID FAR *lpGUID, LPVOID *lplpDD, REFIID iid, IUnknown FAR *pUnkOuter) @@ -103,7 +104,7 @@ extern "C" HRESULT WINAPI DirectDrawCreateEx(GUID FAR *lpGUID, LPVOID *lplpDD, R for ( WORD i = 0; i < NumberOfSections; i++ ) { - if ( !strncmp((char*)pSection->Name, "_rwcseg", 8) ) + if ( *(uint64_t*)(pSection->Name) == 0x006765736377725F ) // _rwcseg { DWORD dwProtect; VirtualProtect((LPVOID)((ptrdiff_t)hModule + pSection->VirtualAddress), pSection->Misc.VirtualSize, PAGE_EXECUTE_READ, &dwProtect);