Prevent a DLL from being loaded/injected
If you're writing a .dll you can prevent that dll from getting loaded into some processes by returning false from the dllmain.
I'm looking for a way to do it the other ay around. I have an exe, and I want to prevent a certain hook dll from getting loaded/injected into my exe.
A customer is running some software which loads a hook dll into our exe, and this is subsequently preventing our application from running as intended. Both our software as well as the third party app is required, and there is no way to get the third party dll changed. (no longer supported).
Re: Prevent a DLL from being loaded/injected
Quote:
Originally Posted by
OReubens
I'm looking for a way to do it the other ay around. I have an exe, and I want to prevent a certain hook dll from getting loaded/injected into my exe.
Not sure if this will work, but maybe you could load the library from your exe manually by calling
Code:
LoadLibraryEx(fileName, NULL, LOAD_LIBRARY_AS_DATAFILE);
Maybe that will prevent the DLL from being loaded again as an executable library.
Re: Prevent a DLL from being loaded/injected
In your case, the question to ask is: is this hook dll preventing only one (yours) application from running, or others too?
If yours is the only one, it is most likely your application is a culprit.
I really do not think any hook that is properly implemented can prevent any module from running correctly.
Are you using any hooks in your project?