From 16f59b57b7dd6184e59b35b04d8b444072eb2e7f Mon Sep 17 00:00:00 2001 From: UNYTIX <89742101+UNYTIX@users.noreply.github.com> Date: Tue, 24 Nov 2026 13:05:01 +0100 Subject: [PATCH] HLE: pass OLEAUT32 through to the host so vccorlib140's BSTR imports bind MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `vccorlib140.dll` imports `OLEAUT32.dll!#4` (`SysAllocStringLen`) and `#6` (`SysFreeString`) by ordinal. They are the only two real gaps left in the census: the other 72 unresolved imports are exports of the title's own DLLs, which the loader binds as title imports. System32's `oleaut32.dll` exports the same BSTR pair at the same ordinals, and the host resolver already handles ordinal imports through `GetProcAddress`, so the DLL only needs to be on the allow list. Unbound, both slots stay trap stubs and the first BSTR call would abort the process; nothing on the boot/menu path loads `vccorlib140.dll` today, so this is latent rather than active. Census: 995 functions, 130 HLE, 793 host, 72 missing (was 791 host, 74 missing). 🤖 Generated with Codebuff Co-Authored-By: Codebuff --- crates/victory-hle/src/host.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/crates/victory-hle/src/host.rs b/crates/victory-hle/src/host.rs index 8a2a8750c9..ff382b51b3 100644 --- a/crates/victory-hle/src/host.rs +++ b/crates/victory-hle/src/host.rs @@ -42,6 +42,10 @@ impl Default for HostPolicy { "api-ms-win-shcore-*", "msvcp_win.dll", "ole32.dll", + // `vccorlib140.dll` imports the BSTR pair by ordinal + // (#4 `SysAllocStringLen`, #6 `SysFreeString`); System32 exports + // the same pair at the same ordinals. + "oleaut32.dll", "advapi32.dll", "iphlpapi.dll", // The title's crash handler writes minidumps with it (loaded by name). @@ -146,3 +150,22 @@ mod imp { None } } + +#[cfg(all(test, windows))] +mod tests { + use super::*; + + /// `vccorlib140.dll` imports `OLEAUT32.dll!#4` and `#6`, the BSTR pair. + /// Bound to nothing they would trap and abort on the first call. + #[test] + fn oleaut32_bstr_ordinals_resolve() { + let host = HostPolicy::default(); + for ordinal in [4, 6] { + let found = host.resolve("OLEAUT32.dll", &ImportSymbol::Ordinal(ordinal)); + assert!( + found.is_some_and(|address| address != 0), + "oleaut32 ordinal {ordinal} did not resolve" + ); + } + } +}