Welcome, Guest.
Username: Password: Remember me

TOPIC: Hook into Windows desktop

Hook into Windows desktop 11 months 3 weeks ago #1

Is there any chance to hook ReShade into the windows desktop? I want to inject CustomFX(grain, colorcorrection) into the desktop for calibrating monitors with Nvidia GPUus to correct the horrible banding artefacts. It works perfectly for games (huge thanks to Marty McFly!) just need it at the desktop too!

Also want to write my own shader that takes screen uniformity measurements from DispcalGUI to correct the colour uniformity of the screen.

I notice DXTory (or was it Fraps?) is able to overlay a FPS counter onto the desktop, so it seems to be possible in theory.
Here is a library that may offer some help
github.com/DarthTon/Xenos
The administrator has disabled public write access.

Hook into Windows desktop 11 months 3 weeks ago #2

So the desktop window manager (windows\system32\dwm.exe) is the process which does all the desktop compositing in DX9. Does that mean I can install ReShade files to the system32 folder , replacing the d3d9.dll in system32 folder with the ReShade one?

I'm thinking it will not work and break something :lol:

Might have to backup my computer first and then try replacing the files in safe mode or something.

Would be so awesome if it worked 3d LUT calibration with dithering on everything, and even the future possibility of screen uniformity correction.
The administrator has disabled public write access.

Hook into Windows desktop 11 months 3 weeks ago #3

  • JBeckman
  • JBeckman's Avatar
  • Online
  • Posts: 212
  • Thank you received: 50
You don't want to replace the core d3d9.dll, dxgi,dll or opengl32.dll files in the Windows folder, ever. :)
(It'll break DirectX after all - or OpenGL if that's the file you were to replace. - and the DirectX runtime setup from MS only adds the supplementary files whereas these core files require a full OS reinstall to correct if dism or sfc can't restore them properly.)
Last Edit: 11 months 3 weeks ago by JBeckman.
The administrator has disabled public write access.

Hook into Windows desktop 11 months 3 weeks ago #4

  • crosire
  • crosire's Avatar
  • Offline
  • Posts: 2782
  • Thank you received: 1584
It will break ReShade too. Never ever replace the system DLLs.
The desktop is not rendered via 3D acceleration, so ReShade cannot hook into it.
Cheers, crosire =)
The administrator has disabled public write access.

Hook into Windows desktop 11 months 3 weeks ago #5

Thanks, I will not be messing with those files anytime soon :)

But crosire, are you sure about that because here it says Desktop Window Manager uses DirectX9: en.wikipedia.org/wiki/Desktop_Window_Manager

Since dwm.exe resides in /system32 I presume it uses the d3d9.dll's in there too?

And here is a video where you can see Fraps can overlay its FPS meter onto the Aero desktop which means it is somehow getting its hooks into dwm.exe .



If only there was a way to hook reshade in too!

edit: maybe it's not getting a hook, just "always on top" :oops:
Last Edit: 11 months 3 weeks ago by pneumatic.
The administrator has disabled public write access.

Hook into Windows desktop 11 months 2 weeks ago #6

  • JBeckman
  • JBeckman's Avatar
  • Online
  • Posts: 212
  • Thank you received: 50
Fraps, MSI Afterburner or any other overlay using a exe would work since they could target explorer.exe without needing to replace the core DirectX .dll files.

If made compatible with it the "AppInit" (I think that's what it's called.) global injection method would also work without replacing system files but it requires a very well maintained blacklist or a strict whitelisting system since you do not want ReShade to inject into every single process in Windows not to mention any other application on the system since ReShade32.dll or ReShade64.dll would otherwise always be loaded into a application as it was started.
(GeDoSaTo uses this via a whitelist only system as if it's newer versions.)

Has other drawbacks too such as potentially triggering SecureBoot functionality of modern UEFI bioses to block the injection unless disabled.
The administrator has disabled public write access.

Hook into Windows desktop 9 months 2 weeks ago #7

I managed to created a dummy D3D9 Application that reshade can hook into. Working on making shaders actually show up :P

The administrator has disabled public write access.
The following user(s) said Thank You: brucethemoose

Hook into Windows desktop 9 months 2 weeks ago #8

  • Martigen
  • Martigen's Avatar
  • Offline
  • Posts: 202
  • Thank you received: 47
I might actually use this :) Just started watching a show (Con Man -- great!) bought on Steam, and there's no way to improve Steam's streaming player as far as I can tell at the moment, but injecting Resahde to desktop would solve that.
The administrator has disabled public write access.

Hook into Windows desktop 8 months 5 days ago #9

  • v00d00m4n
  • v00d00m4n's Avatar
  • Offline
  • Posts: 72
  • Thank you received: 18
google for windows shim engine and app compat toolkit, you can re-route dwm.exe and explorer.exe to reshade dll outside of system folder.
The administrator has disabled public write access.

Hook into Windows desktop 7 months 4 weeks ago #10

v00d00m4n wrote:
google for windows shim engine and app compat toolkit, you can re-route dwm.exe and explorer.exe to reshade dll outside of system folder.

How would we hook into it correctly, though? "dwm.exe" Uses no frameworks such as OpenGL, or DirectX.
The administrator has disabled public write access.

Hook into Windows desktop 7 months 3 weeks ago #11

  • v00d00m4n
  • v00d00m4n's Avatar
  • Offline
  • Posts: 72
  • Thank you received: 18
oops, my bad. Just checked with pe analyzer, and it seems like it does rendering via:
api-ms-win-dx-d3dkmt-l1-1-0.dll

I cant find much of information about it, and I cant even find this dll in windows folder, similar api-ms*.dll files has small size of 3-5 kb and it seems like it some sort of api set stub and something like symlinks references that windows re-routes to actual api components, or actuelly traces to kernel. Need to check with debugger to get better idea of how it works. There is no info on MSDN about that, looks like it one of things MS use internally and does not talk much about.
The administrator has disabled public write access.

Hook into Windows desktop 7 months 3 weeks ago #12

  • v00d00m4n
  • v00d00m4n's Avatar
  • Offline
  • Posts: 72
  • Thank you received: 18
NoMansReshade wrote:
I managed to created a dummy D3D9 Application that reshade can hook into. Working on making shaders actually show up :P

btw, its quite a good idea.

You can try to "catch desktop" and "render it" in borderless window on top of actual desktop, but you need to figure out how to solve "top window" problem and makes it act like it not exist or inactive, so that all of windows bellow could get input.
The administrator has disabled public write access.

Hook into Windows desktop 3 months 3 weeks ago #13

NoMansReshade wrote:
I managed to created a dummy D3D9 Application that reshade can hook into. Working on making shaders actually show up :P
Sorry for the bump, but did you get anywhere with this?
The administrator has disabled public write access.

Hook into Windows desktop 3 months 2 weeks ago #14

  • Muf
  • Muf's Avatar
  • Offline
  • Posts: 2
OBS-Classic is able to hook into the DWM on Windows 7. I'm not sure how much has changed between 7 and 10, but that could be a helpful starting point since OBS is open source. I think it might be a bit outside of ReShade's scope though, so it might be better to start a new project focused on providing 3DLUT / colour management on the desktop for Windows using DWM hooking.
The administrator has disabled public write access.