<?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; API</title>
	<atom:link href="http://alax.info/blog/tag/api/feed" rel="self" type="application/rss+xml" />
	<link>http://alax.info/blog</link>
	<description>Software Production Line</description>
	<lastBuildDate>Tue, 03 Aug 2010 09:48:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>DirectShow Filter Graph Spy: 64-bit version and hook API</title>
		<link>http://alax.info/blog/1094</link>
		<comments>http://alax.info/blog/1094#comments</comments>
		<pubDate>Sun, 01 Nov 2009 19:30:19 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[ATL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[64-bit]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[DirectShow]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[spy]]></category>
		<category><![CDATA[x64]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=1094</guid>
		<description><![CDATA[Today&#8217;s update for DirectShow Filter Graph Spy introduces 64-bit version (mind the beta state) and a mini-API for an external module to be involved into graph building process.
Filter Graph Spy is offering three new interfaces that provide extensibility of the spy:

IFilterGraphAddRemoveHook
IFilterGraphConnectHook
IFilterGraphStateControlHook

The interfaces are contained in the type library and can be imported using #import directive. [...]]]></description>
			<content:encoded><![CDATA[<p>Today&#8217;s update for DirectShow Filter Graph Spy introduces 64-bit version (mind the beta state) and a mini-API for an external module to be involved into graph building process.</p>
<p>Filter Graph Spy is offering three new interfaces that provide extensibility of the spy:</p>
<ul>
<li>IFilterGraphAddRemoveHook</li>
<li>IFilterGraphConnectHook</li>
<li>IFilterGraphStateControlHook</li>
</ul>
<p>The interfaces are contained in the type library and can be imported using <a href="http://msdn.microsoft.com/en-us/library/8etzzkb6%28VS.71%29.aspx">#import</a> directive. An implementation of one or more of these interfaces will receive hook style calls corresponding to respective <a href="http://msdn.microsoft.com/en-us/library/dd375786%28VS.85%29.aspx">Filter Graph Manager</a> calls, system wide including in context of other applications.</p>
<p>A COM object may be registered as a hook object with <em>Spy</em> and <em>NoThreadSpy</em> COM classes under predefined registry keys:</p>
<p><a href="http://alax.info/blog/wp-content/uploads/2009/11/02-Image001.png"><img class="alignnone size-medium wp-image-1095" title="Registering a DirectShow Filter Graph Spy Hook" src="http://alax.info/blog/wp-content/uploads/2009/11/02-Image001-320x136.png" alt="Registering a DirectShow Filter Graph Spy Hook" width="320" height="136" /></a></p>
<p>Spy will instantiate the registered hook objects and forward them the calls it receive, before passing them to system Filter Graph Manager object. A hook object has an option to override default processing, including, for example, inserting its own filter in between. For example, <a href="http://msdn.microsoft.com/en-us/library/dd390021%28VS.85%29.aspx">IFilterGraph::Reconnect</a> call is implemented the following way:</p>
<pre>
<pre style="background: #ffffff none repeat scroll 0% 0%; color: #000000;">STDMETHOD<span style="color: #808030;">(</span>Reconnect<span style="color: #808030;">)</span><span style="color: #808030;">(</span>IPin<span style="color: #808030;">*</span> pPin<span style="color: #808030;">)</span> <span style="color: #800000; font-weight: bold;">throw</span><span style="color: #808030;">(</span><span style="color: #808030;">)</span>
<span style="color: #800080;">{</span>
    _Z4<span style="color: #808030;">(</span>atlTraceCOM<span style="color: #808030;">,</span> <span style="color: #008c00;">4</span><span style="color: #808030;">,</span> _T<span style="color: #808030;">(</span><span style="color: #800000;">"</span><span style="color: #0000e6;">...</span><span style="color: #0f69ff;">\n</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
    HOOK_PROLOG<span style="color: #808030;">(</span>CFilterGraphConnectHookHost<span style="color: #808030;">)</span>
        OnReconnect<span style="color: #808030;">(</span>pT<span style="color: #808030;">,</span> pPin<span style="color: #808030;">,</span> <span style="color: #808030;">&amp;</span>bDefault<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
    HOOK_EPILOG<span style="color: #808030;">(</span><span style="color: #808030;">)</span>
    <span style="color: #800000; font-weight: bold;">return</span> m_pInnerFilterGraph2<span style="color: #808030;">-</span><span style="color: #808030;">&gt;</span>Reconnect<span style="color: #808030;">(</span>pPin<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
<span style="color: #800080;">}</span></pre>
</pre>
<p>Before passing the call to original Reconnect method, spy is iterating through associated hooks, passing them <em>IFilterGraphConnectHook::OnReconnect</em> call. Setting <em>bDefault</em> parameter to <em>FALSE</em> will prevent spy from passing the call to original method.</p>
<p>Included <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/BdaHooks">BdaHooks</a> project shows a sample implementation of the hooking COM classes (note <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/BdaHooks/ConnectHook.rgs">.rgs registration</a>).</p>
<p>Filter Graph Spy is compatible with all current Windows operating systems, 32-bit and 64-bit (<a href="http://en.wikipedia.org/wiki/X86-64">x64</a>), in particular including:</p>
<ul>
<li><a href="http://www.microsoft.com/windows/windows-7/">Windows 7</a></li>
<li>Windows Server 2008</li>
<li>Windows Vista</li>
<li>Windows Server 2003</li>
<li>Windows XP</li>
<li>Windows 2000</li>
</ul>
<p>NOTE: DirectShow Filter Graph Spy is <span style="text-decoration: underline;">NOT</span> suitable for production environment, it is <span style="text-decoration: underline;">NOT</span> licensed to be redistributed to be a part of production state software item.</p>
<p>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 included (<a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/Release%20Trace/Win32/DirectShowSpy.dll?format=raw">Win32</a>, <a href="http://code.assembla.com/roatl-utilities/subversion/nodes/trunk/FilterGraphSpy/Release%20Trace/x64/DirectShowSpy.dll?format=raw">x64</a>); installation instructions are in <a href="http://alax.info/blog/777">another post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/1094/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Combo Box selection, WM_SETREDRAW and CB_SETCURSEL</title>
		<link>http://alax.info/blog/994</link>
		<comments>http://alax.info/blog/994#comments</comments>
		<pubDate>Thu, 30 Jul 2009 12:04:05 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[WTL]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[CB_SETCURSEL]]></category>
		<category><![CDATA[combo box]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[WM_SETREDRAW]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=994</guid>
		<description><![CDATA[Given the combo box initialization code:
m_ComboBox.SetRedraw(FALSE);
m_ComboBox.ResetContent();
for(INT nIndex = 0; nIndex &#60; 3; nIndex++)
    m_ComboBox.AddString(AtlFormatString(_T("Item %d"), nIndex + 1));
m_ComboBox.SetCurSel(1);
m_ComboBox.SetRedraw(TRUE)
How the combo box is going to look like?
Here it goes:

Combo box won&#8217;t repaint window on SetRedraw(TRUE) AKA WM_SETREDRAW. But once you move a mouse pointer over the control, or tab to focus it, the [...]]]></description>
			<content:encoded><![CDATA[<p>Given the combo box initialization code:</p>
<pre>m_ComboBox<span style="color: #808030;">.</span>SetRedraw<span style="color: #808030;">(</span>FALSE<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
m_ComboBox<span style="color: #808030;">.</span>ResetContent<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
<span style="color: #800000; font-weight: bold;">for</span><span style="color: #808030;">(</span><span style="color: #603000;">INT</span> nIndex <span style="color: #808030;">=</span> <span style="color: #008c00;">0</span><span style="color: #800080;">;</span> nIndex <span style="color: #808030;">&lt;</span> <span style="color: #008c00;">3</span><span style="color: #800080;">;</span> nIndex<span style="color: #808030;">+</span><span style="color: #808030;">+</span><span style="color: #808030;">)</span>
    m_ComboBox<span style="color: #808030;">.</span>AddString<span style="color: #808030;">(</span>AtlFormatString<span style="color: #808030;">(</span>_T<span style="color: #808030;">(</span><span style="color: #800000;">"</span><span style="color: #0000e6;">Item </span><span style="color: #0f69ff;">%d</span><span style="color: #800000;">"</span><span style="color: #808030;">)</span><span style="color: #808030;">,</span> nIndex <span style="color: #808030;">+</span> <span style="color: #008c00;">1</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
m_ComboBox<span style="color: #808030;">.</span>SetCurSel<span style="color: #808030;">(</span><span style="color: #008c00;">1</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
m_ComboBox<span style="color: #808030;">.</span>SetRedraw<span style="color: #808030;">(</span>TRUE<span style="color: #808030;">)</span></pre>
<p>How the combo box is going to look like?</p>
<p><span id="more-994"></span>Here it goes:</p>
<p><img class="size-full wp-image-995 alignnone" title="ComboBoxSample01 #1" src="http://alax.info/blog/wp-content/uploads/2009/07/image001.png" alt="ComboBoxSample01 #1" width="300" height="129" /></p>
<p>Combo box won&#8217;t repaint window on SetRedraw(TRUE) AKA <a href="http://msdn.microsoft.com/en-us/library/dd145219%28VS.85%29.aspx">WM_SETREDRAW</a>. But once you move a mouse pointer over the control, or tab to focus it, the correct selection will be painted, &#8220;Item 2&#8243;:</p>
<p><img class="alignnone size-full wp-image-996" title="ComboBoxSample01 #2" src="http://alax.info/blog/wp-content/uploads/2009/07/image002.png" alt="ComboBoxSample01 #2" width="300" height="129" /></p>
<p>The control ignores the invalidation caused by <a href="http://msdn.microsoft.com/en-us/library/bb775899%28VS.85%29.aspx">CB_SETCURSEL</a> message while processing final SetRedraw message. To avoid GUI glitches, for example, a m_ComboBox.Invalidate() or <a href="http://msdn.microsoft.com/en-us/library/dd145002%28VS.85%29.aspx">InvalidateRect</a> might be called after SetRedraw(TRUE).</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/994/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RegSetKeySecurity, CRegKey::SetKeySecurity and CSecurityDesc</title>
		<link>http://alax.info/blog/950</link>
		<comments>http://alax.info/blog/950#comments</comments>
		<pubDate>Mon, 22 Jun 2009 18:10:43 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[ATL]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[CRegKey]]></category>
		<category><![CDATA[CSecurityDesc]]></category>
		<category><![CDATA[registry]]></category>
		<category><![CDATA[RegSetKeySecurity]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[SetKeySecurity]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=950</guid>
		<description><![CDATA[One thing is worth special mentioning in connection with previous post on DirectShow Filter Graph Spy on Microsoft Vista system: ATL&#8217;s CSecurityDesc class caused to waste some time.
CRegKey Key;
ATLENSURE_SUCCEEDED(HRESULT_FROM_WIN32(Key.Open(HKEY_CLASSES_ROOT, pszKeyName, READ_CONTROL &#124; WRITE_OWNER)));
CSecurityDesc AdministratorsOwnerSecurityDescriptor;
AdministratorsOwnerSecurityDescriptor.SetOwner(Sids::Admins());
ATLENSURE_SUCCEEDED(HRESULT_FROM_WIN32(Key.SetKeySecurity(OWNER_SECURITY_INFORMATION, &#38;AdministratorsOwnerSecurityDescriptor)));
The code compiles fine, but on runtime it gives error 87 (ERROR_INVALID_PARAMETER, E_INVALIDARG) in the last line, returned from RegSetKeySecurity API [...]]]></description>
			<content:encoded><![CDATA[<p>One thing is worth special mentioning in connection with previous post on <a href="http://alax.info/blog/944">DirectShow Filter Graph Spy</a> on <a href="http://www.microsoft.com/windows/windows-vista/default.aspx">Microsoft Vista</a> system: ATL&#8217;s CSecurityDesc class caused to waste some time.</p>
<pre style="background: #ffffff none repeat scroll 0% 0%; color: #000000;">CRegKey Key<span style="color: #800080;">;</span>
ATLENSURE_SUCCEEDED<span style="color: #808030;">(</span>HRESULT_FROM_WIN32<span style="color: #808030;">(</span>Key<span style="color: #808030;">.</span>Open<span style="color: #808030;">(</span>HKEY_CLASSES_ROOT<span style="color: #808030;">,</span> pszKeyName<span style="color: #808030;">,</span> READ_CONTROL <span style="color: #808030;">|</span> WRITE_OWNER<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
CSecurityDesc AdministratorsOwnerSecurityDescriptor<span style="color: #800080;">;</span>
AdministratorsOwnerSecurityDescriptor<span style="color: #808030;">.</span>SetOwner<span style="color: #808030;">(</span>Sids<span style="color: #800080;">::</span>Admins<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
ATLENSURE_SUCCEEDED<span style="color: #808030;">(</span>HRESULT_FROM_WIN32<span style="color: #808030;">(</span>Key<span style="color: #808030;">.</span>SetKeySecurity<span style="color: #808030;">(</span>OWNER_SECURITY_INFORMATION<span style="color: #808030;">,</span> <span style="color: #808030;">&amp;</span>AdministratorsOwnerSecurityDescriptor<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span></pre>
<p>The code compiles fine, but on runtime it gives error <em>87</em> (<em>ERROR_INVALID_PARAMETER</em>, <em>E_INVALIDARG</em>) in the last line, returned from <a href="http://msdn.microsoft.com/en-us/library/aa379314(VS.85).aspx">RegSetKeySecurity</a> API call. My first guess was that ATL&#8217;s <a href="http://msdn.microsoft.com/en-us/library/k0c0e5w6.aspx">CSecurityDesc</a> class for some reason prepared wrong descriptor which resulted in rejecting it as an argument. From the first glance it looks (not sure) that this class deals, to some extent, with structures itself rather than using API functions, so it could be that it results in something looking differently from expected by API calls.</p>
<p>Still the problem is in class itself and its cast from <em>CSecurityDesc&amp;</em> to required <em>SECURITY_DESCRIPTOR*</em> type. The class only implements operator to automatically cast to <em><span style="color: #ff0000;">const</span> SECURITY_DESCRIPTOR*</em> type, so the following line would not be passed by compiler:</p>
<pre style="background: #ffffff none repeat scroll 0% 0%; color: #000000;">Key<span style="color: #808030;">.</span>SetKeySecurity<span style="color: #808030;">(</span>OWNER_SECURITY_INFORMATION<span style="color: #808030;">,</span> AdministratorsOwnerSecurityDescriptor<span style="color: #808030;">)</span></pre>
<p>However <em><span style="color: #ff0000;">&amp;</span>AdministratorsOwnerSecurityDescriptor</em> is another level of indirection and hence <em>SECURITY_DESCRIPTOR*</em><span style="color: #ff0000;">*</span> type, which is passed by compiler, but results in indeed invalid argument.</p>
<p>So in order to correctly convert <em>CSecurityDesc&amp;</em> to <em>SECURITY_DESCRIPTOR*</em> it can be done this way:</p>
<pre style="background: #ffffff none repeat scroll 0% 0%; color: #000000;">CRegKey Key<span style="color: #800080;">;</span>
ATLENSURE_SUCCEEDED<span style="color: #808030;">(</span>HRESULT_FROM_WIN32<span style="color: #808030;">(</span>Key<span style="color: #808030;">.</span>Open<span style="color: #808030;">(</span>HKEY_CLASSES_ROOT<span style="color: #808030;">,</span> pszKeyName<span style="color: #808030;">,</span> READ_CONTROL <span style="color: #808030;">|</span> WRITE_OWNER<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
CSecurityDesc AdministratorsOwnerSecurityDescriptor<span style="color: #800080;">;</span>
AdministratorsOwnerSecurityDescriptor<span style="color: #808030;">.</span>SetOwner<span style="color: #808030;">(</span>Sids<span style="color: #800080;">::</span>Admins<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
ATLENSURE_SUCCEEDED<span style="color: #808030;">(</span>HRESULT_FROM_WIN32<span style="color: #808030;">(</span>Key<span style="color: #808030;">.</span>SetKeySecurity<span style="color: #808030;">(</span>OWNER_SECURITY_INFORMATION<span style="color: #808030;">,</span> const_cast<span style="color: #808030;">&lt;</span><span style="color: #603000;">SECURITY_DESCRIPTOR</span><span style="color: #808030;">*</span><span style="color: #808030;">&gt;</span><span style="color: #808030;">(</span><span style="color: #808030;">(</span><span style="color: #800000; font-weight: bold;">const</span> <span style="color: #603000;">SECURITY_DESCRIPTOR</span><span style="color: #808030;">*</span><span style="color: #808030;">)</span> AdministratorsOwnerSecurityDescriptor<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/950/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Time Zone Information &amp; Monitor Information</title>
		<link>http://alax.info/blog/715</link>
		<comments>http://alax.info/blog/715#comments</comments>
		<pubDate>Sat, 22 Nov 2008 21:07:57 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[ATL]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Utilities]]></category>
		<category><![CDATA[WTL]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=715</guid>
		<description><![CDATA[I am sharing a couple of utilities to be able to quick check system settings. TimeZoneInformation prints in a human friendly style TIME_ZONE_INFORMATION structure as reported by Windows through GetTimeZoneInformation API.
TIME_ZONE_INFORMATION:
.Bias: -120
.StandardName: FLE Standard Time
.StandardDate: { .wYear 0, .wMonth 10, .wDay 5, .wDayOfWeek 0, .wHour 4, .wMinute 0, .wSecond 0, .wMilliseconds 0 }
.StandardBias: 0
.DaylightName: FLE [...]]]></description>
			<content:encoded><![CDATA[<p>I am sharing a couple of utilities to be able to quick check system settings. TimeZoneInformation prints in a human friendly style <a href="http://msdn.microsoft.com/en-us/library/ms725481(VS.85).aspx">TIME_ZONE_INFORMATION structure</a> as reported by Windows through <a href="http://msdn.microsoft.com/en-us/library/ms724421(VS.85).aspx">GetTimeZoneInformation</a> API.</p>
<pre>TIME_ZONE_INFORMATION:
.Bias: -120
.StandardName: FLE Standard Time
.StandardDate: { .wYear 0, .wMonth 10, .wDay 5, .wDayOfWeek 0, .wHour 4, .wMinute 0, .wSecond 0, .wMilliseconds 0 }
.StandardBias: 0
.DaylightName: FLE Daylight Time
.DaylightDate: { .wYear 0, .wMonth 3, .wDay 5, .wDayOfWeek 0, .wHour 3, .wMinute 0, .wSecond 0, .wMilliseconds 0 }
.DaylightBias: -60
[...]</pre>
<p><a href="http://alax.info/blog/wp-content/uploads/2008/11/22-image001.png"><img class="alignnone size-medium wp-image-716" title="TimeZoneInformation Screenshot" src="http://alax.info/blog/wp-content/uploads/2008/11/22-image001-300x211.png" alt="" width="300" height="211" /></a></p>
<p>A Visual C++ .NET 2008 source code <a href="http://trac2.assembla.com/roatl-utilities/browser/trunk/TimeZoneInformation">is available from SVN</a>, release binary <a href="http://trac2.assembla.com/roatl-utilities/browser/trunk/TimeZoneInformation/Release/TimeZoneInformation.exe?format=raw">included</a>.</p>
<p>And the second utility is MonitorInformation to print multi-monitor related information again as reported by Windows, <a href="http://msdn.microsoft.com/en-us/library/ms724385.aspx">GetSystemMetrics</a> and <a href="http://msdn.microsoft.com/en-us/library/ms534809(VS.85).aspx">EnumDisplayMonitors</a> APIs.</p>
<pre>System Metrics:
  SM_XVIRTUALSCREEN: 0
  SM_YVIRTUALSCREEN: 0
  SM_CXVIRTUALSCREEN: 1680
  SM_CYVIRTUALSCREEN: 1050
  SM_CMONITORS: 1
  SM_SAMEDISPLAYFORMAT: 1

Monitor 0 at (0, 0) - (1680, 1050):
  Coordinates (rcMonitor): (0, 0) - (1680, 1050)
  Work Area (rcWork): (0, 0) - (1680, 1026)
  Flags (dwFlags): 0x1
  Device Name (szDevice): \\.\DISPLAY1</pre>
<p><a href="http://alax.info/blog/wp-content/uploads/2008/11/22-image002.png"><img class="alignnone size-medium wp-image-717" title="MonitorInformation Screenshot" src="http://alax.info/blog/wp-content/uploads/2008/11/22-image002-300x226.png" alt="" width="300" height="226" /></a></p>
<p>A Visual C++ .NET 2008 source code is <a href="http://trac2.assembla.com/roatl-utilities/browser/trunk/MonitorInformation">available from SVN</a>, release binary <a href="http://trac2.assembla.com/roatl-utilities/browser/trunk/MonitorInformation/Release/MonitorInformation.exe?format=raw">included</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/715/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More about APIs</title>
		<link>http://alax.info/blog/401</link>
		<comments>http://alax.info/blog/401#comments</comments>
		<pubDate>Wed, 02 Jul 2008 20:40:29 +0000</pubDate>
		<dc:creator>Roman</dc:creator>
				<category><![CDATA[Seriously]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[camera]]></category>

		<guid isPermaLink="false">http://alax.info/blog/?p=401</guid>
		<description><![CDATA[Just recently there was a problem discovered in considered to be stable DirectShow component (the problem itself is not fatal &#8211; access violation while being used in improbable scenario &#8211; and thus it may appear it is even ignored), another &#8220;pleasant&#8221; thing came up with an API from another vendor.
The camera vendor is recognized in [...]]]></description>
			<content:encoded><![CDATA[<p>Just recently there was a problem discovered in considered to be stable DirectShow component (the problem itself is not fatal &#8211; access violation while being used in improbable scenario &#8211; and thus it may appear it is even ignored), another &#8220;pleasant&#8221; thing came up with an API from another vendor.</p>
<p>The camera vendor is recognized in the industry and even considered to be among leaders, kind of &#8220;cheap for superior quality&#8221;. Their SDK/API has always been offered to reach several goals: the first was to cover product line with unified access method; the second was to embed implementation of a not so much popular <a href="http://en.wikipedia.org/wiki/Trivial_File_Transfer_Protocol">TFTP</a> protocol used for this type of hardware (rivals use more popular protocols: <a href="http://www.w3.org/Protocols/">HTTP</a>, <a href="http://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol">RTSP</a>). These not include regular things like to documented access to variety of features, availability for Win32 and Linux etc.</p>
<p>API documentation has always been not very much accurate as if it was given insufficient attention but luckily it was quite simple to figure things out. Another warning thing was that native software worked directly, without SDK: it was not very good for independent software vendors like us because there was a suspicion that SDK was something complimentary and was undertested. Fortunately however, the vendor decided to change this and their mainstream software started using the same SDK redistributables available for independent vendors also.</p>
<p>The first incident was recently when the vendor changed SDK implementation without changing published API and without giving any notice in documentation on one of the features. It did not break compilation or anything in our software, however it started working differently in production environment. We started receiving complaints and since we did not find any documentation changes, contacted the vendor&#8217;s support for comments and found out that implementation has been changed&#8230;</p>
<p>Now we got a new issue. As mentioned before, SDK&#8217;s advantage was to cover product line being constantly extended. New hardware from the product line appears to be quite sophisticated &#8211; a camera with multiple sensors. I believe this was not the thing foreseen when original SDK was designed so there was a kind of solution to workaround indexed access to individual sensor parameters in the API. However it appeared now that new products don&#8217;t support some of the older product features and SDK instead of returning a kind of &#8220;unsupported&#8221; error code to the requests, instead it messes other values. So it appeared that unified access to the product line was broken&#8230;</p>
<p>Everything was finally sorted out but in total it took a lot of time to. First of all, the problem due to its nature spread to production from where the dealer started receiving complaints from his client. The dealer in his turn forwarded the issue to us where we had problems investigating it because this particular piece of hardware is a kind of rare and expensive. When we gather sufficient data to think of the case as an SDK bug we forwarded the issue to the vendor.</p>
<p>Obviously the vendor responded with ridiculous suggestions assuming us to be complete lamers. Still we were in position to help our client and resolve the case, so spent some time to gather additional information to prove the supposition of an SDK bug. It took quite some time at our expense while finally we could work out a workaround for the problem and soon after receive a confirmation for a bug&#8230; Can we expect it to be fixed with next SDK update? &#8220;We will do this some time later&#8221;.</p>
<p>Why things happen this way? OK we are a small ISV with our own problems getting things work as expected. The vendor, however, is a high technology leader, well known and recognized throughout the industry, a subject of a completely different scale. Expensive hardware ans software is involved and we are still getting ridiculous problems at the output.</p>
]]></content:encoded>
			<wfw:commentRss>http://alax.info/blog/401/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
