MCPcopy Create free account
hub / github.com/acl-dev/acl / DetourPageProtectAdjustExecute

Function DetourPageProtectAdjustExecute

lib_fiber/cpp/src/detours/detours.cpp:2523–2539  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2521C_ASSERT((DETOUR_PAGE_NO_EXECUTE_ALL << 4) == DETOUR_PAGE_EXECUTE_ALL);
2522
2523static DWORD DetourPageProtectAdjustExecute(_In_ DWORD dwOldProtect,
2524 _In_ DWORD dwNewProtect)
2525// Copy EXECUTE from dwOldProtect to dwNewProtect.
2526{
2527 bool const fOldExecute = ((dwOldProtect & DETOUR_PAGE_EXECUTE_ALL) != 0);
2528 bool const fNewExecute = ((dwNewProtect & DETOUR_PAGE_EXECUTE_ALL) != 0);
2529
2530 if (fOldExecute && !fNewExecute) {
2531 dwNewProtect = ((dwNewProtect & DETOUR_PAGE_NO_EXECUTE_ALL) << 4)
2532 | (dwNewProtect & DETOUR_PAGE_ATTRIBUTES);
2533 }
2534 else if (!fOldExecute && fNewExecute) {
2535 dwNewProtect = ((dwNewProtect & DETOUR_PAGE_EXECUTE_ALL) >> 4)
2536 | (dwNewProtect & DETOUR_PAGE_ATTRIBUTES);
2537 }
2538 return dwNewProtect;
2539}
2540
2541_Success_(return != FALSE)
2542BOOL WINAPI DetourVirtualProtectSameExecuteEx(_In_ HANDLE hProcess,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…