non-persistent DllMain

Sam Liddicott
Fri Oct 3 12:13:00 GMT 2008

[Forgot to copy this to the list, + new question]

* Aurimas Černius wrote, On 03/10/08 12:12:
> If I'm not wrong, GetModuleHandle(NULL) returns the handle of the
> current module (should be DLL handle, when called from DLL). So saving
> handle to a global variable is not needed.
> I think that DllMain is called when DLL is not yet completely loaded,
> so it is impossible to set values of global variables. Isn't it?
Makes sense, but most examples state to store hModule at this point...
however your suggestion was good, and I can now hook wndprocs.

Sadly it then crashes explorer.exe, but thats another problem for me to
look into.

Thanks very much.

I can now hook the wndproc OK, but I don't think it is being called.
I test this by coding a tight loop (up to ten trillion or something) and
watching the load graph in process monitor.

I can make the load shoot up before I hook, and after I hook, and before
I call the hook, but if the loop is in the hookproc, the load never goes
high before it crashes.

It crashes when I do the first sendmessage after hooking.


Unsubscribe info:
Problem reports:

More information about the Cygwin mailing list