HLE: match rpcrt4 UuidFromString nil-UUID and canonical string rules #1975

Open
github-bot wants to merge 1 commit from github-bot/gh-1975 into main AGit
Owner

@⁠mgunes1311-lab on GitHub · 2026-11-25 02:10 UTC · original
mgunes1311-lab:hle-rpcrt4-uuid-string → main · +147 −41 · 1 files · 1 commits · open

Summary

  • UuidFromStringA / UuidFromStringW null-string nil UUID: In rpcrt4.dll, passing NULL as StringUuid is documented to write the nil UUID (00000000-0000-0000-0000-000000000000) and return RPC_S_OK (0). Our HLE previously rejected a null string pointer with RPC_S_INVALID_STRING_UUID (1705).
  • Canonical 8-4-4-4-12 grammar: Unlike ole32's CLSIDFromString, rpcrt4's UuidFromStringA and UuidFromStringW accept only the exact 36-character xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx text form (lower or upper case). parse previously accepted {...} braces, unmatched { or }, arbitrary trailing characters after }, and missing or misplaced dashes, while UuidFromStringW scanned the entire input into a heap Vec before parsing.
  • UuidToStringA / UuidToStringW allocation check: Return RPC_S_OUT_OF_MEMORY (14) if allocate returns null instead of writing a null pointer and returning RPC_S_OK.

Verification

  • cargo test -p victory-hle --target x86_64-pc-windows-msvc --locked (including a Windows differential test comparing UuidFromStringA and UuidFromStringW directly against System32\rpcrt4.dll across null, valid, braced, malformed-dash, whitespace, and trailing-garbage inputs)
  • cargo clippy --workspace --all-targets --all-features --target x86_64-pc-windows-msvc --locked -- -D warnings
  • cargo doc --workspace --no-deps --target x86_64-pc-windows-msvc --locked
  • cargo run -p xtask --target x86_64-pc-windows-msvc --locked -- policy --staged
**@⁠mgunes1311-lab** on GitHub · 2026-11-25 02:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/1975) `mgunes1311-lab:hle-rpcrt4-uuid-string` → `main` · +147 −41 · 1 files · 1 commits · open ## Summary - **`UuidFromStringA` / `UuidFromStringW` null-string nil UUID:** In `rpcrt4.dll`, passing `NULL` as `StringUuid` is documented to write the nil UUID (`00000000-0000-0000-0000-000000000000`) and return `RPC_S_OK` (`0`). Our HLE previously rejected a null string pointer with `RPC_S_INVALID_STRING_UUID` (`1705`). - **Canonical `8-4-4-4-12` grammar:** Unlike `ole32`'s `CLSIDFromString`, `rpcrt4`'s `UuidFromStringA` and `UuidFromStringW` accept only the exact 36-character `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` text form (lower or upper case). `parse` previously accepted `{...}` braces, unmatched `{` or `}`, arbitrary trailing characters after `}`, and missing or misplaced dashes, while `UuidFromStringW` scanned the entire input into a heap `Vec` before parsing. - **`UuidToStringA` / `UuidToStringW` allocation check:** Return `RPC_S_OUT_OF_MEMORY` (`14`) if `allocate` returns null instead of writing a null pointer and returning `RPC_S_OK`. ## Verification - `cargo test -p victory-hle --target x86_64-pc-windows-msvc --locked` (including a Windows differential test comparing `UuidFromStringA` and `UuidFromStringW` directly against `System32\rpcrt4.dll` across null, valid, braced, malformed-dash, whitespace, and trailing-garbage inputs) - `cargo clippy --workspace --all-targets --all-features --target x86_64-pc-windows-msvc --locked -- -D warnings` - `cargo doc --workspace --no-deps --target x86_64-pc-windows-msvc --locked` - `cargo run -p xtask --target x86_64-pc-windows-msvc --locked -- policy --staged`
UuidFromStringA and UuidFromStringW document a null string pointer as writing the nil UUID and returning RPC_S_OK, and accept only the 36-character canonical 8-4-4-4-12 text form rather than braces, misplaced dashes, or trailing characters after a closing brace. Also return RPC_S_OUT_OF_MEMORY when UuidToStringA or UuidToStringW fails to allocate.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:50:29 +00:00
Author
Owner

