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

Open
mgunes1311-lab wants to merge 1 commit from upstream-pr/1975 into main
mgunes1311-lab commented 2026-11-25 02:10:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mgunes1311-lab on 2026-11-25T02:10:43Z.


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
<!-- greyfinch-sync:Marvisak/VIctory:issue:5483784739 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1975). Originally posted by [mgunes1311-lab](https://github.com/mgunes1311-lab) on 2026-11-25T02:10:43Z. --- ## 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`
catminou4 commented 2026-11-25 02:48:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T02:48:46Z.

Review: COMMENTED


Static review only: victory-hle is Windows-only — nothing compiles or runs on macOS; source review of the diff.

rpcrt4 UuidFromString nil-UUID + canonical string rules — small but exact RPC runtime conformance fix; good.

<!-- greyfinch-sync:Marvisak/VIctory:review:6051088262 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1975#pullrequestreview-6051088262). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T02:48:46Z. **Review:** COMMENTED --- Static review only: victory-hle is Windows-only — nothing compiles or runs on macOS; source review of the diff. rpcrt4 UuidFromString nil-UUID + canonical string rules — small but exact RPC runtime conformance fix; good.
DesertGamer commented 2026-11-25 03:03:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DesertGamer on 2026-11-25T02:17:16Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7150535715 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1975#issuecomment-7150535715). Originally posted by [DesertGamer](https://github.com/DesertGamer) on 2026-11-25T02:17:16Z. --- ### 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.*
AgneyaK commented 2026-11-25 03:03:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by AgneyaK on 2026-11-25T02:31:43Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7150839550 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1975#issuecomment-7150839550). Originally posted by [AgneyaK](https://github.com/AgneyaK) on 2026-11-25T02:31:43Z. --- 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.
Marvisak commented 2026-11-25 09:06:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T08:23:17Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7156962712 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1975#issuecomment-7156962712). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T08:23:17Z. --- <!-- 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)_
fuzeofficlal commented 2026-11-26 02:07:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T01:37:14Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179955565 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1975#issuecomment-7179955565). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T01:37:14Z. --- 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.
cloph-dsp commented 2026-11-27 05:50:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-27T05:50:42Z.


Independent Windows verification of PR #1975 (rpcrt4: UuidFromString matches the host runtime).

  • Windows, rustc/cargo 1.100.0/MSVC, worktree-local CARGO_TARGET_DIR (D:\Victory-Contrib\target-1975-watch), CARGO_BUILD_JOBS=2.
  • Head 72a7ec1f1e629b91745b49baa6849cc16f7d165d, merge base 940d32f.
  • Command: cargo test --locked -p victory-hle --lib -- modules::rpcrt4::tests::uuid_from_string_matches_the_host_runtime --exact --test-threads=1 --quiet -> 1 passed; 0 failed; 143 filtered.
  • Negative control: git grep -F for the new test name on 940d32f returned no hits (test absent on base).
  • git diff --check 940d32f HEAD exit 0 (clean).
  • The test is #[cfg(windows)] and compares against the host runtime on this Windows machine; other OS paths and the full crate suite were not exercised. This PR already carries other verification reports; this is an additional direct-Windows/MSVC data point.
  • Only pre-existing fetch_update deprecation warnings.
  • AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only UUID parsing). No game data, assets, shaders, DRM or decrypt used.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7210994785 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1975#issuecomment-7210994785). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-27T05:50:42Z. --- Independent Windows verification of PR #1975 (`rpcrt4: UuidFromString matches the host runtime`). - Windows, rustc/cargo 1.100.0/MSVC, worktree-local `CARGO_TARGET_DIR` (`D:\Victory-Contrib\target-1975-watch`), `CARGO_BUILD_JOBS=2`. - Head `72a7ec1f1e629b91745b49baa6849cc16f7d165d`, merge base `940d32f`. - Command: `cargo test --locked -p victory-hle --lib -- modules::rpcrt4::tests::uuid_from_string_matches_the_host_runtime --exact --test-threads=1 --quiet` -> `1 passed; 0 failed; 143 filtered`. - Negative control: `git grep -F` for the new test name on `940d32f` returned no hits (test absent on base). - `git diff --check 940d32f HEAD` exit 0 (clean). - The test is `#[cfg(windows)]` and compares against the host runtime on this Windows machine; other OS paths and the full crate suite were not exercised. This PR already carries other verification reports; this is an additional direct-Windows/MSVC data point. - Only pre-existing `fetch_update` deprecation warnings. - AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only UUID parsing). No game data, assets, shaders, DRM or decrypt used.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1975:upstream-pr/1975'
git switch 'upstream-pr/1975'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1975'
git switch 'upstream-pr/1975'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1975'
git switch 'upstream-pr/1975'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1975'
git switch 'main'
git merge --squash 'upstream-pr/1975'
git switch 'main'
git merge --ff-only 'upstream-pr/1975'
git switch 'main'
git merge 'upstream-pr/1975'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!1973
No description provided.