microsoft / D3D11On12

The Direct3D11-On-12 mapping layer
MIT License
274 stars 33 forks source link

how D3D11ON12.DLL is loaded by windows 11 #39

Closed maoguangmeng closed 2 years ago

maoguangmeng commented 2 years ago

I can compile and generate D3D11On12.dll. But do not know how to use it? Directly replace C:\Windows\System32\ then reboot,I found that doesn't work by https://docs.microsoft.com/en-us/windows-hardware/test/hlk/testref/c510c85c-9da1-4028-b396-4b1b5117f5c5

In short we want to know how windows11 loads my compiled dll(D3D11On12.dll) and it works fine.thank you for your help。

xinhappy1 commented 2 years ago

the same with me thanks

jenatali commented 2 years ago

D3D11On12.dll is loaded via LoadLibrary when the D3D11 runtime decides to use D3D11On12. That means that your locally-built version can be used by inserting it into the library search order earlier than System32. The easiest way to do this is to just drop it next to the .exe file that you're testing with.

xinhappy1 commented 2 years ago

For d3d11on12.dll, I compile and generate d3d11on12.dll.I did the following experiments on Windows 11 AMD platform , but they don't work:

  1. I replace C:\Windows\System32\d3d11on12.dll directly , then reboot , I found that doesn't work.My experiment was successful before the replacement, but failed after the replacement.
  2. I used the following command to write the DLL into the registry and then restart the PC, but the test still failed: TAKEOWN /F %SystemRoot%\system32\d3d11on12.dll ICACLS %SystemRoot%\system32\d3d11on12.dll /grant Administrators:F And I have another question: Why can't I find d3d11on12.dll in the registry before replacing DLL?
  3. Is the C:\Windows\system32\devicecensus.exe program calling my DLL? I put my d3d11on12.dll and devicecensus.exe in the same directory for testing, but it didn't work.
  4. I added d3d11on12.dll under _HKEY_LOCALMACHINE\System\CurrentControlSet\Control\Session Manager\KnownDLLs in the registry according to the instructions on page library search order, but it still doesn't work.

What should I do to make d3d11on12.dll work fine on windows11? looking forward to your reply!

jenatali commented 2 years ago

My experiment was successful before the replacement, but failed after the replacement.

What is "my experiment"? Can you be more specific on what works and what doesn't?

Why can't I find d3d11on12.dll in the registry before replacing DLL?

I don't know why you'd expect to find it in the registry. It's not a COM server or otherwise registered in any way, there's just a delay-load link to it from d3d11.dll.

xinhappy1 commented 2 years ago

Thank you for your reply!In short, I compile your D3D11On12 code and generate d3d11on12.dll, then I use the generated d3d11on12.dll to replace C:\Windows\system32\d3d11on12.dll, then reboot,I found that doesn't work.

I read the library search order page you mentioned, I added d3d11on12.dll under HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\KnownDLLs in the registry according to the instructions on page library search order, but it still doesn't work.

You said, the easiest way to do this is to just drop it next to the .exe file that we're testing with. I did it, but it didn't work.

What should I do to make d3d11on12.dll work fine on windows11 AMD platform?

jenatali commented 2 years ago

I found that doesn't work.

Can you elaborate on "doesn't work"?

myfly007 commented 2 years ago

My experiment was successful before the replacement, but failed after the replacement.

What is "my experiment"? Can you be more specific on what works and what doesn't?

Why can't I find d3d11on12.dll in the registry before replacing DLL?

I don't know why you'd expect to find it in the registry. It's not a COM server or otherwise registered in any way, there's just a delay-load link to it from d3d11.dll.

I had the same proble,how to get d3d11.dll to load my locally-built version d3d11on12.dll, I don't seem to see such instructionsv in the README?

xinhappy1 commented 2 years ago

My experiment was successful before the replacement, but failed after the replacement.

What` is "my experiment"? Can you be more specific on what works and what doesn't?

Why can't I find d3d11on12.dll in the registry before replacing DLL?

I don't know why you'd expect to find it in the registry. It's not a COM server or otherwise registered in any way, there's just a delay-load link to it from d3d11.dll.

In other words, I want to know how d3d11.dll loads my locally-built d3d11on12.dll? Can you tell me? Thanks for your help!

jenatali commented 2 years ago

I've already said, it's loaded via LoadLibrary for the name "d3d11on12.dll".

xinhappy1 commented 2 years ago

Hi,I downloaded d3d11on12.dll from download. Then directly replace C:\Windows\System32\d3d11on12.dll. It works fine. However,I compile your D3D11On12 code and generate d3d11on12.dll, then I use the generated d3d11on12.dll to replace C:\Windows\system32\d3d11on12.dll,I found that doesn't work. I compared your d3d11on12.dll with the DLL from download. There are two main differences:

  1. The version number of your DLL file is 10.0.10011.16384, and the version number of the DLL from download is 10.0.19041.84;
  2. Your DLL does not have a digital signature. The DLL from addagag has a digital signature (summary algorithm sha256).

Are these two reasons why my DLL replacement failed?If so, what should I do? looking forward to your reply!

shawnhar commented 2 years ago

I don't know what that download link is, but it's not an official Microsoft thing. I'd advise against using binaries downloaded from an unknown/untrusted source.

You should not be copying new versions of this DLL over the operating system version in System32. That's unnecessary and unsupported.

Jesse has already explained how the 9on12 layer is loaded, and asked you several times to elaborate on what you are attempting to and what you mean by "doesn't work".

xinhappy1 commented 2 years ago

I don't know what that download link is, but it's not an official Microsoft thing. I'd advise against using binaries downloaded from an unknown/untrusted source.

You should not be copying new versions of this DLL over the operating system version in System32. That's unnecessary and unsupported.

Jesse has already explained how the 9on12 layer is loaded, and asked you several times to elaborate on what you are attempting to and what you mean by "doesn't work".

Thank you for your reply!I'm just curious about how d3d11on12.dll works. I added some logging statements (by OutputDebugStringA) to the D3D11On12 code and compiled it. I want to know about "call flow". The experiment is: run the test item D3D12-11On12video-decodeVPBlit of WHLK. The WPA is shown in the image.I want to replace C:\Windows\System32\d3d11on12.dll with my compiled dll.But it has never been successful.

I compiled the code with VS2022 on WIN 10, and then replaced the DLL on Win 11 with the generated DLL.Is there any problem with me doing this? Looking forward to your reply! Best regards!

shawnhar commented 2 years ago

Repeating answers from earlier in this thread:

I'm closing this issue as the question has been answered.