Faster string comparing

This commit is contained in:
Silent 2015-02-21 16:53:58 +01:00
parent a82447b1aa
commit fc6f5c576a

View file

@ -4,6 +4,7 @@
#include <windows.h> #include <windows.h>
#include <stdio.h> #include <stdio.h>
#include <Shlwapi.h> #include <Shlwapi.h>
#include <cstdint>
#include "MemoryMgr.h" #include "MemoryMgr.h"
extern "C" HRESULT WINAPI DirectDrawCreateEx(GUID FAR *lpGUID, LPVOID *lplpDD, REFIID iid, IUnknown FAR *pUnkOuter) 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++ ) for ( WORD i = 0; i < NumberOfSections; i++ )
{ {
if ( !strncmp((char*)pSection->Name, "_rwcseg", 8) ) if ( *(uint64_t*)(pSection->Name) == 0x006765736377725F ) // _rwcseg
{ {
DWORD dwProtect; DWORD dwProtect;
VirtualProtect((LPVOID)((ptrdiff_t)hModule + pSection->VirtualAddress), pSection->Misc.VirtualSize, PAGE_EXECUTE_READ, &dwProtect); VirtualProtect((LPVOID)((ptrdiff_t)hModule + pSection->VirtualAddress), pSection->Misc.VirtualSize, PAGE_EXECUTE_READ, &dwProtect);