Replies: 1 comment 2 replies
-
What do you mean by "reliably"? You could log the error, abort the initialization, and run the necessary cleanup if needed. The two advantages of having
Did you have other advantages in mind? Currently many of the taskbar mods that rely on Taskbar.View.dll hook |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Global mods--those that inject into (nearly) every process--have a glaring inefficiency: they load every DLL they need to hook functions from or otherwise modify the memory of indiscriminately. Take Aerexplorer for example. It is a mod that modifies the user interface of Explorer windows, including the file open/save dialogs seen in other programs. It accomplishes this by hooking functions within ExplorerFrame.dll, shell32.dll, and more. Since it needs to affect file open/save dialogs, it injects into every process. This includes programs that don't use these dialogs and as such normally won't ever load these DLLs, such as a CLI tool like Git. This doesn't affect my system all that much, but it could definitely be problematic for users running lower end systems, and it honestly just irks me thinking about how inefficient this is.
My idea is to listen for DLL loads and simply perform the needed modifications upon that DLL being loaded. Luckily, Windows has an API,
LdrRegisterDllNotificationthat accomplishes this. One could simply write a wrapper function for this that checks if the needed DLL is already loaded and skips the listening entirely.However, the reason I decided against this is because the aforementioned Windows API is obviously asynchronous. It can't reliably be used with the current Windhawk mod API; it would be simply impossible to detect most failures by the time the mod leaves
Wh_ModInit. My current proposition is to provide an API function (perhaps calledWh_Uninject) that would simply unload the mod from the process, the same way as ifWh_ModInithad failed.Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions