X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org To: =?UTF-8?B?QXVyaW1hcyDEjGVybml1cw==?= , cygwin AT cygwin DOT com Date: Fri, 03 Oct 2008 13:12:09 +0100 Subject: Re: non-persistent DllMain Envelope-To: aurisc4 AT gmail DOT com,cygwin AT cygwin DOT com References: <48E5FB68 DOT 1090104 AT liddicott DOT com> <48E5FE38 DOT 7040400 AT gmail DOT com> Message-ID: <48E60C19.8070409@liddicott.com> From: "Sam Liddicott" User-Agent: Thunderbird 2.0.0.17 (X11/20080925) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id m93CE0xR020066 [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/