#ifdef _WIN32 #include #include // winhttp.dll proxy — forwards all exports to system winhttp // This allows us to be loaded as winhttp.dll beside DEVOUR.exe without breaking HTTP. static HMODULE g_real = nullptr; static HMODULE getReal() { if (g_real) return g_real; char sys[MAX_PATH]; GetSystemDirectoryA(sys, MAX_PATH); std::string p = std::string(sys) + "\\winhttp.dll"; g_real = LoadLibraryA(p.c_str()); return g_real; } extern "C" FARPROC getProc(const char* name) { HMODULE r = getReal(); if (!r) return nullptr; return GetProcAddress(r, name); } // List of winhttp exports to forward — generated via dumpbin /exports winhttp.dll // We use pragma comment linker exports forwarding syntax where possible. // For MinGW/MSVC compatibility, also provide explicit forwarders. #pragma comment(linker, "/export:WinHttpAddRequestHeaders=" __FILE__ ".WinHttpAddRequestHeaders") extern "C" void* WinHttpAddRequestHeaders = nullptr; // placeholder — real forwarding via .def // The .def file does the forwarding; this cpp just ensures LoadLibrary of real dll early. BOOL APIENTRY DllMainProxy(HMODULE, DWORD reason, LPVOID) { if (reason == DLL_PROCESS_ATTACH) getReal(); return TRUE; } #endif