question about thunk
"tom_gee" <tom_gee-/[email protected]> Wed, 13 Apr 2011 00:24:28 -0000
| Newsgroups | gmane.comp.windows.wtl |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I have a question about the following thunk used in ATL Windowing:
mov dword ptr [esp+0x4], pThis
jmp WndProc
with information from this link: http://www.unixwiz.net/techtips/win32-callconv-asm.html. I can understand [esp+0x4] holds the leftmost parameter, i.e. hwnd,
When the first windows message comes in, hwng is replaced by pThis, and after this message is handled, WndProc exits. the content at [esp+0x4], i.e.pThis, would be popped out during the stack cleanup.
Then the next windows message comes in, hwnd is passed in again by Windows OS, because the winproc is called by OS automatically.
my question is, since the thunk only executes once per window object, how is the substitution made permanently for the 2nd and following hwnd passed in? although hwnd remains the same for each window, it has to be passed in again and again for each call of wnd, right?
what's wrong with my reasoning above?
Thanks
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/wtl/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/wtl/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/