<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>words &#187; COM</title>
	<atom:link href="http://www.curlybrace.com/words/category/technology/com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.curlybrace.com/words</link>
	<description>by Jeff Fitzsimons</description>
	<lastBuildDate>Tue, 20 Dec 2011 10:21:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>What Exactly Are ATL&#8217;s BEGIN_COM_MAP, END_COM_MAP, and COM_INTERFACE_ENTRY Macros?</title>
		<link>http://www.curlybrace.com/words/2011/12/20/what-exactly-are-atls-begin_com_map-end_com_map-and-com_interface_entry/</link>
		<comments>http://www.curlybrace.com/words/2011/12/20/what-exactly-are-atls-begin_com_map-end_com_map-and-com_interface_entry/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 10:20:44 +0000</pubDate>
		<dc:creator>Jeff Fitzsimons</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.curlybrace.com/words/?p=1959</guid>
		<description><![CDATA[There are many places where ATL&#8217;s COM_MAP macros are documented, but I haven&#8217;t seen it plainly stated what they actually mean. Simply put, BEGIN_COM_MAP implements _InternalQueryInterface. COM_INTERFACE_ENTRY indicates that your class supports the specified interface. END_COM_MAP finishes the _InternalQueryInterface implementation. &#8230; <a href="http://www.curlybrace.com/words/2011/12/20/what-exactly-are-atls-begin_com_map-end_com_map-and-com_interface_entry/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>There are many places where ATL&#8217;s COM_MAP macros are documented, but I haven&#8217;t seen it plainly stated what they actually mean.</p>
<p>Simply put, BEGIN_COM_MAP implements _InternalQueryInterface.  COM_INTERFACE_ENTRY indicates that your class supports the specified interface.  END_COM_MAP finishes the _InternalQueryInterface implementation.</p>
<blockquote><p>Note:  A QueryInterface implementation which calls this _InternalQueryInterface method must either be hand-coded, <a href="http://msdn.microsoft.com/en-us/library/c43h4867(v=VS.100).aspx">or supplied by CComObject, CComAggObject, etc</a>.</p></blockquote>
<p>For example:</p>
<blockquote><pre>
class MyClass :
    public CComObjectRoot,
    public ISomeInterface
{
public:
    BEGIN_COM_MAP(MyClass)
        COM_INTERFACE_ENTRY(ISomeInterface)
    END_COM_MAP()
};

CComClass<MyClass> myInstance = new CComClass<MyCLass>;
</pre>
</blockquote>
<p>The COM_INTERFACE_ENTRY line indicates that MyClass implements ISomeInterface.  If QueryInterface is called to requests an ISomeInterface pointer, the call will succeed.  Without the COM_INTERFACE_ENTRY line, the QueryInterface call would fail.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curlybrace.com/words/2011/12/20/what-exactly-are-atls-begin_com_map-end_com_map-and-com_interface_entry/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Demise of CAPICOM</title>
		<link>http://www.curlybrace.com/words/2008/10/15/the-demise-of-capicom/</link>
		<comments>http://www.curlybrace.com/words/2008/10/15/the-demise-of-capicom/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 06:43:01 +0000</pubDate>
		<dc:creator>Jeff Fitzsimons</dc:creator>
				<category><![CDATA[Authenticode]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[CAPICOM]]></category>
		<category><![CDATA[code signing]]></category>

		<guid isPermaLink="false">http://www.curlybrace.com/words/?p=266</guid>
		<description><![CDATA[CAPICOM, a COM-based wrapper for the CryptoAPI library, is deprecated and on its way out. However, Microsoft has no time line for phasing it out, nor have they provided sufficient documentation of alternatives. Many CAPICOM pages contain a confusing, bright-red &#8230; <a href="http://www.curlybrace.com/words/2008/10/15/the-demise-of-capicom/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>CAPICOM, a COM-based wrapper for the CryptoAPI library, is deprecated and on its way out.  However, Microsoft has no time line for phasing it out, nor have they provided sufficient documentation of alternatives.</p>
<p>Many CAPICOM pages contain a confusing, bright-red header along the lines of:</p>
<blockquote><p><span style="color:#FF0000">[The SignedCode object is available for use in the operating systems listed in the Requirements section. Instead, use Platform Invocation Services (PInvoke) to call the Win32 API SignerSignEx, SignerTimeStampEx, and WinVerifyTrust functions to sign content with an Authenticode digital signature. For information about PInvoke, see Platform Invoke Tutorial. The .NET and CryptoAPI via P/Invoke: Part 1 and .NET and CryptoAPI via P/Invoke: Part 2 subsections of Extending .NET Cryptography with CAPICOM and P/Invoke may also be helpful.]</span></p></blockquote>
<p>Note that this alarming paragraph seems to begin by simply telling you that this API is supported on the operating systems listed later.  It does <b>not</b> state that the API will not be available on later OSes, but <i>why</i> place this here otherwise?  The next sentence, beginning with, &#8220;Instead, &#8230;&#8221; seems to be contrasting with something, yet makes absolutely no sense in this context.</p>
<p>Finally, this paragraph instructs us to investigate <a href="http://msdn.microsoft.com/en-us/library/aa387734(VS.85).aspx">SignerSignEx</a>, and <a href="http://msdn.microsoft.com/en-us/library/cc300159(VS.85).aspx">SignerTimeStampEx</a>, which are supplied by the mssign32.dll, have no header file, and absolutely no example code.  This is what I find most irksome, they document each and every function and structure, yet each page says, &#8220;there is no header file, so copy and paste the declaration given here.&#8221;  Well, why not simply provide an mssign.h file on blogs.msdn, or similar?  And why, oh why, is there not a single line of sample code?</p>
<h3>Follow-up</h3>
<p>I have provided a basic header file for mssign32.dll, <a href="http://www.curlybrace.com/words/?p=271">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.curlybrace.com/words/2008/10/15/the-demise-of-capicom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CoCreateInstance Fails With &#8220;Class Not Registered&#8221;</title>
		<link>http://www.curlybrace.com/words/2008/06/17/cocreateinstance-clsctx_inproc_server-failing-with-class-not-registered/</link>
		<comments>http://www.curlybrace.com/words/2008/06/17/cocreateinstance-clsctx_inproc_server-failing-with-class-not-registered/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 00:47:28 +0000</pubDate>
		<dc:creator>Jeff Fitzsimons</dc:creator>
				<category><![CDATA[COM]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.curlybrace.com/words/?p=131</guid>
		<description><![CDATA[Recently, I had a problem unique to my test machine. Attempting to call CoCreateInstance on a COM class provided by one of our DLLs resulted in HRESULT 0&#215;80040154, which corresponds to &#8220;Class not registered&#8221;. This was a mystery since regsvr32 &#8230; <a href="http://www.curlybrace.com/words/2008/06/17/cocreateinstance-clsctx_inproc_server-failing-with-class-not-registered/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently, I had a problem unique to my test machine.  Attempting to call CoCreateInstance on a COM class provided by one of our DLLs resulted in HRESULT 0&#215;80040154, which corresponds to &#8220;Class not registered&#8221;.</p>
<p>This was a mystery since regsvr32 appeared to properly register our DLL, and all the obvious registry keys were intact!</p>
<p>After a bit of web searching, I experimented with using CLSCTX_ALL instead of CLSCTX_INPROC_SERVER.  Now, the call succeeded!  But why, since this is a DLL and, therefore, should be considered an in-process COM server?</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms686615(VS.85).aspx">MSDN documentation</a> states that CLSCTX_ALL is defined as the combination of CLSCTX_INPROC_SERVER, CLSCTX_INPROC_HANDLER, and CLSCTX_LOCAL_SERVER.  I began substituting each one in turn and found that the key was CLSCTX_LOCAL_SERVER.</p>
<p>Stepping through the code in the debugger revealed that the instant the CoCreateInstance call was made, a new instance of dllhost.exe appeared in the process list.  This explained why CLSCTX_INPROC_SERVER would fail, since strictly speaking, the DLL was being hosted in dllhost&#8217;s process space.</p>
<p>Ultimately, the problem turned out to be an artifact from an old COM+ experiment.  There was a COM+ entry corresponding to our COM server in the Component Services panel (Control Panel | Administrative Tools | Component Services, under Component Services | Computers | My Computer | COM+ Applications).  The COM+ entry dictated that the COM server be hosted by proxy by dllhost.exe.  Deleting this COM+ entry and re-running regsvr32 fixed the problem.</p>
<blockquote><p><img src='http://www.curlybrace.com/words/wp-content/uploads/2008/06/componentservices.PNG' alt='Component Services panel in Administrative Tools' /></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.curlybrace.com/words/2008/06/17/cocreateinstance-clsctx_inproc_server-failing-with-class-not-registered/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