@⁠DesertGamer on GitHub · 2026-11-25 02:17 UTC · original

VIctory V2: community PRs, merged and tested

Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.

Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).

⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.

Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2

Unofficial community fork of Marvisak/VIctory, GPL-3.0.

**@⁠DesertGamer** on GitHub · 2026-11-25 02:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/1975#issuecomment-7150535715) ### VIctory V2: community PRs, merged and tested Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch. **Where it stands today:** launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1). :warning: Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk. Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help: https://DesertGamer/VIctory-V2 *Unofficial community fork of Marvisak/VIctory, GPL-3.0.*
Author
Owner

@⁠AgneyaK on GitHub · 2026-11-25 02:31 UTC · original

Tested 72a7ec1 merged onto main 940d32f (clean), Windows 11 build 26300, host rpcrt4.dll 10.0.26100.1, Rust 1.98.1 MSVC.

  • The differential test agrees with this Windows build too: uuid_from_string_matches_the_host_runtime passes here, as do the other 5 rpcrt4 tests.
  • The tests catch main's differences. With only this PR's test module on main's rpcrt4.rs, 3 of 6 fail:
    • uuid_from_string_matches_the_host_runtime: main gives (1705, <untouched>) where the host DLL gives (0, nil UUID), for the null string.
    • garbage_is_refused: main parses "{1234abcd-00ef-4a5b-8012-3456789abcde}", which the host refuses.
    • uuid_from_string_writes_what_it_reads: 1705 instead of 0.
  • Stable: cargo test -p victory-hle --lib --locked 5 runs, 144 passed each. cargo clippy -p victory-hle --all-targets --locked -- -D warnings: clean.

One thing for whoever merges it: this makes the parser stricter, so a caller that passed braced text and relied on the old leniency now gets RPC_S_INVALID_STRING_UUID, as it would from the real DLL. I didn't check whether the title calls UuidFromString with braces; it isn't among the calls I see in the boot and menu logs here.

AI use: Claude Code (Claude Opus 5.5) ran these checks and wrote this; the results are from the runs described.

**@⁠AgneyaK** on GitHub · 2026-11-25 02:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/1975#issuecomment-7150839550) Tested `72a7ec1` merged onto `main` `940d32f` (clean), Windows 11 build 26300, host `rpcrt4.dll` **10.0.26100.1**, Rust 1.98.1 MSVC. - **The differential test agrees with this Windows build too:** `uuid_from_string_matches_the_host_runtime` passes here, as do the other 5 `rpcrt4` tests. - **The tests catch `main`'s differences.** With only this PR's test module on `main`'s `rpcrt4.rs`, 3 of 6 fail: - `uuid_from_string_matches_the_host_runtime`: `main` gives `(1705, <untouched>)` where the host DLL gives `(0, nil UUID)`, for the null string. - `garbage_is_refused`: `main` parses `"{1234abcd-00ef-4a5b-8012-3456789abcde}"`, which the host refuses. - `uuid_from_string_writes_what_it_reads`: `1705` instead of `0`. - **Stable:** `cargo test -p victory-hle --lib --locked` 5 runs, `144 passed` each. `cargo clippy -p victory-hle --all-targets --locked -- -D warnings`: clean. One thing for whoever merges it: this makes the parser stricter, so a caller that passed braced text and relied on the old leniency now gets `RPC_S_INVALID_STRING_UUID`, as it would from the real DLL. I didn't check whether the title calls `UuidFromString` with braces; it isn't among the calls I see in the boot and menu logs here. AI use: Claude Code (Claude Opus 5.5) ran these checks and wrote this; the results are from the runs described.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 08:23 UTC · original

Automated triage for the maintainers.

Merge candidate.

This changes UuidFromStringA/UuidFromStringW in crates/victory-hle/src/modules/rpcrt4.rs so a null string writes the nil UUID and returns RPC_S_OK. That is the documented behaviour of the host function. It also narrows parse to the exact 36-character 8-4-4-4-12 form with no braces and no trailing characters, and makes UuidToStringA/W return RPC_S_OUT_OF_MEMORY when allocate returns null. Before this change they wrote a null pointer and returned OK.

