<?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>Fooling Around &#187; COM</title>
	<atom:link href="http://alax.info/blog/tag/com/feed" rel="self" type="application/rss+xml" />
	<link>http://alax.info/blog</link>
	<description>// Software Production Line</description>
	<lastBuildDate>Fri, 03 Feb 2012 22:49:15 +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>Utility Clearance: Simple SMTP Email Sender</title>
		<link>http://alax.info/blog/1331</link>
		<comments>http://alax.info/blog/1331#comments</comments>
		<pubDate>Sun, 29 Jan 2012 19:52:09 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[message]]></category>
		<category><![CDATA[schannel]]></category>
		<category><![CDATA[SMTP]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[tls]]></category>
		<category><![CDATA[utilitiy]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1331</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1331" title="Utility Clearance: Simple SMTP Email Sender"></a>The library implements SMTP client and exposes a simple COM interface to send emails. The interface is simple and straightforward, and the emails can be send from various environments, including such as JavaScript code. The class supports SSL/TLS security and &#8230;<p class="read-more"><a href="http://alax.info/blog/1331">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1331" title="Utility Clearance: Simple SMTP Email Sender"></a><p>The library implements SMTP client and exposes a simple COM interface to send emails. The interface is simple and straightforward, and the emails can be send from various environments, including such as JavaScript code. The class supports SSL/TLS security and is GMail compliant.</p>
<p><img class="alignnone size-full wp-image-1332" title="Alax.Info Email Tools 1.0 Type Library" src="http://alax.info/blog/wp-content/uploads/2012/01/Image001.png" alt="" width="523" height="479" /></p>
<p>A JScript code snippet below provides a sample use case:</p>
<pre style="color: #000000; background: #ffffff;">message <span style="color: #808030;">=</span> <span style="color: #800000; font-weight: bold;">new</span> <span style="color: #797997;">ActiveXObject</span><span style="color: #808030;">(</span><span style="color: #800000;">"</span><span style="color: #0000e6;">AlaxInfo.EmailTools.Message</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
message<span style="color: #808030;">.</span>ServerHost <span style="color: #808030;">=</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">mail.alax.info</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
<span style="color: #696969;">//message.ServerPort = 25;</span>
message<span style="color: #808030;">.</span>Sender <span style="color: #808030;">=</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">Sender &lt;test@alax.info&gt;</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
message<span style="color: #808030;">.</span>ToRecipients <span style="color: #808030;">=</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">Recipient &lt;address@gmail.com&gt;</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
<span style="color: #696969;">//message.CcRecipients = "";</span>
<span style="color: #696969;">//message.BccRecipients = "";</span>
message<span style="color: #808030;">.</span>Subject <span style="color: #808030;">=</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">Message Test (Plain)</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
message<span style="color: #808030;">.</span>Body <span style="color: #808030;">=</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">This is an e-mail message test:</span><span style="color: #800000;">"</span> <span style="color: #808030;">+</span> <span style="color: #800000;">"</span><span style="color: #0f69ff;">\r</span><span style="color: #0f69ff;">\n</span><span style="color: #800000;">"</span> <span style="color: #808030;">+</span>
  <span style="color: #800000;">"</span><span style="color: #800000;">"</span> <span style="color: #808030;">+</span> <span style="color: #800000;">"</span><span style="color: #0f69ff;">\r</span><span style="color: #0f69ff;">\n</span><span style="color: #800000;">"</span> <span style="color: #808030;">+</span>
  <span style="color: #800000;">"</span><span style="color: #0000e6;">- Security: None</span><span style="color: #800000;">"</span> <span style="color: #808030;">+</span> <span style="color: #800000;">"</span><span style="color: #0f69ff;">\r</span><span style="color: #0f69ff;">\n</span><span style="color: #800000;">"</span> <span style="color: #808030;">+</span>
  <span style="color: #800000;">"</span><span style="color: #0000e6;">- Authentication: Plain Text (PLAIN)</span><span style="color: #800000;">"</span> <span style="color: #808030;">+</span> <span style="color: #800000;">"</span><span style="color: #0f69ff;">\r</span><span style="color: #0f69ff;">\n</span><span style="color: #800000;">"</span> <span style="color: #808030;">+</span>
  <span style="color: #800000;">"</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
message<span style="color: #808030;">.</span>AuthMethods <span style="color: #808030;">=</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">plain</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
message<span style="color: #808030;">.</span>AuthName <span style="color: #808030;">=</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">test@alax.info</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
message<span style="color: #808030;">.</span>AuthPassword <span style="color: #808030;">=</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">12345678</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
message<span style="color: #808030;">.</span>Send<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span></pre>
<p>The capabilities include:</p>
<ul>
<li>No additional dependencies &#8211; regsvr32 the DLL and it&#8217;s ready to use; SSL/TLS implementation through <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa374782%28v=vs.85%29.aspx">SChannel API</a></li>
<li>UTF-8 encoding and support for Unicode and international characters</li>
<li>Secure SSL connections (<strong>SecureSocketsLayer</strong> property)</li>
<li>Secure Transport Layer Security (TLS) connections with <strong>STARTTLS</strong> command (<strong>TransportLayerSecurity</strong> property)</li>
<li>Authentication options: plain text (LOGIN, PLAIN), digest (CRAM-MD5)</li>
<li>Protocol References:</li>
<ul>
<li><a href="http://tools.ietf.org/html/rfc5321">RFC 5321 &#8211; Simple Mail Transfer Protocol</a></li>
<li><a href="http://tools.ietf.org/html/rfc2045">RFC 2045 &#8211; Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies</a></li>
<li><a href="http://tools.ietf.org/html/rfc3207">RFC 3207 &#8211; SMTP Service Extension for Secure SMTP over Transport Layer Security</a></li>
<li><a href="http://tools.ietf.org/html/rfc2195">RFC 2195 &#8211; IMAP/POP AUTHorize Extension for Simple Challenge/Response</a></li>
<li><a href="http://tools.ietf.org/html/rfc4616">RFC 4616 &#8211; The PLAIN Simple Authentication and Security Layer (SASL) Mechanism</a></li>
</ul>
</ul>
<p><span id="more-1331"></span></p>
<p>Relaying through Google Mail needs secure connection (SSL or TLS) plus plain text authentication of sender:</p>
<pre style="color: #000000; background: #ffffff;">message <span style="color: #808030;">=</span> <span style="color: #800000; font-weight: bold;">new</span> <span style="color: #797997;">ActiveXObject</span><span style="color: #808030;">(</span><span style="color: #800000;">"</span><span style="color: #0000e6;">AlaxInfo.EmailTools.Message</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
message<span style="color: #808030;">.</span>ServerHost <span style="color: #808030;">=</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">smtp.gmail.com</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
<span style="color: #696969;">//message.ServerPort = 587;</span>
message<span style="color: #808030;">.</span>Sender <span style="color: #808030;">=</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">Sender &lt;foo+sender@gmail.com&gt;</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
message<span style="color: #808030;">.</span>ToRecipients <span style="color: #808030;">=</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">Recipient &lt;bar+receiver@gmail.com&gt;</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
<span style="color: #696969;">//message.CcRecipients = "";</span>
<span style="color: #696969;">//message.BccRecipients = "";</span>
message<span style="color: #808030;">.</span>Subject <span style="color: #808030;">=</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">Message Test (TLS, Plain)</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
message<span style="color: #808030;">.</span>Body <span style="color: #808030;">=</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">This is an e-mail message test:</span><span style="color: #800000;">"</span> <span style="color: #808030;">+</span> <span style="color: #800000;">"</span><span style="color: #0f69ff;">\r</span><span style="color: #0f69ff;">\n</span><span style="color: #800000;">"</span> <span style="color: #808030;">+</span>
  <span style="color: #800000;">"</span><span style="color: #800000;">"</span> <span style="color: #808030;">+</span> <span style="color: #800000;">"</span><span style="color: #0f69ff;">\r</span><span style="color: #0f69ff;">\n</span><span style="color: #800000;">"</span> <span style="color: #808030;">+</span>
  <span style="color: #800000;">"</span><span style="color: #0000e6;">- Security: TLS</span><span style="color: #800000;">"</span> <span style="color: #808030;">+</span> <span style="color: #800000;">"</span><span style="color: #0f69ff;">\r</span><span style="color: #0f69ff;">\n</span><span style="color: #800000;">"</span> <span style="color: #808030;">+</span>
  <span style="color: #800000;">"</span><span style="color: #0000e6;">- Authentication: Plain Text (PLAIN)</span><span style="color: #800000;">"</span> <span style="color: #808030;">+</span> <span style="color: #800000;">"</span><span style="color: #0f69ff;">\r</span><span style="color: #0f69ff;">\n</span><span style="color: #800000;">"</span> <span style="color: #808030;">+</span>
  <span style="color: #800000;">"</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
message<span style="color: #808030;">.</span>TransportLayerSecurity <span style="color: #808030;">=</span> <span style="color: #0f4d75;">true</span><span style="color: #800080;">;</span>
message<span style="color: #808030;">.</span>AuthMethods <span style="color: #808030;">=</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">plain</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
message<span style="color: #808030;">.</span>AuthName <span style="color: #808030;">=</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">foo@gmail.com</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
message<span style="color: #808030;">.</span>AuthPassword <span style="color: #808030;">=</span> <span style="color: #800000;">"</span><span style="color: #0000e6;">password</span><span style="color: #800000;">"</span><span style="color: #800080;">;</span>
message<span style="color: #808030;">.</span>Send<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span></pre>
<h4>Download Information</h4>
<ul>
<li>Download (32-bit): <a href="http://www.alax.info/svn/public/trunk/Utilities/EmailTools/Win32/">EmailTools.dll</a></li>
<li>Download (64-bit): <a href="http://www.alax.info/svn/public/trunk/Utilities/EmailTools/x64/">EmailTools.dll</a></li>
<li>License: This software is free to use</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1331/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft.Jet.OLEDB.4.0 ProgID is not available (Windows 7 but probably not only)</title>
		<link>http://alax.info/blog/1086</link>
		<comments>http://alax.info/blog/1086#comments</comments>
		<pubDate>Fri, 30 Oct 2009 08:56:38 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[ole]]></category>
		<category><![CDATA[oledb]]></category>
		<category><![CDATA[registry]]></category>
		<category><![CDATA[win7]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1086</guid>
		<description><![CDATA[<a href="http://alax.info/blog/1086" title="Microsoft.Jet.OLEDB.4.0 ProgID is not available (Windows 7 but probably not only)"></a>It was a sort of ridiculous problem: an attempt to instantiate a Microsoft.Jet.OLEDB.4.0 object failed with error. Still some applications are still running without problems connecting to Jet databases, how comes? There has been a number of posts on Internet, &#8230;<p class="read-more"><a href="http://alax.info/blog/1086">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/1086" title="Microsoft.Jet.OLEDB.4.0 ProgID is not available (Windows 7 but probably not only)"></a><p>It was a sort of ridiculous problem: an attempt to instantiate a Microsoft.Jet.OLEDB.4.0 object failed with error. Still some applications are still running without problems connecting to Jet databases, how comes?</p>
<p>There has been <a href="http://www.google.com/search?q=Microsoft.Jet.OLEDB.4.0">a number of posts on Internet</a>, but none of the top ones appeared to be relevant.</p>
<p>The problem is reproduced extremely simple:</p>
<pre style="background: #ffffff none repeat scroll 0% 0%; color: #000000; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"><span style="color: #800000; font-weight: bold;">int</span> _tmain<span style="color: #808030;">(</span><span style="color: #800000; font-weight: bold;">int</span> argc<span style="color: #808030;">,</span> _TCHAR<span style="color: #808030;">*</span> argv<span style="color: #808030;">[</span><span style="color: #808030;">]</span><span style="color: #808030;">)</span>
<span style="color: #800080;">{</span>
    ATLVERIFY<span style="color: #808030;">(</span>SUCCEEDED<span style="color: #808030;">(</span>CoInitialize<span style="color: #808030;">(</span><span style="color: #7d0045;">NULL</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
    <span style="color: #800080;">{</span>
        <span style="color: #696969;">//CoLoadLibrary(L"C:\\Program Files (x86)\\Common Files\\System\\Ole DB\\oledb32.dll", TRUE);</span>
        CComPtr<span style="color: #800080;">&lt;</span>IDBInitialize<span style="color: #800080;">&gt;</span> pDbInitialize<span style="color: #800080;">;</span>
        <span style="color: #800000; font-weight: bold;">const</span> HRESULT nResult <span style="color: #808030;">=</span> pDbInitialize<span style="color: #808030;">.</span>CoCreateInstance<span style="color: #808030;">(</span><span style="color: #800000;">L"</span><span style="color: #0000e6;">Microsoft.Jet.OLEDB.4.0</span><span style="color: #800000;">"</span><span style="color: #808030;">,</span> <span style="color: #7d0045;">NULL</span><span style="color: #808030;">,</span> CLSCTX_INPROC_SERVER<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        _tprintf<span style="color: #808030;">(</span>_T<span style="color: #808030;">(</span><span style="color: #800000;">"</span><span style="color: #0000e6;">nResult 0x</span><span style="color: #0f69ff;">%08x</span><span style="color: #0f69ff;">\n</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span><span style="color: #808030;">,</span> nResult<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
    <span style="color: #800080;">}</span>
    CoUninitialize<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
    <span style="color: #800000; font-weight: bold;">return</span> <span style="color: #008c00;">0</span><span style="color: #800080;">;</span>
<span style="color: #800080;">}</span></pre>
<p>Oops, the code gives error REGDB_E_CLASSNOTREG 0&#215;80040154 &#8220;Class not registered&#8221;. It looked like system was unable to locate one of the internally used DLLs &#8211; oledb32.dll, and if we help by uncommenting the line commented in the code snippet above, the error changes to ERROR_MOD_NOT_FOUND 0x8007007e &#8220;The specified module could not be found&#8221;.</p>
<p>The problem appears to be that one of the system components, which is involved, &#8220;Microsoft OLE DB Data Conversion Library&#8221; is registered with the system using a <a href="http://msdn.microsoft.com/en-us/library/ms724884%28VS.85%29.aspx">REG_EXPAND_SZ</a> value, to be located using path &#8220;%CommonProgramFiles(x86)%\System\Ole DB\oledb32.dll&#8221;. It is obvious that <strong>CommonProgramFiles(x86)</strong> is placeholder to be expanded, but does the expansion succeed?</p>
<p><span id="more-1086"></span></p>
<p>On my system there was no such environment string, so expansion failed. There however was <strong>CommonProgramFiles</strong>, and it pointed to correct location. So, this hot fix makes it work right:</p>
<pre><span style="color: #603000;">BOOL</span> UpdateEnvironmentVariables<span style="color: #808030;">(</span><span style="color: #808030;">)</span>
<span style="color: #800080;">{</span>
    <span style="color: #603000;">CString</span> sCommonProgramFilesX86<span style="color: #800080;">;</span>
    sCommonProgramFilesX86<span style="color: #808030;">.</span><span style="color: #400000;">GetEnvironmentVariable</span><span style="color: #808030;">(</span>_T<span style="color: #808030;">(</span><span style="color: #800000;">"</span><span style="color: #0000e6;">CommonProgramFiles(x86)</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
    <span style="color: #800000; font-weight: bold;">if</span><span style="color: #808030;">(</span>sCommonProgramFilesX86<span style="color: #808030;">.</span>IsEmpty<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span>
    <span style="color: #800080;">{</span>
        <span style="color: #603000;">CString</span> sCommonProgramFiles<span style="color: #800080;">;</span>
        sCommonProgramFiles<span style="color: #808030;">.</span><span style="color: #400000;">GetEnvironmentVariable</span><span style="color: #808030;">(</span>_T<span style="color: #808030;">(</span><span style="color: #800000;">"</span><span style="color: #0000e6;">CommonProgramFiles</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        <span style="color: #800000; font-weight: bold;">if</span><span style="color: #808030;">(</span><span style="color: #808030;">!</span>sCommonProgramFiles<span style="color: #808030;">.</span>IsEmpty<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span>
        <span style="color: #800080;">{</span>
            ATLVERIFY<span style="color: #808030;">(</span><span style="color: #400000;">SetEnvironmentVariable</span><span style="color: #808030;">(</span>_T<span style="color: #808030;">(</span><span style="color: #800000;">"</span><span style="color: #0000e6;">CommonProgramFiles(x86)</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span><span style="color: #808030;">,</span> sCommonProgramFiles<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
            <span style="color: #800000; font-weight: bold;">return</span> TRUE<span style="color: #800080;">;</span>
        <span style="color: #800080;">}</span>
    <span style="color: #800080;">}</span>
    <span style="color: #800000; font-weight: bold;">return</span> FALSE<span style="color: #800080;">;</span>
<span style="color: #800080;">}</span>

<span style="color: #800000; font-weight: bold;">int</span> _tmain<span style="color: #808030;">(</span><span style="color: #800000; font-weight: bold;">int</span> argc<span style="color: #808030;">,</span> _TCHAR<span style="color: #808030;">*</span> argv<span style="color: #808030;">[</span><span style="color: #808030;">]</span><span style="color: #808030;">)</span>
<span style="color: #800080;">{</span>
    ATLVERIFY<span style="color: #808030;">(</span>SUCCEEDED<span style="color: #808030;">(</span>CoInitialize<span style="color: #808030;">(</span><span style="color: #7d0045;">NULL</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
    <span style="color: #800080;">{</span>
        UpdateEnvironmentVariables<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        CComPtr<span style="color: #800080;">&lt;</span>IDBInitialize<span style="color: #800080;">&gt;</span> pDbInitialize<span style="color: #800080;">;</span>
        <span style="color: #800000; font-weight: bold;">const</span> HRESULT nResult <span style="color: #808030;">=</span> pDbInitialize<span style="color: #808030;">.</span>CoCreateInstance<span style="color: #808030;">(</span><span style="color: #800000;">L"</span><span style="color: #0000e6;">Microsoft.Jet.OLEDB.4.0</span><span style="color: #800000;">"</span><span style="color: #808030;">,</span> <span style="color: #7d0045;">NULL</span><span style="color: #808030;">,</span> CLSCTX_INPROC_SERVER<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        _tprintf<span style="color: #808030;">(</span>_T<span style="color: #808030;">(</span><span style="color: #800000;">"</span><span style="color: #0000e6;">nResult 0x</span><span style="color: #0f69ff;">%08x</span><span style="color: #0f69ff;">\n</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span><span style="color: #808030;">,</span> nResult<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
    <span style="color: #800080;">}</span>
    CoUninitialize<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
    <span style="color: #800000; font-weight: bold;">return</span> <span style="color: #008c00;">0</span><span style="color: #800080;">;</span>
<span style="color: #800080;">} </span></pre>
<p>I am under impression that the problem is not specific to Windows 7. I remember similar symptoms on Windows XP system, but they were not critical and not investigated to solution. It rather seems that OLE DB component is registering itself using a reference to environment variable which is not present on a number of systems.</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 81px; width: 1px; height: 1px;">
<h3 class="r"><a class="l" onmousedown="return rwt(this,'','','res','1','AFQjCNEiQBNPN2MLUciPFN3dRVUU-1FyJA','&amp;sig2=GPxd_FHW5MyBRM2Op0Da1A','0CAoQFjAA')" href="http://support.software602.com/kb/view.aspx?articleID=987">Error code 80040154. <em>Class not registered</em></a></h3>
</div>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1086/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DirectShow Filter Graph Spy on Vista</title>
		<link>http://alax.info/blog/944</link>
		<comments>http://alax.info/blog/944#comments</comments>
		<pubDate>Mon, 22 Jun 2009 08:36:15 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[ATL]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[registry]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[spy]]></category>
		<category><![CDATA[Vista]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=944</guid>
		<description><![CDATA[<a href="http://alax.info/blog/944" title="DirectShow Filter Graph Spy on Vista"></a>I have been receiving comments that Filter Graph Spy tool does not work with Microsoft Vista operating system. I never had a moment to check until recently, and this time I realized that it really does not work. I am &#8230;<p class="read-more"><a href="http://alax.info/blog/944">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/944" title="DirectShow Filter Graph Spy on Vista"></a><p>I have been receiving comments that <a href="http://alax.info/blog/777">Filter Graph Spy</a> tool does not work with Microsoft Vista operating system. I never had a moment to check until recently, and this time I realized that it really does not work. I am definitely aware of dramatic changes introduced with this operating system, and in particular UAC feature, virtualization and changes in security. No wonder this was the first guess that security was the cause, however the investigation showed there was a trail of issues underneath&#8230;</p>
<p>Investigation details deserve a separate post, while this one briefly outlines the issues and also accompany the repository update with a version compatible with Vista OS.</p>
<p>First of all, COM registration of the DLL (which definitely requires privilege elevation) succeeded on Vista. This means the registration procedure did not encounter any errors on the way, or poorly written code ignored the problem. It appeared that the source of the problem was <a href="http://msdn.microsoft.com/en-us/library/ms693452(VS.85).aspx">CoTreatAsClass</a> API, which failed to do the requested action, however returned status code indicating successful operation. This definitely looks like a bug and further comments on this particular behavior are expected to appear on <a href="http://social.msdn.microsoft.com/Forums/en-US/windowssecurity/threads/">Windows Applications Security MSDN forum</a>, where I opened <a href="http://social.msdn.microsoft.com/Forums/en-US/windowssecurity/thread/583793b8-a73c-4cb5-ae8c-a3620203aed9">a topic on the matter</a>.</p>
<p>With a COM TreatAs feature activated, the class&#8217;s behavior to instantiate instead of DirectShow&#8217;s CLSID_FilterGraph is restored, and in particular the DLL generates <em>FilterGraphSpy.log</em> log file on filter graph activity. Note that log file location is OS dependent (due to Vista&#8217;s permissions and file system virtualization):</p>
<ul>
<li>pre-Vista OS: root of syste drive, typically <em>C:\</em></li>
<li>starting Vista, administrator with elevated privileges: <em>CSIDL_COMMON_APPDATA</em>, typically <em>C:\ProgramData</em> (note this directory is hidden by deafult)</li>
<li>starting Vista, without elevated administrator privileges: <em>CSIDL_LOCAL_APPDATA</em>, typically <em>C:\Users\$(UserName)\AppData\Local</em> (note that <em>AppData</em> directory is hidden by deafult)</li>
</ul>
<p>Still even with the log file generated and indicating activation of the spy, it was unable to connect to remote graph through the running object table (ROT). It appeared that the ROT entires are there where expected, it was OK to get an object from ROT and the problem came from QueryInterface code:</p>
<pre>CComPtr<span style="color: #800080;">&lt;</span>IUnknown<span style="color: #800080;">&gt;</span> pFilterGraphUnknown<span style="color: #800080;">;</span>
ATLENSURE_SUCCEEDED<span style="color: #808030;">(</span>pRunningObjectTable<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span><span style="color: #400000;">GetObject</span><span style="color: #808030;">(</span>pMoniker<span style="color: #808030;">,</span> <span style="color: #808030;">&amp;</span>pFilterGraphUnknown<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
CComQIPtr<span style="color: #800080;">&lt;</span>IMyFilterGraph<span style="color: #800080;">&gt;</span> pFilterGraph <span style="color: #808030;">=</span> pFilterGraphUnknown<span style="color: #800080;">;</span> <span style="color: #696969;">// <span style="color: #ff0000;">E_NOINTERFACE</span></span></pre>
<p>The call reached the original object but COM subsystem was unable to marshal the interface through apartments to enable interprocess communication on it. The reason for this is absence of <em>PSFactoryBuffer</em> class (CLSID {92A3A302-DA7C-4A1F-BA7E-1802BB5D2D02}), which provides proxy/stub pairs for marshaling well known DirectShow interfaces in the Vista&#8217;s version of <em>quartz.dll</em>. <a href="http://social.msdn.microsoft.com/Forums/en-US/windowsdirectshowdevelopment/thread/5079f1c5-1275-4449-a11c-3cbb820e33eb">As mentioned by Microsoft&#8217;s Mike Wasson</a>, this class was moved from <em>quartz.dll</em> into Vista SDK&#8217;s <em>proppage.dll</em>, so in order to obtain connectivity to remote DirectShow graphs starting Vista, one needs to install this DLL with <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC&amp;displaylang=en">Windows SDK</a>, or otherwise have it registered with the operating system.</p>
<p>Also note that DirectShow-enabled applications that have their filter graphs published on ROT will need an utility application such as <a href="http://msdn.microsoft.com/en-us/library/ms787460(VS.85).aspx">GraphEdit</a> started with the same permissions (elevated or not) in order to be able to access ROT entires.</p>
<div style="background-color: #efa; border: 1px solid #ffc; padding: 2px; ">To sum everything up, to install Alax.Info DirectShow Filter Graph Spy on Vista:<br/></p>
<ul>
<li>get the latest <em>FilterGraphSpy.dll</em></li>
<li>regsvr32 <em>FilterGraphSpy.dll</em> on target system from administrative command prompt, with elevated privileges (note you should have a log file <em>FilterGraphSpy.log</em> generated in CSIDL_COMMON_APPDATA directory, with a few lines indicating registration success)</li>
<li>get <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC&amp;displaylang=en">Windows SDK</a> and make <em>$(WindowsSDK)\Bin\proppage.dll</em> file registered on target system (also administrative regsvr32), note that it is necessary to restart DirectShow-enabled applications and GraphEdit after DLL registration to get graphs visible through ROT</li>
<li>mind the log file directories with <em>FilterGraphSpy.log</em> file</li>
</ul>
</div>
<p>A partial Visual C++ .NET 2008 source code is <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy">available from SVN</a>, release binary <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/Release%20Trace/FilterGraphSpy.dll?format=raw">included</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/944/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RegisterTypeLibrary to register type libraries the way regsvr32 registers COM servers</title>
		<link>http://alax.info/blog/739</link>
		<comments>http://alax.info/blog/739#comments</comments>
		<pubDate>Mon, 05 Jan 2009 16:26:51 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[TLB]]></category>
		<category><![CDATA[type library]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=739</guid>
		<description><![CDATA[<a href="http://alax.info/blog/739" title="RegisterTypeLibrary to register type libraries the way regsvr32 registers COM servers"></a>While regsvr32 tool is used to register COM servers, such as .DLL, .OCX, .AX files, sometimes you need an equivalent for type library files, such as .TLB, for example to automate software registration on a host. There has been no &#8230;<p class="read-more"><a href="http://alax.info/blog/739">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/739" title="RegisterTypeLibrary to register type libraries the way regsvr32 registers COM servers"></a><p>While <a href="http://support.microsoft.com/kb/249873">regsvr32 tool</a> is used to register COM servers, such as .DLL, .OCX, .AX files, sometimes you need an equivalent for type library files, such as .TLB, for example to automate software registration on a host. There has been no stock utility for this that I am aware of, so I have been using my own one (RegisterTypeLibrary):</p>
<pre>C:\Program Files\Alax.Info\Media Tools&gt;RegisterTypeLibrary.exe Acquisition.dll
Type Library Information:
  File Path: Acquisition.dll
  File Full Path: C:\Program Files\Alax.Info\Media Tools\Acquisition.dll
  Name: AlaxInfoMediaToolsAcquisition
  Documentation String: Alax.Info Media Tools Acquisition 1.0 Type Library
  GUID: {4C03D3C8-13AD-451F-9363-FAD08EF94A91}
  LCID: 0
  Platform: 1
  Version: 1.0
  Flags: 0x8

Registering...
Registered.</pre>
<p>/U unregisters, /Q displays information about type library (may be useful as it also works for .DLL files where type library is embedded into binary).</p>
<p>A Visual C++ .NET 2008 source code is <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/RegisterTypeLibrary">available from SVN</a>, release binary <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/RegisterTypeLibrary/Release/RegisterTypeLibrary.exe?format=raw">included</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/739/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Private DMO</title>
		<link>http://alax.info/blog/674</link>
		<comments>http://alax.info/blog/674#comments</comments>
		<pubDate>Sat, 25 Oct 2008 20:59:38 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[ATL]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[alt]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[DMO]]></category>
		<category><![CDATA[sample]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=674</guid>
		<description><![CDATA[<a href="http://alax.info/blog/674" title="Private DMO"></a>Started as Is it possible to use local component in DLL? on microsoft.public.vc.atl newsgroup. The question is to embed a custom DirectX Media Object (DMO) into executable so that it is only available to proprietary application and not to entire &#8230;<p class="read-more"><a href="http://alax.info/blog/674">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/674" title="Private DMO"></a><p>Started as <a href="http://groups.google.com/group/microsoft.public.vc.atl/browse_thread/thread/8b2bbcb309d9012a#">Is it possible to use local component in DLL?</a> on <a href="http://groups.google.com/group/microsoft.public.vc.atl">microsoft.public.vc.atl</a> newsgroup. The question is to embed a custom <a href="http://msdn.microsoft.com/en-us/library/ms783356(VS.85).aspx">DirectX Media Object</a> (DMO) into executable so that it is only available to proprietary application and not to entire system and could be reused in other applications. If in particular this DMO should be available to intelligent connect, e.g. used by embedded Windows Media Player control, the solution requires that private DMO appears fully registered as full featured regular DMO.</p>
<p>A while ago I <a href="http://groups.google.com/group/microsoft.public.win32.programmer.directx.video/browse_thread/thread/c50857317a54b2a/aa827bb9fabfc75b">proposed a solution</a> on getting COM Class/DMO embedded into executable and temporarily exposed as availble without registry registration through <a href="http://msdn.microsoft.com/en-us/library/ms693407.aspx">CoRegisterClassObject</a>/RegisterClassObject, however in addition to COM class registration, a DMO needs to also be specifically listed as a DMO, through <a href="http://msdn.microsoft.com/en-us/library/ms783385(VS.85).aspx">DMORegister</a> API.</p>
<p>In order to expose private DMO to DirectShow subsystem the following steps has to be performed:</p>
<ul>
<li>register COM class object as a COM class (CoRegisterClassObject) to enable its instantiation by its CLSID</li>
<li>use DMORegister API to list DMO in global list (warning, seems to be requiring write permission on HKEY_CLASSES_ROOT key)</li>
<li>have the filter graph of interest created</li>
<li>use DMOUnregister API as early as possible to unlist private DMO from global list</li>
</ul>
<pre>ATLENSURE_SUCCEEDED(__objMap_CPrivateMediaObject.RegisterClassObject(CLSCTX_INPROC_SERVER, REGCLS_MULTI_SEPARATE));
DMO_PARTIAL_MEDIATYPE pInputMediaTypes[] = { { MEDIATYPE_Video, CPrivateMediaObject::GetXxxxSubtype() } };
ATLENSURE_SUCCEEDED(DMORegister(L"Private DMO", CLSID_PrivateMediaObject, DMOCATEGORY_VIDEO_DECODER, 0, _countof(pInputMediaTypes), pInputMediaTypes, 0, NULL));
...
ATLVERIFY(SUCCEEDED(DMOUnregister(CLSID_PrivateMediaObject, DMOCATEGORY_VIDEO_DECODER)));</pre>
<p>The sample code/project takes an .AVI file which is a XVID video file with a FOURCC compression code changed from XVID to XXXX. The file is unplayable but there is a private DMO which accepts XXXX video and copies data as is into XVID format on its output.</p>
<p>A Visual C++ .NET 2008 source code <a href="http://trac2.assembla.com/roatl-utilities/browser/trunk/PrivateDmoSample">is available from SVN</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/674/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ATL Registration Script</title>
		<link>http://alax.info/blog/630</link>
		<comments>http://alax.info/blog/630#comments</comments>
		<pubDate>Sat, 06 Sep 2008 16:05:27 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[ATL]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[registry]]></category>
		<category><![CDATA[rgs]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=630</guid>
		<description><![CDATA[<a href="http://alax.info/blog/630" title="ATL Registration Script"></a>Since ATL version 3, and actually it probably existed even since even earlier time, I have seen Microsoft Visual Studio (and its predecessor Visual C++) generating .RGS registration script with hardcoded CLSID value, ProgID values and other strings entered through &#8230;<p class="read-more"><a href="http://alax.info/blog/630">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/630" title="ATL Registration Script"></a><p>Since ATL version 3, and actually it probably existed even since even earlier time, I have seen Microsoft Visual Studio (and its predecessor Visual C++) generating .RGS registration script with hardcoded CLSID value, ProgID values and other strings entered through IDE wizard. While it seems to work nice at the moment of generation, it still gives the problem to lose sync between identifiers if code is copied between projects or a different way. It might be an oversight originally, but was not it the obvious thing to do later to avoid possible typos of inaccurate user? Microsoft Visua Studio 2008 still generates the same code.</p>
<p>Previous versions of development environment offered attributed code option which in fact took care of this problem very well. Although there has been a lot of negative feedback written about C++ attributes, this was a kind of problem attributes left no chances to break: CLSID was specified once only in C++ COM class attribute and the rest of the deal was generated automatically, including IDL and registration sequence.</p>
<p>It is especially unclear why it was left this way because internal ATL classes already have all necessary capabilities to process wildcards. For example, default .RGS script contains an entry for COM class type library, HKCR\CLSID\{&#8230;} key, &#8220;TypeLib&#8221; value. Why would hardcode it if it can be specified through a replacement:</p>
<pre>HKCR
{
	NoRemove CLSID
	{
		ForceRemove %CLSID% = s '...'
		{
<strong><span style="color: #3366ff;">			'TypeLib' = s '%LIBID%'
</span></strong></pre>
<p>And the replacement is so easily added overriding CAtlModule&#8217;s virtual AddCommonRGSReplacements:</p>
<pre>class CFooModule :
	public CAtlDllModuleT&lt;CFooModule&gt;
{
...
// CAtlModule
	HRESULT AddCommonRGSReplacements(IRegistrarBase* pRegistrar) throw()
	{
		_ATLTRY
		{
			ATLENSURE_SUCCEEDED(__super::AddCommonRGSReplacements(pRegistrar));
			ATLASSERT(!IsEqualGUID(m_libid, GUID_NULL));
			ATLENSURE_SUCCEEDED(pRegistrar-&gt;AddReplacement(L"LIBID", StringFromIdentifier(m_libid)));
		}
		_ATLCATCH(Exception)
		{
			return Exception;
		}
		return S_OK;
	}</pre>
<p>I thought it would be implemented natively in ATL long ago, along with per-coclass replacements like %CLSID%.</p>
<p>This is how I like my registration script:</p>
<pre>HKCR
{
	%PROGID% = s '%DESCRIPTION%'
	{
		CLSID = s '%CLSID%'
	}
	%VIPROGID% = s '%DESCRIPTION%'
	{
		CLSID = s '%CLSID%'
		CurVer = s '%PROGID%'
	}
	NoRemove CLSID
	{
		ForceRemove %CLSID% = s '%DESCRIPTION%'
		{
			ProgID = s '%PROGID%'
			VersionIndependentProgID = s '%VIPROGID%'
			ForceRemove 'Programmable'
			InprocServer32 = s '%MODULE%'
			{
				val ThreadingModel = s 'Both'
			}
			TypeLib = s '%LIBID%'
		}
	}
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/630/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To: Wrap an existing DirectShow filter with a private video source filter (COM aggregation)</title>
		<link>http://alax.info/blog/511</link>
		<comments>http://alax.info/blog/511#comments</comments>
		<pubDate>Wed, 06 Aug 2008 20:44:36 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[ATL]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[aggregation]]></category>
		<category><![CDATA[AVI]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[hack]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=511</guid>
		<description><![CDATA[<a href="http://alax.info/blog/511" title="How To: Wrap an existing DirectShow filter with a private video source filter (COM aggregation)"></a>See beginning in microsoft.public.win32.programmer.directx.video newsgroup. This sample is demonstrating COM aggregation to embed an existing filter an re-expose it as a new filter having inner filter pre-initialized. The Visual Studio C++.NET 2008 projects contains a DirectShow filter class that registers &#8230;<p class="read-more"><a href="http://alax.info/blog/511">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://alax.info/blog/511" title="How To: Wrap an existing DirectShow filter with a private video source filter (COM aggregation)"></a><p>See beginning in <a href="http://groups.google.com/group/microsoft.public.win32.programmer.directx.video/browse_thread/thread/05261b50e064cf37?lnk=igtc#">microsoft.public.win32.programmer.directx.video</a> newsgroup.</p>
<p>This sample is demonstrating <a href="http://support.microsoft.com/kb/173823">COM aggregation</a> to embed an existing filter an re-expose it as a new filter having inner filter pre-initialized.</p>
<p>The Visual Studio C++.NET 2008 projects contains a <a href="http://msdn.microsoft.com/en-us/library/ms783323.aspx">DirectShow</a> filter class that registers itself under <a href="http://msdn.microsoft.com/en-us/library/ms783347.aspx">Video Capture Sources category</a> and embeds <a href="http://msdn.microsoft.com/en-us/library/ms783662.aspx">File Source (Async) Filter</a> inside initialized to stream <em>clock.avi</em> file from Windows directory.</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2008/08/06-image002.png"><img class="alignnone size-medium wp-image-513" title="Filter running" src="http://alax.info/blog/wp-content/uploads/2008/08/06-image002-300x152.png" alt="" width="300" height="152" /></a></p>
<p><span id="more-511"></span></p>
<p><a href="http://alax.info/blog/wp-content/uploads/2008/08/06-image001.png"><img class="alignnone size-medium wp-image-512" title="New filter registration" src="http://alax.info/blog/wp-content/uploads/2008/08/06-image001-253x300.png" alt="" width="253" height="300" /></a></p>
<p>The code of interest is in <em>Filter.h</em>. <em>CFilter</em> class is the implementation of the DirectShow filter.</p>
<p><em>CFilter</em> registers itself as a filter through static <em>UpdateRegistry</em> method, which overrides stock <a href="http://msdn.microsoft.com/en-us/library/w0ey2be3.aspx">DECLARE_REGISTRY_RESOURCEID</a> macro and adds IFilterMapper2 interface calls to register/unregister the filter.</p>
<p>To take an advantage of aggregating another object we need <a href="http://msdn.microsoft.com/en-us/library/97c868sh.aspx">DECLARE_PROTECT_FINAL_CONSTRUCT</a> macro to be able to instantiate inner (that is aggregated) object on the very start (we cannot do this right in constructor), <a href="http://msdn.microsoft.com/en-us/library/sf3y8zcf.aspx">DECLARE_GET_CONTROLLING_UNKNOWN</a> macro to declare member menthod that exposes controlling unknown.</p>
<p>In a <a href="http://msdn.microsoft.com/en-us/library/afkt56xx.aspx">FinalConstruct</a> method we instantiate aggregated object (note GetControllingUnknown() argument which indicates instantiating as aggregated):</p>
<pre>ATLENSURE_SUCCEEDED(m_pInnerUnknown.CoCreateInstance(CLSID_AsyncReader, GetControllingUnknown()));</pre>
<p>and initialize the object through <a href="http://msdn.microsoft.com/en-us/library/ms910558.aspx">IFileSourceFilter::Load</a>. The inner object is ready and we are to expose its functionality as if implemented natively. We need to update object&#8217;s <a href="http://msdn.microsoft.com/en-us/library/6bwekse3.aspx">COM MAP</a> for this:</p>
<pre>BEGIN_COM_MAP(CFilter)
	COM_INTERFACE_ENTRY(IFilter)
	// NOTE: We still implement IDispatch through IFilter but we hide it to hopefully expose inner filter's IDispatch
	//COM_INTERFACE_ENTRY(IDispatch)
	// NOTE: We are hiding inner filter IFileSourceFilter to avoid GraphEdit prompts for file path on filter insertion
	COM_INTERFACE_ENTRY_NOINTERFACE(IFileSourceFilter)
	COM_INTERFACE_ENTRY_AGGREGATE_BLIND(m_pInnerUnknown)
END_COM_MAP()</pre>
<p><a href="http://msdn.microsoft.com/en-us/library/7t02fskk.aspx">COM_INTERFACE_ENTRY_AGGREGATE_BLIND</a> will expose all inner object interfaces (except mentioned higher on the map) to the outside world. And we explicitly suppress <a href="http://msdn.microsoft.com/en-us/library/ms785718.aspx">IFileSourceFilter</a> through <a href="http://msdn.microsoft.com/en-us/library/a6ba4c4b.aspx">COM_INTERFACE_ENTRY_NOINTERFACE</a> to prevent <a href="http://msdn.microsoft.com/en-us/library/ms787460(VS.85).aspx">GraphEdit</a> from discovering it and popping up a file dialog to select a source file.</p>
<p>Source code: <a href="http://alax.info/blog/wp-content/uploads/2008/08/directshowwrappersourcefiltersample01.zip">DirectShowWrapperSourceFilterSample.01.zip</a> (note that Release build binary is included)</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/511/feed</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>

