Loading xpcom/build/nsWindowsDllInterceptor.h +10 −25 Original line number Diff line number Diff line Loading @@ -93,6 +93,9 @@ public: { mSuccess = !!VirtualProtectEx(GetCurrentProcess(), mFunc, mSize, mNewProtect, &mOldProtect); if (!mSuccess) { // printf("VirtualProtectEx failed! %d\n", GetLastError()); } return mSuccess; } Loading Loading @@ -132,7 +135,6 @@ public: // Ensure we can write to the code. AutoVirtualProtect protect(fn, 2, PAGE_EXECUTE_READWRITE); if (!protect.Protect()) { // printf("VirtualProtectEx failed! %d\n", GetLastError()); continue; } Loading Loading @@ -268,7 +270,6 @@ public: AutoVirtualProtect protectBefore(fn - 5, 5, PAGE_EXECUTE_READWRITE); AutoVirtualProtect protectAfter(fn, 2, PAGE_EXECUTE_READWRITE); if (!protectBefore.Protect() || !protectAfter.Protect()) { //printf ("VirtualProtectEx failed! %d\n", GetLastError()); return false; } Loading Loading @@ -377,7 +378,6 @@ public: // ensure we can modify the original code AutoVirtualProtect protect(origBytes, nBytes, PAGE_EXECUTE_READWRITE); if (!protect.Protect()) { //printf ("VirtualProtectEx failed! %d\n", GetLastError()); continue; } Loading Loading @@ -417,7 +417,7 @@ public: mHookPage = (byteptr_t)VirtualAllocEx(GetCurrentProcess(), nullptr, mMaxHooks * kHookSize, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); PAGE_EXECUTE_READ); if (!mHookPage) { mModule = 0; return; Loading @@ -426,19 +426,6 @@ public: bool Initialized() { return !!mModule; } void LockHooks() { if (!mModule) { return; } DWORD op; VirtualProtectEx(GetCurrentProcess(), mHookPage, mMaxHooks * kHookSize, PAGE_EXECUTE_READ, &op); mModule = 0; } bool AddHook(const char* aName, intptr_t aHookDest, void** aOrigFunc) { if (!mModule) { Loading Loading @@ -670,6 +657,12 @@ protected: { *aOutTramp = nullptr; AutoVirtualProtect protectHookPage(mHookPage, mMaxHooks * kHookSize, PAGE_EXECUTE_READWRITE); if (!protectHookPage.Protect()) { return; } byteptr_t tramp = FindTrampolineSpace(); if (!tramp) { return; Loading Loading @@ -1005,7 +998,6 @@ protected: // ensure we can modify the original code AutoVirtualProtect protect(aOrigFunction, nBytes, PAGE_EXECUTE_READWRITE); if (!protect.Protect()) { //printf ("VirtualProtectEx failed! %d\n", GetLastError()); return; } Loading Loading @@ -1091,13 +1083,6 @@ public: // not need it. } void LockHooks() { if (mDetourPatcher.Initialized()) { mDetourPatcher.LockHooks(); } } bool AddHook(const char* aName, intptr_t aHookDest, void** aOrigFunc) { // Use a nop space patch if possible, otherwise fall back to a detour. Loading Loading
xpcom/build/nsWindowsDllInterceptor.h +10 −25 Original line number Diff line number Diff line Loading @@ -93,6 +93,9 @@ public: { mSuccess = !!VirtualProtectEx(GetCurrentProcess(), mFunc, mSize, mNewProtect, &mOldProtect); if (!mSuccess) { // printf("VirtualProtectEx failed! %d\n", GetLastError()); } return mSuccess; } Loading Loading @@ -132,7 +135,6 @@ public: // Ensure we can write to the code. AutoVirtualProtect protect(fn, 2, PAGE_EXECUTE_READWRITE); if (!protect.Protect()) { // printf("VirtualProtectEx failed! %d\n", GetLastError()); continue; } Loading Loading @@ -268,7 +270,6 @@ public: AutoVirtualProtect protectBefore(fn - 5, 5, PAGE_EXECUTE_READWRITE); AutoVirtualProtect protectAfter(fn, 2, PAGE_EXECUTE_READWRITE); if (!protectBefore.Protect() || !protectAfter.Protect()) { //printf ("VirtualProtectEx failed! %d\n", GetLastError()); return false; } Loading Loading @@ -377,7 +378,6 @@ public: // ensure we can modify the original code AutoVirtualProtect protect(origBytes, nBytes, PAGE_EXECUTE_READWRITE); if (!protect.Protect()) { //printf ("VirtualProtectEx failed! %d\n", GetLastError()); continue; } Loading Loading @@ -417,7 +417,7 @@ public: mHookPage = (byteptr_t)VirtualAllocEx(GetCurrentProcess(), nullptr, mMaxHooks * kHookSize, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); PAGE_EXECUTE_READ); if (!mHookPage) { mModule = 0; return; Loading @@ -426,19 +426,6 @@ public: bool Initialized() { return !!mModule; } void LockHooks() { if (!mModule) { return; } DWORD op; VirtualProtectEx(GetCurrentProcess(), mHookPage, mMaxHooks * kHookSize, PAGE_EXECUTE_READ, &op); mModule = 0; } bool AddHook(const char* aName, intptr_t aHookDest, void** aOrigFunc) { if (!mModule) { Loading Loading @@ -670,6 +657,12 @@ protected: { *aOutTramp = nullptr; AutoVirtualProtect protectHookPage(mHookPage, mMaxHooks * kHookSize, PAGE_EXECUTE_READWRITE); if (!protectHookPage.Protect()) { return; } byteptr_t tramp = FindTrampolineSpace(); if (!tramp) { return; Loading Loading @@ -1005,7 +998,6 @@ protected: // ensure we can modify the original code AutoVirtualProtect protect(aOrigFunction, nBytes, PAGE_EXECUTE_READWRITE); if (!protect.Protect()) { //printf ("VirtualProtectEx failed! %d\n", GetLastError()); return; } Loading Loading @@ -1091,13 +1083,6 @@ public: // not need it. } void LockHooks() { if (mDetourPatcher.Initialized()) { mDetourPatcher.LockHooks(); } } bool AddHook(const char* aName, intptr_t aHookDest, void** aOrigFunc) { // Use a nop space patch if possible, otherwise fall back to a detour. Loading