void DetourNtdllForModule(HMODULE base) { auto const& process = GetThisProcess(); auto& module = GetNtdllModule(); auto& helper = GetHelperInterface(); if (helper.CommonDetourModule(process, L"ntdll", base, module)) { DetourFunc(process, base, "NtMapViewOfSection", GetNtMapViewOfSectionDetour(), NtMapViewOfSectionDetour); DetourFunc(process, base, "NtUnmapViewOfSection", GetNtUnmapViewOfSectionDetour(), NtUnmapViewOfSectionDetour); DetourFunc( process, base, "LdrLoadDll", GetLdrLoadDllDetour(), LdrLoadDllDetour); DetourFunc(process, base, "LdrUnloadDll", GetLdrUnloadDllDetour(), LdrUnloadDllDetour); } }
void UndetourNtdllForModule(bool remove) { auto& module = GetNtdllModule(); auto& helper = GetHelperInterface(); if (helper.CommonUndetourModule(L"ntdll", module)) { UndetourFunc(L"NtMapViewOfSection", GetNtMapViewOfSectionDetour(), remove); UndetourFunc( L"NtUnmapViewOfSection", GetNtUnmapViewOfSectionDetour(), remove); UndetourFunc(L"LdrLoadDll", GetLdrLoadDllDetour(), remove); UndetourFunc(L"LdrUnloadDll", GetLdrUnloadDllDetour(), remove); module = std::make_pair(nullptr, 0); } }
void UndetourNtUnmapViewOfSection() { UndetourFunc(L"NtUnmapViewOfSection", GetNtUnmapViewOfSectionDetour(), true); }