<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Beware of using stack-based COM objects from .NET</title>
	<atom:link href="http://www.voyce.com/index.php/2010/01/21/beware-of-using-stack-based-com-objects-from-net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.voyce.com/index.php/2010/01/21/beware-of-using-stack-based-com-objects-from-net/</link>
	<description>Programming and debugging tidbits</description>
	<lastBuildDate>Wed, 04 Jan 2012 23:07:52 +0000</lastBuildDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Grant Shirreffs</title>
		<link>http://www.voyce.com/index.php/2010/01/21/beware-of-using-stack-based-com-objects-from-net/comment-page-1/#comment-999</link>
		<dc:creator>Grant Shirreffs</dc:creator>
		<pubDate>Thu, 14 Oct 2010 20:17:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.voyce.com/?p=618#comment-999</guid>
		<description>Thanks, exactly what I wanted.</description>
		<content:encoded><![CDATA[<p>Thanks, exactly what I wanted.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ian</title>
		<link>http://www.voyce.com/index.php/2010/01/21/beware-of-using-stack-based-com-objects-from-net/comment-page-1/#comment-998</link>
		<dc:creator>ian</dc:creator>
		<pubDate>Thu, 14 Oct 2010 09:20:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.voyce.com/?p=618#comment-998</guid>
		<description>Hi Grant,

Thanks for the comment.

I found the offset using the public symbols for mscorwks and disassembling around functions of interest. If you&#039;ve got the pdb symbols loaded (using &lt;code&gt;.symfix&lt;/code&gt; should setup the appropriate paths) you can use &lt;code&gt;x&lt;/code&gt; (examine symbols) to find the routine, e.g.:
&lt;code&gt;
0:020&gt; x mscorwks!RCW::Cleanup
79faa927 mscorwks!RCW::Cleanup = &lt;no type information&gt;
&lt;/code&gt;

The particular offset I used was the location in that routine where it actually deleted its internal wrapper object:
&lt;code&gt;
0:020&gt; u 79faa974 
mscorwks!RCW::Cleanup+0x4d:
79faa974 e8a7f7ecff      call    mscorwks!operator delete (79e7a120)
79faa979 59              pop     ecx
79faa97a e8356eecff      call    mscorwks!_EH_epilog3 (79e717b4)
79faa97f c3              ret
&lt;/code&gt;

The creation function is &lt;code&gt;mscorwks!RCW:CreateRCW&lt;/code&gt;, so you can search for that using &lt;code&gt;x&lt;/code&gt; in your live process in the same way.

Hope that helps.</description>
		<content:encoded><![CDATA[<p>Hi Grant,</p>
<p>Thanks for the comment.</p>
<p>I found the offset using the public symbols for mscorwks and disassembling around functions of interest. If you&#8217;ve got the pdb symbols loaded (using <code>.symfix</code> should setup the appropriate paths) you can use <code>x</code> (examine symbols) to find the routine, e.g.:<br />
<code><br />
0:020> x mscorwks!RCW::Cleanup<br />
79faa927 mscorwks!RCW::Cleanup = &lt;no type information&gt;<br />
</code></p>
<p>The particular offset I used was the location in that routine where it actually deleted its internal wrapper object:<br />
<code><br />
0:020> u 79faa974<br />
mscorwks!RCW::Cleanup+0x4d:<br />
79faa974 e8a7f7ecff      call    mscorwks!operator delete (79e7a120)<br />
79faa979 59              pop     ecx<br />
79faa97a e8356eecff      call    mscorwks!_EH_epilog3 (79e717b4)<br />
79faa97f c3              ret<br />
</code></p>
<p>The creation function is <code>mscorwks!RCW:CreateRCW</code>, so you can search for that using <code>x</code> in your live process in the same way.</p>
<p>Hope that helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Grant Shirreffs</title>
		<link>http://www.voyce.com/index.php/2010/01/21/beware-of-using-stack-based-com-objects-from-net/comment-page-1/#comment-997</link>
		<dc:creator>Grant Shirreffs</dc:creator>
		<pubDate>Thu, 14 Oct 2010 00:48:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.voyce.com/?p=618#comment-997</guid>
		<description>Interesting article; thanks very much for this.

I especially like the idea of the dumping breakpoints on RCW creation and destruction.  Unfortunately, the addresses you give are specific to a version of MSCORWKS.DLL , and are completely unmapped in a typical 32-bit process on my Windows 7/64 machine.  How did you arrive at these addresses?  I&#039;ve tried remapping them based on the MSCORWKS addresses in your call stack compared to those in mine, but the functions must have moved inside the DLL.  Any hints?

Thanks again
Grant</description>
		<content:encoded><![CDATA[<p>Interesting article; thanks very much for this.</p>
<p>I especially like the idea of the dumping breakpoints on RCW creation and destruction.  Unfortunately, the addresses you give are specific to a version of MSCORWKS.DLL , and are completely unmapped in a typical 32-bit process on my Windows 7/64 machine.  How did you arrive at these addresses?  I&#8217;ve tried remapping them based on the MSCORWKS addresses in your call stack compared to those in mine, but the functions must have moved inside the DLL.  Any hints?</p>
<p>Thanks again<br />
Grant</p>
]]></content:encoded>
	</item>
</channel>
</rss>

