HLE: implement the RPC runtime's GUID calls #636
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!636
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/636/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Nixitov on GitHub · 2026-11-24 06:00 UTC · original
Nixitov:hle/allow-rpcrt4→main· +442 −0 · 4 files · 1 commits · merged 2026-11-25 00:09 UTCFixes #510 (the null GUID). Following @mercuryVM's review, this no longer passes
rpcrt4.dllthrough: it implements the calls titles use and leaves everything else refused.Implemented (
crates/victory-hle/src/modules/rpcrt4.rs, served asrpcrt4.dll):UuidCreate,UuidCreateSequential: 16 bytes fromBCryptGenRandom, version 4 and variant bits set. Sequential does not report a MAC address or a clock of this machine; it is the same generator in the same shape.UuidFromStringA/W: braces and upper case taken, 32 hex digits required, dashes optional, and nothing after the last digit but a closing brace. Anything else answersRPC_S_INVALID_STRING_UUIDand leaves the out GUID alone.UuidToStringA/W: the canonical lower-case form. The allocation keeps its length in a word before the text, soRpcStringFreeAandRpcStringFreeWboth give the whole thing back, and both take null.RpcStringFreeA/W.LoadLibrary("rpcrt4.dll")returns our pseudo module: the kernel module already does that for a DLL a module serves that the host policy refuses, so the title resolves these imports without the host DLL.Why not pass-through: as the review says,
RpcBindingFromStringBindingwithncacn_ip_tcporncacn_httpopens sockets through rpcrt4's ownws2_32imports, whichmodules::netnever sees.Verified here (Windows 11 26200.9974, RTX 5070, driver 617.14, release build):
loaded as a pseudo module dll="rpcrt4.dll", and noa host DLL outside the host policy: refusedline for it (it was the only one).cargo test -p victory-hle --lib: 92 passed. The new tests cover the format/parse round trip in both string widths, version and variant bits over 64 creates, invalid text refused, and both frees including null.cargo xtask policy: 152 files ok. Clippy clean on the new module; fmt clean on the touched files.The host policy is unchanged:
HostPolicy::default()still refusesrpcrt4.dll, andthe_rpc_runtime_is_implemented_herechecks that every call above resolves to HLE even withHostPolicy::none().No game files; only log lines and identifiers.
AI-assisted (DeepSeek V4.1 Flash coding agent).
@Nixitov on GitHub · 2026-11-24 08:34 UTC · original
Reworked along the lines you suggested, @mercuryVM — thank you, the point about rpcrt4's own
ws2_32imports is right and it is not worth that hole for a GUID.The policy change is gone.
crates/victory-hle/src/modules/rpcrt4.rsnow implements exactly the calls you listed and serves the DLL name from the modules registry, so the resolution order makes them HLE with any policy (a test asserts that withHostPolicy::none()), andLoadLibrary("rpcrt4.dll")takes the pseudo-module path the kernel module already uses for console DLLs the host policy refuses. Every other rpcrt4 import stays Missing.UuidCreateandUuidCreateSequential:BCryptGenRandom, version 4, variant bits; sequential deliberately does not report this machine's MAC or clock.UuidFromStringA/WandUuidToStringA/W: the canonical text, braces and upper case accepted on input,RPC_S_INVALID_STRING_UUIDand the out GUID untouched otherwise.RpcStringFreeA/W: the allocation carries its length, so both frees take it (and null).On this machine (Windows 11, RTX 5070, release build) the title logs
loaded as a pseudo module dll="rpcrt4.dll", theoutside the host policy: refusedline for it is gone, and it still reaches the world.cargo test -p victory-hle --lib92 passed,cargo xtask policy152 files ok, clippy clean on the new module.One thing I could not check: whether the title's identifiers now differ from the null GUID in its own logs beyond the creation call — the UUID calls no longer answer zero, but I have no other observable of the value it uses. If you have a check for that in mind, I will add it.
AI-assisted (DeepSeek V4.1 Flash coding agent).
@molodayamama on GitHub · 2026-11-24 14:07 UTC · original
Independent Windows check of
7216ab7113115ea1accfabc6e3a00ee700c7c846(Windows 10 22H2 19045, Rust 1.98.1, MSVC x64).cargo test -p victory-hle --locked --lib rpcrt4 -- --test-threads=1 --nocapture: 5 passed.The focused RPC UUID fixtures ran on Windows. They cover format/parse round trips, malformed text, version-4 creation, and releasing strings using the two entry points. No RPC connection was opened.
Only source-built synthetic fixtures were used. AI-assisted verification.