The evidence is a new Windows-only differential test against the host rpcrt4.dll. A contributor reports it passing on build 26100, and also reports that the same tests fail on main's parser. I checked the new parse loop: dashes at positions 8/13/18/23, 32 hex digits, nothing after. I also checked the map_while NUL scanning, which no longer copies the wide string into a Vec, and the null checks.

One thing to note: braced input is now refused, as the host DLL refuses it. Any title path that depended on the old leniency would now get RPC_S_INVALID_STRING_UUID.

CI: check passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 08:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/1975#issuecomment-7156962712) <!-- victory-triage v1 head=72a7ec1f1e629b91745b49baa6849cc16f7d165d verdict=merge-candidate at=2026-11-25T08:23:04Z --> Automated triage for the maintainers. **Merge candidate.** This changes `UuidFromStringA`/`UuidFromStringW` in `crates/victory-hle/src/modules/rpcrt4.rs` so a null string writes the nil UUID and returns `RPC_S_OK`. That is the documented behaviour of the host function. It also narrows `parse` to the exact 36-character `8-4-4-4-12` form with no braces and no trailing characters, and makes `UuidToStringA`/`W` return `RPC_S_OUT_OF_MEMORY` when `allocate` returns null. Before this change they wrote a null pointer and returned OK. The evidence is a new Windows-only differential test against the host `rpcrt4.dll`. A contributor reports it passing on build 26100, and also reports that the same tests fail on `main`'s parser. I checked the new `parse` loop: dashes at positions 8/13/18/23, 32 hex digits, nothing after. I also checked the `map_while` NUL scanning, which no longer copies the wide string into a `Vec`, and the null checks. One thing to note: braced input is now refused, as the host DLL refuses it. Any title path that depended on the old leniency would now get `RPC_S_INVALID_STRING_UUID`. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 01:37 UTC · original

Code review and Windows 11 native rpcrt4.dll parity verification at head 72a7ec1f1e62 merged cleanly onto main (63bcca43c6a0):

  • Code review (crates/victory-hle/src/modules/rpcrt4.rs:84-137, 219-247, 469-528):
    • UuidFromStringA/W reject null uuid (INVALID_STRING_UUID), write the nil UUID with OK when text.is_null(), preserve *uuid on parse failure, and enforce the exact 36-char canonical xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx grammar (rejecting braces, spaces, missing/misplaced hyphens, and trailing characters), verified directly against host rpcrt4.dll in uuid_from_string_matches_the_host_runtime. Also cleanly adds OUT_OF_MEMORY checks on null allocate in UuidToStringA/W.
  • Verified (Windows 11, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy --locked -p victory-hle --tests -- -D warnings: 0 warnings
    • cargo test --locked -p victory-hle -- --test-threads=1: 155/155 passed (153 lib + fidelityfx + no_dll_planting).

LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 01:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/1975#issuecomment-7179955565) Code review and Windows 11 native `rpcrt4.dll` parity verification at head `72a7ec1f1e62` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review (`crates/victory-hle/src/modules/rpcrt4.rs:84-137, 219-247, 469-528`)**: - `UuidFromStringA`/`W` reject null `uuid` (`INVALID_STRING_UUID`), write the nil UUID with `OK` when `text.is_null()`, preserve `*uuid` on parse failure, and enforce the exact 36-char canonical `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` grammar (rejecting braces, spaces, missing/misplaced hyphens, and trailing characters), verified directly against host `rpcrt4.dll` in `uuid_from_string_matches_the_host_runtime`. Also cleanly adds `OUT_OF_MEMORY` checks on null `allocate` in `UuidToStringA`/`W`. - **Verified (Windows 11, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy --locked -p victory-hle --tests -- -D warnings`: 0 warnings - `cargo test --locked -p victory-hle -- --test-threads=1`: **155/155 passed** (153 lib + `fidelityfx` + `no_dll_planting`). LGTM.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1975/head:github-bot/gh-1975'
git switch 'github-bot/gh-1975'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1975'
git switch 'github-bot/gh-1975'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1975'
git switch 'github-bot/gh-1975'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1975'
git switch 'main'
git merge --squash 'github-bot/gh-1975'
git switch 'main'
git merge --ff-only 'github-bot/gh-1975'
git switch 'main'
git merge 'github-bot/gh-1975'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1975
No description provided.