rwid
02-26-2007, 11:17 PM
Hi guys,
I wish to monitor calls to global constructors during DllMain...
Is there any way to break on DllMain with the Visual Studio debugger? (I'm using vs2003, and I don't have the source code to the target dll)
I know Softice/Ollydbg can achieve this but I don't wish to use them here.
As an alternative, I tried patching the binary's DllMain to simply return without doing anything, and calling DllMain myself so I can monitor and break on it.
However this causes LoadLibrary to fail on the target dll... how can this happen?
Is it possible that a dll imported by the target dll requires the target dll's DllMain code has been called before it's own DllMain, eg. an MSVCxx.dll? (the target dll was compiled in VC++)
It's only explanation I can think of...
Btw, the code i patched into the target DLL's DllMain is simply:
mov eax, TRUE
ret 0xC
Looks OK, no?
I wish to monitor calls to global constructors during DllMain...
Is there any way to break on DllMain with the Visual Studio debugger? (I'm using vs2003, and I don't have the source code to the target dll)
I know Softice/Ollydbg can achieve this but I don't wish to use them here.
As an alternative, I tried patching the binary's DllMain to simply return without doing anything, and calling DllMain myself so I can monitor and break on it.
However this causes LoadLibrary to fail on the target dll... how can this happen?
Is it possible that a dll imported by the target dll requires the target dll's DllMain code has been called before it's own DllMain, eg. an MSVCxx.dll? (the target dll was compiled in VC++)
It's only explanation I can think of...
Btw, the code i patched into the target DLL's DllMain is simply:
mov eax, TRUE
ret 0xC
Looks OK, no?