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

Manually merged
github merged 2 commits from github-bot/gh-1154 into main 2026-11-29 08:21:31 +00:00 AGit
Owner

@⁠kibagami-nc on GitHub · 2026-11-28 14:27 UTC · original
kibagami-nc:fix/d3d12-from-system32 → main · +177 −0 · 1 files · 2 commits · merged 2026-11-29 08:16 UTC

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.

**@⁠kibagami-nc** on GitHub · 2026-11-28 14:27 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1154) `kibagami-nc:fix/d3d12-from-system32` → `main` · +177 −0 · 1 files · 2 commits · merged 2026-11-29 08:16 UTC ## 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.
victory.exe delay-loads d3d12.dll (build.rs), and the delay-load helper
looks in the program's folder first. #1035's game folder held Windows 10
2004's D3D12.dll (10.0.19041.423). On Windows 11 with an RTX 5060 that copy
answered shader model 6.5 and ignored D3D12SDKVersion and the Agility SDK
runtime beside it, so `victory play` refused the start.

A notification hook (__pfnDliNotifyHook2, which delayimp.h lets a program
define) now loads d3d12.dll with LOAD_LIBRARY_SEARCH_SYSTEM32 before the
helper would. Other DLLs are left to the helper. It still loads at the first
use, so D3D12SDKVersion is read when it was. A d3d12.dll beside the program
is named at the start as not used.

Checked with a stand-in D3D12.dll beside a copy of victory.exe: main's stops
with 0xC06D007E (the helper loading that file), this one loads System32's
and `victory shader-model` answers 6.8.
Test: direct3d_12_is_windows_own_from_system32.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 14:34:29 +00:00
github-bot changed title from victory.exe: Direct3D 12 from System32, never a d3d12.dll beside it (#1035) to victory.exe: a copy of Windows' d3d12.dll beside it is set aside for System32's (#1035) 2026-11-28 14:44:28 +00:00
The hook loaded System32's d3d12.dll whatever lay beside the program. But a
d3d12.dll there can be wanted: the Wine notes in #120 put vkd3d-proton's
beside victory.exe, with a native override. check_d3d12_beside now reads the
file before Direct3D 12 is loaded. Only a copy of Windows' own (a 10.x version
resource from Microsoft Corporation) sends d3d12.dll to System32; anything else
is loaded as before.

A copy of this PC's own d3d12.dll beside the program also broke it on main
(`victory shader-model` answered "none"); with this it answers 6.8.
Test: a_copy_of_windows_own_direct3d_12_is_set_aside_for_system32s.
github manually merged commit 39dfea3de3 into main 2026-11-29 08:21:31 +00:00
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/trustno1-coder--VIctory-NVIDIA!1154
No description provided.