<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx</link><description>Ah, dynamic code generation.</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6214027</link><pubDate>Wed, 14 Nov 2007 18:45:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6214027</guid><dc:creator>Bryan</dc:creator><description>&lt;p&gt;Here's to looking forward to your next installment of this series.&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6214602</link><pubDate>Wed, 14 Nov 2007 18:58:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6214602</guid><dc:creator>Greg D</dc:creator><description>&lt;p&gt;This is the kind of stuff that they never taught you in school. . .&lt;/p&gt;
&lt;p&gt;I like to think that I'd have reached the same conclusion, but I imagine it would have taken me somewhat longer to do so.&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6215390</link><pubDate>Wed, 14 Nov 2007 19:18:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6215390</guid><dc:creator>RUF</dc:creator><description>&lt;p&gt;For the next episode i would like to know your opinion about that kind of hacks in the code&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6215471</link><pubDate>Wed, 14 Nov 2007 19:20:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6215471</guid><dc:creator>JS Bangs</dc:creator><description>&lt;p&gt;This is one of those posts that I initially read with total bewilderment, having no idea what DEP and IP_ON_HEAP meant. I was about to move on to something else when my brain suddenly connected DEP to Data Execution Prevention... which means that IP_ON_HEAP must be Instruction Pointer On Heap. And now the whole article makes sense.&lt;/p&gt;
&lt;p&gt;Maybe this will help someone else who doesn't use those abbreviations on a regular basis.&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6215786</link><pubDate>Wed, 14 Nov 2007 19:29:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6215786</guid><dc:creator>Skywing</dc:creator><description>&lt;p&gt;Hmm - it's my understanding that by default, there is emulation support for old style atlthunks enabled ( &lt;a rel="nofollow" target="_new" href="http://msdn2.microsoft.com/en-us/library/bb736299.aspx"&gt;http://msdn2.microsoft.com/en-us/library/bb736299.aspx&lt;/a&gt; ). &amp;nbsp;I do recall something about it being inadvertently disabled in Vista RTM, though.&lt;/p&gt;
&lt;p&gt;Did this predate the atlthunk emulation hack, or was the system booted with /noexecute=alwayson ?&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6215967</link><pubDate>Wed, 14 Nov 2007 19:33:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6215967</guid><dc:creator>Keithius</dc:creator><description>&lt;p&gt;-&amp;gt; JS Bangs&lt;/p&gt;
&lt;p&gt;Yes, that does help. I was similarly mystified until you made the connection from DEP to Data Execution Prevention. Thank you!&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6216300</link><pubDate>Wed, 14 Nov 2007 19:40:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6216300</guid><dc:creator>Erik</dc:creator><description>&lt;p&gt;"You should be able to determine the cause instantly."&lt;/p&gt;

&lt;p&gt;OK, smartypants. &amp;nbsp;I realize this is a Win32 blog and therefore covers many topics beyond my knowledge as a .NET programmer. &amp;nbsp;However, statements like that turn me off. &amp;nbsp;I like to read your blog to learn about the inner workings of the Windows platform. &amp;nbsp;I could do without the cockiness.&lt;/p&gt;
&lt;div class="post"&gt;[&lt;i&gt;I think knowing the reasons for IP being on the heap is one of the basic things you need to know when you're doing any unmanaged programming (not just Win32). You need to know how the CPU works because in the unmanaged world, there's nobody between you and the CPU. -Raymond&lt;/i&gt;]&lt;/div&gt;</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6216819</link><pubDate>Wed, 14 Nov 2007 19:53:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6216819</guid><dc:creator>codekaizen</dc:creator><description>&lt;p&gt;Whoa, Erik -&lt;/p&gt;
&lt;p&gt;Consider dialing back the edginess a bit. When we only get text, the usual side-band channels of information, like tone, facial-expression and shared setting, are missing. You have to fill them in. I've found it more pleasant to imagine these in a way which conduces to my continual learning and improvement.&lt;/p&gt;
&lt;p&gt;I, for one, enjoy a good didactic tone when the subject is obviously mastered by the author. It's just a rhetorical device, and to me it communicates an encouraging poke to wake up and think. When mixed with the right amount of caffeine, it does a fair bit to shift me into high gear in the morning. I started only knowing .Net, too, but after a few years of interpreting Raymond as expecting me to know more, I now do, and am better for it. &lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6217275</link><pubDate>Wed, 14 Nov 2007 20:05:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6217275</guid><dc:creator>brian</dc:creator><description>&lt;p&gt;&amp;quot;I, for one, enjoy a good didactic tone when the subject is obviously mastered by the author. It's just a rhetorical device, and to me it communicates an encouraging poke to wake up and think.&amp;quot;&lt;/p&gt;
&lt;p&gt;I second that. As a .net programmer that only briefly has to touch win32, I read the blog to learn. When Raymond says &amp;quot;It Should Be obvious&amp;quot; &amp;nbsp;it's a challenge. &amp;nbsp;It says to me The Answer is on the page and i ask myself &amp;quot;Can I find it?&amp;quot;&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6217501</link><pubDate>Wed, 14 Nov 2007 20:09:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6217501</guid><dc:creator>Matt Green</dc:creator><description>&lt;p&gt;It's a damn shame that we need to resort to hacks like this in order to properly wrap Win32. Thankfully, almost all of the newer APIs have a context parameter that can be associated with objects.&lt;/p&gt;
&lt;p&gt;How does ATL8 fix this, anyway?&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6218546</link><pubDate>Wed, 14 Nov 2007 20:33:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6218546</guid><dc:creator>Tim Smith</dc:creator><description>&lt;p&gt;ALT8 fixes the problem by using PAGE_EXECUTE_READWRITE when allocating the thunk block with VirtualAlloc.&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6218929</link><pubDate>Wed, 14 Nov 2007 20:44:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6218929</guid><dc:creator>AsmGuru62</dc:creator><description>&lt;p&gt;There is no need to wrap WndProc - can be done perfectly with GetWindowLong() and then calling virtual message routing method.&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6220707</link><pubDate>Wed, 14 Nov 2007 21:40:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6220707</guid><dc:creator>Matt Green</dc:creator><description>&lt;P&gt;I'm fairly certain that some messages are missed with that method, AsmGuru62. Specifically, the pre-create messages.&lt;/P&gt;
&lt;DIV class=post&gt;[&lt;I&gt;Windows doesn't have any "pre-create" messages. How could it? How can you deliver a message to a window that doesn't exist yet? Maybe you're thinking of something else. -Raymond&lt;/I&gt;]&lt;/DIV&gt;</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6221912</link><pubDate>Wed, 14 Nov 2007 22:13:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6221912</guid><dc:creator>Ugh</dc:creator><description>&lt;p&gt;&amp;quot;ALT8 fixes the problem by using PAGE_EXECUTE_READWRITE when allocating the thunk block with VirtualAlloc.&amp;quot;&lt;/p&gt;
&lt;p&gt;Eeeek. Does that mean a heap overwrite or buffer overflow into the thunk block could result in &amp;quot;remote code execution&amp;quot;? Which is what DEP is supposed to protect against?&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6222340</link><pubDate>Wed, 14 Nov 2007 22:28:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6222340</guid><dc:creator>name required</dc:creator><description>&lt;P&gt;"There is no need to wrap WndProc - can be done perfectly with GetWindowLong() and then calling virtual message routing method."&lt;/P&gt;
&lt;P&gt;Except when you need to wrap the window which is based on existing class, using GetWindowLong slots already.&lt;/P&gt;
&lt;DIV class=post&gt;[&lt;I&gt;Isn't that why C++ has derived classes? If you're talking about Win32 subclassing, then there's GetProp. -Raymond&lt;/I&gt;]&lt;/DIV&gt;</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6222868</link><pubDate>Wed, 14 Nov 2007 22:41:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6222868</guid><dc:creator>Erik Madsen</dc:creator><description>&lt;P&gt;"Consider dialing back the edginess a bit."&lt;/P&gt;
&lt;P&gt;Mine was simply a comment on tone. &amp;nbsp;The statement "This was totally obvious to me, but the person who asked the question met it with stunned amazement" seemed gratuitous to me. &amp;nbsp;It serves only to show Raymond's superiority over his colleague. &amp;nbsp;Why do I need to know this? &amp;nbsp;Whereas I do need to know the reasons for IP being on the heap, as Raymond pointed out in his response.&lt;/P&gt;
&lt;P&gt;All things considered, I do enjoy reading this blog. &amp;nbsp;I feel I learn something each morning.&lt;/P&gt;
&lt;DIV class=post&gt;[&lt;I&gt;It really should be obvious to an experienced programmer. And I'm assuming an audience of experienced programmers. It says right there what the problem is: IP_ON_HEAP. And it's clear that it was on purpose rather than accidental once you look at the stack trace. -Raymond&lt;/I&gt;]&lt;/DIV&gt;</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6223759</link><pubDate>Wed, 14 Nov 2007 23:06:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6223759</guid><dc:creator>Evan</dc:creator><description>&lt;p&gt;I got to the point reading &amp;quot;This was totally obvious to me, but the person who asked the question met it with stunned amazement,&amp;quot; and thought for sure that it was going to continue with the asking person getting all indignant that you figured out what they were using, that you were reverse engineering their program and intellectual property, etc.&lt;/p&gt;
&lt;p&gt;(I've never done any ATL programming, and didn't know what IP_ON_HEAP meant until this sentence &amp;quot;The fault is IP_ON_HEAP which is precisely what DEP protects against.&amp;quot;)&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6224121</link><pubDate>Wed, 14 Nov 2007 23:18:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6224121</guid><dc:creator>mh</dc:creator><description>&lt;p&gt;I see no issue. &amp;nbsp;I didn't know it either, Raymond felt that I should, so now I do.&lt;/p&gt;
&lt;p&gt;Result.&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6224322</link><pubDate>Wed, 14 Nov 2007 23:23:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6224322</guid><dc:creator>Andy</dc:creator><description>&lt;p&gt;It's posts like this that are why I love to read this blog so much. Bits of info that you could get no where else in an almost tutorial like form but with more personality than a regular tutorial. I can hardly wait for the second half.&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6224387</link><pubDate>Wed, 14 Nov 2007 23:25:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6224387</guid><dc:creator>name required</dc:creator><description>&lt;p&gt;I was referring to Win32 class, and to AsmGuru62's suggestion to use GetWindowLong to avoid thunking.&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6226024</link><pubDate>Thu, 15 Nov 2007 00:09:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6226024</guid><dc:creator>movl</dc:creator><description>&lt;p&gt;Evan: seconded, that's what gave it all away. But especially the registers dump is pretty baffling.&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6228177</link><pubDate>Thu, 15 Nov 2007 01:02:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6228177</guid><dc:creator>Neil</dc:creator><description>&lt;p&gt;[Windows doesn't have any &amp;quot;pre-create&amp;quot; messages.]&lt;/p&gt;
&lt;p&gt;I think he's referring to those messages sent before CreateWindow returns, which won't get subclassed if you SetWindowLongPtr afterwards.&lt;/p&gt;
&lt;p&gt;Presumably the thunks avoid having to store pThis as window words or properties?&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6245063</link><pubDate>Thu, 15 Nov 2007 09:17:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6245063</guid><dc:creator>Worf</dc:creator><description>&lt;p&gt;Amazingly, I guessed what the issue was, and was half-right (I figured DEP easily enough - Windows CE's x86 Emulator is incompatible with DEP on a multiprocessor system (but OK on single processor). IP_ON_HEAP had me scratching my head (IP address? Wha?), until I realized it meant &amp;quot;Instruction Pointer&amp;quot; (to which I usually call PC - program counter).&lt;/p&gt;
&lt;p&gt;Alas, I do not know ATL, so that baffled me.&lt;/p&gt;
&lt;p&gt;All you .NET developers - I'm on the other side of the fence. I know Win32, but the C stuff only. ATL, MFC, COM, OLE, etc baffle me as well. (Last time I coded a GUI, it was all done using CreateWindow - no resource files, no resource editor or other fancy goodies.)&lt;/p&gt;
&lt;p&gt;But I enjoy this blog, for it appeals to me - the low-level stuff of Windows. And, no matter how far away you go, sometimes you end up in the muck (like this ATL example - it helps to understand what's really happening behind that pretty face).&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6248597</link><pubDate>Thu, 15 Nov 2007 11:19:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6248597</guid><dc:creator>Frederik Slijkerman</dc:creator><description>&lt;p&gt;By the way, is a thunk much faster than retrieving the 'this' pointer with GetWindowLongPtr(hwnd, GWLP_USERDATA) ? &amp;nbsp;(Assuming that you have stored that previously.)&lt;/p&gt;
&lt;p&gt;Or are there other benefits? Because the GWLP method seems to be much easier to me...&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6248768</link><pubDate>Thu, 15 Nov 2007 11:24:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6248768</guid><dc:creator>Jonathan</dc:creator><description>&lt;p&gt;I, too, thought about IP address, and expected a pshychic &amp;quot;0x0100a8c0 = 192.168.0.1&amp;quot; or something.&lt;/p&gt;
&lt;p&gt;BTW, identification of this could've been easily added to the debugger - &amp;quot;if IP_ON_HEAP and the stack looks like X then say something about ATL&amp;quot;. That would've moved this class of incidents from &amp;quot;psychic debugging by gurus&amp;quot; to a simple &amp;quot;read the helpful debugger output&amp;quot;. I think Application Verifier had somehting like that. &lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6251216</link><pubDate>Thu, 15 Nov 2007 12:40:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6251216</guid><dc:creator>Roman Werpachowski</dc:creator><description>
&lt;p&gt;OP: "Since C++ functions have a hidden this parameter"&lt;/p&gt;

&lt;p&gt;Umm, not all of them. Just the class methods.&lt;/p&gt;
&lt;div class="post"&gt;[&lt;i&gt;I bet you miss the nitpicker's corner. -Raymond&lt;/i&gt;]&lt;/div&gt;</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6253789</link><pubDate>Thu, 15 Nov 2007 13:53:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6253789</guid><dc:creator>Dean Harding</dc:creator><description>&lt;p&gt;Roman Werpachowski: You must be new here...&lt;/p&gt;
&lt;p&gt;No wait, it's probably me that's new here, if I didn't expect a comment like that...&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6255444</link><pubDate>Thu, 15 Nov 2007 14:36:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6255444</guid><dc:creator>Name required</dc:creator><description>
&lt;p&gt;Well you know what, in a dozen years of C++ Windows programming the total number of times I've needed to know the reasons for IP being on the heap is exactly:&lt;/p&gt;
&lt;div class="post"&gt;[&lt;i&gt;Wow, you've never invoked a virtual method on an object that has already been deleted. I wish I were as awesome as you. -Raymond&lt;/i&gt;]&lt;/div&gt;</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6262983</link><pubDate>Thu, 15 Nov 2007 17:35:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6262983</guid><dc:creator>ace</dc:creator><description>&lt;p&gt;I know how CPU and messages in Windows work, but I'd still be grateful if somebody can explain: why is the thunking in ATL necessary -- which problem is actually solved by it, that can't be solved otherwise?&lt;/p&gt;
</description></item><item><title>Interesting Finds: November 15, 2007</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6263306</link><pubDate>Thu, 15 Nov 2007 17:47:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6263306</guid><dc:creator>Jason Haley</dc:creator><description /></item><item><title>Is DEP on or off on Windows XP Service Pack 2?</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6264016</link><pubDate>Thu, 15 Nov 2007 18:10:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6264016</guid><dc:creator>The Old New Thing</dc:creator><description>&lt;p&gt;Why did that IP_ON_HEAP problem show up all of a sudden?&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6264393</link><pubDate>Thu, 15 Nov 2007 18:23:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6264393</guid><dc:creator>nick</dc:creator><description>&lt;p&gt;guys, consider the performance. &lt;/p&gt;
&lt;p&gt;of course, you can store the &amp;quot;this&amp;quot; pointer in window user data. but that end up with calling GetWindowLong() repeatedly. don't forget the thousands of message a window proc would process.&lt;/p&gt;
&lt;p&gt;there's a wonderful article on this topic in codeproject, but I forget where it is.&lt;/p&gt;
&lt;p&gt;raymond, could you tell more about thunk emulation in the next post of the series?&lt;/p&gt;
&lt;p&gt;I have ever come across a bug. &lt;/p&gt;
&lt;p&gt;the program is based on ATL3. it does run in a DEP enabled PC, the main window shows up. but when calling a function in a dll which creates a new window, the program crashes at that moment.&lt;/p&gt;
&lt;p&gt;the main window created successfully is because, i suppose, the thunk emulation. what confused me is why the window created in DLL is out of luck? or did i miss anything?&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6268535</link><pubDate>Thu, 15 Nov 2007 20:45:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6268535</guid><dc:creator>AsmGuru62</dc:creator><description>&lt;p&gt;GetWindowLong() should be rather quick - it is just an accessing the data via offset, of course HWND must be also verified... still it should be OK to call it every time WndProc is entered. I have it in my library for a lot of years and I did not see any slowdowns.&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6271816</link><pubDate>Thu, 15 Nov 2007 22:40:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6271816</guid><dc:creator>Matt Green</dc:creator><description>&lt;P&gt;Yeah I was thinking of WM_NCCREATE (I always think of it as the "pre-WM_CREATE" message), and I don't think the GetWindowLong() method works for those. Of course, you don't need to use WM_NCCREATE too often.&lt;/P&gt;
&lt;DIV class=post&gt;[&lt;I&gt;Naturally, the first message does the SetWindowLong. Somebody has to do the Set after all. -Raymond&lt;/I&gt;]&lt;/DIV&gt;</description></item><item><title>Psychic debugging...</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6275589</link><pubDate>Fri, 16 Nov 2007 00:46:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6275589</guid><dc:creator>Eric Gunnerson's C# Compendium</dc:creator><description>&lt;p&gt;Ray wrote a post entitled &amp;quot; Psychic Debuggin: IP on heap &amp;quot;, where he talks about somebody being amazed&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6275713</link><pubDate>Fri, 16 Nov 2007 00:49:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6275713</guid><dc:creator>Amateur</dc:creator><description>&lt;P&gt;Can someone make a summary what ATL is? I'm not a programmer, but encounter this very often.&lt;/P&gt;
&lt;DIV class=post&gt;[&lt;I&gt;&lt;A href="http://blogs.msdn.com/oldnewthing/archive/2007/05/21/2757223.aspx"&gt;Don't be helpless&lt;/A&gt;. &lt;A href="http://search.live.com/results.aspx?q=atl"&gt;Live Search&lt;/A&gt;. &lt;A href="http://www.google.com/search?q=atl"&gt;Google&lt;/A&gt;. &lt;A href="http://search.yahoo.com/searchp=atl"&gt;Yahoo&lt;/A&gt;. All of them answer your question on the first page of results. I write for an advanced audience. (Whether I actually&amp;nbsp;&lt;U&gt;have&lt;/U&gt; an advanced audience is open to debate.) If you're a beginner, you may want to unsubscribe and switch to a blog that's more suited to your experience. Don't worry. When you become an advanced programmer, this article will still be here for you. -Raymond&lt;/I&gt;]&lt;/DIV&gt;</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6280924</link><pubDate>Fri, 16 Nov 2007 03:25:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6280924</guid><dc:creator>AsmGuru62</dc:creator><description>&lt;p&gt;I pass 'this' with WM_CREATE (lParam points to it in its first DWORD). Not sure what can be done with WM_NCCREATE, which cannot be done with WM_CREATE...&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6293360</link><pubDate>Fri, 16 Nov 2007 11:08:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6293360</guid><dc:creator>olde farthe</dc:creator><description>&lt;p&gt;&amp;quot;Whether I actually have an advanced audience is open to debate.&amp;quot;&lt;/p&gt;
&lt;p&gt;I wish I was as famous as Raymond, so that I could have a blog, insult my readers, and get away with it.&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6309715</link><pubDate>Fri, 16 Nov 2007 21:02:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6309715</guid><dc:creator>Dave</dc:creator><description>&lt;p&gt;Personally, I love the tone here. This blog makes me smile almost every day, and that's worth the price of admission by itself.&lt;/p&gt;
&lt;p&gt;Sarcasm and snarky comments wake up my brain and make the post memorable, improving my chances of remembering the technical details as well.&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6363068</link><pubDate>Sun, 18 Nov 2007 15:23:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6363068</guid><dc:creator>MadQ</dc:creator><description>&lt;p&gt;@Matt Green, AsmGuru62: for overlapped windows, the very first message is actually WM_GETMINMAXINFO. Actually, I think it might be for all windows that don't have the WS_CHILD style, but I'm too lazy right now to write something to find out for sure.&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6393959</link><pubDate>Mon, 19 Nov 2007 11:50:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6393959</guid><dc:creator>Name required</dc:creator><description>&lt;p&gt;&amp;quot;I wish I were as awesome as you&amp;quot;&lt;/p&gt;
&lt;p&gt;Don't clap, just throw money.&lt;/p&gt;
</description></item><item><title>re: Psychic debugging: IP on heap</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6451101</link><pubDate>Wed, 21 Nov 2007 10:06:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6451101</guid><dc:creator>Sidebar Willy</dc:creator><description>&lt;p&gt;&amp;quot;I pass 'this' with WM_CREATE (lParam points to it in its first DWORD). Not sure what can be done with WM_NCCREATE, which cannot be done with WM_CREATE...&amp;quot;&lt;/p&gt;
&lt;p&gt;The old Scratch program uses WM_NCCREATE: &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/oldnewthing/archive/2005/04/22/410773.aspx"&gt;http://blogs.msdn.com/oldnewthing/archive/2005/04/22/410773.aspx&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>DEP, NXCOMPAT, .NET 2.0 SP1</title><link>http://blogs.msdn.com/oldnewthing/archive/2007/11/14/6188257.aspx#6830110</link><pubDate>Fri, 21 Dec 2007 23:38:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6830110</guid><dc:creator>All Your Base Are Belong To Us</dc:creator><description>&lt;p&gt;Yesterday I had an interesting case that I thought of sharing, even though there&amp;amp;#39;s nothing very new&lt;/p&gt;
</description></item></channel></rss>