victory.exe: a copy of Windows' d3d12.dll beside it is set aside for System32's (#1035) #1154

Merged
kibagami-nc merged 2 commits from upstream-pr/1154 into main 2026-11-29 08:16:57 +00:00
kibagami-nc commented 2026-11-28 14:27:18 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by kibagami-nc on 2026-11-28T14:27:18Z.


What happened (#1035)

An RTX 5060 on Windows 11 build 26300, with driver 621.40:

  • victory play said the GPU runs shader model 6.5;
  • it fetched Microsoft's runtime into D3D12\, and still got 6.5;
  • it refused the start, blaming the driver.

The reporter's game folder, where victory.exe is, held a D3D12.dll of version 10.0.19041.423: Windows 10 2004's own Direct3D 12. victory.exe shader-model printed only 6.5, with no runtime line, because no D3D12Core.dll was loaded at all.

victory.exe delay-loads d3d12.dll (build.rs), so that D3D12SDKVersion is read late. The delay-load helper loads it with the default search, which looks in the program's folder first. So that old copy was the one loaded. It knows neither the Agility SDK (D3D12SDKVersion, D3D12\D3D12Core.dll) nor shader model 6.6.

A copy of Windows' own d3d12.dll is never right there. Even a copy of this PC's own d3d12.dll beside victory.exe breaks it on main: victory shader-model answers none.

The change (apps/victory/src/main.rs)

  • check_d3d12_beside, at the start, right after match_d3d12_core and before Direct3D 12 is loaded. It reads a d3d12.dll beside victory.exe, if there is one. A copy of Windows' own (a version resource in Windows' 10.x numbering, from "Microsoft Corporation") is set aside, and the start says so, with its version. Anything else is left alone.
  • delay_load_hook, set as __pfnDliNotifyHook2. delayimp.h lets a program define that notification hook in place of delayimp.lib's empty one; the default is a separate member of the library, delayhk1.obj. At dliNotePreLoadLibrary for d3d12.dll, and only where such a copy was found, it returns LoadLibraryExW("d3d12.dll", …, LOAD_LIBRARY_SEARCH_SYSTEM32). Otherwise it returns null, and the helper does what it did.
  • Load timing is unchanged. d3d12.dll is still loaded at its first use, so D3D12SDKVersion is read when it was: after match_d3d12_core, and after victory play fetches the runtime.

What is left alone on purpose: a d3d12.dll there that is not Windows'. #120's Wine notes put vkd3d-proton's d3d12.dll beside victory.exe, with WINEDLLOVERRIDES=d3d12=n, and a wrapper may be put there too. Both load as before. (A first version of this PR loaded System32's whatever lay there. It was narrowed in f17ccf0.)

Tests

victory.exe shader-model from a copy of the program in a folder with a d3d12.dll beside it:

Beside it main (e7d8150) this change (debug and release)
a stand-in with Windows 10 2004's version resource (10.0.19041.423, Microsoft Corporation), not a real DLL no output, exit 0xC06D007E (the helper loaded it and failed) the note, runtime C:\WINDOWS\SYSTEM32\D3D12Core.dll, 6.8
a copy of this PC's own System32\d3d12.dll (10.0.26100.9818) none the note, runtime C:\WINDOWS\SYSTEM32\D3D12Core.dll, 6.8
a file that is not Windows' exit 0xC06D007E the same: left to the helper, as on main
nothing runtime C:\WINDOWS\SYSTEM32\D3D12Core.dll, 6.8 the same
  • New tests::a_copy_of_windows_own_direct3d_12_is_set_aside_for_system32s:
    • the rule: only d3d12.dll, in any case, at the pre-load notification, and only with a copy found;
    • windows_d3d12_version: it reads this PC's System32\d3d12.dll as version 10.x. It refuses a 10.x resource without Microsoft's name, Microsoft's name in another numbering, and a file without a version resource;
    • system32_d3d12: it returns the module at %SystemRoot%\System32\d3d12.dll.
  • cargo test -p victory --locked: 27 + 2 passed.
  • Clippy (-p victory --all-targets -D warnings, default and --all-features): clean. That is with main's three findings allowed (let_and_return, manual_is_multiple_of, some_filter), which #665 fixes.
  • dumpbin /imports on the release build: d3d12.dll is still a delay-load import.

Not run with the game, and not run under Wine here.

Confirmed on #1035's PC

With that D3D12.dll moved out of the folder, the reporter's game starts (#1035: "it worked"). That confirms the cause. This change does the same without anyone having to find and move the file.

