views:

457

answers:

1

Hello. I want to intercept dll's loading so I can use them. My first idea was to hook GetProcAddress. Surprisingly, by hooking it, I can only intercept calls made within the process that owns my library. (I opened another executables that call GetProcAddress and those calls don't get intercepted) (I guess because it is dynamically compiled against my lib)

Example of the output:

C:\Windows\syswow64\kernel32.dll Module32NextW

C:\Windows\syswow64\kernel32.dll CreateToolhelp32Snapshot

C:\Windows\system32\DINPUT.dll DirectInputCreateW

C:\Windows\SysWOW64\ntdll.dll DirectDrawCreate

Anyway, what I want to know is where I should start to be able to intercept dlls loading so I can then use their functions.

Basically, I want to be able to call GetModuleInformation for any dll loaded.

A: 

Install a system-wide hook on the LoadLibrary function. (I have no idea how to use that small comment thing underneath the question so)

Sam Blackburn