Prevent a DLL from being loaded/injected
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Prevent a DLL from being loaded/injected

  1. #1
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    3,643

    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).

  2. #2
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    1,999

    Re: Prevent a DLL from being loaded/injected

    Quote Originally Posted by OReubens View Post
    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.
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  3. #3
    Join Date
    May 1999
    Location
    DELAWARE, USA
    Posts
    9,915

    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?
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center