Welcome, Guest.
Username: Password: Remember me

TOPIC: Hook into Windows desktop

Hook into Windows desktop 2 years 2 months 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 2 years 2 months 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 2 years 2 months ago #3

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: 2 years 2 months ago by JBeckman.
The administrator has disabled public write access.

Hook into Windows desktop 2 years 2 months ago #4

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 2 years 2 months 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: 2 years 2 months ago by pneumatic.
The administrator has disabled public write access.

Hook into Windows desktop 2 years 2 months ago #6

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 2 years 8 hours 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, Snoutie

Hook into Windows desktop 2 years 8 hours ago #8

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 1 year 10 months ago #9

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 1 year 10 months 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 1 year 10 months ago #11

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 1 year 10 months ago #12

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 1 year 6 months 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 1 year 6 months ago #14

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.

Hook into Windows desktop 2 months 2 weeks ago #15

I manged to (sort-of) accomplish by injecting the latest reshade into the latest version of obs studio. Reshade came up, and shaders appeared to be working fine. I then used a program called WindowsTop to make the capture window stay on top and enable click through input. The only issue is, when attempting to create a fullscreen capture with resahde, I get extreme visual glitches using Reshade making it nearly impossible to actually use. So it works, but not that well. Maybe someone else can use this information to figure something else out.

EDIT: Actually, I figured out why there were so many visual glitches when attempting to use resahde on a window that was being captured onto that same window, it's simply because reshade is reshading itself infinitely. This works just like the "inception" effect of obs or any screen recording, when the display is displaying itself displaying itself...and so on. So it's sorta like stacking a million shaders over themselves, it looks like a garbled, distorted, ultra sharpened mess. Cool for random visuals though haha.

So there are two options.

1:Get a second monitor and create a display capture, fullscreen it, drag it over to your main monitor, use WindowTop to make it on top and click-through, then drag your mouse to your other monitor to use your cursor properly. It actually works. Too bad my other monitor is 1080p and my main is 1440p, so the image quality is garbage.
2: Simply use OBS's window capture function, and do the same steps as number 1. Although in this case, there appears to be quite apparent visual compression of the capture, so even though this will technically let you use reshade on a capture that is on the same screen it is capturing, it doesn't look that great tbh. Also, another drawback is that you are limited to only that window having reshade applied to it, not the whole actual desktop unlike the first option.

So in conclusion, it's not that great, but it's definitely the closest of gotten to be able to sue reshade over my desktop or non game/video applications (Firefox looked dope with some FilmicPass haha).
Last Edit: 2 months 2 weeks ago by miwalker. Reason: New information discovered.
The administrator has disabled public write access.