diff options
| author | Dominik <55330408+Dom-in@users.noreply.github.com> | 2026-11-22 10:49:02 +0000 |
|---|---|---|
| committer | Dominik <55330408+Dom-in@users.noreply.github.com> | 2026-11-22 10:58:12 +0000 |
| commit | 6f5b59ea8159dd99fba20933616f778135cc1fa7 (patch) | |
| tree | 42bab2780508bea94893321c607cabc5810fb0d6 /runtime/shims/registry.cpp | |
| parent | c2967a5e60060e4068fb992196d8f4b494a5046c (diff) | |
runtime: serve LoadLibrary/GetProcAddress of shim-owned modules; xgameruntime.lib's run-time entry points
The package's GDK modules don't import xgameruntime.dll. libHttpClient.GDK.dll and XCurl.dll have no import
entry for it, but both carry the wide string "xgameruntime.dll" and the names InitializeApiImpl[Ex|Ex2],
QueryApiImpl and UninitializeApiImpl next to a statically linked XGameRuntimeInitialize: xgameruntime.lib's
thunks LoadLibraryW the runtime and GetProcAddress those names. Bound to the host, that bypasses the offline
shim. The executable is very likely built the same way.
- library_loader.cpp: LoadLibrary*/GetModuleHandle*/GetProcAddress/FreeLibrary for kernel32, kernelbase and the
api-ms-win-core-libraryloader sets. A module the registry owns (rt::shims::owns_dll) gets a pseudo-handle and
GetProcAddress resolves through the registry; an unserved name is NULL with ERROR_PROC_NOT_FOUND. Every other
module goes to the host.
- xgameruntime.cpp: the five entry points, with the signatures and the unknown-class error documented by
xodus-gaming/xgameruntime-docs (GPL-3.0, facts only). QueryApiImpl logs the class and interface ids and refuses
them, so the first boot with the executable names the COM interfaces to implement.
- xgameruntime_test drives the path through XCurl.dll's api-set binding; docs/runtime_imports.md records the
measurement and the new dry-run counts.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/shims/registry.cpp')
| -rw-r--r-- | runtime/shims/registry.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/shims/registry.cpp b/runtime/shims/registry.cpp index ecea4d8cd..d6f989fae 100644 --- a/runtime/shims/registry.cpp +++ b/runtime/shims/registry.cpp | |||
| @@ -320,6 +320,17 @@ void* find(const std::string& dll_lower, const std::string& name) { | |||
| 320 | return it == table().end() ? nullptr : it->second; | 320 | return it == table().end() ? nullptr : it->second; |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | bool owns_dll(const std::string& dll_lower) { | ||
| 324 | static const char* const host[] = {"kernel32.dll", "kernelbase.dll", "msvcrt.dll", "ucrtbase.dll", "ucrtbased.dll", | ||
| 325 | "vulkan-1.dll", "ntdll.dll", "user32.dll"}; | ||
| 326 | if (starts_with(dll_lower, "api-ms-") || starts_with(dll_lower, "ext-ms-")) return false; | ||
| 327 | for (const char* h : host) | ||
| 328 | if (dll_lower == h) return false; | ||
| 329 | const std::string prefix = dll_lower + "!"; | ||
| 330 | auto it = table().lower_bound(prefix); | ||
| 331 | return it != table().end() && it->first.compare(0, prefix.size(), prefix) == 0; | ||
| 332 | } | ||
| 333 | |||
| 323 | void* make_unimplemented_thunk(const std::string& dll, const std::string& name) { | 334 | void* make_unimplemented_thunk(const std::string& dll, const std::string& name) { |
| 324 | std::lock_guard lock(g_pool_mutex); | 335 | std::lock_guard lock(g_pool_mutex); |
| 325 | static std::map<std::string, void*> s_thunks; | 336 | static std::map<std::string, void*> s_thunks; |