HookAPI without DLL injection and HookAPI with DLL injection

c++ / delphi package - dll injection and api hooking
Post Reply
bedlam
Posts: 24
Joined: Tue Feb 01, 2005 1:01 pm

HookAPI without DLL injection and HookAPI with DLL injection

Post by bedlam »

Hi all,

just a couple of Q's...

Could someone here please explain to me the difference between using HookAPI without DLL injection and using HookAPI with DLL injection from inside the DLL ???

What is the difference between the functions that end in A and W but have similar function name ??? eg: CreateProcessA / CreateProcessW
Should you always hook both ???


thanks, :confused:
Chromix
Posts: 35
Joined: Fri Aug 12, 2005 5:58 pm

Post by Chromix »

You should really read the documentation carefully.
HookAPI hooks the current process only. In order to hook APIs in other processes you need to inject a dll there.
A -> Ansi
W -> Widestring (unicode)
madshi
Site Admin
Posts: 10766
Joined: Sun Mar 21, 2004 5:25 pm

Re: HookAPI without DLL injection and HookAPI with DLL injec

Post by madshi »

bedlam wrote:Could someone here please explain to me the difference between using HookAPI without DLL injection and using HookAPI with DLL injection from inside the DLL ???
HookAPI only hooks the API in the current process. If you call HookAPI without DLL injection, you're hooking the API only in your own process. If you put the HookAPI call etc in a hook dll, you can then inject the dll into one specific target application to hook the API there. Or you can inject it into all processes to get system wide API hooking.
bedlam wrote:What is the difference between the functions that end in A and W but have similar function name ??? eg: CreateProcessA / CreateProcessW
Should you always hook both ???
"A" is for "Ansi" strings, that means 1 byte per character.
"W" is for "Wide" strings, that means 2 byte per character.

Ansi strings can only describe western text like english, german, french etc. If you need to handle russian and chinese text and such stuff you need wide strings.

Do you need to hook both? That depends. In most cases either the Ansi API internally calls the Wide API or vica versa. In those cases it's good enough to hook the API which is called by the other API. Unfortunately most often in win9x the wide API calls the ansi API, while in the NT family it's the other way round.
madshi
Site Admin
Posts: 10766
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Chromix beat me again... :D
bedlam
Posts: 24
Joined: Tue Feb 01, 2005 1:01 pm

Post by bedlam »

thanx guys......i guess it's all in the docs like u say, but it's much quicker to get the answers here :D

there's not much room left in my head for all that document reading :wink:
Post Reply