GENERATE_INTERCEPT_HEADER(LoadLibraryW, HMODULE, WINAPI, _In_ LPCWSTR lpLibFileName) { SDLOG(2, "DetouredLoadLibraryW %s\n", CW2A(lpLibFileName)); HMODULE mod = TrueLoadLibraryW(lpLibFileName); // restart detour in case we missed anything if(mod) restartDetour(CW2A(lpLibFileName)); return mod; }
GENERATE_INTERCEPT_HEADER(LoadLibraryExW, HMODULE, WINAPI, _In_ LPCWSTR lpLibFileName, _Reserved_ HANDLE hFile, _In_ DWORD dwFlags) { SDLOG(2, "DetouredLoadLibraryExW %s\n", CW2A(lpLibFileName)); string fn((CW2A(lpLibFileName))); if(fn.find("GeDoSaTo") != fn.npos) return GetCurrentModule(); // find out why we need this HMODULE mod = TrueLoadLibraryExW(lpLibFileName, hFile, dwFlags); // restart detour in case we missed anything if(mod) restartDetour(CW2A(lpLibFileName)); return mod; }
GENERATE_INTERCEPT_HEADER(LoadLibraryW, HMODULE, WINAPI, _In_ LPCWSTR lpLibFileName) { SDLOG(22, "DetouredLoadLibraryW %s\n", lpLibFileName); if(preventDllLoading(std::wstring(lpLibFileName), true)) return NULL; HMODULE mod = TrueLoadLibraryW(lpLibFileName); // restart detour in case we missed anything if(mod) restartDetour(CW2A(lpLibFileName)); return mod; }
GENERATE_INTERCEPT_HEADER(LoadLibraryExA, HMODULE, WINAPI, _In_ LPCSTR lpLibFileName, _Reserved_ HANDLE hFile, _In_ DWORD dwFlags) { SDLOG(22, "DetouredLoadLibraryExA %s\n", lpLibFileName); string fn(lpLibFileName); if(fn.find("GeDoSaTo") != fn.npos) return GetCurrentModule(); // find out why we need this if(preventDllLoading(std::string(lpLibFileName))) return NULL; HMODULE mod = TrueLoadLibraryExA(lpLibFileName, hFile, dwFlags); // restart detour in case we missed anything if(mod) restartDetour(lpLibFileName); return mod; }