Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions crates/victory-hle/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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"
);
}
}
}