Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible on windows to prevent other applications hooking in system DLLs

I am desperately looking for a cause of crashes in my Qt-based Application.

After some observation I've detected, that alone opening a QFileDialog, which is standard windows file dialog, even without selecting any file, causes the application to crash after some minutes. It doesn't happen on all machines.

I've opened my application in dependency walker and the profiling revealed, that opening of file dialog loads tons of DLLs, which I don't need in my application - all the tools which hooked in windows shell. Among the others - TortoiseSVN, which even makes depends to freeze.

Is it possible in an application context to prevent other DLLs like codecs or shell-hooks to be loaded?

Is it at least possible to create a QFileDialog without loading all the tool hooked in windows?

enter image description here

like image 225
Valentin H Avatar asked Oct 19 '22 14:10

Valentin H


1 Answers

This is definitely possible, but it's not trivial. What you have to do is insert an API hook on LoadLibrary (and/or the Native API equivalent.) When your hook is called, you can examine the DLL filename and decide whether you want to pass it along to the real LoadLibrary or return an error.

A couple places to find more info on API hooks:

  • A tutorial on CodeProject
  • Microsoft Detours is Microsoft's library for API hooking.

Now all of that said, for your specific situation you may be better off just changing your TortoiseSVN settings. If you set the include/exclude paths in Tortoise to only look at directories on your computer that contain SVN repos, I bet this freeze will go away as long as you avoid those directories.

like image 79
MrEricSir Avatar answered Nov 02 '22 03:11

MrEricSir