DevourUnlocker/src/platform/winhttp_proxy.cpp
MiTHRAL 422f47f25c
Some checks are pending
Build DevourUnlocker / windows (push) Waiting to run
Build DevourUnlocker / linux (push) Waiting to run
Build DevourUnlocker / standalone (push) Waiting to run
v2.0.0: cross-platform winhttp proxy rewrite
- Replace hard offsets (0x74B0B0) with il2cpp resolver + string-xref sigscan
- winhttp.dll proxy (zero BepInEx, forwards WinHttp* exports) for Windows + Proton (WINEDLLOVERRIDES=winhttp=n,b)
- Selective ImGui GUI (F6) per-robe/character overrides, persisted to DevourUnlocker.json
- CMake cross-platform build, Linux .so verified
- Standalone Python CLI+Tkinter (CachyOS/Proton paths, compatdata/1274570)
- Install scripts pulling from git releases (install.sh/ps1), BepInEx Harmony fallback, CI build.yml
- Legacy DirectX11 Edition kept as reference, x64/Release artifacts removed
2026-08-21 15:28:02 -04:00

37 lines
1.2 KiB
C++

#ifdef _WIN32
#include <Windows.h>
#include <string>
// 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