No game files, dumps or extracted data are included.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5541133537 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1154). Originally posted by [kibagami-nc](https://github.com/kibagami-nc) on 2026-11-28T14:27:18Z. --- ## What happened (#1035) An RTX 5060 on Windows 11 build 26300, with driver 621.40: - `victory play` said the GPU runs shader model 6.5; - it fetched Microsoft's runtime into `D3D12\`, and still got 6.5; - it refused the start, blaming the driver. The reporter's game folder, where `victory.exe` is, held a `D3D12.dll` of version **10.0.19041.423**: Windows 10 2004's own Direct3D 12. `victory.exe shader-model` printed only `6.5`, with no `runtime` line, because no `D3D12Core.dll` was loaded at all. `victory.exe` delay-loads `d3d12.dll` (build.rs), so that `D3D12SDKVersion` is read late. The delay-load helper loads it with the default search, which looks in the program's folder first. So that old copy was the one loaded. It knows neither the Agility SDK (`D3D12SDKVersion`, `D3D12\D3D12Core.dll`) nor shader model 6.6. A copy of Windows' own `d3d12.dll` is never right there. Even a copy of this PC's own `d3d12.dll` beside `victory.exe` breaks it on main: `victory shader-model` answers `none`. ## The change (`apps/victory/src/main.rs`) - **`check_d3d12_beside`**, at the start, right after `match_d3d12_core` and before Direct3D 12 is loaded. It reads a `d3d12.dll` beside `victory.exe`, if there is one. A **copy of Windows' own** (a version resource in Windows' 10.x numbering, from "Microsoft Corporation") is set aside, and the start says so, with its version. Anything else is left alone. - **`delay_load_hook`**, set as `__pfnDliNotifyHook2`. delayimp.h lets a program define that notification hook in place of delayimp.lib's empty one; the default is a separate member of the library, `delayhk1.obj`. At `dliNotePreLoadLibrary` for `d3d12.dll`, and only where such a copy was found, it returns `LoadLibraryExW("d3d12.dll", …, LOAD_LIBRARY_SEARCH_SYSTEM32)`. Otherwise it returns null, and the helper does what it did. - **Load timing is unchanged.** `d3d12.dll` is still loaded at its first use, so `D3D12SDKVersion` is read when it was: after `match_d3d12_core`, and after `victory play` fetches the runtime. **What is left alone on purpose:** a `d3d12.dll` there that is not Windows'. #120's Wine notes put vkd3d-proton's `d3d12.dll` beside `victory.exe`, with `WINEDLLOVERRIDES=d3d12=n`, and a wrapper may be put there too. Both load as before. (A first version of this PR loaded System32's whatever lay there. It was narrowed in f17ccf0.) ## Tests `victory.exe shader-model` from a copy of the program in a folder with a `d3d12.dll` beside it: | Beside it | main (`e7d8150`) | this change (debug and release) | |---|---|---| | a stand-in with Windows 10 2004's version resource (10.0.19041.423, Microsoft Corporation), not a real DLL | no output, exit `0xC06D007E` (the helper loaded it and failed) | the note, `runtime C:\WINDOWS\SYSTEM32\D3D12Core.dll`, `6.8` | | a copy of this PC's own `System32\d3d12.dll` (10.0.26100.9818) | `none` | the note, `runtime C:\WINDOWS\SYSTEM32\D3D12Core.dll`, `6.8` | | a file that is not Windows' | exit `0xC06D007E` | the same: left to the helper, as on main | | nothing | `runtime C:\WINDOWS\SYSTEM32\D3D12Core.dll`, `6.8` | the same | - **New** `tests::a_copy_of_windows_own_direct3d_12_is_set_aside_for_system32s`: - **the rule:** only `d3d12.dll`, in any case, at the pre-load notification, and only with a copy found; - **`windows_d3d12_version`:** it reads this PC's `System32\d3d12.dll` as version 10.x. It refuses a 10.x resource without Microsoft's name, Microsoft's name in another numbering, and a file without a version resource; - **`system32_d3d12`:** it returns the module at `%SystemRoot%\System32\d3d12.dll`. - **`cargo test -p victory --locked`**: 27 + 2 passed. - **Clippy** (`-p victory --all-targets -D warnings`, default and `--all-features`): clean. That is with main's three findings allowed (`let_and_return`, `manual_is_multiple_of`, `some_filter`), which #665 fixes. - `dumpbin /imports` on the release build: `d3d12.dll` is still a delay-load import. Not run with the game, and not run under Wine here. ## Confirmed on #1035's PC With that `D3D12.dll` moved out of the folder, the reporter's game starts (#1035: "it worked"). That confirms the cause. This change does the same without anyone having to find and move the file. No game files, dumps or extracted data are included.
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
trustno1-coder/VIctory-NVIDIA!1154
No description provided.