InjectLibrary with invalid filename

c++ / delphi package - dll injection and api hooking
Post Reply
JohnStevenson
Posts: 27
Joined: Mon Jun 14, 2004 12:45 pm

InjectLibrary with invalid filename

Post by JohnStevenson »

When I call InjectLibrary and pass in an invalid filename in the libFileName param, the function returns False and GetLastError reports ERROR_FILE_NOT_FOUND, as you would expect.

However if I pass in a blank value in libFileName, InjectLibrary returns True! In this case GetLastError reports ERROR_ACCESS_DENIED (which it also does after a successful injection).

The same thing happens with UninjectLibrary. It returns True with a blank value, though in this case GetLastError reports ERROR_INSUFFICIENT_BUFFER. This happens on Win98SE and on XP.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Interesting. Will have to check what this is.

But: Why do you give in an blank file name? :sceptic:
JohnStevenson
Posts: 27
Joined: Mon Jun 14, 2004 12:45 pm

Post by JohnStevenson »

I changed one thing and it affected something else...in other words standard incompetence on my part!!
Post Reply