delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/10/03/08:14:02

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
To: =?UTF-8?B?QXVyaW1hcyDEjGVybml1cw==?= <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 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" <sam AT liddicott DOT com>
User-Agent: Thunderbird 2.0.0.17 (X11/20080925)
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
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/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019