<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Johannes Passing&#039;s Blog</title>
	<atom:link href="http://jpassing.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jpassing.wordpress.com</link>
	<description></description>
	<lastBuildDate>Sat, 07 Nov 2009 10:36:28 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='jpassing.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/3d1ed6bbc67f13240599979d8ded1ff4?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Johannes Passing&#039;s Blog</title>
		<link>http://jpassing.wordpress.com</link>
	</image>
			<item>
		<title>cfix 1.5.1 released</title>
		<link>http://jpassing.wordpress.com/2009/11/07/cfix-1-5-1-released/</link>
		<comments>http://jpassing.wordpress.com/2009/11/07/cfix-1-5-1-released/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 10:36:28 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[cfix]]></category>
		<category><![CDATA[bugfix]]></category>
		<category><![CDATA[qa]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[unittesting]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=543</guid>
		<description><![CDATA[A new version of cfix, the unit testing framework for C and C++ on Windows, is now available on Sourceforge. Despite fixing several minor issues, the new version resolves the following two issues that were reported by users:

Definiting multiple WinUnit fixtures with setup/teardown routines in a single .cpp file leads to a compilation error
A thread [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=543&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>A new version of <a href='http://www.cfix-testing.org/'>cfix, the unit testing framework for C and C++ on Windows</a>, is now available on Sourceforge. Despite fixing several minor issues, the new version resolves the following two issues that were reported by users:</p>
<ul>
<li>Definiting multiple WinUnit fixtures with setup/teardown routines in a single .cpp file leads to a compilation error</li>
<li>A thread handle is leaked during execution of a test (#2889511)</li>
</ul>
<p>Updated binaries and source code are <a href='http://sourceforge.net/projects/cfix/files/'>available for download on Sourceforge</a>.</p>
<p><i>Btw, in case you use cfix for kernel mode testing and are using WDK 7600, please have a look at my previous post: <a href='http://jpassing.wordpress.com/2009/10/21/ltcg-issues-with-the-win7amd64-environment-of-wdk-7600/'>LTCG issues with the WIN7/amd64 environment of WDK 7600</a></i></p>
Posted in cfix, Testing, Tools Tagged: bugfix, cfix, qa, release, unittesting <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/543/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/543/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/543/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=543&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/11/07/cfix-1-5-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
		<item>
		<title>LTCG issues with the WIN7/amd64 environment of WDK 7600</title>
		<link>http://jpassing.wordpress.com/2009/10/21/ltcg-issues-with-the-win7amd64-environment-of-wdk-7600/</link>
		<comments>http://jpassing.wordpress.com/2009/10/21/ltcg-issues-with-the-win7amd64-environment-of-wdk-7600/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 07:26:49 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[WDK]]></category>
		<category><![CDATA[cfix]]></category>
		<category><![CDATA[ddk]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[ltcg]]></category>
		<category><![CDATA[win7]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=533</guid>
		<description><![CDATA[Now that Windows 7 is out, we all sooner or later have to upgrade to WDK 7600. I am still reluctant to move away from WDK 6000/6001 because of the dropped W2K support, but this is a different issue.
However, as one cfix user who has obviously already adopted WDK 7600 kindly pointed out to me, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=533&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Now that Windows 7 is out, we all sooner or later have to upgrade to WDK 7600. I am still reluctant to move away from WDK 6000/6001 because of the dropped W2K support, but this is a different issue.</p>
<p>However, as one cfix user who has obviously already adopted WDK 7600 kindly pointed out to me, linking a kernel mode unit test against cfix using WDK 7600 and the WIN7/amd64 environment fails reproducibly with the following error message:</p>
<blockquote><p>
error fatal error C1047: The object or library file &#8216;&#8230;\lib\amd64\cfixkdrv.lib&#8217; was created with an older compiler than other objects; rebuild old objects and libraries
</p></blockquote>
<p>In contrast, building the same driver for WIN7/x86 works fine.</p>
<p>As <a href='http://msdn.microsoft.com/en-us/library/ms173554(VS.80).aspx'>the documentation for C1047</a> indicates, this error is usually related to inconsistent usage of Link Time Code Generation (LTCG): As soon as you use LTCG, all objects and libraries must be compiled with /GL &#8212; this normally is not a big deal, but as <a href='http://msdn.microsoft.com/en-us/library/ms794571.aspx'>this WDK page</a> rightfully explains, it means that libraries built this way are not suitable for redistribution because of their dependency on a specific compiler/linker version. But of couse, it also means that a library <i>not</i> built using /GL cannot be used easily when you build your program using LTCG.</p>
<p>Before Windows 7, all WDK build environment configurations I am aware of did not use LTCG. Neither did cfix, so everything worked fine even if your compiler/linker versions did not match the ones used for building cfix.</p>
<p>With WDK 7600, this situation changes: While WLH and other downlevel build environments still do not seem to use LTCG, the WIN7 environment, at least for amd64, enables LTCG by default.</p>
<p>What this means is that as soon as you link against a library which is not part of the WDK and therefore likely to be built using a different compiler version, you&#8217;ll get C1047. It is thus no surprise that attempting to link against cfixkdrv.lib, which is the library all kernel mode unit tests have to link against and which itself has been built using WDK 6000, leads to the error quoted above.</p>
<p>However, once you have figured this out, the workaround for this issue is trivial: Disable LTCG for your test driver by adding the following line to your SOURCES file:</p>
<blockquote><p><code><br />
USER_C_FLAGS=/GL-<br />
</code></p></blockquote>
<p>Link time code generation is a very powerful optimization technique and I encourage everybody to make use of it if possible. However, for the compatibility reasons outlined above, I consider it a rather stupid idea to have the WDK enable LTCG by default. Rather, I had much preferred to see an opt-in switch for LTCG.</p>
<p>Anyway, for the next version, I will consider shipping both, a 7600-compatible LTCG-enabled and a non-LTCG-enabled version of cfixkdrv.lib. Until then, the workaround described above will do the trick.</p>
Posted in cfix, WDK Tagged: ddk, library, ltcg, WDK, win7 <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/533/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/533/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/533/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/533/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/533/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/533/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/533/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/533/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/533/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/533/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=533&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/10/21/ltcg-issues-with-the-win7amd64-environment-of-wdk-7600/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
		<item>
		<title>Launched ntrace.org</title>
		<link>http://jpassing.wordpress.com/2009/10/13/launched-ntrace-org/</link>
		<comments>http://jpassing.wordpress.com/2009/10/13/launched-ntrace-org/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 19:47:19 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[NTrace]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[dtrace]]></category>
		<category><![CDATA[dynamic tracing]]></category>
		<category><![CDATA[fbt]]></category>
		<category><![CDATA[lille]]></category>
		<category><![CDATA[tracing]]></category>
		<category><![CDATA[wcre]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[x86]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=530</guid>
		<description><![CDATA[Having given my presentation on NTrace today at the WCRE in Lille/France, I have also opened ntrace.org to the public. NTrace, in case you have missed my previous posts, is a dynamic function boundary tracing system for Windows/x86 I initially developed as part of my Master&#8217;s thesis that is capable of performing DTrace-like tracing of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=530&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Having given my presentation on NTrace today at the <a href='http://web.soccerlab.polymtl.ca/wcre2009/'>WCRE</a> in Lille/France, I have also opened <a href='http://ntrace.org/'>ntrace.org</a> to the public. NTrace, in case you have missed my previous posts, is a dynamic function boundary tracing system for Windows/x86 I initially developed as part of my Master&#8217;s thesis that is capable of performing DTrace-like tracing of both user and kernel mode components. </p>
<p>On the <a href='http://ntrace.org/'>NTrace page</a>, you will now find the paper itself as being published as part of the WCRE proceedings (mind the copyright notice, please) along with two screencasts: One showing how NTrace can be used to trace kernel mode components such as NTFS, and one demonstrating NTrace for user mode tracing.</p>
<p>If you have questions about NTrace or are interested in more details, please feel free to write me an email &#8212; my address is jpassing at acm org.</p>
Posted in NTrace, Tools Tagged: dtrace, dynamic tracing, fbt, lille, NTrace, tracing, wcre, Windows, x86 <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/530/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/530/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/530/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=530&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/10/13/launched-ntrace-org/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
		<item>
		<title>Mixing 32 and 64-bit components in a single MSI</title>
		<link>http://jpassing.wordpress.com/2009/10/09/mixing-32-and-64-bit-components-in-a-single-msi/</link>
		<comments>http://jpassing.wordpress.com/2009/10/09/mixing-32-and-64-bit-components-in-a-single-msi/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 10:21:32 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Windows Installer]]></category>
		<category><![CDATA[64-bit]]></category>
		<category><![CDATA[amd64]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[i386]]></category>
		<category><![CDATA[MSI]]></category>
		<category><![CDATA[Registry]]></category>
		<category><![CDATA[WOW]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=408</guid>
		<description><![CDATA[Definetely one my pet peeves about Windows Installer is how it deals with instruction set architectures (ISAs). Looking at Windows NT history, supported ISAs have come (amd64, IA-64) and gone (Alpha, PowerPC, MIPS) &#8212; yet most of the time, there was more than one ISA being officially supported. Having to ship binaries for multiple ISAs [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=408&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Definetely one my pet peeves about Windows Installer is how it deals with instruction set architectures (ISAs). Looking at Windows NT history, supported ISAs have come (amd64, IA-64) and gone (Alpha, PowerPC, MIPS) &#8212; yet most of the time, there was more than one ISA being officially supported. Having to ship binaries for multiple ISAs therefore always has been on the agenda for many ISVs.</p>
<p>Needless to say, supporting multiple ISAs requires special consideration when developing setup packages and providing separate packages &#8212; one for each ISA &#8212; has become common practice to approach this. This approach makes perfect sense: Given the incompatibility of most ISAs, nobody needs Alpha binaries on a MIPS system or amd64 binaries on a IA-64 machine, so there seems little reason to mix ISAs within a single package.</p>
<p>Unsurprisingly, Windows Installer, which was created somewhere around 2000, also goes this route and encourages developers to provide separate packages for each ISA.</p>
<p>However, with the advent of amd64/x64/IA-32e/Intel 64/whateveryoucallit, the situation has changed: Because i386 and amd64 are so closely related and compatible, there are now plenty of situations where combining binaries of differing ISAs (i.e. amd64 and i386) in a single installer package makes perfect sense. Examples for this include:</p>
<ul>
<li>
A package comprises a shell extension as well as a standalone App. For certain reasons (maybe the use of VB6), there only is a 32 bit version of the App. The shell extension, in contrast, is available for both, i386 and amd64. Whether you put everything into one package or provide separate packages for each ISA, one of them will comprise a mixture of ISAs.
</li>
<li>
SDKs for unmanaged code usually include .lib and .dll files for multiple architectures. Shipping separate packages for i386 and amd64 (containing different binaries but the same headers, docs, etc.) may please the Windows Installer gods, but seems redundant, a waste of disk space, and user-unfriendly.
</li>
</ul>
<p>Thanks to the <code>msidbComponentAttributes64bit</code> flag, mixing architectures in a single MSI package is technically possible: You mark the package as being 32 bit and set said flag for all 64-bit components. Rather than splitting your setup into multiple packages, you can conveniently combine everything into one.</p>
<p>When reading the documentation (and ICE requirements, more on this later) carefully though, it turns out that this is not quite what the Windows Installer team invented this flag for. Anyway, it works fine, problem solved.</p>
<h3>Hmmm&#8230;</h3>
<p>If only there was not <a href='http://msdn.microsoft.com/en-us/library/aa369034(VS.85).aspx'>ICE80</a>.</p>
<p>ICE80, alas, is critical if you intend to conform to the <i>Requirements for the Windows Vista Logo Program for Software</i>:</p>
<blockquote><p>
Applications must use the Windows Installer (MSI) or ClickOnce for installation. Windows Installation packages must not receive any errors from the Internal Consistency Evaluators (ICEs) listed here:</p>
<p>1-24, 27-31, 33-36, 38, 40-57, 59, 61-63, 65, 67-72, <b>74-84</b>, 86-87, 89-94, 96-99
</p></blockquote>
<p>ICE80 mainly states that (1) you should not install 64 bit components to 32 bit directories (e.g. <i>Program Files</i> vs. <i>Program Files (x86)</i>) and (2) you should not use 64 bit components in a 32 bit package.</p>
<p>(1) is fair enough, although it raises the question where you should install your software to without splitting it in two or violating other ICE rules. Worse yet, (2) effectively means that said way to create multi-ISA packages, creating 32 bit packages with some components marked with <code>msidbComponentAttributes64bit</code>, is illegal alltogether.</p>
<p>So to be logo&#8217;ed, there seems to be no other way than providing separate packages, maybe along with (urgh!) a meta-package that installs the other two.</p>
<p>If there are more important things on your schedule than getting a Vista logo, ICE80 seems like something that can safely be ignored. Indeed, this is what I have done several times, including in case of the cfix installer.</p>
<p>Anyway, let&#8217;s ignore ICE80 once more and hold on to the plan of building a 32-bit package containing both, 32-bit and 64-bit components.</p>
<h3>Urgh&#8230;</h3>
<p>For an SDK that is installed on 64-bit Windows, it will usually make sense to install both, 32 and 64 bit .lib and .dll files etc. On 32-bit Windows, installing 64-bit components may seem odd, but due to the existence of amd64 compilers for i386, it still makes sense to install them or at least offer them as optional feature.</p>
<p>So far, so good. Things get interesting, though, when COM registration comes into play. Naturally, a 32 bit installer package <i>sees</i> the system like any other 32 bit application does. Most importantly, this means that <a href='http://msdn.microsoft.com/en-us/library/aa384235(VS.85).aspx'>Registry Reflection</a> and <a href='http://msdn.microsoft.com/en-us/library/aa384187(VS.85).aspx'>File System Redirection</a> applies. </p>
<p>Now consider a package that contains both a 32-bit and a 64-bit version of some COM server, each installed to a separate directory. COM Registration either be performed through the Class or the Registry table. Provided that the <code>msidbComponentAttributes64bit</code> flag has been used properly, such a package will work great on 64 bit systems thanks to Registry Reflection: The regsitry entries will be written to the proper (reflected) locations and both COM servers will work properly.</p>
<p>Now think what happens on 32-bit Windows: (1) There is no Registry Reflection and (2) Windows Installer silently ignores <code>msidbComponentAttributes64bit</code> flags. Result: The installation will run just as smooth as on the 64-bit system. However, while installing the files continues to works flawlessly, the registry will be left in a less-than-optimal state: Due to the nonexistence of Registry Reflection, the registration entries of both COM servers will have been written to the same location! </p>
<p>Needless to say, the server whose registration entries were written first will now be unusable.</p>
<p>In a way, Windows Installer has taken its revenge for breaking the rules.</p>
<p>Bottom line: Mixing 32 and 64-bit components in a single MSI works fine in many cases, but is against the MSI rules and can lead to further problems. And while I am still convinced that providing separate, ISA-specific packages is wrong or at least inconvenient in certain situations, it is definitely the safer and &#8220;right&#8221; way to go.</p>
<p><i>(Note: Windows Installer 4.5 introduced multi-package transactions, which allow reliable and transactional multi-package setups to be built so that splitting a setup into multiple packages can be implemented without much pain. However, very few users already have Windows Installer 4.5 installed and Windows 2000 is not even supported by this release. For many of us,  relying on this feature therefore is not really an option.)</i></p>
Posted in Windows Installer Tagged: 64-bit, amd64, COM, i386, MSI, Registry, Windows Installer, WOW <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/408/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=408&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/10/09/mixing-32-and-64-bit-components-in-a-single-msi/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
		<item>
		<title>I&#8217;ll be at WCRE 2009 presenting NTrace</title>
		<link>http://jpassing.wordpress.com/2009/10/06/ill-be-at-wcre-2009-presenting-ntrace/</link>
		<comments>http://jpassing.wordpress.com/2009/10/06/ill-be-at-wcre-2009-presenting-ntrace/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 11:27:15 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Kernel]]></category>
		<category><![CDATA[NTrace]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[fbt]]></category>
		<category><![CDATA[france]]></category>
		<category><![CDATA[NT]]></category>
		<category><![CDATA[reverse engineering]]></category>
		<category><![CDATA[tracing]]></category>
		<category><![CDATA[wcre]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=522</guid>
		<description><![CDATA[Next week, the 16th Working Conference on Reverse Engineering (WCRE) will be held in Lille, France. I will be there presenting NTrace: Function Boundary Tracing for Windows on IA-32.
NTrace is a dynamic function boundary tracing toolkit for IA-32/x86 that can be used to trace both kernel and user mode Windows components &#8212; examples for components [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=522&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Next week, the <a href='http://web.soccerlab.polymtl.ca/wcre2009/'>16th Working Conference on Reverse Engineering (WCRE)</a> will be held in Lille, France. I will be there presenting <I>NTrace: Function Boundary Tracing for Windows on IA-32</i>.</p>
<p>NTrace is a dynamic function boundary tracing toolkit for IA-32/x86 that can be used to trace both kernel and user mode Windows components &#8212; examples for components that can be traced include the kernel itself (ntoskrnl), drivers like NTFS as well as user mode components such as kernel32, shell32 or even explorer.exe.</p>
<p>NTrace implements a novel approach to instrumenting IA-32 machine code and integrating with the Structured Exception Handling facility of Windows. Using this approach, NTrace is not only capable of tracing nearly the entire Windows kernel and system libraries, it is also faster than Solaris DTrace FBT on IA-32!</p>
<p>Details on how exactly NTrace works will be publiched in the paper, which will be made available soon. I will also publish more details on NTrace both here and on a dedicated NTrace website.</p>
<p>The work, by the way, is basically the result of my Master&#8217;s thesis I wrote back in 2008.</p>
Posted in Kernel, NTrace Tagged: conference, fbt, france, Kernel, NT, NTrace, reverse engineering, tracing, wcre, Windows <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/522/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/522/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/522/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/522/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/522/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/522/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/522/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/522/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/522/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/522/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=522&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/10/06/ill-be-at-wcre-2009-presenting-ntrace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
		<item>
		<title>Visual Assert Beta 2 Released</title>
		<link>http://jpassing.wordpress.com/2009/09/05/visual-assert-beta-2-released/</link>
		<comments>http://jpassing.wordpress.com/2009/09/05/visual-assert-beta-2-released/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 10:24:57 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[Visual Assert]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[cfix]]></category>
		<category><![CDATA[addin]]></category>
		<category><![CDATA[qa]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[test-driven]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=467</guid>
		<description><![CDATA[The Beta 2 release of Visual Assert (formerly named cfix studio) is now available for download. The release marks a major step in the development of Visual Assert for that it not only comprises a number of bugfixes but also introduces major new features. The two most important certainly are support for EXE targets and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=467&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The Beta 2 release of <a href='http://www.visualassert.com/'>Visual Assert</a> (formerly named <i>cfix studio</i>) is now <a href='http://www.visualassert.com/unit-testing-framework/download.html'>available for download</a>. The release marks a major step in the development of Visual Assert for that it not only comprises a number of bugfixes but also introduces major new features. The two most important certainly are support for EXE targets and Wizard assistance.</p>
<h3>Support for EXE Targets</h3>
<p>As <a href='/2009/08/06/cfix-studio-beta-2-to-add-support-for-exe-based-unit-tests/'>announced in a previous post</a> and also discussed in the <a href='/2009/09/05/cfix-1-5-released-adds-support-for-exe-embedded-tests-and-kernel-mode-multi-threading/'>post about the cfix 1.5 release</a>, Visual Assert now fully supports unit tets emedded in EXE modules. </p>
<p>Previous releases required all unit tests to be compiled and linked into DLLs. In fact, the usage of DLLs has many advantages and therefore remains the recommended practice. However, for certain projects, such a requirement can turn out to be a true obstacle: Whenever the code to be tested is not exported from a DLL or part of a static library (LIB), accessing this code from within such a test DLL could become quite a challenge.</p>
<p>The fact that Visual Assert Beta 2 now fully supports EXE modules means the following: You can now place your unit tests wherever you think they fit best. Whether they are part of a DLL or an EXE, whether you create separate &#8220;unit test&#8221; projects or intermingle your test code with other code &#8212; it is now all up to you. Wherever you placed your tests, Visual Assert will find them and will provide a consistent user experience. </p>
<p>And the best part of the support for EXE modules is that it is totally non-intrusive: You do not have to change your main/WinMain function, much less any other code or build settings. And when run &#8220;outside&#8221; Visual Assert, i.e. launched directly or in the Visual Studio Debugger, the application will behave as normal.</p>
<p>Needless to say, the cfix 1.5 command line test runners, cfix32.exe and cfix64.exe <a href='/?p=492'>also have been updated</a> to properly deal with EXE modules.</p>
<h3>The Wizard</h3>
<p>Although neither the WinUnit API nor the cfix C and C++ API require much boilerplate code to be written, there still is some amount of code that more or less all unit tests share. Thanks to the new Wizard, you can now have Visual Assert generate this code for you. This <i>really</i> helps creating new fixtures more quickly!</p>
<h3>Download, Try it, Share Your Opinion</h3>
<p>Of course, using the new Beta version is free. So whether you are a full time tester or a unit testing sceptic, download the new release and try it by yourself. And of course, your feedback, both positive and negative, is always welcome and <a href='https://cfix.fogbugz.com/default.asp?pg=pgPublicEdit&amp;ixArea=16'>can be posted here</a>.</p>
<p><b><a href='http://www.visualassert.com/unit-testing-framework/download.html'>Download Visual Assert Beta 2</a></b></p>
Posted in cfix, Testing, Visual Assert, Visual Studio Tagged: addin, cfix, qa, tdd, test-driven, unit testing, Visual Assert, Visual Studio <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/467/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/467/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/467/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/467/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/467/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/467/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/467/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/467/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/467/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/467/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=467&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/09/05/visual-assert-beta-2-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
		<item>
		<title>cfix 1.5 released; adds support for EXE-embedded tests and kernel mode multi-threading</title>
		<link>http://jpassing.wordpress.com/2009/09/05/cfix-1-5-released-adds-support-for-exe-embedded-tests-and-kernel-mode-multi-threading/</link>
		<comments>http://jpassing.wordpress.com/2009/09/05/cfix-1-5-released-adds-support-for-exe-embedded-tests-and-kernel-mode-multi-threading/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 10:11:30 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[cfix]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[qa]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[test-driven]]></category>
		<category><![CDATA[unit test]]></category>
		<category><![CDATA[unit testing]]></category>
		<category><![CDATA[unit testing framework]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=492</guid>
		<description><![CDATA[A new version of the cfix unit testing framework is now ready for download.
Unlike the previous release, which was mainly a maintenance release, cfix 1.5 adds major new features: kernel mode multithreading and EXE-based unit tests.
EXE based unit tests
As I discussed in a previous post in the context of Visual Assert/cfix studio, cfix&#8217; restriction to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=492&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>A new version of the <a href='http://www.cfix-testing.org/'>cfix unit testing framework</a> is now ready for download.</p>
<p>Unlike the previous release, which was mainly a maintenance release, cfix 1.5 adds major new features: kernel mode multithreading and EXE-based unit tests.</p>
<h3>EXE based unit tests</h3>
<p>As I <a href='/2009/08/06/cfix-studio-beta-2-to-add-support-for-exe-based-unit-tests/'>discussed in a previous post in the context of Visual Assert/cfix studio</a>, cfix&#8217; restriction to DLL based unit tests has turned out to be quite a limitation for certain kinds of projects. </p>
<p>In cfix 1.5, this restriction has been removed: cfix now supports both, unit tests compiled and linked into DLL modules and unit tests embedded into EXE modules. </p>
<p>Now, when I say <i>embeded into an EXE module</i>, I do not mean that you may merely leave out the /LD compiler switch  &#8212; it means that you may compile and link unit tests <i>into the actual</i> application EXE module <i>without</i> impacting this application&#8217;s behavior or having to change the application&#8217;s main() routine: When you run the application direcly or through the debugger, it will behave as normal (e.g. launch GUI). Once you launch it via <code>cfix32 -exe <i>app.exe</i></code> (or <code>cfix64 -exe <i>app.exe</i></code>, respectively), however, the application&#8217;s main() routine will not execute and instead, your embedded unit tests will run.</p>
<p>This may seem awkward at first &#8212; but it offers a tremendous advantage: <i>All</i> of the application&#8217;s code now immediately becomes testable (i.e. accessible by unit test code) without having to do complex reorganization of your build process or source tree layout (although it is still a very good idea to enhance the build process s.t. the unit tests are stripped in the RTM builds and to make cfix.dll <a href='http://msdn.microsoft.com/en-us/library/yx9zd12s(VS.80).aspx'>a delayload DLL</a>). For many projects, relying on this feature will therefore make adopting cfix and maybe even unit testing in general <i>much</i> easier.</p>
<p>In almost all regards, EXE-embedded unit tests behave the same as their DLL counterparts. They are, however, slightly less handy when it comes to debugging (unless you use <a href='http://www.visualassert.com/'>Visual Assert</a>, which will shield you from this). For this reason, and their greater flexibility in general, it should be noted though that DLL-based unit tests will remain the preferred choice.</p>
<h3>Kernel mode multithreading</h3>
<p>Since its first release, cfix has featured support for multi-threaded test cases. Multi-threaded test cases are tests which spawn child threads and &#8212; and this is the important point &#8212; both, the &#8220;main&#8221; thread and the child threads may trigger assertions (i.e. use CFIX_ASSERT and friends). Regardless of the thread an assertion occurs on, it will be recognized by the framework and will lead to the test case being marked as having failed. In case this sounds trivial to you, be informed that not even JUnit properly supports this :)</p>
<p>And while this feature has been supported for user mode tests ever since, the infrastructure for kernel mode unit tests, which was added in version 1.1, has lacked support for this feature: There was no kernel mode counterpart of <a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/CfixCreateThread.html'>CfixCreateThread</a> and thus, only single-threaded kernel mode tests were supported.</p>
<p>cfix 1.5 now finally introduces <a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/CfixCreateSystemThread.html'>CfixCreateSystemThread</a>: CfixCreateSystemThread is basically a wrapper for PsCreateSystemThread with the added functionality of registering the child thread with cfix. Thus, all threads spawned using CfixCreateSystemThread (rather than using PsCreateSystemThread directly) are allowed to make use of assertions.</p>
<p><i>Kudos to Matt Oh for beta-testing this feature.</i></p>
<h3>Minor enhacements</h3>
<p>Another enhancement related to multi threaded tests is <i>Auto-joining of child threads</i>: After a test routine completes, the framework will now automatically check whether any child threads were created. If this is the case and any of these threads are still running, they will be waited on &#8212; not before all threads have terminated will the test run resume. This feature both makes writing multi-threaded tests more convenient (you do not have to wait by yourself) and safer (No more runaway child threads).</p>
<p>Finally, another feature worth noting is that by specifying the <code>-td</code> command line switch, cfix can be directed to <i>not</i> capture a stack backtrace when an assertion fails. Although stack backtraces are usually very helpful, the symbol loading can make their creation quite expensive. Using this switch can therefore speed up the usage of cfix.</p>
<h3>Download/Upgrade Now</h3>
<p>You see, there are many good reasons to upgrade your cfix installation or &#8212; in case you are not using cfix yet &#8212; to give cfix a try. </p>
<p>Better yet, check out the <a href='http://www.visualassert.com'>Visual Assert</a> AddIn for Visual C++ &#8212; it is based on the new cfix 1.5 release and seamlessly integrates with Visual Studio.</p>
<p><b><a href='https://sourceforge.net/projects/cfix/files/cfix/cfix%201.5.0/cfix_1.5.0.3535.msi/download'>Download cfix 1.5.0 Installer</a></b><br />
<b><a href='https://sourceforge.net/projects/cfix/files/cfix/cfix%201.5.0/cfix-src-1.5.0.3535.zip/download'>Download cfix 1.5.0 source code</a></b></p>
Posted in cfix, Testing, Win32 Tagged: cfix, download, qa, release, test-driven, unit test, unit testing, unit testing framework <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/492/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/492/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/492/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/492/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/492/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/492/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=492&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/09/05/cfix-1-5-released-adds-support-for-exe-embedded-tests-and-kernel-mode-multi-threading/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
		<item>
		<title>cfix studio renamed to Visual Assert</title>
		<link>http://jpassing.wordpress.com/2009/09/02/cfix-studio-renamed-to-visual-assert/</link>
		<comments>http://jpassing.wordpress.com/2009/09/02/cfix-studio-renamed-to-visual-assert/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 18:56:18 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[Visual Assert]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[cfix]]></category>
		<category><![CDATA[addin]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=457</guid>
		<description><![CDATA[Back when I began thinking about creating a Visual Studio Add-In for cfix, I needed a code name for the project. After tentatively using the name cfix+ for a while, I quickly settled on cfix studio &#8212; given that the project revolved around cfix and Visual Studio, this name pretty much suggested itself.
Soon after going [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=457&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Back when I began thinking about creating a Visual Studio Add-In for cfix, I needed a code name for the project. After tentatively using the name <i>cfix+</i> for a while, I quickly settled on <i>cfix studio</i> &#8212; given that the project revolved around cfix and Visual Studio, this name pretty much suggested itself.</p>
<p>Soon after going into Beta, however, I had to realize that this name was not without its problems. Most importantly, it makes it hard for users to properly differentiate between <i>cfix</i> and <i>cfix studio</i>. This obviously led to situations where people were not quite sure whether <i>cfix studio</i> is a supplement to, replacement of, or just new version of <i>cfix</i>.</p>
<p>I would not care too much about this ambiguity if the two projects were not very different in terms of licensing: While using the Add-In will require a license to be purchased once it leaves the beta status, the underlying cfix framework is, and will always remain open source and be licensed under the quite permissive LGPL. </p>
<p>As all APIs and libraries unit tests link against are part of the cfix framework, and the cfix framework itself is self-contained, this means that despite the Add-In being closed source, you still get the benefits of open source: Most importantly, there is no lock-in &#8212; you can stop using the Add-In and switch back to the command line tools at any time and be all-open source again. You are even free to create a fork of cfix at any time &#8212; there really is nothing other than convenience that binds you to using the Add-In.</p>
<p>Given that a growing number of people indeed tends to object to using closed source APIs and fears such vendor lock-in, I consider it important to stress this open source nature of the cfix framework underlying the Add-In. </p>
<p>However, at this point it should also become clear that a name that blurs the distinction between the two projects is counterproductive.</p>
<p>Based on this insight, I opted for dropping the <i>cfix studio</i> name and replacing it by something different: <i>Visual Assert</i>. This name should emphasise that the Add-In may be based on, but really is separate from the cfix framework.</p>
<p><img src="http://jpassing.files.wordpress.com/2009/09/logo-visualassert.gif?w=250&#038;h=46" alt="Visual Assert" title="Visual Assert" width="250" height="46" class="size-full wp-image-460" align="center" /></p>
<p>The new name will be used beginning with the upcoming Beta 2 release.</p>
Posted in cfix, Testing, Visual Assert, Visual Studio Tagged: addin, Visual Assert, Visual Studio <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/457/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=457&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/09/02/cfix-studio-renamed-to-visual-assert/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>

		<media:content url="http://jpassing.files.wordpress.com/2009/09/logo-visualassert.gif" medium="image">
			<media:title type="html">Visual Assert</media:title>
		</media:content>
	</item>
		<item>
		<title>Writing Data-Driven Custom Actions</title>
		<link>http://jpassing.wordpress.com/2009/08/26/writing-data-driven-custom-actions/</link>
		<comments>http://jpassing.wordpress.com/2009/08/26/writing-data-driven-custom-actions/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 17:36:57 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Win32]]></category>
		<category><![CDATA[Windows Installer]]></category>
		<category><![CDATA[custom action]]></category>
		<category><![CDATA[MSI]]></category>
		<category><![CDATA[WiX]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=391</guid>
		<description><![CDATA[Whenever Windows Installer&#8217;s built-in actions do not suffice to perform a specific task, a Custom Action needs to be written. Needless to say, Custom Actions, can be a bit tricky &#8212; not only can they be laborious to write and cumbersome to debug, they also run the risk of interfering with Windows Installer&#8217;s declarative, transactional [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=391&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Whenever Windows Installer&#8217;s built-in actions do not suffice to perform a specific task, a Custom Action needs to be written. Needless to say, Custom Actions, can be a bit tricky &#8212; not only can they be laborious to write and cumbersome to debug, they also run the risk of interfering with Windows Installer&#8217;s declarative, transactional way of performing installs.</p>
<p>It is not really surprising that Windows Installer therefore more or less discourages the use of Custom Actions unless it is absolutely necessary. Moreover, as a result of its declarative nature, it is understadable that Windows Installer prefers Custom Actions to be <a href='http://robmensching.com/blog/posts/2007/9/13/Zataoca-Custom-actions-should-be-data-driven'>data-driven</a>.</p>
<p>What this means in practice is that a Custom Action should not perform a hard-coded task &#8212; rather, it should query one or more (custom) tables containing the necessary information (in a declarative manner) about what is to be performed and should act accordingly.</p>
<p>Using WiX, creating custom tables turns out to be pretty easy. Let&#8217;s assume we create a Custom Action that, based on some condition, does something with a specific file. An appropriate table could look like this:</p>
<blockquote><pre>

&lt;CustomTable Id="MyCustomTable"&gt;
  &lt;Column Id="Id" Type="string" PrimaryKey="yes"/&gt;
  &lt;Column Id="Path" Type="string"/&gt;
  &lt;Column Id="Condition" Type="string"/&gt;

  &lt;Row&gt;
    &lt;Data Column="Id"&gt;Foo&lt;/Data&gt;
    &lt;Data Column="Path"&gt;[INSTALLLOCATION]foo.txt&lt;/Data&gt;
    &lt;Data Column="Condition"&gt;&lt;![CDATA[ &amp;FeatureFoo=3 ]]&gt;&lt;/Data&gt;
  &lt;/Row&gt;
  &lt;Row&gt;
    &lt;Data Column="Id"&gt;Bar&lt;/Data&gt;
    &lt;Data Column="Path"&gt;[INSTALLLOCATION]bar.txt&lt;/Data&gt;
    &lt;Data Column="Condition"&gt;&lt;![CDATA[ &amp;FeatureBar=3 ]]&gt;&lt;/Data&gt;
  &lt;/Row&gt;
&lt;/CustomTable&gt;
</pre>
</blockquote>
<p>To query this table, we have to open a view and fetch the records one by one:</p>
<blockquote><pre>
PMSIHANDLE Database = MsiGetActiveDatabase( InstallHandle );
ASSERT( Database != NULL );

PMSIHANDLE View;
UINT Result = MsiDatabaseOpenView(
  Database,
  L"SELECT `Condition`, `Path`, FROM `MyCustomTable`",
  &amp;View );
if ( ERROR_SUCCESS != Result )
{
  ...
}

Result = MsiViewExecute( View, NULL );
if ( ERROR_SUCCESS != Result )
{
  ...
}

for ( ;; )
{
  PMSIHANDLE Record;
  Result = MsiViewFetch( View, &amp;Record );
  if ( Result == ERROR_NO_MORE_ITEMS  )
  {
    break;
  }
  else if ( ERROR_SUCCESS != Result )
  {
    ...
  }

  //
  // Read condition.
  //
  // N.B. Do not format -- this is done by
  // MsiEvaluateCondition itself.
  //

  WCHAR Condition[ 256 ];
  DWORD Length = _countof( Condition );
  Result = MsiRecordGetString(
    Record,
    1,
    Condition,
    &amp;Length );
  if ( ERROR_SUCCESS != Result )
  {
    ...
  }

  if ( MSICONDITION_TRUE != MsiEvaluateCondition(
    InstallHandle,
    Condition ) )
  {
    //
    // This record can be skipped.
    //
    continue;
  }

  //
  // Read remaing fields.
  //

  WCHAR Path[ MAX_PATH ];
  Length = _countof( VszPath );
  Result = GetFormattedRecord(
    InstallHandle,
    Record,
    2,
    Path,
    &amp;Length );
  if ( ERROR_SUCCESS != Result )
  {
    ...
  }

  ...
}
</pre>
</blockquote>
<p>With <code>GetFormattedRecord</code> being the following utility routine:</p>
<blockquote><pre>

static UINT GetFormattedRecord(
  __in MSIHANDLE InstallHandle,
  __in MSIHANDLE Record,
  __in UINT Field,
  __out PWSTR Value,
  __inout PDWORD Length
  )
{
  DWORD RecLength = *Length;
  UINT Result = MsiRecordGetString(
    Record,
    Field,
    Value,
    &amp;RecLength );
  if ( ERROR_SUCCESS != Result )
  {
    *Length = RecLength;
    return Result;
  }

  PMSIHANDLE FormattingRecord = MsiCreateRecord( 1 );

  Result = MsiRecordSetString( FormattingRecord, 0, Value );
  if ( ERROR_SUCCESS != Result )
  {
    return Result;
  }

  return MsiFormatRecord(
    InstallHandle,
    FormattingRecord,
    Value,
    Length );
}
</pre>
</blockquote>
<p>Some things are worth noting:</p>
<ul>
<li>I use PMSIHANDLE, which, as you probably already know, is not a typedef for MSIHANDLE* but rather a smart-pointer like class that automatically closes the handle when it goes out of scope.</li>
<li>The use of backticks in the query.</li>
<li>It must have been a Visual Basic programmer implementing <code>MsiRecordGetString</code>: Field Indexes start with 1, not 0. To make matters worse, reading from index 0 does not fail but returns arbitrary data. Finally, to confuse people further, indexes are 0-based for <code>MsiRecordSetString</code>.</li>
<li>If the field contains formatted data, you have to <code>MsiFormatRecord</code> it yourself. For conditions, however, <code>MsiEvaluateCondition</code> handles that for you.</li>
</ul>
<p>So far, so good. There is, however, one thing to notice: To access the installer database, the custom action <a href='http://msdn.microsoft.com/en-us/library/aa367457(VS.85).aspx'>must be a <i>nondeferred</i> action</a>:</p>
<blockquote><p>
You cannot access the current installer session or all property data from a deferred execution custom action
</p></blockquote>
<p>The problem with nondeferred actions, however, is that they execute in user context &#8212; in contrast to deferred actions, which execute in system context. On pre-Vista platforms, a per-machine installer package can be expected to always be launched by an administrator (otherwise it will fail anyway) &#8212; in this case, the differences between user and system context may not be important &#8212; both, for example, have r/w access to files in %ProgramFiles%. On Vista and later OS, however, it is common to have a regular user launch an installation which causes an elevation prompt once it reaches the main install phase. In this case, the user context is significantly less privileged than system context.</p>
<p>For a hypothetical custom action that is intended to edit a file installed to %ProgramFiles%, this means that (disregarding rollback considerations and assuming proper scheduling) performing this action from within the nondeferred custom action will work fine on pre-Vista OS. When run on Vista, though, it is likely to fail due to lack of write access to %ProgramFiles%. In practice, this means that all system-changing tasks usually have to be performed by a deferred action.</p>
<p>To sum up: To be data-driven, you have to use nondeferred actions. To be able to perform any serious, system state-changing tasks, however, you have to use deferred actions. </p>
<p>Great.</p>
<p>As it turns out, however, there is a way to escape this catch-22, and it is carefully buried in the Windows Installer documentation:</p>
<blockquote><p>
[...] Actions that update the system, such as the InstallFiles and WriteRegistryValues actions, cannot be run by calling MsiDoAction. The exception to this rule is if MsiDoAction is called from a custom action that is scheduled in the InstallExecuteSequence table between the InstallInitialize and InstallFinalize actions. [...]
</p></blockquote>
<p>[From the <i>Remarks</i> section of <a href='http://msdn.microsoft.com/en-us/library/aa370090(VS.85).aspx'>MsiDoAction</a>]</p>
<p>In fact, the way I came across this solution was by looking at the source code of the WiX <code>XmlFile</code> action, which I knew manages to both be data-driven (uses a custom table) and alter system state (edits XML files). The way it does this, and the point where the above remark comes into play, is as follows: In the nondeferred action, you do not perform any actions changing system state. Rather, you collect the information from the installer tables and stuff it (yuck) into the <code>CustomActionData</code> property. Then, leveraging <code>MsiDoAction</code> and passing said <code>CustomActionData</code>, you schedule another custom action &#8212; this time a deferred one &#8212; which parses the <code>CustomActioData</code> (yuck) and, based on this data, finally performs the actual modifications &#8212; in system context.</p>
<p>It really could not be easier and more intuitive, right?</p>
Posted in Win32, Windows Installer Tagged: custom action, MSI, Win32, Windows Installer, WiX <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/391/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/391/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/391/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=391&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/08/26/writing-data-driven-custom-actions/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
		<item>
		<title>Overview on Designing High-Performance Windows Applications</title>
		<link>http://jpassing.wordpress.com/2009/08/25/overview-on-designing-high-performance-windows-applications/</link>
		<comments>http://jpassing.wordpress.com/2009/08/25/overview-on-designing-high-performance-windows-applications/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 15:21:52 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=316</guid>
		<description><![CDATA[Back in 2008, the Windows Server Performance Team Blog, which I came across recently, ran a series of posts on Designing Applications for High Performance:

Designing Applications for High Performance &#8211; Part I
Designing Applications for High Performance &#8211; Part II
Designing Applications for High Performance &#8211; Part III

If you are interested in developing server side applications for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=316&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Back in 2008, the <a href='http://blogs.technet.com/winserverperformance/'>Windows Server Performance Team Blog</a>, which I came across recently, ran a series of posts on Designing Applications for High Performance:</p>
<ul>
<li><a href='http://blogs.technet.com/winserverperformance/archive/2008/04/25/designing-applications-for-high-performance-part-1.aspx'>Designing Applications for High Performance &#8211; Part I</a></li>
<li><a href='http://blogs.technet.com/winserverperformance/archive/2008/05/21/designing-applications-for-high-performance-part-ii.aspx'>Designing Applications for High Performance &#8211; Part II</a></li>
<li><a href='http://blogs.technet.com/winserverperformance/archive/2008/06/26/designing-applications-for-high-performance-part-iii.aspx'>Designing Applications for High Performance &#8211; Part III</a></li>
</ul>
<p>If you are interested in developing server side applications for Windows, these articles are definitely worth reading.</p>
Posted in Misc Tagged: links, performance, server <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/316/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/316/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/316/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/316/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/316/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/316/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/316/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/316/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/316/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/316/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=316&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/08/25/overview-on-designing-high-performance-windows-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
		<item>
		<title>Vote for cfix</title>
		<link>http://jpassing.wordpress.com/2009/08/23/vote-for-cfix/</link>
		<comments>http://jpassing.wordpress.com/2009/08/23/vote-for-cfix/#comments</comments>
		<pubDate>Sun, 23 Aug 2009 08:52:49 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[cfix]]></category>
		<category><![CDATA[award]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=422</guid>
		<description><![CDATA[The Automated Testing Institute has elected cfix to be one of the finalists for the Autmation Honors award. The winners of the award will be highlighted in a Special December Edition of the Automated Software Testing Magazine. 
If you are a cfix user, be sure to vote for cfix here.
And by the way, I think [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=422&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The <i>Automated Testing Institute</i> has elected <a href='http://www.cfix-testing.org/'>cfix</a> to be <a href='http://www.automatedtestinginstitute.com/home/index.php?option=com_content&amp;task=view&amp;id=1248'>one of the finalists</a> for the <i>Autmation Honors</i> award. The winners of the award will be highlighted in a Special December Edition of the Automated Software Testing Magazine. </p>
<p>If you are a cfix user, be sure to <a href='http://www.automatedtestinginstitute.com/home/index.php?option=com_mad4joomla&amp;jid=2&amp;Itemid=137'>vote for cfix here</a>.</p>
<p>And by the way, I think <a href='http://grinder.sourceforge.net/'>The Grinder</a>, which is a really neat web performance testing framework, also deserves being voted for&#8230;</p>
Posted in cfix, Misc Tagged: award, cfix, unit testing <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/422/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/422/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/422/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=422&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/08/23/vote-for-cfix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
		<item>
		<title>cfix studio Beta 2 to add support for EXE-based unit tests</title>
		<link>http://jpassing.wordpress.com/2009/08/06/cfix-studio-beta-2-to-add-support-for-exe-based-unit-tests/</link>
		<comments>http://jpassing.wordpress.com/2009/08/06/cfix-studio-beta-2-to-add-support-for-exe-based-unit-tests/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 11:16:13 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Visual Assert]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[cfix]]></category>
		<category><![CDATA[addin]]></category>
		<category><![CDATA[cfix studio]]></category>
		<category><![CDATA[mfc]]></category>
		<category><![CDATA[qa]]></category>
		<category><![CDATA[unit test]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=398</guid>
		<description><![CDATA[N.B. cfix studio was the code name of what has become Visual Assert
The biggest shortcoming of the current cfix studio version certainly is that it requires all tests be implemented in a DLL. Conceptually, keeping test cases separated from the remaining code certainly is a good idea &#8212; and implementing tests in a DLL is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=398&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style='color:red;font-style:italic;padding:20px;'>N.B. cfix studio was the code name of what has become <a href='http://www.visualassert.com/'><b>Visual Assert</b></a></span></p>
<p>The biggest shortcoming of the current cfix studio version certainly is that it requires all tests be implemented in a DLL. Conceptually, keeping test cases separated from the remaining code certainly is a good idea &#8212; and implementing tests in a DLL is a way to accomplish this. However, there are many projects in which such separation is either not feasible or just too much effort.</p>
<p>The good news is that with Beta 2, this will finally change: EXEs become first class-citizens in cfix studio and it will not matter any more whether your tests are part of a DLL or EXE project &#8212; you can just put them where you think is appropriate.</p>
<p>Take a classic MFC/GUI application project as an example: It is pretty common for these kinds of projects that most, if not all, application logic is part of a single Visual Studio project that compiles into a single EXE. There may be some additional DLLs or LIBs, but by and large, the EXE itself is where most of the interesting things happen.</p>
<p>The upcoming Beta 2 release now allows you to implement all your unit tests as part of the same EXE project. This means that your tests have access to all classes, functions and resources that are part of the project &#8212; all of which you would not easily have access to if you implemented the tests in a separate DLL. </p>
<p>Of course, embedding unit tests into an executable raises two questions:</p>
<ol>
<li>
	How to strip the tests from the final release?
</li>
<li>
	How on earth will you be able to run these tests without having main() create windows, load files, play sounds, etc each time?
</li>
</ol>
<p>Thankfully, C/C++ has a preprocessor and Visual C++ has the &#8220;exclude from build&#8221; feature which allows you to exclude certain files whenever the project is built using a specific configuration. Using any of these two features, the first question is easily answered.</p>
<p>The second problem is more tricky &#8212; but thankfully, it has already been solved for you: When cfix studio runs unit tests, it is well aware of that running main() might have, let&#8217;s say <i>interesting</i> effects &#8212; so what it does is simple: It just makes sure that main() is never run! Not only does this ensure that the tests run <i>silently</i>, i.e. without windows popping up etc, it also has the benefit that all unit tests &#8220;see&#8221; the application in a pristine state: Rather than having to worry about which state main() has brought the application into, you can initialize and clean up any state you need in your Setup and Teardown functions<sup>1</sup>. </p>
<p>To make a long story short: You can write unit tests in EXE projects in exactly the same manner as you would in a DLL project. No special considerations needed, no project settings that need to be changed, no additional boilerplate code to write. And when you run the EXE outside cfix studio, i.e. hit F5 in Visual Studio or launch the EXE directly, you will not even notice that the EXE houses some unit tests &#8212; everything works as normal.</p>
<p>Sounds good? Then wait a few more days and see it in action!</p>
<p><b>Remarks</b><br />
1: <i>Needless to say, all global variables are initialized, constructors are run, etc. All CRT initialization happens as normal; only main()/WinMain() is not run. And yes, it also works for apps that link statically to MFC and therefore do not have a &#8220;regular&#8221; WinMain()</i>. </p>
Posted in cfix, Testing, Tools, Visual Assert, Visual Studio, Win32 Tagged: addin, cfix, cfix studio, mfc, qa, Testing, Tools, unit test, Visual Studio <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/398/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/398/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/398/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=398&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/08/06/cfix-studio-beta-2-to-add-support-for-exe-based-unit-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
		<item>
		<title>More Context Menu Handlers for Everyday Use</title>
		<link>http://jpassing.wordpress.com/2009/08/05/more-context-menu-handlers-for-everyday-use/</link>
		<comments>http://jpassing.wordpress.com/2009/08/05/more-context-menu-handlers-for-everyday-use/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 17:21:05 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[cmd.exe]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[verbs]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=381</guid>
		<description><![CDATA[Although Windows Explorer may actually not be the brightest spot of Windows, it is still, for most users, among the most often used pograms. Customizing it to speed up certain tasks is thus a natural desire.
A while ago, I wrote about how to extend the context menu by new commands that allow MSI packages to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=381&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Although Windows Explorer may actually not be the brightest spot of Windows, it is still, for most users, among the most often used pograms. Customizing it to speed up certain tasks is thus a natural desire.</p>
<p><a href='http://jpassing.wordpress.com/2007/08/18/install-msi-with-log-from-shell-context-menu/'>A while ago</a>, I wrote about how to extend the context menu by new commands that allow MSI packages to be installed/uninstalled with  logfiles being created. The registry entries I used were:</p>
<blockquote><pre>
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Msi.Package\shell\LoggedInstall]
@="&amp;Logged Install"

[HKEY_CLASSES_ROOT\Msi.Package\shell\LoggedInstall\command]
@="msiexec.exe /l* \"%1-install.log\" /i \"%1\" %*"

[HKEY_CLASSES_ROOT\Msi.Package\shell\LoggedUninstall]
@="L&amp;ogged Uninstall"

[HKEY_CLASSES_ROOT\Msi.Package\shell\LoggedUninstall\command]
@="msiexec.exe /l* \"%1-uninstall.log\" /x \"%1\" %*"

[HKEY_CLASSES_ROOT\Msi.Package\shell\runas\command]
@="msiexec.exe /l* \"%1.log\" /i \"%1\" %*"
</pre>
</blockquote>
<p>While I do not use Windows Installer every day, I am a heavy user of cmd.exe command prompts. Another set of custom verbs I use on my machines therefore deal with opening command line windows. Getting Windows Explorer to open a &#8220;normal&#8221; command prompt using the context menu is not hard and it has been demonstrated on various places. The idea becomes truly powerful, though, when the commands are specialized to open  special kinds of command windows:</p>
<ul>
<li>A plain command prompt</li>
<li>An elevated command prompt (<a href='http://jpassing.wordpress.com/2007/12/08/launch-elevated-processes-from-the-command-line/'>using elevate.exe</a>)</li>
<li>A WDK command prompt (WLH-chk)</li>
<li>A WDK command prompt (WLHA64-chk)</li>
<li>A Visual Studio 2005 command prompt</li>
<li>etc &#8230;</li>
</ul>
<p>To distinguish the different types of consoles, I like to use different colors &#8212; The Visual Studio command prompt is white/green, the elevated prompt is green/blue, and so on. The following script puts it all together (mind the static paths):</p>
<blockquote><pre>
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\Open DDK Console here (WLH-chk)]
@="Open DD&amp;K Console here (WLH-chk)"

[HKEY_CLASSES_ROOT\Directory\shell\Open DDK Console here (WLH-chk)\command]
@="C:\\Windows\\System32\\cmd.exe /k C:\\WinDDK\\6000\\bin\\setenv.bat C:\\WinDDK\\6000\\ chk WLH &amp;&amp; cd /D %1 &amp;&amp; color 1f"

[HKEY_CLASSES_ROOT\Directory\shell\Open DDK Console here (WLHA64-chk)]
@="Open DD&amp;K Console here (WLHA64-chk)"

[HKEY_CLASSES_ROOT\Directory\shell\Open DDK Console here (WLHA64-chk)\command]
@="C:\\Windows\\System32\\cmd.exe /k C:\\WinDDK\\6000\\bin\\setenv.bat C:\\WinDDK\\6000\\ chk AMD64 &amp;&amp; cd /D %1 &amp;&amp; color 1f"

[HKEY_CLASSES_ROOT\Directory\shell\Open Default Console here]
@="Open Default Conso&amp;le here"

[HKEY_CLASSES_ROOT\Directory\shell\Open Default Console here\command]
@="cmd.exe /K \"title %1 &amp;&amp; cd /D %1\""

[HKEY_CLASSES_ROOT\Directory\shell\Open Elevated Console here]
@="Open Ele&amp;vated Console here"

[HKEY_CLASSES_ROOT\Directory\shell\Open Elevated Console here\command]
@="d:\\bin\\elevate.exe /K \"title %1 &amp;&amp; color 1a &amp;&amp; cd /D %1\""

[HKEY_CLASSES_ROOT\Directory\shell\Open VS.Net 2005 Console here]
@="Open VS.Net 200&amp;5 Console here"

[HKEY_CLASSES_ROOT\Directory\shell\Open VS.Net 2005 Console here\command]
@="cmd.exe /K \"cd /D %1 &amp;&amp; \"C:\\Program Files (x86)\\Microsoft Visual Studio 8\\VC\\vcvarsall.bat\" &amp;&amp; color 2f\""
</pre>
</blockquote>
<p>Finally, if you perform backups to the cloud from time to time and do want to upload unencrypted data or for other reasons encrypt specific files occasionaly, it may also be practical to have two GPG commands in your context menu &#8212; one to (symetrically) encrypt, and one to decrypt:</p>
<blockquote><pre>
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.gpg]
@="GpgFile"

[HKEY_CLASSES_ROOT\GpgFile]

[HKEY_CLASSES_ROOT\GpgFile\shell]

[HKEY_CLASSES_ROOT\GpgFile\shell\Decrypt]
@="Decrypt"

[HKEY_CLASSES_ROOT\GpgFile\shell\Decrypt\command]
@="\"c:\\Program Files (x86)\\GNU\\GnuPG\\gpg.exe\" -d -i -o %1.plain %1"

[HKEY_CLASSES_ROOT\*\shell\GpgSymmetricEncrypt]
@="Encrypt with GPG (symmetric)"

[HKEY_CLASSES_ROOT\*\shell\GpgSymmetricEncrypt\command]
@="\"c:\\Program Files (x86)\\GNU\\GnuPG\\gpg.exe\" -c %1"</pre>
</blockquote>
Posted in Misc, Tools Tagged: cmd.exe, shell, Tools, verbs, Windows <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/381/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/381/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/381/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/381/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/381/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/381/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/381/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/381/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/381/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/381/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=381&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/08/05/more-context-menu-handlers-for-everyday-use/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
		<item>
		<title>Introducing cfix studio, the Visual Studio AddIn for C/C++ Unit Testing</title>
		<link>http://jpassing.wordpress.com/2009/06/23/introducing-cfix-studio-the-visual-studio-addin-for-cc-unit-testing/</link>
		<comments>http://jpassing.wordpress.com/2009/06/23/introducing-cfix-studio-the-visual-studio-addin-for-cc-unit-testing/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 18:32:01 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Visual Assert]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[cfix]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=290</guid>
		<description><![CDATA[N.B. cfix studio was the code name of what has become Visual Assert
There is little doubt that native code, and C and C++ in particular, is here to stay. And still, it is pretty obvious that when it comes to tools and IDEs, it is the managed world that has gotten most attention from tool [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=290&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style='color:red;font-style:italic;padding:20px;'>N.B. cfix studio was the code name of what has become <a href='http://www.visualassert.com/'><b>Visual Assert</b></a></span></p>
<p>There is little doubt that native code, and C and C++ in particular, is here to stay. And still, it is pretty obvious that when it comes to tools and IDEs, it is the managed world that has gotten most attention from tool vendors over the past years. </p>
<p>While there are lots and lots of useful tools for native development, many of them probably even better than their managed counterparts, there are some areas where the managed language fraction is far ahead: One of these areas certainly is IDE support for unit testing.</p>
<p>JUnit for Eclipse, TestDriven.Net for Visual Studio and MS Test make test-driven development <i>so much</i> more convenient and efficient that it is almost ridiculous that using command line tools is still state of the art for C/C++ development.</p>
<p>That said, there is great news: With <a href='http://www.cfix-studio.com'>cfix studio</a>, there finally is a solution filling in this gap! cfix studio, <a href='http://jpassing.wordpress.com/2009/06/23/cfix-1-4-released/'>based on the cfix unit testing framework</a>, is a Visual Studio-AddIn that allows you to easily write, manage, run, and debug your unit tests from within Visual Studio. No fiddling with command line tools, complex configuration, or boilerplate code required! </p>
<p>Among <a href='http://www.cfix-studio.com/unit-testing-framework/key-features.html'>lots of other features</a>, cfix studio also has first-class support for multi-architecture development – you can easily switch back and forth between 32-bit and 64-bit and can even mix tests of different architectures in a single test run. Needless to say, cfix studio, like cfix, is also fully compatible to WinUnit. </p>
<p>If that has caught your interest, you are invited to check out the first beta version of cfix studio:</p>
<div style='padding-left:50px;padding-top:20px;padding-bottom:20px;'>
<p><b><a href='http://cfix-studio.com/unit-testing-framework/download.html'>Download cfix studio Beta 1</a></b><br />
Version 1.0.0.3458
</div>
<p>It is free, quick to install and comes with a set of example projects. Give it a try &#8212; and please <a href='https://cfix.fogbugz.com/default.asp?pg=pgPublicEdit&amp;ixArea=16'>let me know about all your crticism, suggestions and other feedback</a>!</p>
<p>Here are some screenshots of cfix studio in action:</p>
<p><a href="http://cfix-studio.com/unit-testing-framework/images/stories/explorer-contextmenu.png"><img src="http://jpassing.files.wordpress.com/2009/06/explorer-contextmenu-thumb.png?w=250&#038;h=197" alt="Test Explorer" width="250" height="197" class="alignnone size-full wp-image-300" /></a><br />
<i>The Test Explorer allows you to start a single or set of tests, the Run Window shows the results</i></p>
<p><a href='http://cfix-studio.com/unit-testing-framework/images/stories/run-running.png'><img src="http://jpassing.files.wordpress.com/2009/06/run-running-thumb.png?w=250&#038;h=181" alt="Run Window" title="Run Window: Viewing test progress" width="250" height="181" class="alignnone size-full wp-image-299" /></a><br />
<i>Run Window: Viewing test progress</i></p>
<p><a href="http://cfix-studio.com/unit-testing-framework/images/stories/run-failed-assertion.png"><img src="http://jpassing.files.wordpress.com/2009/06/run-failed-assertion-thumb.png?w=250&#038;h=159" alt="Failed Assertion" title="Failed Assertion" width="250" height="159" class="alignnone size-full wp-image-303" /></a><br />
<i>Run Window: Viewing test results and details of a failed assertion</i></p>
<p><a href="http://cfix-studio.com/unit-testing-framework/images/stories/debug-failed-assertion.png"><img src="http://jpassing.files.wordpress.com/2009/06/debug-failed-assertion-thumb.png?w=250&#038;h=197" alt="Debgging a failed assertion" title="Debgging a failed assertion" width="250" height="197" class="alignnone size-full wp-image-294" /></a><br />
<i>When running in the debugger, a failed assertion will hit a breakpoint and the Run Window will show additional details</i></p>
Posted in cfix, Debugging, Testing, Tools, Visual Assert, Visual Studio  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/290/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/290/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/290/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/290/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/290/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/290/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/290/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/290/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/290/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/290/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=290&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/06/23/introducing-cfix-studio-the-visual-studio-addin-for-cc-unit-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>

		<media:content url="http://jpassing.files.wordpress.com/2009/06/explorer-contextmenu-thumb.png" medium="image">
			<media:title type="html">Test Explorer</media:title>
		</media:content>

		<media:content url="http://jpassing.files.wordpress.com/2009/06/run-running-thumb.png" medium="image">
			<media:title type="html">Run Window: Viewing test progress</media:title>
		</media:content>

		<media:content url="http://jpassing.files.wordpress.com/2009/06/run-failed-assertion-thumb.png" medium="image">
			<media:title type="html">Failed Assertion</media:title>
		</media:content>

		<media:content url="http://jpassing.files.wordpress.com/2009/06/debug-failed-assertion-thumb.png" medium="image">
			<media:title type="html">Debgging a failed assertion</media:title>
		</media:content>
	</item>
		<item>
		<title>cfix 1.4 released</title>
		<link>http://jpassing.wordpress.com/2009/06/23/cfix-1-4-released/</link>
		<comments>http://jpassing.wordpress.com/2009/06/23/cfix-1-4-released/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 18:27:38 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[cfix]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=311</guid>
		<description><![CDATA[Today, a new version of cfix, the open source unit testing framework for user and kernel mode C and C++, has been released. cfix 1.4, in addition to the existing feature of allowing test runs to be restricted to specific fixtures, now also allows single testcases to be run in isolation, which can be a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=311&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Today, a new version of cfix, the open source unit testing framework for user and kernel mode C and C++, has been released. cfix 1.4, in addition to the existing feature of allowing test runs to be restricted to specific fixtures, now also allows single testcases to be run in isolation, which can be a great aid in debugging. Besides several minor fixes, the cfix API has been slightly enhanced and cfix now degrades more gracefully in case of dbghelp-issues.</p>
<p>Updated cfix binaries and source code are now <a href='http://sourceforge.net/project/showfiles.php?group_id=218233&amp;package_id=263204'>available for download</a></p>
Posted in cfix, Debugging, Testing, Tools, Win32  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/311/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/311/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=311&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/06/23/cfix-1-4-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
		<item>
		<title>On Setup Bootstrap Loaders</title>
		<link>http://jpassing.wordpress.com/2009/05/24/on-setup-bootstrap-loaders/</link>
		<comments>http://jpassing.wordpress.com/2009/05/24/on-setup-bootstrap-loaders/#comments</comments>
		<pubDate>Sun, 24 May 2009 16:28:29 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Windows Installer]]></category>
		<category><![CDATA[bootstrapper]]></category>
		<category><![CDATA[MSI]]></category>
		<category><![CDATA[setup]]></category>
		<category><![CDATA[WiX]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=275</guid>
		<description><![CDATA[Almost two years ago, I wrote about how to create multi-language MSI packages. Although using transforms to internationalize an MSI package is a viable solution, one drawback of this approach is that it may require a bootstrap loader.
While it is easy to say that a bootstrap loader is required and many high-profile setups do indeed [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=275&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Almost two years ago, <a href='http://jpassing.wordpress.com/2007/06/14/authoring-multi-language-msi-packages/'>I wrote about how to create multi-language MSI packages</a>. Although using transforms to internationalize an MSI package is a viable solution, one drawback of this approach is that it may require a bootstrap loader.</p>
<p>While it is easy to say that a bootstrap loader is required and many high-profile setups do indeed use bootstrap loaders, bootstrap loaders do have their issues. They not only add complexity to the setup package, there actually are several reasons why a bootstrap loader-free setup may be preferrable.</p>
<h3>Bootstrap loaders</h3>
<p>The idea of a bootstrap loader is to have an EXE file that does some prerequisite work and then launches the actual installer, which is usually implemented as an MSI package. While the MSI package may be a separate file, a download-friendly setup usually requires the bootstrap loader to <i>embed</i> the MSI package inside the EXE file and extract it when started.</p>
<p>While the average end user probably will not care much whether he double-clicks on an .exe or an .msi file, a standalone MSI-package is a better Windows citizen for at least the following two reasons:</p>
<ul>
<li>
Active Directory has native support for deploying MSI packages. It is, of course, possible to deploy EXE-based setups through AD, but these tend to require more work or more elaborate software solutions like SMS.
</li>
<li>
msiexec supports a plethora of switches that allow customizing and automating setups. These switches usually cannot be used when a bootstrap loader is present. To be equally admin-friendly, a bootstrap loader should therefore support appropriate command line switches for things like performing quiet installations, pre-selecting features, and suppressing reboots. Needless to say, impementing these features increases complexity and implementation effort.
</li>
</ul>
<p>That said, there are good reasons to avoid using a bootstrap loader. If, for example, all the bootstrap loader has to do is determine the user&#8217;s locale to choose an appropriate MSI transform, it may well be worth considering whether it is easier to just offer 5 language-specific MSI packages for download. And in case of CD-ROM based distribution, a simple HTML Application (HTA) could serve as a bootstrap loader-surrogate. </p>
<p>Still, there are situations when a a true boostrap loader is required. A classic example for this is MDAC: With Windows XP, MDAC has become part of Windows, but if you still support older Windows releases, you do not have much choice but to redistribute MDAC. In all those years, however, Microsoft has not managed to provide a proper merge module for MDAC. There were several half-hearted attempts both by Microsoft and others to wrap MDAC by a MSM, and in fact, I tested at least five of them, but not a single one was robust enough to be useable in practice. Given this situation, the only sane choice was (and still is) to put the duty of installing MDAC on the bootstrap loader.</p>
<p>Another common reason for using bootstrap loaders used to be that the machine might not have the correct Windows Installer version installed &#8212; but unless you are crazy enough to require Windows Installer 4.0, this should not be of much concern today.</p>
<h3>Creating a bootstrap loader</h3>
<p>Notwithstanding these pros and cons, the question remains how to create a bootstrap loader. Several of the commercial setup authoring tools have built-in support for that and their use might be the most straighforward approach. However, after having had a horrid experience with <i>Wise for Windows Installer</i>, I have not used any of these Windows Installer-based authoring tools and therefore cannot say much about them.</p>
<p>With the upcoming 3.0 release, WiX also includes a tool for creating bootstrap loaders &#8212; although it does not quite <a href='http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/02/27/creating-a-bootstrap-loader-with-wix-3-0.aspx'>seem ready for prime time yet</a>.</p>
<p>Creating a custom bootstrap loader from scratch is certainly the most flexible approach and doing so should not actually be <i>too</i> hard. However, implementing a full fledged bootstrap loader is likely to require more effort than most teams are willing to put into a setup.</p>
<p>There is, however, another approach that may seem somewhat unorthodox at first but has served me well for a past project: Using one of the script-based setup solutions to roll your own bootstrap loader. The idea of tools such as Wise Installation System (which, btw., has absolutely nothing to do with Wise for Windows Installer</i>) is that the entire setup is authored as a script. Now, contrary to the original intent of these authoring tools, you can leave all the wizards and UIs aside, start off with an empty script and leverage the rather powerful building blocks and constructs these scripting languages tend to offer to create a highly customized (UI-less) bootstrap loader. Taking WIS as an example, extracting an embedded file is a matter of one line of code. Similarly, invoking GetLocaleInfo to query the system&#8217;s locale is a snap. And for even more powerful bootstrap loaders, it is possible to extract a helper DLL and call its routines from within Wise Script.</p>
<p>As I said, this approach has served me well for a particular project that required a pretty complex bootstrap loader. And while I cannot recommend this approach unconditionally (especially because of the quirkiness of WIS and the fact that WIS is actually an obsolete technology), it is an approach that, when a bootstrap loader is absolutely necessary, may be worth considering.</p>
Posted in Windows Installer Tagged: bootstrapper, MSI, setup, Windows Installer, WiX <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/275/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/275/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/275/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=275&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/05/24/on-setup-bootstrap-loaders/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
		<item>
		<title>Uniquely Identifying a Module&#8217;s Build</title>
		<link>http://jpassing.wordpress.com/2009/04/22/uniquely-identifying-a-modules-build/</link>
		<comments>http://jpassing.wordpress.com/2009/04/22/uniquely-identifying-a-modules-build/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 19:49:26 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Kernel]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[pe]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=237</guid>
		<description><![CDATA[It is common practice to embed a version resource (VS_VERSIONINFO) into PE images such as DLL and EXE files. While this resource mainly serves informational purposes, the version information is occasionaly used to perform certain checks, such as verifying the module&#8217;s suitability for a particular purpose.
Under certain circumstances, however, this versioning information may be too [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=237&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>It is common practice to embed a version resource (VS_VERSIONINFO) into PE images such as DLL and EXE files. While this resource mainly serves informational purposes, the version information is occasionaly used to perform certain checks, such as verifying the module&#8217;s suitability for a particular purpose.</p>
<p>Under certain circumstances, however, this versioning information may be too imprecise: Versions are not necessarily incremented after each build, so it is possible that two copies of a module carry the same versioning information, yet differ significantly in their implementation. In such situations, identifying the actual <i>build</i> of the module might become neccessary.</p>
<p>The most common, but by no means the only situation in which this applies in practice concerns debugging &#8212; to identify the PDB file exactly matching a given module, the debugger must be able to recognize the <i>specific</i> build of a module. It thus does not come as a surprise that all images for which debugging information has been generated contain a dedicated identifier for this purpose: The <i>CodeView signature GUID</i>.</p>
<p>Summarizing what Oleg Starodumov <a href='http://www.debuginfo.com/articles/debuginfomatch.html'>has covered in more detail</a>, cl, when directed to generate a PDB file, implicitly creates this GUID and, along with the path to the PDB file, embeds this data into the PE image. For current versions, the relevant structure used to encode this information is CV_INFO_PDB70, which seems to have been documented once, but not any more:</p>
<blockquote><pre>
typedef struct _CV_INFO_PDB70
{
  ULONG CvSignature;
  GUID Signature;
  ULONG Age;
  UCHAR PdbFileName[ ANYSIZE_ARRAY ];
} CV_INFO_PDB70, *PCV_INFO_PDB70;
</pre>
</blockquote>
<p>In order to be able to locate the structure within the PE image, a directory entry of type IMAGE_DEBUG_TYPE_CODEVIEW is written to the image&#8217;s debug directory. The following code listing demonstrates how to obtain the signature GUID of an image:</p>
<blockquote><pre>
#define PtrFromRva( base, rva ) ( ( ( PUCHAR ) base ) + rva )

static PIMAGE_DATA_DIRECTORY GetDebugDataDirectory(
  __in ULONG_PTR LoadAddress
  )
{
  PIMAGE_DOS_HEADER DosHeader =
    ( PIMAGE_DOS_HEADER ) ( PVOID ) LoadAddress;
  PIMAGE_NT_HEADERS NtHeader = ( PIMAGE_NT_HEADERS )
    PtrFromRva( DosHeader, DosHeader-&gt;e_lfanew );
  ASSERT ( IMAGE_NT_SIGNATURE == NtHeader-&gt;Signature );

  return &amp;NtHeader-&gt;OptionalHeader.DataDirectory
      [ IMAGE_DIRECTORY_ENTRY_DEBUG ];
}

NTSTATUS GetDebugGuid(
  __in ULONG_PTR ModuleBaseAddress,
  __out GUID *Guid
  )
{
  PIMAGE_DATA_DIRECTORY DebugDataDirectory;
  PIMAGE_DEBUG_DIRECTORY DebugHeaders;
  ULONG Index;
  ULONG NumberOfDebugDirs;
  ULONG_PTR ModuleBaseAddress;
  NTSTATUS Status;

  DebugDataDirectory  = DebugDataDirectory( ModuleBaseAddress );
  DebugHeaders    = ( PIMAGE_DEBUG_DIRECTORY ) PtrFromRva(
    ModuleBaseAddress,
    DebugDataDirectory-&gt;VirtualAddress );

  ASSERT( ( DebugDataDirectory-&gt;Size % sizeof( IMAGE_DEBUG_DIRECTORY ) ) == 0 );
  NumberOfDebugDirs = DebugDataDirectory-&gt;Size / sizeof( IMAGE_DEBUG_DIRECTORY );

  //
  // Lookup CodeView record.
  //
  for ( Index = 0; Index &lt; NumberOfDebugDirs; Index++ )
  {
    PCV_INFO_PDB70 CvInfo;
    if ( DebugHeaders[ Index ].Type != IMAGE_DEBUG_TYPE_CODEVIEW )
    {
      continue;
    }

    CvInfo = ( PCV_INFO_PDB70 ) PtrFromRva(
      ModuleBaseAddress,
      DebugHeaders[ Index ].AddressOfRawData );

    if ( CvInfo-&gt;CvSignature != 'SDSR' )
    {
      //
      // Weird, old PDB format maybe.
      //
      return STATUS_xxx_UNRECOGNIZED_CV_HEADER;
    }

    *Guid = CvInfo-&gt;Signature;
    return STATUS_SUCCESS;
  }

  return STATUS_xxx_CV_GUID_LOOKUP_FAILED;
}
</pre>
</blockquote>
Posted in Debugging, Kernel, Win32 Tagged: Debugging, image, pe <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/237/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=237&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/04/22/uniquely-identifying-a-modules-build/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
		<item>
		<title>RCW Reference Counting Rules != COM Reference Counting Rules</title>
		<link>http://jpassing.wordpress.com/2009/03/26/rcw-reference-counting-rules-com-reference-counting-rules/</link>
		<comments>http://jpassing.wordpress.com/2009/03/26/rcw-reference-counting-rules-com-reference-counting-rules/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 17:17:26 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[leak]]></category>
		<category><![CDATA[rcw]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=239</guid>
		<description><![CDATA[Avoiding COM object leaks in managed applications that make use of COM Interop can be a daunting task. While diligent tracking of COM object references and appropriate usage of Marshal.ReleaseComObject usually works fine, COM Interop is always good for surprises.
Recently having been tracking down a COM object leak in a COM/.Net-Interop-centric application, I noticed that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=239&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Avoiding COM object leaks in managed applications that make use of COM Interop can be a daunting task. While diligent tracking of COM object references and appropriate usage of Marshal.ReleaseComObject usually works fine, COM Interop is always good for surprises.</p>
<p>Recently having been tracking down a COM object leak in a COM/.Net-Interop-centric application, I noticed that the CLR did not quite manage the reference count on my COM object as I expected it to do &#8212; more precisely, it incremented the referece count of a COM object when it was passed (from COM) as a method parameter to a callback implemented in .Net &#8212; which, of course, contradicts the rules of COM. So while RCWs indeed <i>mostly</i> follow the rules of COM reference counting, they obviously do not do follow the rules in their entirety. Once I spotted this difference, it was easy to find an <a href='http://osdir.com/ml/windows.devel.dotnet.cx/2005-01/msg00087.html'>explanation of this very topic</a> by <a href='http://www.interact-sw.co.uk/iangblog/'>Ian Griffiths</a>, which is worth quoting [reformatted by me]:</p>
<blockquote><p>[...]<br />
And by the way, the reference counting is kind of similarish to COM, in that, as you point out, things get addrefed when they are passed to you. But they&#8217;re actually not the same. Consider this C# class that<br />
implements a COM interface:</p>
<pre>
public class Foo : ISomeComInterface
{
  public void Spong(ISomeOtherComInterface bar)
  {
    bar.Quux();
  }
}
</pre>
<p>Suppose that Spong is the only member of ISomeComInterface. (Other than the basic IUnknown members, obviously.) This Spong method is passed another COM interface as a parameter. And let&#8217;s suppose that some non-.NET client is going to call this Spong method on our .NET object via COM interop.</p>
<p>The reference counting rules for COM are not the same as those for the RCW in this case.</p>
<p>For COM, the rule here is that the interface is AddRefed for you before it gets passed in, and is Released for you after you return. In other words, you are not required to do any AddRefing or Releasing on a COM object passed to you in this way *unless* you want to keep hold of a reference to it after the call returns. In that case you would AddRef it.</p>
<p>Compare this with the RCW reference count. As with COM, the RCW&#8217;s reference count will be incremented for you when the parameter is passed in. But unlike in COM, it won&#8217;t be decremented for you automatically when you return.</p>
<p>You could sum up the difference like this:</p>
<ul>
<li> COM assumes you won&#8217;t be holding onto the object reference when the method returns</li>
<li>The RCW assumes you *will* be holding onto the object reference when the method returns.</li>
</ul>
<p>So if you don&#8217;t plan to keep hold of the object reference, then the method should really look like this:</p>
<pre>
public void Spong(ISomeOtherComInterface bar)
{
  bar.Quux();
  Marshal.ReleaseComObject(bar);
}
</pre>
<p>According to the COM rules of reference counting, this would be a programming error. But with RCWs, it&#8217;s how you tell the system you&#8217;re not holding onto the object after the method returns.
</p></blockquote>
<p>Pretty counter-intuitive&#8230; Plus, I am not aware of any official documentation on this topic.</p>
Posted in .Net, COM Tagged: .Net, COM, leak, rcw <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/239/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=239&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/03/26/rcw-reference-counting-rules-com-reference-counting-rules/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
		<item>
		<title>cfix 1.3.0 Released, Introducing WinUnit Compatibility</title>
		<link>http://jpassing.wordpress.com/2009/03/03/cfix-130-released-introducing-winunit-compatibility/</link>
		<comments>http://jpassing.wordpress.com/2009/03/03/cfix-130-released-introducing-winunit-compatibility/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 19:52:45 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[cfix]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[unit testing]]></category>
		<category><![CDATA[winunit]]></category>
		<category><![CDATA[xunit]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=213</guid>
		<description><![CDATA[cfix 1.3, the latest version of the unit testing framework for C/C++ on Windows, has just been released. As announced in the last blog post, the major new feature of this release is WinUnit compatibility, i.e. the ability to recompile existing WinUnit test suites into cfix test suites without having to change a single line [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=213&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>cfix 1.3, the latest version of the unit testing framework for C/C++ on Windows, has just been released. As announced in the <a href='http://jpassing.wordpress.com/2009/02/26/embracing-winunit/'>last blog post</a>, the major new feature of this release is WinUnit compatibility, i.e. the ability to recompile existing WinUnit test suites into cfix test suites without having to change a single line of code.</p>
<p>To demonstrate that this compatibility indeed works, consider the following simple example:</p>
<blockquote><pre>
#include "WinUnit.h"

<a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/BEGIN_TEST.html'>BEGIN_TEST</a>(DummyTest)
{
  <a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/WIN_ASSERT_STRING_EQUAL.html'>WIN_ASSERT_STRING_EQUAL</a>( "foo", "bar" "Descriptive message");
}
<a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/BEGIN_TEST.html'>END_TEST</a>
</pre>
</blockquote>
<p>Compile it:</p>
<blockquote><pre>
cl /I %CFIX_HOME%\include /LD /EHa /Zi winunittest.cpp /link /LIBPATH:%CFIX_HOME%\lib\i386
</pre>
</blockquote>
<p>Or, in case %INCLUDE% and %LIB% already happen to be set properly:</p>
<blockquote><pre>
cl /LD /EHa winunittest.cpp
</pre>
</blockquote>
<p>Note that the only difference to compiling the test for WinUnit ist that a different include path is used &#8212; rather than the original winunit.h, cfix&#8217; own winunit.h is used, which in turn implements the WinUnit API on top of the existing API.</p>
<p>The resulting DLL is a valid cfix DLL and its tests can be run in the usual manner. As the example contains a failing test, cfix will print the stack trace and error description to the console:</p>
<blockquote><pre>
D:\sample&gt;<b>cfix32 -ts -z winunittest.dll</b>
cfix version 1.3.0.3340 (fre)
(C) 2008-2009 - Johannes Passing - http://www.cfix-testing.org/
[Failure]      winunittest.DummyTest.DummyTest
      winunittest.cpp(5): DummyTest

      <b>Expression: Descriptive message: [foo] == [bar] (Expression: "foo" == "bar")</b>
      Last Error: 0 (The operation completed successfully. )

      cfix!CfixpCaptureStackTrace +0x40
      cfix!CfixPeReportFailedAssertion +0xd2
      winunittest!cfixcc::Assertion::Fail&lt;std::...
      winunittest!cfixcc::Assertion::Relate&lt;std...
      winunittest!cfixcc::Assertion::Relate ...
      winunittest!cfixcc::Assertion::RelateStri...
      winunittest!DummyTest +0x9c
      cfix!CfixsRunTestRoutine +0x33
      cfix!CfixsRunTestCaseMethod +0x27
      cfix!CfixsRunTestCase +0x25
      ...
</pre>
</blockquote>
<p>Of course, cfix also supports WinUnit fixtures, as the following example, taken from the original <a href='http://msdn.microsoft.com/en-us/magazine/cc136757.aspx'>WinUnit article on MSDN</a> demonstrates:</p>
<blockquote><pre>
#include "WinUnit.h"
#include &lt;windows.h&gt;

// Fixture must be declared.
<a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/FIXTURE.html'>FIXTURE</a>(DeleteFileFixture);

namespace
{
  TCHAR s_tempFileName[MAX_PATH] = _T("");
  bool IsFileValid(TCHAR* fileName);
}

// Both SETUP and TEARDOWN must be present.
<a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/SETUP.html'>SETUP</a>(DeleteFileFixture)
{
  // This is the maximum size of the directory passed to GetTempFileName.
  const unsigned int maxTempPath = MAX_PATH - 14;
  TCHAR tempPath[maxTempPath + 1] = _T("");
  DWORD charsWritten = GetTempPath(maxTempPath + 1, tempPath);
  // (charsWritten does not include null character)
  <a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/WIN_ASSERT_TRUE.html'>WIN_ASSERT_TRUE</a>(charsWritten  0,
    _T("GetTempPath failed."));

  // Create a temporary file
  UINT tempFileNumber = GetTempFileName(tempPath, _T("WUT"),
    0, // This means the file will get created and closed.
    s_tempFileName);

  // Make sure that the file actually exists
  WIN_ASSERT_WINAPI_SUCCESS(IsFileValid(s_tempFileName),
    _T("File %s is invalid or does not exist."), s_tempFileName);
}

// TEARDOWN does the inverse of SETUP, as well as undoing
// any side effects the tests could have caused.
<a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/TEARDOWN.html'>TEARDOWN</a>(DeleteFileFixture)
{
  // Delete the temp file if it still exists.
  if (IsFileValid(s_tempFileName))
  {
    // Ensure file is not read-only
    DWORD fileAttributes = GetFileAttributes(s_tempFileName);
    if (fileAttributes &amp; FILE_ATTRIBUTE_READONLY)
    {
      WIN_ASSERT_WINAPI_SUCCESS(
        SetFileAttributes(s_tempFileName,
          fileAttributes ^ FILE_ATTRIBUTE_READONLY),
          _T("Unable to undo read-only attribute of file %s."),
          s_tempFileName);
    }

    // Since I'm testing DeleteFile, I use the alternative CRT file
    // deletion function in my cleanup.
    <a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/WIN_ASSERT_ZERO.html'>WIN_ASSERT_ZERO</a>(_tremove(s_tempFileName),
      _T("Unable to delete file %s."), s_tempFileName);
  }

  // Clear the temp file name.
  ZeroMemory(s_tempFileName,
    ARRAYSIZE(s_tempFileName) * sizeof(s_tempFileName[0]));
}

<a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/BEGIN_TESTF.html'>BEGIN_TESTF</a>(DeleteFileShouldDeleteFileIfNotReadOnly, DeleteFileFixture)
{
  WIN_ASSERT_WINAPI_SUCCESS(DeleteFile(s_tempFileName));
  <a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/WIN_ASSERT_FALSE.html'>WIN_ASSERT_FALSE</a>(IsFileValid(s_tempFileName),
    _T("DeleteFile did not delete %s correctly."),
    s_tempFileName);
}
<a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/BEGIN_TESTF.html'>END_TESTF</a>

<a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/BEGIN_TESTF.html'>BEGIN_TESTF</a>(DeleteFileShouldFailIfFileIsReadOnly, DeleteFileFixture)
{
  // Set file to read-only
  DWORD fileAttributes = GetFileAttributes(s_tempFileName);
  WIN_ASSERT_WINAPI_SUCCESS(
    SetFileAttributes(s_tempFileName,
    fileAttributes | FILE_ATTRIBUTE_READONLY));

  // Verify that DeleteFile fails with ERROR_ACCESS_DENIED
  // (according to spec)
  <a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/WIN_ASSERT_FALSE.html'>WIN_ASSERT_FALSE</a>(DeleteFile(s_tempFileName));
  <a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/WIN_ASSERT_EQUAL.html'>WIN_ASSERT_EQUAL</a>(ERROR_ACCESS_DENIED, GetLastError());
}
<a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/BEGIN_TESTF.html'>END_TESTF</a>

namespace
{
  bool IsFileValid(TCHAR* fileName)
  {
    return (GetFileAttributes(fileName) != INVALID_FILE_ATTRIBUTES);
  }
}
</pre>
</blockquote>
<p>Compiling and running this test yields the expected output:</p>
<blockquote><pre>
d:\sample&gt;<b>cl /I %CFIX_HOME%\include /LD /EHa /Zi fixture.cpp /link /LIBPATH:%CFIX_HOME%\lib\i386</b>
d:\sample&gt;<b>cfix32 -ts -z fixture.dll</b>
cfix version 1.3.0.3340 (fre)
(C) 2008-2009 - Johannes Passing - http://www.cfix-testing.org/
[Success]      fixture.DeleteFileFixture.DeleteFileShouldDeleteFileIfNotReadOnly
[Success]      fixture.DeleteFileFixture.DeleteFileShouldFailIfFileIsReadOnly

       1 Fixtures
       2 Test cases
           2 succeeded
           0 failed
           0 inconclusive
</pre>
</blockquote>
<h3>Limitations</h3>
<p>All compatibility has its limitations &#8212; although cfix supports all major WinUnit constructs and assertions, there are a small number of known limitations, which are listed in the documentation. And although I am confident that most WinUnit code should compile and run just fine, it is, of course, possible, that further limitations pop up. In such cases, I would welcome an appropriate bug report and will try to fix cfix accordingly.</p>
<h3>Documentation</h3>
<p>In order to have cfix be a fully adequate replacement for cfix, the <a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/API.html'>cfix documentation</a> has additionally been augmented to include a documentation of the entire WinUnit API.</p>
<h3>Technical background</h3>
<p>Technically, implementing the compatibility layer went rather smoothly. On the one hand, WinUnit and cfix have similar architectures, which makes many things easier. On the other hand, WinUnit has a clean, single public header file (contrast that to CppUnit!), which also simplified things. And as WinUnit is limited to C++, I was able to use C++ templates (in combination with some preprocessor macros) to implement the entire WinUnit compatibility layer without having to change a single line of cfix itself. Rather, the WinUnit macros/classes are all mapped onto the existing <a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/CcAPI.html'>cfix C++ API</a>, which already includes most of what was neccessary to implement the WinUnit functionality. </p>
<h3>Conclusion</h3>
<p>In case have been using WinUnit the past and have a set of existing WinUnit-based test suites, give cfix a try &#8212; Not only should it be a full-featured replacement for WinUnit, you can also expect to see, and benefit from new features in upcoming releases!</p>
<p>Last but not least, the release contains a number of minor bugfixes. So upgrading is recommended even if you do not intend to use the new WinUnit compatibility feature.</p>
<p>cfix can be downloaded <a href='http://sourceforge.net/project/showfiles.php?group_id=218233&amp;package_id=263204'>here</a>.</p>
Posted in cfix, Testing, Tools Tagged: c, cfix, release, unit testing, winunit, xunit <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/213/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/213/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/213/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=213&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/03/03/cfix-130-released-introducing-winunit-compatibility/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
		<item>
		<title>Embracing WinUnit</title>
		<link>http://jpassing.wordpress.com/2009/02/26/embracing-winunit/</link>
		<comments>http://jpassing.wordpress.com/2009/02/26/embracing-winunit/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 17:53:01 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[cfix]]></category>
		<category><![CDATA[msdn]]></category>
		<category><![CDATA[qa]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[unit testing]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[winunit]]></category>
		<category><![CDATA[xunit]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=206</guid>
		<description><![CDATA[Around two years ago, in early 2007, after having read about, having tried, and finally having dismissed numerous existing unit testing frameworks for C, I resigned and started thinking about creating a new unit testing framework. Having been accustomed to NUnit and JUnit, I found most frameworks clumsy to use &#8212; some &#8220;frameworks&#8221; like MinUnit [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=206&subd=jpassing&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Around two years ago, in early 2007, after having read about, having tried, and finally having dismissed numerous existing unit testing frameworks for C, I resigned and started thinking about creating a new unit testing framework. Having been accustomed to NUnit and JUnit, I found most frameworks clumsy to use &#8212; some &#8220;frameworks&#8221; like MinUnit are a joke, some frameworks like CUnit require lots of boilerplate code to be written, some frameworks only support C++ but not C, and some manage to combine the worst properties of them all (CppUnit). </p>
<p>However, it was not before end of 2007 until I finally found the time to actually start working on what would later become <a href='http://www.cfix-testing.org/'>cfix</a>. About half way through the initial coding phase, in the February 2007 issue, MSDN magazine featured the article <a href='http://msdn.microsoft.com/en-us/magazine/cc136757.aspx'><i>Simplified Unit Testing for Native C++ Applications</i></a>, introducing <i>WinUnit</i>, a unit testing framework for unmanaged C++. </p>
<h3>Enter WinUnit</h3>
<p>On the one hand, it was nice to see someone thinking the same about current unit testing frameworks and coming up with a new solution. But given the effort that had already gone into cfix, I was not exactly amused about this article &#8212; after all, WinUnit implements one of the core ideas of cfix, namely, to separate the test runner (winunit.exe/<a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/TutorialUserVsCcRunningTheTest.html'>cfix32.exe</a>) from the actual tests (DLLs) and using PE file introspection to identify fixtures and test cases. So although WinUnit already generated <a href='http://www.wintellect.com/cs/blogs/jrobbins/archive/2008/01/17/winunit-an-outstanding-native-c-unit-testing-tool.aspx'>significant</a> <a href='http://weblogs.asp.net/kennykerr/archive/2008/01/17/unit-testing-for-native-c.aspx'>positive feedback</a>, I continued development of cfix &#8212; not only would cfix at least add the benefit of supporting C in addition to C++, after investigating WinUnit a bit, I still saw lots of room for improvement.</p>
<p>Now, one year later, the situation has changed. Contrary to what one might have expected, WinUnit has not evolved into a serious project &#8212; it has not gotten past the MSDN article and the accomanying download link: No new features, no fixes, no blog, no community &#8212; by now, WinUnit seems pretty much dead to me. Sure, nothing prevents you from keep using WinUnit, but using tools for which no further development seems to take place is somewhat dissatisfying to me. </p>
<h3>Good News</h3>
<p>Given this situation and the architectural simlarity of both testing frameworks, it therefore just makes sense to take the next logical step and have cfix embrace WinUnit! </p>
<p>That is, the upcoming cfix 1.3 release will be compatible to WinUnit by allowing developers to take existing test cases written against the WinUnit API and recompile them into cfix test cases without requiring <i>any</i> code to be changed. </p>
<p>With such compatibility in place, transitioning from WinUnit to cfix will thus become a snap. Better yet, because no code has to be changed, the option to switch back and forth between cfix and WinUnit is retained, giving existing WinUnit users maximum flexibility at minimal risk.</p>
<p>The 1.3 release of cfix is due in a couple of days. Once released, I will get a bit more into detail about WinUnit compatibility.</p>
<h3>By the way&#8230;</h3>
<p>today is the <a href='http://jpassing.wordpress.com/2008/02/26/introducing-cfix-a-unit-testing-framework-for-cc-on-win32/'>first anniversary</a> of cfix :)</p>
Posted in Testing Tagged: cfix, msdn, qa, tdd, unit testing, Win32, winunit, xunit <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jpassing.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jpassing.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jpassing.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jpassing.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jpassing.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jpassing.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jpassing.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jpassing.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jpassing.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jpassing.wordpress.com/206/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.wordpress.com&blog=1468393&post=206&subd=jpassing&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://jpassing.wordpress.com/2009/02/26/embracing-winunit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2568ab9d93774268403af71d7cadbf11?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jpassing</media:title>
		</media:content>
	</item>
	</channel>
</rss>