victory.exe: a copy of Windows' d3d12.dll beside it is set aside for System32's (#1035) #1154
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1154"
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?
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 playsaid the GPU runs shader model 6.5;D3D12\, and still got 6.5;The reporter's game folder, where
victory.exeis, held aD3D12.dllof version 10.0.19041.423: Windows 10 2004's own Direct3D 12.victory.exe shader-modelprinted only6.5, with noruntimeline, because noD3D12Core.dllwas loaded at all.victory.exedelay-loadsd3d12.dll(build.rs), so thatD3D12SDKVersionis 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.dllis never right there. Even a copy of this PC's ownd3d12.dllbesidevictory.exebreaks it on main:victory shader-modelanswersnone.The change (
apps/victory/src/main.rs)check_d3d12_beside, at the start, right aftermatch_d3d12_coreand before Direct3D 12 is loaded. It reads ad3d12.dllbesidevictory.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. AtdliNotePreLoadLibraryford3d12.dll, and only where such a copy was found, it returnsLoadLibraryExW("d3d12.dll", …, LOAD_LIBRARY_SEARCH_SYSTEM32). Otherwise it returns null, and the helper does what it did.d3d12.dllis still loaded at its first use, soD3D12SDKVersionis read when it was: aftermatch_d3d12_core, and aftervictory playfetches the runtime.What is left alone on purpose: a
d3d12.dllthere that is not Windows'. #120's Wine notes put vkd3d-proton'sd3d12.dllbesidevictory.exe, withWINEDLLOVERRIDES=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 inf17ccf0.)Tests
victory.exe shader-modelfrom a copy of the program in a folder with ad3d12.dllbeside it:e7d8150)0xC06D007E(the helper loaded it and failed)runtime C:\WINDOWS\SYSTEM32\D3D12Core.dll,6.8System32\d3d12.dll(10.0.26100.9818)noneruntime C:\WINDOWS\SYSTEM32\D3D12Core.dll,6.80xC06D007Eruntime C:\WINDOWS\SYSTEM32\D3D12Core.dll,6.8tests::a_copy_of_windows_own_direct3d_12_is_set_aside_for_system32s:d3d12.dll, in any case, at the pre-load notification, and only with a copy found;windows_d3d12_version: it reads this PC'sSystem32\d3d12.dllas 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.-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 /importson the release build:d3d12.dllis still a delay-load import.Not run with the game, and not run under Wine here.
Confirmed on #1035's PC
With that
D3D12.dllmoved 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.