Thread: Detect if a DLL is load time or run time

  1. #1
    Registered User Ktulu's Avatar
    Join Date
    Oct 2006
    Posts
    107

    Detect if a DLL is load time or run time

    Is there a way to detect if a DLL is a Load Time DLL or a Run Time DLL?
    If I use the FreeLibrary, and try to eject a Load Time DLL, the function still returns TRUE, so it succeeds even when the DLL is not ejected.
    And besides, the FreeLibrary function is not really intended for this.
    So how could I achieve to detect if a DLL, that used by a certain process, is a Load Time DLL or a Run Time DLL?

    Thanks in advance, Ktulu.
    This parameter is reserved

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Why exactly would you need to do that? I don't think it's possible.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User Ktulu's Avatar
    Join Date
    Oct 2006
    Posts
    107
    To prevent people from Injecting DLL's into that certain process because they don't belong there, kind of anti-cheating shield.
    This parameter is reserved

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    I see. Nope, sorry, still not possible. However, what you could try is, at the start of the program, enumerate all loaded DLLs. If there's one in there that doesn't belong, kill the program. Every now and then, later (say every few seconds), you could do the same.

    However, be warned: first, code that does that can rather easily be disabled by a crack patch. Second, several legitimate programs have a habit of injecting DLLs into everything. Virus scanners, for example. So if ever the program terminates because of an unknown DLL, make sure you display the name of that DLL somewhere where you can pick it up in reaction to support calls because the program won't work.
    Of course, any malware could then simply disguise as one of the legitimate hook DLLs.

    So as usual, it's always just a race between protection and the next crack that tricks it. Never forget: the code that's on the client computer is helpless against attacks.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Run time error?
    By shwetha_siddu in forum C Programming
    Replies: 6
    Last Post: 04-21-2009, 01:37 PM
  2. Replies: 12
    Last Post: 01-17-2009, 04:35 AM
  3. Please help - Run time error
    By barkercs in forum C Programming
    Replies: 6
    Last Post: 05-03-2006, 11:15 AM
  4. Replies: 2
    Last Post: 02-28-2002, 12:40 PM
  5. Load and run machine code at runtime
    By ninebit in forum C++ Programming
    Replies: 8
    Last Post: 02-27-2002, 10:26 AM