This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: non-persistent DllMain
- From: "Sam Liddicott" <sam at liddicott dot com>
- To: Aurimas Äernius <aurisc4 at gmail dot com>, cygwin at cygwin dot com
- Date: Fri, 03 Oct 2008 13:12:09 +0100
- Subject: Re: non-persistent DllMain
- Envelope-to: aurisc4@gmail.com,cygwin@cygwin.com
- References: <48E5FB68.1090104@liddicott.com> <48E5FE38.7040400@gmail.com>
[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.
>
thanks!
>
>
> 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.
Sam
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/