<?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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Johannes Passing&#039;s Blog</title>
	<atom:link href="http://jpassing.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jpassing.com</link>
	<description></description>
	<lastBuildDate>Sun, 19 May 2013 03:31:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='jpassing.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Johannes Passing&#039;s Blog</title>
		<link>http://jpassing.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://jpassing.com/osd.xml" title="Johannes Passing&#039;s Blog" />
	<atom:link rel='hub' href='http://jpassing.com/?pushpress=hub'/>
		<item>
		<title>Windows Hotpatching: A Walkthrough</title>
		<link>http://jpassing.com/2011/05/03/windows-hotpatching-a-walkthrough/</link>
		<comments>http://jpassing.com/2011/05/03/windows-hotpatching-a-walkthrough/#comments</comments>
		<pubDate>Tue, 03 May 2011 12:00:32 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Kernel]]></category>
		<category><![CDATA[WDK]]></category>
		<category><![CDATA[WinDBG]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=45</guid>
		<description><![CDATA[As discussed in the last post, Windows 2003 SP1 introduced a technology known as Hotpatching. An integral part of this technology is Hotpatching, which refers to the process of applying an updated on the fly by using runtime code modification techniques. Although Hotpatching has caught a bit of attention, suprisingly little information has been published [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=45&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>As discussed <a href='http://jpassing.com/?p=545'>in the last post</a>, Windows 2003 SP1 introduced a technology known as Hotpatching. An integral part of this technology is <i>Hotpatching</i>, which refers to the process of applying an updated on the fly by using runtime code modification techniques.</p>
<p>Although Hotpatching has caught a bit of attention, suprisingly little information has been published about its inner workings. As the technology is patented, however, there is quite a bit of information that can be obtained by reading the <a href='http://www.patentdebate.com/PATAPP/20040107416'>patent description</a>. Moreover, there is <a href='http://www.openrce.org/articles/full_view/22'>this</a> (admittedly very terse) discussion about the actual implementation of hotpatching.</p>
<p>Armed with this information, it is possible to get into more detail by looking what is actually happening under the hood when a hoftix is applied: I did so and chose KB911897 as an example, which fixes <a href='http://www.microsoft.com/technet/security/bulletin/ms06-030.mspx'>some flaw in mrxsmb.sys and rdbss.sys</a>. I have also gone through the hassle of translating key parts of the respective assembly code back to C.</p>
<h3>Preparing the machine</h3>
<p>First, we need a proper machine image which can be used for the experiment. Unfortunately, KB911897 is an SP1 package, so we have to use an old Win 2003 Server SP1 system to apply this update. Once we have the machine running, we can attach the kernel debugger and see what is happening when the hotfix is installed.</p>
<h3>Observing the update</h3>
<p>When launched with /hotpatch:enable, after some initialization work, the updater calls <tt>NtSetSystemInformation</tt> (which delegates to <tt>ExApplyCodePatch</tt>) to apply the hotpatch. Hotpatching includes a coldpatch, which I do not care about here and the actual hotpatch. The first two calls to <tt>NtSetSystemInformation</tt> (and thus to <tt>ExApplyCodePatch</tt>) are coldpatching-related and I will thus ignore them here. The third call, however, is made to apply the actual hotpatch, so let&#8217;s observe this one further.</p>
<p>Requiring a kernel mode-patch, <tt>ExApplyCodePatch</tt> then calls <tt>MmHotPatchRoutine</tt>, which is where the fun starts. Expressed in C, <tt>MmHotPatchRoutine</tt>, MmHotPatchRoutine roughly looks like this (reverse engineered from assembly, might be slightly incorrect):</p>
<pre>
NTSTATUS MmHotPatchRoutine(
  __in PSYSTEM_HOTPATCH_CODE_INFORMATION RemoteInfo
  )
{
  UNICODE_STRING ImageFileName;
  DWORD Flags = RemoteInfo-&gt;Flags;
  PVOID ImageBaseAddress;
  PVOID ImageHandle;
  NTSTATUS Status, LoadStatus;
  KTHREAD CurrentThread;

  ImageFileName.Length = RemoteInfo-&gt;KernelInfo.NameLength;
  ImageFileName.MaximumLength = RemoteInfo-&gt;KernelInfo.NameLength;
  ImageFileName.Buffer = ( PBYTE ) RemoteInfo + NameOffset;

  CurrentThread = KeGetCurrentThread();
  KeEnterCriticalRegion( CurrentThread );

  KeWaitForSingleObject(
    MmSystemLoadLock,
    WrVirtualMemory,
    0,
    0,
    0 );

  LoadStatus = MmLoadSystemImage(
    &amp;ImageFileName,
    0,
    0,
    0,
    &amp;ImageHandle,
    &amp;ImageBaseAddress );
  if ( NT_SUCCESS( Status ) || Status == STATUS_IMAGE_ALREADY_LOADED )
  {

    Status = MiPerformHotPatch(
      ImageHandle,
      ImageBaseAddress,
      Flags );
    
    if ( NT_SUCCESS( Status ) || LoadStatus == STATUS_IMAGE_ALREADY_LOADED )
    {
      NOTHING;
    }
    else
    {
      MmUnloadSystemImage( ImageHandle );
    }
    
    LoadStatus = Status;
  }


  KeReleaseMutant(
    MmSystemLoadLock,
    1,  // increment
    FALSE,
    FALSE );

  KeLeaveCriticalRegion( CurrentThread );

  return LoadStatus;
}
</pre>
<p>As you see in the code, MmHotPatchRoutine will try load the hotpatch image &#8212; we can verify this in the debugger:</p>
<blockquote><pre>
<b>kd&gt; bp nt!MmLoadSystemImage</b>

<b>kd&gt; g</b>
Breakpoint 3 hit
nt!MmLoadSystemImage:
808ec4b5 6878010000      push    178h

<b>kd&gt; k</b>
ChildEBP RetAddr  
f6acbb28 80990c9e nt!MmLoadSystemImage
f6acbb68 809b2d67 nt!MmHotPatchRoutine+0x59
f6acbba8 808caeff nt!ExApplyCodePatch+0x191
f6acbd50 8082337b nt!NtSetSystemInformation+0xa1e
f6acbd50 7c82ed54 nt!KiFastCallEntry+0xf8
0006bc50 7c821f24 ntdll!KiFastSystemCallRet
0006bd44 7c8304c9 ntdll!ZwSetSystemInformation+0xc
[...]

<b>kd&gt; dt _UNICODE_STRING poi(@esp+4)</b>
ntdll!_UNICODE_STRING
 "\??\c:\windows\system32\drivers\hpf3.tmp"
   +0x000 Length           : 0x50
   +0x002 MaximumLength    : 0x50
   +0x004 Buffer           : 0x81623fa8  "\??\c:\windows\system32\drivers\hpf3.tmp"
   
<b>kd&gt; gu</b>

<b>kd&gt; lm</b>
start    end        module name
[...]           
f6ba4000 f6bad000   hpf3       (deferred)  
[...]
f95cb000 f9641000   mrxsmb     (deferred)  
f9641000 f9671000   rdbss      (deferred)      
[...]
</pre>
</blockquote>
<p>Having loaded the hotpatch image, <tt>MmHotPatchRoutine</tt> proceeds be calling <tt>MiPerformHotPatch</tt>, which looks about like this:</p>
<pre>
NTSTATUS
MiPerformHotPatch(
  IN PLDR_DATA_TABLE_ENTRY ImageHandle,
  IN PVOID ImageBaseAddress,
  IN DWORD Flags
  )
{
  PHOTPATCH_HEADER SectionData ;
  PRTL_PATCH_HEADER Header;    
  NTSTATUS Status;
  PVOID LockVariable;
  PVOID LockedBuffer;
  BOOLEAN f;
  PLDR_DATA_TABLE_ENTRY LdrEntry;

  SectionData = RtlGetHotpatchHeader( ImageBaseAddress );
  if ( ! SectionData  )
  {
    return STATUS_INVALID_PARAMETER;
  }
  
  //
  // Try to get header from MiHotPatchList
  //
  Header = RtlFindRtlPatchHeader(
    MiHotPatchList,
    ImageHandle );

  if ( ! Header )
  {
    PLIST_ENTRY Entry;

    if ( Flags &amp; FLG_HOTPATCH_ACTIVE )
    {
      return STATUS_NOT_SUPPORTED;
    }

    Status = RtlCreateHotPatch(
      &amp;Header,
      SectionData,
      ImageHandle,
      Flags
      );
    if ( ! NT_SUCCESS( Status ) )
    {
      return Status;
    }

    ExAcquireResourceExclusiveLite(
      PsLoadedModuleResource,
      TRUE
      );

    Entry =  PsLoadedModuleList;
    while ( Entry != PsLoadedModuleList )
    {
      LdrEntry = DataTableEntry = CONTAINING_RECORD( Entry,
                                            KLDR_DATA_TABLE_ENTRY,
                                            InLoadOrderLinks )
      if ( LdrEntry-&gt;DllBase DllBase &gt;= MiSessionImageEnd )
      {
        if ( RtlpIsSameImage( Header, LdrEntry ) )
        {
          break;
        }
      }
    }

    ExReleaseResourceLite( PsLoadedModuleResource );

    if ( ! PatchHeader-&gt;TargetDllBase )
    {
      Status = STATUS_DLL_NOT_FOUND ;
    }

    Status = ExLockUserBuffer(
      ImageHandle-&gt;DllBase,
      ImageHandle-&gt;SizeOfImage,
      KernelMode,
      IoWriteAccess,
      LockedBuffer,
      LockVariable
      );
    if ( ! NT_SUCCESS( Status ) )
    {
      FreeHotPatchData( Header );
      return Status;
    }


    Status = RtlInitializeHotPatch(
      ( PRTL_PATCH_HEADER ) Header,
      ( PBYTE ) LockedBuffer - ImageHandle-&gt;DllBase
      );

    ExUnlockUserBuffer( LockVariable );

    if ( ! NT_SUCCESS( Status ) )
    {
      FreeHotPatchData( ImageHandle );
      return Status;
    }

    f = 1;
  }
  else
  {
    if ( ( Flags ^ ImageHandle-&gt;CodeInfo-&gt;Flags ) &amp; FLG_HOTPATCH_ACTIVE )
    {
      return STATUS_NOT_SUPPORTED;
    }

    if ( ! ( ImageHandle-&gt;CodeInfo-&gt;Flags &amp; FLG_HOTPATCH_ACTIVE ) )
    {
      Status = RtlReadHookInformation( Header );
      if ( ! NT_SUCCESS( Status ) )
      {
        return Status;
      }
    }

    f = 0;
  }
  
  Status = MmLockAndCopyMemory(
    ImageHandle-&gt;CodeInfo,
    KernelMode
    );
  if ( NT_SUCCESS( Status ) )
  {
    if ( ! f  )
    {
      return Status;
    }

    LdrEntry-&gt;EntryPointActivationContext = Header;  // ???
    InsertTailList( MiHotPatchList, LdrEntry-&gt;PatchList );
  }
  else
  {
    if ( f ) 
    {
      RtlFreeHotPatchData( Header );
    }
  }

  return Status;
}
</pre>
<p>So <tt>MiPerformHotPatch</tt> inspects the hotpatch information stored in the hotpatch image. This data includes information about which code regions need to be updated. After the neccessary information has been gathered, it applies the code changes.</p>
<p>Two basic problems have to be overcome now: On the one hand, all code sections of drivers are mapped read/execute only. Overwring the instructions thus does not work. On the other hand, the system has to properly synchronize the patching process, i.e. it has to make sure no CPU is currently executing the code that is about to be patched.</p>
<p>To overcome the memory protection problems, Windows facilitates a trick I previously only knew from malware: It creates a memory descriptor list (MDL) for the affected code region, maps the MDL, and updates the code through this mapped region. The memory protection is thus circumvented. As it turns, out, there is even a handy, undocumented helper routine for this purpose: <tt>ExLockUserBuffer</tt>, which is used by <tt>MiPerformHotPatch</tt>.</p>
<p>To proceed, MiPerformHotPatch calls <tt>MmLockAndCopyMemory</tt> to do the actual patching. So how does Windows synchronize the update process? Again, it uses a technique I assumed was a malware trick: It schedules CPU-specific DPCs on all CPUs but the current and keeps those DPCs busy while the current thread is uddating the code. Again, Windows provides a neat routine for that: <tt>KeGenericCallDpc</tt>. In addition to this, Windows raises the IRQL to <i>clock level</i> in order to mask all interrupts.</p>
<p>Here is the pseudo-code for <tt>MmLockAndCopyMemory</tt> and its helper, <tt>MiDoCopyMemory</tt>:</p>
<pre>
NTSTATUS
MmLockAndCopyMemory (
    IN PSYSTEM_HOTPATCH_CODE_INFORMATION PatchInfo,
    IN KPROCESSOR_MODE ProbeMode
    )
{
  PVOID Buffer;
  NTSTATUS Status;
  UINT Index;

  if ( 0 == PatchInfo-&gt;CodeInfo.DescriptorsCount )
  {
    return STATUS_SUCCESS;
  }

  Buffer = ExAllocatePoolWithQuotaTag( 
    9,
    PatchInfo-&gt;CodeInfo.DescriptorsCount * 2,
    'PtoH' );
  if ( ! Buffer )
  {
    return STATUS_INSUFFICIENT_RESOURCES;
  }
  RtlZeroMemory( Buffer, PatchInfo-&gt;CodeInfo.DescriptorsCount * 2 );

  if ( 0 == PatchInfo-&gt;CodeInfo.DescriptorsCount )
  {
    Status = STATUS_INVALID_PARAMETER;
    goto Cleanup;
  }

  for ( Index = 0; Index CodeInfo.DescriptorsCount; Index++ )
  {
    if ( PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].CodeOffset &gt; PatchInfo-&gt;InfoSize ||
       PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].CodeSize &gt; PatchInfo-&gt;InfoSize ||
       PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].CodeOffset +
       PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].CodeSize &gt; PatchInfo-&gt;InfoSize || 
       /* other checks... */ )
    {
      Status = STATUS_INVALID_PARAMETER;
      goto Cleanup;
    }

    Status = ExLockUserBuffer(
      TargetAddress,
      PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].CodeSize
      ProbeMode,
      IoWriteAccess,
      &amp;PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].MappedAddress,
      Buffer[ Index ]
      );
    if ( ! NT_SUCCESS( Status ) )
    {
      goto Cleanup;
    }
  }

  PatchInfo-&gt;Flags |= FLG_HOTPATCH_ACTIVE;

  KeGenericCallDpc(
    MiDoCopyMemory,
    PatchInfo );

  if ( PatchInfo-&gt;Flags &amp; FLG_HOTPATCH_VERIFICATION_ERROR )
  {
    PatchInfo-&gt;Flags &amp;= ~FLG_HOTPATCH_ACTIVE;
    PatchInfo-&gt;Flags &amp;= ~FLG_HOTPATCH_VERIFICATION_ERROR;
    Status = STATUS_DATA_ERROR;
  }

Cleanup:
  if ( PatchInfo-&gt;CodeInfo.DescriptorsCount &gt; 0 )
  {
    for ( Index = 0; Index CodeInfo.DescriptorsCount; Index++ )
    {
      ExUnlockUserBuffer( Buffer[ Index ] );
    }
  }

  ExFreePoolWithTag( Buffer, 0 );
  return Status;
}

VOID MiDoCopyMemory(
  IN PKDPC Dpc,
  IN PSYSTEM_HOTPATCH_CODE_INFORMATION PatchInfo,
  IN ULONG NumberCpus,
  IN DEFERRED_REVERSE_BARRIER ReverseBarrier
  )
{
  KIRQL OldIrql;
  UNREFERENCED_PARAMETER( Dpc );
  NTSTATUS Status;
  ULONG Index;

  OldIrql = KfRaiseIrql( CLOCK1_LEVEL );

  //
  // Decrement reverse barrier count.
  //
  Status = KeSignalCallDpcSynchronize( ReverseBarrier );
  if ( ! NT_SUCCESS( Status ) )
  {
    goto Cleanup;
  }

  PatchInfo-&gt;Flags &amp;= ~FLG_HOTPATCH_VERIFICATION_ERROR;
    
  for ( Index = 0; Index CodeInfo.DescriptorsCount; Index++ )
  {
    if ( PatchInfo-&gt;Flags &amp; FLG_HOTPATCH_ACTIVE )
    {
      if ( PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].ValidationSize != 
        RtlCompareMemory(
          PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].MappedAddress,
          ( PBYTE ) PatchInfo + PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].ValidationOffset,
          PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].ValidationSize ) )
      {

        if ( PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].CodeSize != 
          RtlCompareMemory(
            PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].MappedAddress,
            ( PBYTE ) PatchInfo + PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].OrigCodeOffset,
            PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].CodeSize ) )
        {
          PatchInfo-&gt;Flags &amp;= FLG_HOTPATCH_VERIFICATION_ERROR;
          break;
        }
      }
    }
    else
    {
      if ( PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].CodeSize !=
        RtlComparememory(
          PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].MappedAddress,
          ( PBYTE ) PatchInfo + PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].CodeOffset,
          PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].CodeSize ) )
      {
        PatchInfo-&gt;Flags &amp;= FLG_HOTPATCH_VERIFICATION_ERROR;
        break;
      }
    }
  }

  //loc_479533
  if ( PatchInfo-&gt;Flags &amp; FLG_HOTPATCH_VERIFICATION_ERROR ||
     PatchInfo-&gt;CodeInfo.DescriptorsCount &lt;= 0 )
  {
    goto Cleanup;
  }

  for ( Index = 0; Index CodeInfo.DescriptorsCount; Index++ )
  {
    PVOID Source;
    if ( PatchInfo-&gt;Flags &amp; FLG_HOTPATCH_ACTIVE )
    {
      Source = ( PBYTE ) PatchInfo + PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].CodeOffset;
    }
    else
    {
      Source = ( PBYTE ) PatchInfo + PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].OrigCodeOffset;
    }

    RtlCopyMemory(
      PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].MappedAddress,
      Source,
      PatchInfo-&gt;CodeInfo.CodeDescriptors[ Index ].CodeSize
      );
  }


Cleanup:
   KeSignalCallDpcSynchronize( ReverseBarrier );
   KfLowerIrql( OldIrql );
   KeSignalCallDpcDone( NumberCpus );
}
</pre>
<p>To see the code, in action, we set a breakpoint on nt!MiDoCopyMemory:</p>
<blockquote><pre>
<b>kd&gt; k</b>
ChildEBP RetAddr  
f6acbac0 8087622f nt!MiDoCopyMemory
f6acbae8 80990a10 nt!KeGenericCallDpc+0x3d
f6acbb0c 80990bea nt!MmLockAndCopyMemory+0xf1
f6acbb34 80990cba nt!MiPerformHotPatch+0x143
f6acbb68 809b2d67 nt!MmHotPatchRoutine+0x75
f6acbba8 808caeff nt!ExApplyCodePatch+0x191
f6acbd50 8082337b nt!NtSetSystemInformation+0xa1e
</pre>
</blockquote>
<p>Before letting  MiDoCopyMemory do its work, let&#8217;s see what it is about to do. No modifications have yet been done to mrxsmb:</p>
<blockquote><pre>
<b>kd&gt; !chkimg mrxsmb</b>
0 errors : mrxsmb 

<b>kd&gt; !chkimg rdbss</b>
0 errors : rdbss
</pre>
</blockquote>
<p>The second argument is a structure holding the information garthered previously, peeking into it reveals:</p>
<blockquote><pre>
<b>kd&gt; dd /c 1 poi(esp+8) l 4</b>
81583008  00000001
8158300c  00000149
81583010  00000008   &lt;-- # of code patches
81583014  f9648b1f   &lt;-- hmm...
</pre>
</blockquote>
<p>As it turns out, address 81583014 refers to a variable length array of size 8. Poking aroud with dd, the following listing suggests that the structure is of size 28 bytes:</p>
<blockquote><pre>
<b>kd&gt; dd /c 7 81583014</b>
81583014  f9648b1f fa2afb1f 000000ec 00000005 000000f1 000000f6 00000005
81583030  f9648b24 fa2b2b24 000000fb 00000002 000000fd 000000ff 00000002
8158304c  f96585ef fa2b15ef 00000101 00000005 00000106 0000010b 00000005
81583068  f96585f4 fa2b45f4 00000110 00000002 00000112 00000114 00000002
81583084  f9658569 fa2b3569 00000116 00000005 0000011b 00000120 00000005
815830a0  f965856e fa2b656e 00000125 00000002 00000127 00000129 00000002
815830bc  f9653378 fa2b5378 0000012b 00000005 00000130 00000135 00000005
815830d8  f965337d fa2b837d 0000013a 00000005 0000013f 00000144 00000005
</pre>
</blockquote>
<p>Given that rdbss was loaded to address range f9641000-f9671000, it is obvious that the first 2 columns refer to code addresses. The third, fifth and sixth column looks like an offset, the fourth and seventh like the length of the code change. First, let&#8217;s see where the first column points to:</p>
<blockquote><pre>
<b>kd&gt; u f9648b1f</b>
rdbss!RxInitiateOrContinueThrottling+0x6b:
f9648b1f 90              nop
f9648b20 90              nop
f9648b21 90              nop
f9648b22 90              nop
f9648b23 90              nop
rdbss!RxpCancelRoutine:
f9648b24 8bff            mov     edi,edi
f9648b26 55              push    ebp
f9648b27 8bec            mov     ebp,esp
</pre>
</blockquote>
<p>Now that looks promising, especially since the fourth column holds the value 5. Let&#8217;s look at the second row:</p>
<blockquote><pre>
<b>kd&gt; u f9648b24</b>
rdbss!RxpCancelRoutine:
f9648b24 8bff            mov     edi,edi
</pre>
</blockquote>
<p>No doubt, the first and second row define the two patches necessary to redirect RxpCancelRoutine. But what to replace this code with? As it turns out, the offsets in column three are relative to the structure and point to the code that is to be written:</p>
<blockquote><pre>
<b>kd&gt; u poi(esp+8)+000000ec</b>
815830f4 e9dcc455fd      jmp     7eadf5d5          mov     edi,edi

<b>kd&gt; u poi(esp+8)+000000fb</b>
81583103 ebf9            jmp     815830fe
</pre>
</blockquote>
<p>That makes perfectly sense &#8212; the five nops are to be overwritten by a near jump, the mov edi, edi will be replaced by a short jump. </p>
<p>So let&#8217;s run <tt>MiDoCopyMemory</tt> and have a look at the results. Back in <tt>MmLockAndCopyMemory</tt>, the code referred to by the first to rows look like this:</p>
<blockquote><pre>
<b>kd&gt; u f9648b1f</b>
rdbss!RxInitiateOrContinueThrottling+0x6b:
f9648b1f e9dcc455fd      jmp     hpf3!RxpCancelRoutine (f6ba5000)

<b>kd&gt; u f9648b24</b>
rdbss!RxpCancelRoutine:
f9648b24 ebf9            jmp     rdbss!RxInitiateOrContinueThrottling+0x6b (f9648b1f)
f9648b26 55              push    ebp
f9648b27 8bec            mov     ebp,esp

</pre>
</blockquote>
<p>Voilà, RxpCancelRoutine has been patched and calls are redirected to hpf3!RxpCancelRoutine, the new routine located in the auxiliarry &#8216;hpf3&#8242; driver. All that remains to be done is cleanup (unlocking the memory etc).</p>
<p>That&#8217;s it &#8212; that&#8217;s how Windows applies patches on the fly using hotpatching. Too bad that the technology is so rarely used in practice.</p>
<br />Filed under: <a href='http://jpassing.com/category/debugging/'>Debugging</a>, <a href='http://jpassing.com/category/kernel/'>Kernel</a>, <a href='http://jpassing.com/category/wdk/'>WDK</a>, <a href='http://jpassing.com/category/windbg/'>WinDBG</a>  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=45&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2011/05/03/windows-hotpatching-a-walkthrough/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://2.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>#ifdef _WIN32</title>
		<link>http://jpassing.com/2011/05/02/ifdef-_win32/</link>
		<comments>http://jpassing.com/2011/05/02/ifdef-_win32/#comments</comments>
		<pubDate>Mon, 02 May 2011 12:00:15 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Win32]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=49</guid>
		<description><![CDATA[When writing processor-specific code, the _M_IX86, _M_AMD64 and _M_IA64 can be used for conditional compilation &#8212; so far, so good. But sometimes code is not exactly processor-specific but rather specific to the natural machine word length (i.e. 32 bit or 64 bit). Fur such situations, there are defines, too &#8212; however there is a little [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=49&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>
When writing processor-specific code, the _M_IX86, _M_AMD64 and _M_IA64 can be used for conditional compilation &#8212; so far, so good. But sometimes code is not exactly processor-specific but rather specific to the natural machine word length (i.e. 32 bit or 64 bit). Fur such situations, there are defines, too &#8212; however there is a little catch: For ancient 16 bit code, there is _WIN16. For 64 bit, the WDK build environment defines _WIN64 by default. Given these two macros, it is tempting to conclude that _WIN32 should only be defined for 32 bit builds &#8212; however this is not the case. As it turns out, _WIN32 is always defined, both for 32 and 64 bit builds.</p>
<p>And yes, this behaviour is documented <a href='http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win64/win64/the_tools.asp'>on MSDN</a>, but it is stupid anyway.
</p>
<p>However, where _WIN32 can be of use is when writing code targeting multiple platforms &#8212; as _WIN32 is always defined, it can be used as an indicator that you compile for Windows, regardless of the compiler used (another option is to use _MSC_VER, but that is compiler-specific).</p>
<br />Filed under: <a href='http://jpassing.com/category/c-2/'>C</a>, <a href='http://jpassing.com/category/win32/'>Win32</a>  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=49&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2011/05/02/ifdef-_win32/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://2.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>Windows Hotpatching</title>
		<link>http://jpassing.com/2011/05/01/windows-hotpatching/</link>
		<comments>http://jpassing.com/2011/05/01/windows-hotpatching/#comments</comments>
		<pubDate>Sun, 01 May 2011 12:56:00 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Kernel]]></category>
		<category><![CDATA[WDK]]></category>
		<category><![CDATA[WinDBG]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=545</guid>
		<description><![CDATA[Several years ago, with Windows Server 2003 SP1, Microsoft introduced a technology and infrastructure called Hotpatching. The basic intent of this infrastructure is to provide a means to apply hotfixes on the fly, i.e. without having to reboot the system &#8212; even if the hotfix contains changes on critical system components such as the kernel [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=545&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Several years ago, with Windows Server 2003 SP1, Microsoft introduced a technology and infrastructure called <i>Hotpatching</i>. The basic intent of this infrastructure is to provide a means to apply hotfixes on the fly, i.e. without having to reboot the system &#8212; even if the hotfix contains changes on critical system components such as the kernel iteself, important drivers, or user mode libraries such as shell32.dll. </p>
<p>Trying to applying hotfixes on the fly introduces a variety of problems &#8212; the most important being:</p>
<ul>
<li>Patching code that is currently in use</li>
<li>Atomically replacing files on disk that are currently in use and therefore locked</li>
<li>Making sure that all changes take effect for both, processes currently running and processes which are yet to be started (i.e. before the next reboot)</li>
<li>Allowing further hotfixes to be applied on system that has not been rebooted since the last hotfix has been applied in an on-the-fly fashion</li>
</ul>
<p>The Windows Hotpatching infrastructure is capable of handling all these cases &#8212; it is, however, not applicable to all kinds of code fixes. Generally speaking, it can only be used for fixes that merely comprise smallish code changes but do not affect layout or semantics of data structures. A fix for a buffer overflow caused by an off-by-one error, however, is a perfect example for a fix that could certainly be applied using the Hotpatching infrastructure.</p>
<p>That all sounds good and nice, but reality is that we still reboot our machines for just about every update Microsoft provides us, right? </p>
<p>Right. The answer for this is threefold. First, as indicated, some hotfixes can be expected to make changes that cannot be safely applied using the Hotpatching system. Secondly, Hotpatching is used on an opt-in basis, so you will not benefit from it automatically: When a hotpatch-enabled hotfix is applied through Windows Update or by launching the corresponding exe file, it is not used and a reboot will be required. The user has to explicitly specify the <code>/hotpatch:enable</code> switch in order to have the hotfix to be applied on the fly.</p>
<p>In the months after the release of SP1, a certain fraction of the hotfixes issued by Microsoft were indeed hotpatch-enabled and could be applied without a reboot. Interestingly, however, I am not aware of a single hotfix issued since Server 2003 SP2 that supported hotpatching!</p>
<p>And thirdly: Whether Microsoft has lost faith in their hotpatching facility, whether the effort to test such hotfixes turned out to be too high or whether there were other reasons speaking against issueing hotpatch-enabled hotfixes &#8212; I do not know.</p>
<p>Notwithstanding this observation, Hotpatching is an interesting technology that deserves to be looked at in more detail. Although I will not cover the entire infrastructure, I will spend at least one more blog post on the mechanisms implemented in Windows that allow code modifications to be performed on the fly. That is, I will focus on the <i>hotpatching</i> part of the infrastructure and will ignore <i>coldpatching</i> and other, smaller aspects of the infrastructre.</p>
<br />Filed under: <a href='http://jpassing.com/category/debugging/'>Debugging</a>, <a href='http://jpassing.com/category/kernel/'>Kernel</a>, <a href='http://jpassing.com/category/wdk/'>WDK</a>, <a href='http://jpassing.com/category/windbg/'>WinDBG</a>  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=545&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2011/05/01/windows-hotpatching/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://2.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>How to test MFC applications using Visual Assert or cfix</title>
		<link>http://jpassing.com/2010/09/26/how-to-test-mfc-applications-using-visual-assert-or-cfix/</link>
		<comments>http://jpassing.com/2010/09/26/how-to-test-mfc-applications-using-visual-assert-or-cfix/#comments</comments>
		<pubDate>Sun, 26 Sep 2010 10:41:27 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[cfix]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Visual Assert]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[mfc]]></category>
		<category><![CDATA[unit test]]></category>
		<category><![CDATA[visualassert]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=596</guid>
		<description><![CDATA[Automated testing of GUI applications is tricky. It is not only tricky because testing the GUI itself is hard (despite there being good tools around), it is also tricky because GUI applications often tend to be a bit hostile towards unit testing. One class of GUI applications for which this kind of hostility often applies [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=596&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Automated testing of GUI applications is tricky. It is not only tricky because testing the GUI itself is hard (despite there being good tools around), it is also tricky because GUI applications often tend to be a bit hostile towards unit testing.</p>
<p>One class of GUI applications for which this kind of hostility often applies is MFC applications. Although MFC allows the use of DLLs, components, etc, the framework still encourages the use of relatively monolithic architectures.</p>
<p>Regardless of whether this is a good or bad thing, the question is how to make unit testing MFC applications feasible and less painful.</p>
<p>In one of the last releases, both cfix and Visual Assert introduced the abilify to embed unit tests into executable modules. That is, the framework allows unit tests to be compiled and linked into the main application .exe file. Such an executable can then be run in two modes: On the one hand, it can be launched regularly and the existance of unit tests will largely go unnnoticed. On the other hand, the executable can be launched indirectly via cfix of Visual Assert &#8212; and in this case, the application will not have its WinMain routine run, but rather have its unit tests be executed.</p>
<p>Although this feature enables us to do unit testing without having to rethink or tweak the application&#8217;s architecture more than necessary, the question still in how far MFC <i>likes</i> this kind of testing.</p>
<p>At this point, a distinction has to be made on whether the unit tests make use of MFC APIs or not. Tests that only exercise internal methods will run smoothless, without further setup or precautions needed. Of course, this also holds for tests that make of of basic MFC functionality such as using classes like CString or CArray.</p>
<p>For test that make use of more &#8220;interesting&#8221; MFC functions, however, it is quite possible that you will observe slightly strange behavior: API calls failing, fields not having the proper value, or maybe even crashes.</p>
<p>An example for this is the field <code>AFX_MODULE_STATE::m_hCurrentInstanceHandle</code>. During a normal run, this field will hold the address of the current module. In a unit tests, however, the following assertion will fail:</p>
<blockquote><pre>
CFIX_ASSERT( AfxGetModuleState()-&gt;m_hCurrentInstanceHandle != 0 );
</pre>
</blockquote>
<p>If you think about this for a minute, this should not really come as a surprise. As described previously, Visual Assert/cfix, when attempting to run tests embedded into an executable module, will not call the applocation&#8217;s WinMain/main routine. They will ensure that all initializers (in particular: constructors of global C++ objects) are run, but calling the actual main routine is effectively skipped. Many of the MFC APIs, however, rely on quite a bit of initialization work that is performed during startup. Some of this work is conducted as part of constructors of global objects executed, a significant part of this work, however, is done in <code>AfxWinInit</code>.</p>
<p>Quoting <a href='http://msdn.microsoft.com/en-us/library/w04bs753(VS.80).aspx'>MSDN</a>:</p>
<blockquote><p>
This function is called by the MFC-supplied WinMain function, as part of the CWinApp initialization of a GUI-based application, to initialize MFC.
</p></blockquote>
<p>And indeed, if you look at the default MFC WinMain routine, <code>AfxWinMain</code>, you will see that it calls <code>AfxWinInit</code>.</p>
<p>The key to using &#8220;interesting&#8221; MFC APIs in your unit tests therefore is to make sure that <code>AfxWinMain</code> has been called before.</p>
<p>Unfortunately, there is no counterpart to AfxWinInit, so initializing MFC in a fixture&#8217;s Before or Setup routine and shutting MFC down in a After or Teardown routine is not feasible. Rather, you have to call it once <i>per process</i>, something that is a bit unusual for unit testing and requires a tiny bit of manual work. The easiest way to accomplish this is to a lazy initialization helper routine:</p>
<blockquote><pre>
static void InitalizeMfc()
{
  static BOOL Initialized = FALSE;
  if ( ! Initialized )
  {
    CFIX_ASSERT( AfxWinInit(
      ::GetModuleHandle(NULL),
      NULL,
      ::GetCommandLine(),
      0 ) );
    Initialized = TRUE;
  }
}
</pre>
</blockquote>
<p>&#8230;and call it from each fixture&#8217;s Setup routine:</p>
<blockquote><pre>
static void SetUp()
{
  InitalizeMfc();
}
</pre>
</blockquote>
<p>With this in place, MFC APIs will now work properly and <code>AfxGetModuleState()-&gt;m_hCurrentInstanceHandle</code> will contain a proper address. </p>
<p>With this bit of MFC background in mind, writing unit tests for MFC applications should be not much different than writing tests for any other kind of application.</p>
<p><i>One final tip</i>: Adding unit tests to your project introduces a dependeny to cfix.dll. In your final build, you&#8217;ll want to remove (#ifdef out, for example) all your tests so this dependency will disappear. During development, however, this dependency might be a bit of a drag because there might be machines on which cfix is not available. To alleviate this situation, consider making cfix.dll a delay-load: Unless you want to run unit tests, it is then ok to miss cfix.dll on other machines.</p>
<br />Filed under: <a href='http://jpassing.com/category/cfix/'>cfix</a>, <a href='http://jpassing.com/category/testing/'>Testing</a>, <a href='http://jpassing.com/category/visual-assert/'>Visual Assert</a>, <a href='http://jpassing.com/category/win32/'>Win32</a> Tagged: <a href='http://jpassing.com/tag/mfc/'>mfc</a>, <a href='http://jpassing.com/tag/testing/'>Testing</a>, <a href='http://jpassing.com/tag/unit-test/'>unit test</a>, <a href='http://jpassing.com/tag/visualassert/'>visualassert</a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=596&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2010/09/26/how-to-test-mfc-applications-using-visual-assert-or-cfix/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://2.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 1.1 beta and cfix 1.7 released</title>
		<link>http://jpassing.com/2010/05/24/visual-assert-1-1-beta-and-cfix-1-7-released/</link>
		<comments>http://jpassing.com/2010/05/24/visual-assert-1-1-beta-and-cfix-1-7-released/#comments</comments>
		<pubDate>Mon, 24 May 2010 09:08:38 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[cfix]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Visual Assert]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Win32]]></category>

		<guid isPermaLink="false">http://jpassing.com/?p=660</guid>
		<description><![CDATA[Slightly delayed, Visual Assert 1.1 beta is now available for download. As announced in a previous post, the most important change in the new version is added suport for the latest version of Visual Studio, Visual Studio 2010. However, the new version also brings a couple of new features that apply to all versions of [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=660&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Slightly delayed, Visual Assert 1.1 beta <a href='http://www.visualassert.com/unit-testing-framework/download.html'>is now available for download</a>. As announced in a <a href='/2010/04/18/coming-soon-visual-assert-for-visual-studio-2010/'>previous post</a>, the most important change in the new version is added suport for the latest version of Visual Studio, Visual Studio 2010.</p>
<p>However, the new version also brings a couple of new features that apply to all versions of Visual Studio. Most importantly, cfix and Visual Assert now expose an <a href='http://www.visualassert.com/visual-studio-addin/doc/EventAPI.html'>API that allows developers to plug in custom <i>event sinks</i></a>. A custom event sink is implemented as a DLL and receives all events the runtime generates during the execution of a test suite. As such, the API is perfectly suited for implementing custom loggers.</p>
<p><a href="http://jpassing.files.wordpress.com/2010/05/opt1.png"><img src="http://jpassing.files.wordpress.com/2010/05/opt1.png?w=150&#038;h=87" alt="" title="Options Dialog: General" width="150" height="87" class="alignleft size-thumbnail wp-image-663" /></a></p>
<p>To make this new feature easily usable, the Options dialog (Menu: <i>Tools &gt; Options</i>) has been enhanced appropriately. Moreover, the dialog  now includes some further options concerning stack size, current directory adjustment, and VC++ directory registration that have not been exposed previously.</p>
<p><a href="http://jpassing.files.wordpress.com/2010/05/opt2.png"><img src="http://jpassing.files.wordpress.com/2010/05/opt2.png?w=150&#038;h=87" alt="" title="Options Dialog: Host Process" width="150" height="87" class="alignleft size-thumbnail wp-image-664" /></a></p>
<p>Coming along with the new Visual Assert release, a new cfix release, version 1.7, is <a href='http://sourceforge.net/projects/cfix/files/cfix/'>now available on Sourceforge</a>.</p>
<br />Filed under: <a href='http://jpassing.com/category/cfix/'>cfix</a>, <a href='http://jpassing.com/category/testing/'>Testing</a>, <a href='http://jpassing.com/category/tools/'>Tools</a>, <a href='http://jpassing.com/category/visual-assert/'>Visual Assert</a>, <a href='http://jpassing.com/category/visual-studio/'>Visual Studio</a>, <a href='http://jpassing.com/category/win32/'>Win32</a>  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=660&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2010/05/24/visual-assert-1-1-beta-and-cfix-1-7-released/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://2.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/2010/05/opt1.png?w=150" medium="image">
			<media:title type="html">Options Dialog: General</media:title>
		</media:content>

		<media:content url="http://jpassing.files.wordpress.com/2010/05/opt2.png?w=150" medium="image">
			<media:title type="html">Options Dialog: Host Process</media:title>
		</media:content>
	</item>
		<item>
		<title>Coming soon: Visual Assert for Visual Studio 2010</title>
		<link>http://jpassing.com/2010/04/18/coming-soon-visual-assert-for-visual-studio-2010/</link>
		<comments>http://jpassing.com/2010/04/18/coming-soon-visual-assert-for-visual-studio-2010/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 08:46:50 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[cfix]]></category>
		<category><![CDATA[Visual Assert]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[addin]]></category>
		<category><![CDATA[qa]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[visual studio 2010]]></category>
		<category><![CDATA[vs]]></category>
		<category><![CDATA[vs2010]]></category>

		<guid isPermaLink="false">http://jpassing.com/?p=656</guid>
		<description><![CDATA[Now that Visual Studio 2010 has oficially been released, I keep getting questions about a Visual Studio 2010-enabled version of Visual Assert. The fact that Visual Studio 2010 is already out, yet there is no Visual Assert version for it is unfortunate. It would have been nice to have Visual Studio 2010 support ready on [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=656&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Now that Visual Studio 2010 has oficially been <a href='http://go.microsoft.com/?LinkId=9725695'>released</a>, I keep getting questions about a Visual Studio 2010-enabled version of Visual Assert.</p>
<p>The fact that Visual Studio 2010 is already out, yet there is no Visual Assert version for it is unfortunate. It would have been nice to have Visual Studio 2010 support ready on Visual Studio&#8217;s release date, however, that was not possible due to lack of time. Having solved most compatibilty issues though (of which there were many, Visual Studio 2010 is a truly painful release for AddIn developers), I am now confident to be able to offer <b>a first beta by begin of May</b>.</p>
<p>This version will not only add support for Visual Studio 2010, but will also contain a set of other improvements and new features.</p>
<br />Filed under: <a href='http://jpassing.com/category/cfix/'>cfix</a>, <a href='http://jpassing.com/category/visual-assert/'>Visual Assert</a>, <a href='http://jpassing.com/category/visual-studio/'>Visual Studio</a> Tagged: <a href='http://jpassing.com/tag/addin/'>addin</a>, <a href='http://jpassing.com/tag/cfix/'>cfix</a>, <a href='http://jpassing.com/tag/qa/'>qa</a>, <a href='http://jpassing.com/tag/testing/'>Testing</a>, <a href='http://jpassing.com/tag/visual-assert/'>Visual Assert</a>, <a href='http://jpassing.com/tag/visual-studio-2010/'>visual studio 2010</a>, <a href='http://jpassing.com/tag/vs/'>vs</a>, <a href='http://jpassing.com/tag/vs2010/'>vs2010</a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=656&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2010/04/18/coming-soon-visual-assert-for-visual-studio-2010/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://2.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>What a weirdo: How the /analyze switch changes its behavior depending on its environment</title>
		<link>http://jpassing.com/2010/02/13/what-a-weirdo-how-the-analyze-switch-changes-its-behavior-depending-on-its-environment/</link>
		<comments>http://jpassing.com/2010/02/13/what-a-weirdo-how-the-analyze-switch-changes-its-behavior-depending-on-its-environment/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 15:38:36 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[WDK]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[cl]]></category>
		<category><![CDATA[codeanalysis]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[vsts]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=626</guid>
		<description><![CDATA[In Visual Studio 2005 Team System (VSTS), the &#8220;ultimate&#8221; SKU of Visual Studio 2005, Microsoft introduced the /analyze compiler switch. When the /analyze switch is used, the cl compiler not only does its regular checks, but performs a much more thorough static code analysis. While /analyze is very useful indeed, it was only available in [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=626&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>In Visual Studio 2005 <i>Team System</i> (VSTS), the &#8220;ultimate&#8221; SKU of Visual Studio 2005, Microsoft introduced the /analyze compiler switch. When the /analyze switch is used, the cl compiler not only does its regular checks, but performs a much more thorough static code analysis.</p>
<p>While /analyze is very useful indeed, it was only available in the top SKU &#8212; the Standard and Professional versions of Visual Studio lacked support for this compiler switch (this has changed by now, Professional now also supports this feature). As some smart people quickly figured out though, the compilers shipped as part of the Windows SDK did support /analyze, too.</p>
<p>So given that some compilers do support /analyze while other do not, you may well expect that there are two slightly different types of binaries, one that the SDK and VSTS uses, and one that is shipped with other Visual Studio SKUs. </p>
<p>At least this was what I expected. As it turns out though, this is not quite the case.</p>
<h4>Where&#8217;s /analyze?</h4>
<p>For the past two years, I have been developing using Visual Studio 2005 Team System along with Windows SDK 6.0 and WDK 6000 on a Vista x64 machine. Using this setup, I was able to use the /analyze switch in both, &#8220;regular&#8221; Visual Studio projects and WDK (build.exe-driven) projects. That led me to the conclusion that the WDK 6000 compilers, like the SDK compilers were in fact  /analyze-enabled binaries as well.</p>
<p>Switching to a Windows 7 machine with VSTS 2005 and 2008, SDK 7.0, and WDK 6000 did not change this &#8212; /analyze kept working fine in all environments.</p>
<p>Then I set up a build server, installed WDK 6000 and Windows SDK 7.0 and attempted to perform a build &#8212; to my surprise, though, I got plenty of complaints about the /anayze switch not being supported.</p>
<p>I verified that the right compilers (WDK 6000) were used and compared cl versions between the build machine and my development machine &#8212; both were 14.00.50727.220, so everything seemed right. Running <code>cl.exe /?</code> on both machines, however, I noticed that despite versions being the same, this Code Analsis section was missing in the output on the build machine:</p>
<blockquote><pre>
                         -CODE ANALYSIS-

/analyze[:WX-] enable code analysis
    WX- - code analysis warnings should not be treated as errors even if /WX is invoked
</pre>
</blockquote>
<p>So obviously, Code Analysis support is enabled or disabled depending on external factors &#8212; not the binary itself, but the environment somehow determines whether the /analyze switch is supported or not.</p>
<p>Observing <code>cl.exe /?</code> with <i>Process Monitor</i> on my development machine resulted in the  following output:</p>
<p>
<a href="http://jpassing.files.wordpress.com/2010/01/c1xxast.png"><img src="http://jpassing.files.wordpress.com/2010/01/c1xxast.png?w=300&#038;h=182" alt="Process Monitor tracing the search for c1xxast" title="Process Monitor tracing the search for c1xxast" width="300" height="182" class="size-medium wp-image-629" /></a><br />
</p>
<p>This trace leaves little room for interpretation: <b>The code analysis features must (mainly) be implemented in c1xxast.dll.</b> c1xxast.dll, however, is not shipped with the WDK itself, nor is it shipped with the non-VSTS SKUs of Visual Studio. So by default, the WDK&#8217;s cl will fail to locate the DLL and will revert to &#8220;/analyze-disabled mode&#8221;.</p>
<p><b>If, however, you have VSTS or the Windows SDK installed on your machine and your %PATH% happens to include the right directories, cl&#8217;s search for c1xxast.dll will succeeded and &#8212; tada &#8212; /analyze suddenly works.</b> On my development machine, this obviously was the case, whilst on the build machine, it was not.</p>
<h4>Compiler version mish-mash</h4>
<p>I added the Windows SDK&#8217;s <code>bin</code> directory to the build machine&#8217;s %PATH% and rerun the build. As I expected, /analyze now worked fine &#8212; what I did not quite expect though was that I was now getting <i>dozens</i> of compilation warnings like:</p>
<blockquote><pre>
warning C6309: Argument '1' is null: this does not adhere to function 
specification of 'CfixCreateThread'
</pre>
</blockquote>
<p>The reason for this was simple: The WDK cl.exe (remember, version 14.00.50727.220), thanks to a proper %PATH%, now used c1xxast.dll from SDK 7 to perform code analysis &#8212; despite the fact that c1xxast.dll actually &#8220;belonged&#8221; to cl version 15.00.30729.01. So the c1xxast.dll was one generation ahead of the WDK I was using.</p>
<p><b>The really, <i>really</i> cool thing about cl being able to work with a newer c1xxast.dll is that you can continue using WDK 6000 or 6001 (with W2K support!) and <i>still</i> benefit from the latest-and-greatest static code analysis features</b>.</p>
<p>The reason for getting several warnings on the build machine while not getting similar warnings on my development machine was simply that on my development machine, the VS 2005 directory <i>preceded</i> the SDK directory in my %PATH%. Once I switched the order, I got the same wanings on both machines. This leads me to:</p>
<p><b>The ugly thing about this, however, is that a tiny change in the order of directories in %PATH% can suddenly make a huge difference w.r.t. code analysis. </b> This is not quite what you&#8217;d normally expect.</p>
<p>(The additional compiler warnings, by the way, were a result of the improved analysis checks in cl 15: cl 14 routinely failed to verify the usage of __in vs. __in_opt parameters; cl 15 has become much more precise here and found several mis-attributed function signatures.)</p>
<br />Filed under: <a href='http://jpassing.com/category/tools/'>Tools</a>, <a href='http://jpassing.com/category/visual-studio/'>Visual Studio</a>, <a href='http://jpassing.com/category/wdk/'>WDK</a>, <a href='http://jpassing.com/category/win32/'>Win32</a> Tagged: <a href='http://jpassing.com/tag/cl/'>cl</a>, <a href='http://jpassing.com/tag/codeanalysis/'>codeanalysis</a>, <a href='http://jpassing.com/tag/compiler/'>compiler</a>, <a href='http://jpassing.com/tag/sdk/'>sdk</a>, <a href='http://jpassing.com/tag/visual-studio/'>Visual Studio</a>, <a href='http://jpassing.com/tag/vsts/'>vsts</a>, <a href='http://jpassing.com/tag/windows/'>Windows</a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=626&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2010/02/13/what-a-weirdo-how-the-analyze-switch-changes-its-behavior-depending-on-its-environment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://2.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/2010/01/c1xxast.png?w=300" medium="image">
			<media:title type="html">Process Monitor tracing the search for c1xxast</media:title>
		</media:content>
	</item>
		<item>
		<title>Visual Assert hits RTM, now available for free</title>
		<link>http://jpassing.com/2010/01/31/visual-assert-hits-rtm-now-available-for-free/</link>
		<comments>http://jpassing.com/2010/01/31/visual-assert-hits-rtm-now-available-for-free/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 12:59:01 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[cfix]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Visual Assert]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[addin]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[rtm]]></category>
		<category><![CDATA[VC]]></category>
		<category><![CDATA[vs]]></category>

		<guid isPermaLink="false">http://jpassing.com/?p=642</guid>
		<description><![CDATA[Visual Assert, the unit testing Add-In for Visual Studio/Visual C++ has finally left its beta status and &#8212; better yet &#8212; is now available for free, both for commercial and non-commercial use. Visual Assert, based on the cfix 1.6 unit testing framework, allows you to easily write, manage, run, and debug your C/C++ unit tests [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=642&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a href='http://www.visualassert.com/'>Visual Assert, the unit testing Add-In for Visual Studio/Visual C++</a> has finally left its beta status and &#8212; better yet &#8212; is now available <b>for free</b>, both for commercial and non-commercial use.<br />
<img src="http://jpassing.files.wordpress.com/2010/01/visualassertscreenshot.png?w=200&#038;h=170" alt="" title="Visual Assert Screenshot" width="200" height="170" class="alignright size-medium wp-image-643" /></p>
<p>Visual Assert, based on the <a href='http://www.cfix-testing.org/'>cfix 1.6</a> unit testing framework, allows you to easily write, manage, run, and debug your C/C++ unit tests -– without ever leaving the Visual Studio® IDE. No fiddling with command line tools, no complex configuration, and no boilerplate code required.</p>
<p>Sounds good? Then go straight to the <a href='http://www.visualassert.com/'>Visual Assert homepage</a> and download the installer!</p>
<br />Filed under: <a href='http://jpassing.com/category/cfix/'>cfix</a>, <a href='http://jpassing.com/category/testing/'>Testing</a>, <a href='http://jpassing.com/category/tools/'>Tools</a>, <a href='http://jpassing.com/category/visual-assert/'>Visual Assert</a>, <a href='http://jpassing.com/category/visual-studio/'>Visual Studio</a>, <a href='http://jpassing.com/category/win32/'>Win32</a> Tagged: <a href='http://jpassing.com/tag/addin/'>addin</a>, <a href='http://jpassing.com/tag/c/'>c</a>, <a href='http://jpassing.com/tag/free/'>free</a>, <a href='http://jpassing.com/tag/plugin/'>plugin</a>, <a href='http://jpassing.com/tag/release/'>release</a>, <a href='http://jpassing.com/tag/rtm/'>rtm</a>, <a href='http://jpassing.com/tag/vc/'>VC</a>, <a href='http://jpassing.com/tag/vs/'>vs</a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=642&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2010/01/31/visual-assert-hits-rtm-now-available-for-free/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://2.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/2010/01/visualassertscreenshot.png?w=300" medium="image">
			<media:title type="html">Visual Assert Screenshot</media:title>
		</media:content>
	</item>
		<item>
		<title>cfix 1.6 released, simplifies authoring of multi-threaded tests</title>
		<link>http://jpassing.com/2010/01/31/cfix-1-6-released-simplifies-authoring-of-multi-threaded-tests/</link>
		<comments>http://jpassing.com/2010/01/31/cfix-1-6-released-simplifies-authoring-of-multi-threaded-tests/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 12:56:03 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[cfix]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Visual Assert]]></category>
		<category><![CDATA[functional testing]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[oss]]></category>
		<category><![CDATA[qa]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://jpassing.com/?p=640</guid>
		<description><![CDATA[A new release of cfix, the unit testing framework for C and C++, is now available for download. Besides some minor enhancements like extending the maximum permitted fixture name, cfix 1.6 introduces a major new feature, Anonymous Thread Auto-Registration. Since its very first release, cfix has supported multi-threaded test cases, i.e. test cases that spawn [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=640&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>A new release of <a href='http://www.cfix-testing.org/'>cfix, the unit testing framework for C and C++</a>, is now available for download. Besides some minor enhancements like extending the maximum permitted fixture name, cfix 1.6 introduces a major new feature, <a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/AnonymousThreadsAutoRegistration.html'><i>Anonymous Thread Auto-Registration</i></a>. </p>
<p>Since its very first release, cfix has supported multi-threaded test cases, i.e. test cases that spawn child threads, each of which potentially making use of the various assertion statements like CFIX_ASSERT. To make this work and ensure that failing assertions are handled properly, however, usage of <a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/CfixCreateThread.html'>CfixCreateThread</a> (rather than the native Win32 CreateThread) was mandatory when spawning such threads. </p>
<p>Although using CfixCreateThread (or <a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/CfixCreateSystemThread.html'>CfixCreateSystemThread</a> in case of kernel mode code) remains the preferred way to create child threads, there are situations where usage of this API is not possible &#8212; for example, when the child threads are created by libraries such as <i>boost</i>.</p>
<p>To support such scenarios, cfix now allows you to annotate a fixture to enable <i>Anonymous Thread Auto-Registration</i>, which means that newly spawned threads are automatically registered with cfix &#8212; no usage of CfixCreateThread required. Thanks to this feature, writing multi-threaded tests becomes straightforward &#8212; and integrating with libraries such as boost does not pose a problem any more.</p>
<p>For more details about this feature, please refer to the <a href='http://www.cfix-testing.org/unit-testing-framework/windows/doc/AnonymousThreadsAutoRegistration.html'>respective section in the cfix documentation</a>.</p>
<p>As always, updated binaries and source code are available on <a href='http://sourceforge.net/projects/cfix/files/'>Sourceforge</a>.</p>
<br />Filed under: <a href='http://jpassing.com/category/cfix/'>cfix</a>, <a href='http://jpassing.com/category/testing/'>Testing</a>, <a href='http://jpassing.com/category/tools/'>Tools</a>, <a href='http://jpassing.com/category/visual-assert/'>Visual Assert</a> Tagged: <a href='http://jpassing.com/tag/cfix/'>cfix</a>, <a href='http://jpassing.com/tag/functional-testing/'>functional testing</a>, <a href='http://jpassing.com/tag/open-source/'>open source</a>, <a href='http://jpassing.com/tag/oss/'>oss</a>, <a href='http://jpassing.com/tag/qa/'>qa</a>, <a href='http://jpassing.com/tag/testing/'>Testing</a>, <a href='http://jpassing.com/tag/unit-testing/'>unit testing</a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=640&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2010/01/31/cfix-1-6-released-simplifies-authoring-of-multi-threaded-tests/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://2.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>How to customize test run execution to make your cfix test runs more effective</title>
		<link>http://jpassing.com/2010/01/24/how-to-cutomize-test-run-execution-to-make-your-cfix-test-runs-more-effective/</link>
		<comments>http://jpassing.com/2010/01/24/how-to-cutomize-test-run-execution-to-make-your-cfix-test-runs-more-effective/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 09:51:04 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[cfix]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Visual Assert]]></category>
		<category><![CDATA[fixture]]></category>
		<category><![CDATA[harness]]></category>
		<category><![CDATA[qa]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[unit testing]]></category>
		<category><![CDATA[unit testing framework]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=369</guid>
		<description><![CDATA[One of the features introduced back in cfix 1.2 was the ability to customize test execution with the command line parameters -fsr and -fsf. Using these switches can make your test runs more effective and can help simplify debugging &#8212; so it is worth spending a minute on this topic. Assume our test run comprises [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=369&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>One of the features introduced back in <a href='http://www.cfix-testing.org/'>cfix 1.2</a> was the ability to customize test execution with the command line parameters <tt>-fsr</tt> and <tt>-fsf</tt>. Using these switches can make your test runs more effective and can help simplify debugging &#8212; so it is worth spending a minute on this topic.</p>
<p>Assume our test run comprises two fixtures, <i>Fixture A</i> and <i>Fixture B</i>. As fixtures are always run in alphabetic order, and tests run in the order they are defined, the first test to be executed is <i>Test 1</i> of <i>Fixture A</i>, followed by <i>Test 2</i> of <i>Fixture A</i>, and so on. Assuming all tests of <i>Fixture A</i> succeed, execution then proceeds with the first test of <i>Fixture B</i>. The following figure illustrates this:</p>
<img src="http://jpassing.files.wordpress.com/2009/07/fixtureexecution_success.png?w=500" alt="Successful execution of a unit testing suite" title="unit testing"   class="size-full wp-image-370" />
<p>Things get interesting when one of the tests fails: Let us assume <i>Test 2</i> of <i>Fixture A</i> leads to a failed assertion. The default behavior of cfix, which equals the behavior of JUnit and NUnit, is to report the failure and proceed with <i>Test 3</i> of the same fixture:</p>
<img src="http://jpassing.files.wordpress.com/2009/07/fixtureexecution_def.png?w=500" alt="Execution resumes after a failed unit test" title="framework"   class="size-full wp-image-371" />
<p>In many cases, this is the appropriate thing to do &#8212; letting the test run to completion and figure out the reasons for the failure afterwards. But in certain scenarios, resuming with <i>Test 3</i> might not be the smartest thing to do &#8212; rather, as soon as a test fails, execution should proceed with the next <i>fixture</i>. This is what <tt>-fsf</tt> (<i>&#8220;<b>s</b>hort-circuit <b>f</b>ixture&#8221;</i>) does:</p>
<img src="http://jpassing.files.wordpress.com/2009/07/fixtureexecution_fsf.png?w=500" alt="Short-circuiting the fixture" title="Short-circuiting the fixture"   class="size-full wp-image-375" />
<p>Once a test case has failed, all remaining tests of the same fixture are skipped.</p>
<p>When debugging, even resuming at the next fixture is often not desired. Rather, as soon as one test fails, you may immediately want to take a closer a look at the failure, so resuming the run is mute. <tt>-fsr</tt> (<i>&#8220;<b>s</b>hort-circuit <b>r</b>un&#8221;</i>) does right that: It aborts the run immediately.</p>
<img src="http://jpassing.files.wordpress.com/2009/07/fixtureexecution_fsr21.png?w=500" alt="Short-circuiting the run" title="Short-circuiting the run"   class="size-full wp-image-374" />
<p>By the way &#8212; in <a href='http://www.visualassert.com/'>Visual Assert</a>, you can quickly access these options in the <i>Options</i> menu in the Test Explorer window:</p>
<p><img src="http://jpassing.files.wordpress.com/2010/01/vaoptions.png?w=500" alt="Visual Assert Test Explorer" title="Visual Assert Test Explorer" /></p>
<br />Posted in cfix, Testing, Visual Assert Tagged: cfix, fixture, harness, qa, test, unit testing, unit testing framework, Visual Assert <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=369&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2010/01/24/how-to-cutomize-test-run-execution-to-make-your-cfix-test-runs-more-effective/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.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/07/fixtureexecution_success.png" medium="image">
			<media:title type="html">unit testing</media:title>
		</media:content>

		<media:content url="http://jpassing.files.wordpress.com/2009/07/fixtureexecution_def.png" medium="image">
			<media:title type="html">framework</media:title>
		</media:content>

		<media:content url="http://jpassing.files.wordpress.com/2009/07/fixtureexecution_fsf.png" medium="image">
			<media:title type="html">Short-circuiting the fixture</media:title>
		</media:content>

		<media:content url="http://jpassing.files.wordpress.com/2009/07/fixtureexecution_fsr21.png" medium="image">
			<media:title type="html">Short-circuiting the run</media:title>
		</media:content>

		<media:content url="http://jpassing.files.wordpress.com/2010/01/vaoptions.png" medium="image">
			<media:title type="html">Visual Assert Test Explorer</media:title>
		</media:content>
	</item>
		<item>
		<title>The hidden danger of forgetting to specify %SystemRoot% in a custom environment block</title>
		<link>http://jpassing.com/2009/12/28/the-hidden-danger-of-forgetting-to-specify-systemroot-in-a-custom-environment-block/</link>
		<comments>http://jpassing.com/2009/12/28/the-hidden-danger-of-forgetting-to-specify-systemroot-in-a-custom-environment-block/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 20:42:02 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[COM]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[cryptoapi]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[procmon]]></category>
		<category><![CDATA[SXS]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=607</guid>
		<description><![CDATA[When spawning a process using CreateProcess and friends, the child process usually inherits the environment (i.e. all environment variables) of the spawning process. Of course, this behavior can be overridden by creating a custom environment block and passing it to the lpEnvironment parameter of CreateProcess. While the MSDN documentation on CreateProcess does contain a remark [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=607&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>When spawning a process using CreateProcess and friends, the child process usually inherits the environment (i.e. all environment variables) of the spawning process. Of course, this behavior can be overridden by creating a custom environment block and passing it to the <code>lpEnvironment</code> parameter of <code>CreateProcess</code>.</p>
<p>While the <a href='http://msdn.microsoft.com/en-us/library/ms682425(VS.85).aspx'>MSDN documentation on CreateProcess</a> does contain a remark saying that current directory information (<code>=C:</code> and friends) should be included in such a custom environment block, it does not mention the importance of <code>SystemRoot</code>.</p>
<p>The <code>SystemRoot</code> environment variable usually contains the path c:\windows &#8212; the path that is also accessible using the <code>GetWindowsDirectory</code> function. This environment variable, as it turns out, is not only handy for scripting purposes &#8212; it is, in fact, essential for the proper operation of many libraries.</p>
<p>For very simple programs, forgetting to include <code>SystemRoot</code> in a custom environment block usually goes unnoticed &#8212; even an empty environment block works just fine. In case of more complex applications, however, the omission of this variable can quickly lead to errors &#8212; on Vista, the most common error that can be tracked back to a missing <code>SystemRoot</code> variable is SXS failing to find/load basic system libraries.</p>
<p>Now that we have Windows 7, <code>SystemRoot</code> seems to have become even more important: Now it is not only SXS that requires <code>SystemRoot</code> to be specified properly, but also CryptoAPI.</p>
<p>In my particular case, I was experiencing a 0&#215;80090006 (&#8220;Invalid Signature&#8221;, NTE_BAD_SIGNATURE) error whenever the child process attempted to call <code>CoGetObject</code> to retrieve a pointer to a DCOM object. While this error occured on Windows 7, the same code worked fine on Windows Vista and XP. </p>
<p>Given this more than general error message, it seemed anything but clear to me what the problem was, so I attached a debugger to the child process (using gflags/Image File Execution Options). Once I did that, I got the following messages in my debug output output: </p>
<blockquote><p>
CryptAcquireContext:  CheckSignatureInFile failed at cryptapi.c line 5198<br />
CryptAcquireContext:  Failed to read registry signature value at cryptapi.c line 873
</p></blockquote>
<p>I set a breakpoint on <code>CryptAcquireContextW</code> and looked at the stack trace:</p>
<blockquote><pre>

0:000&gt; k
ChildEBP RetAddr  
0008f8a4 75760a4f ole32!CRandomNumberGenerator::Initialize+0x2e
0008f8b0 75760769 ole32!CRandomNumberGenerator::GenerateRandomNumber+0xd
0008f8e8 757609cf ole32!CStdMarshal::AddIPIDEntry+0x48
0008f93c 75766aae ole32!CStdMarshal::MarshalServerIPID+0x5a
0008f994 75767519 ole32!CStdMarshal::MarshalObjRef+0xb9
0008f9c8 7576778e ole32!MarshalInternalObjRef+0x8c
0008fa4c 757676ba ole32!CRemoteUnknown::CRemoteUnknown+0x3b
0008fa8c 7576754a ole32!CComApartment::InitRemoting+0x19c
0008fa98 7586d83e ole32!CComApartment::StartServer+0x13
0008faa8 757652b3 ole32!InitChannelIfNecessary+0x1e
0008fb20 757fc046 ole32!CoUnmarshalInterface+0x38
0008fb34 757fd3d5 ole32!CObjrefMoniker::Load+0x26
0008fb70 7573cb7f ole32!CObjrefMonikerFactory::ParseDisplayName+0x16f
0008fbbc 7573caae ole32!FindClassMoniker+0x8b
0008fbf4 75789dc7 ole32!MkParseDisplayName+0xbb
0008fc3c 6954ce84 ole32!CoGetObject+0x82
...
</pre>
</blockquote>
<p>Quite obviously, COM, trying to unmarshal an interface, needed a random number and attempted to use CryptoAPI for this purpose. Looking at the paramters of CryptAcquireContext, I saw that the <i>Microsoft Strong Cryptographic Provider</i> was attempted to be loaded &#8212; one of the standard Windows CSPs &#8212; so everything seemed normal.</p>
<p>Guided by the message <i>Failed to read registry signature</i>, I switched to <i>Process Monitor</i> to see which registry key was being queried: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Cryptography\Defaults\Provider\Microsoft Strong Cryptographic Provider.</p>
<p>Taking a look at this key in regedit, it did not take long before spotting <code>SystemRoot</code> as the culprit:</p>
<p><img src="http://jpassing.files.wordpress.com/2009/12/regedit.png?w=500" alt="" title="Regedit" class="alignright size-medium wp-image-610" /></p>
<p>Looking at file system activity in <i>Process Monitor</i> proved this:</p>
<p><img src="http://jpassing.files.wordpress.com/2009/12/procmon3.png?w=500&#038;h=164" alt="Process Monitor" title="Process Monitor" width="500" height="164" class="alignright size-full wp-image-618" /></p>
<p>Interestingly, on Windows Vista, all <code>Image Path</code> values in the CSP registry keys do <i>not</i> use <code>SystemRoot</code> &#8212; they just contain the file name and rely on the library path in order to locate the libraries at runtime. This explains why my code worked fine on Vista.</p>
<p>(While making this change, the developer seemed to forget to change the value&#8217;s type from REG_SZ to REG_EXPAND_SZ though :) )</p>
<p><b>Bottom Line 1</b>: Always, <i>always</i> include <code>SystemRoot</code> when passing a custom environment block to CreateProcess.</p>
<p><b>Bottom Line 2</b>: The case also shows how a seemingly trivial change in Windows (using an absolute path rather then just a file name in the CSP registry key) can lead to an application incompatibility.</p>
<br />Posted in COM, Debugging, Win32 Tagged: api, cryptoapi, process, procmon, SXS, Win32 <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=607&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2009/12/28/the-hidden-danger-of-forgetting-to-specify-systemroot-in-a-custom-environment-block/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://2.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/12/regedit.png" medium="image">
			<media:title type="html">Regedit</media:title>
		</media:content>

		<media:content url="http://jpassing.files.wordpress.com/2009/12/procmon3.png" medium="image">
			<media:title type="html">Process Monitor</media:title>
		</media:content>
	</item>
		<item>
		<title>cfix finished 2nd in ATI&#8217;s Automation Honors Awards, surpassed only by JUnit</title>
		<link>http://jpassing.com/2009/12/19/cfix-finished-2nd-in-atis-automation-honors-awards/</link>
		<comments>http://jpassing.com/2009/12/19/cfix-finished-2nd-in-atis-automation-honors-awards/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 14:25:13 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[cfix]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[ati]]></category>
		<category><![CDATA[automated test]]></category>
		<category><![CDATA[awards]]></category>
		<category><![CDATA[unit test]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=589</guid>
		<description><![CDATA[Along with JUnit, JWebUnit, NUnit, and SimpleTest, cfix was one of the nominees for the Automated Testing Institute&#8217;s Automation Honors Award 2009 in the category Best Open Source Unit Automated Test Tool. A few days ago, the results were published and cfix finished second &#8212; surpassed only by JUnit, which finished 1st (No real surprise [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=589&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Along with JUnit, JWebUnit, NUnit, and SimpleTest, cfix was one of the nominees for the <a href='http://www.atihonors.automatedtestinginstitute.com/'>Automated Testing Institute&#8217;s Automation Honors Award 2009</a> in the category <i>Best Open Source Unit Automated Test Tool</i>. A few days ago, the results were published and cfix finished second &#8212; surpassed only by JUnit, which finished 1st (No real surprise here). If you are interested, there is a <a href='http://www.automatedtestinginstitute.com/home/index.php?option=com_content&amp;view=article&amp;id=1262&amp;Itemid=131'>video</a> in which the results are presented.</p>
<br />Posted in cfix, Misc Tagged: ati, automated test, awards, cfix, unit test <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=589&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2009/12/19/cfix-finished-2nd-in-atis-automation-honors-awards/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.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>NTrace paper published on computer.org</title>
		<link>http://jpassing.com/2009/11/25/ntrace-paper-published-on-computer-org/</link>
		<comments>http://jpassing.com/2009/11/25/ntrace-paper-published-on-computer-org/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 20:37:59 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[NTrace]]></category>
		<category><![CDATA[diagnostics]]></category>
		<category><![CDATA[fbt]]></category>
		<category><![CDATA[IEEE]]></category>
		<category><![CDATA[paper]]></category>
		<category><![CDATA[reverse engineering]]></category>
		<category><![CDATA[tracing]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=581</guid>
		<description><![CDATA[Our paper NTrace: Function Boundary Tracing for Windows on IA-32 from WCRE 2009 has now been published on computer.org: Abstract: For a long time, dynamic tracing has been an enabling technique for reverse engineering tools. Tracing can not only be used to record the control flow of a particular component such as a piece of [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=581&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Our paper <i>NTrace: Function Boundary Tracing for Windows on IA-32</i> from WCRE 2009 has now been published on computer.org:</p>
<p>Abstract:</p>
<blockquote><p>
For a long time, dynamic tracing has been an enabling technique for reverse engineering tools. Tracing can not only be used to record the control flow of a particular component such as a piece of malware itself, it is also a way to analyze the interactions of a component and their impact on the rest of the system. Unlike Unix-based systems, for which several dynamic tracing tools are available, Windows has been lacking appropriate tools. From a reverse engineering perspective, however, Windows may be considered the most relevant OS, particularly with respect to malware analysis. In this paper, we present NTrace, a dynamic tracing tool for the Windows kernel, drivers, system libraries, and applications that supports function boundary tracing. NTrace incorporates 2 novel approaches: (1) a way to integrate with Windows Structured Exception Handling and (2) a technique to instrument binary code on IA-32 architectures that is both safe and more efficient than DTrace.
</p></blockquote>
<p><a href='http://www.computer.org/portal/web/csdl/doi/10.1109/WCRE.2009.12'>http://www.computer.org/portal/web/csdl/doi/10.1109/WCRE.2009.12</a></p>
<p>If you do not feel like reading the paper, you can also take a look at the screencasts:</p>
<p><span style='margin-left:20px;'><br />
<a href='http://int3.de/download/ntrace/NTraceKM.wmv'><img src='http://ntrace.files.wordpress.com/2009/09/screencastpart11.png?w=80' border='0'></a></p>
<p><a href='http://int3.de/download/ntrace/NTraceKM.wmv'>Part 1. Kernel Mode NTrace:<br />
Tracing NTFS and the I/O manager</a></p>
<p><a href='http://int3.de/download/ntrace/NTraceUM.wmv'><img src='http://ntrace.files.wordpress.com/2009/09/screencastpart2.png?w=80' border='0' alt='Part 2: User Mode NTrace' /></a></p>
<p><a href='http://int3.de/download/ntrace/NTraceUM.wmv'>Part 2. User Mode NTrace:<br />
Tracing COM loading a DLL</a><br />
</span></p>
<br />Posted in NTrace Tagged: diagnostics, fbt, IEEE, NTrace, paper, reverse engineering, tracing <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=581&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2009/11/25/ntrace-paper-published-on-computer-org/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://int3.de/download/ntrace/NTraceKM.wmv" length="6729770" type="video/x-ms-wmv" />
<enclosure url="http://int3.de/download/ntrace/NTraceUM.wmv" length="17188692" type="video/x-ms-wmv" />
	
		<media:content url="http://2.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://ntrace.files.wordpress.com/2009/09/screencastpart11.png?w=80" medium="image" />

		<media:content url="http://ntrace.files.wordpress.com/2009/09/screencastpart2.png?w=80" medium="image">
			<media:title type="html">Part 2: User Mode NTrace</media:title>
		</media:content>
	</item>
		<item>
		<title>Visual Assert Beta 3 released</title>
		<link>http://jpassing.com/2009/11/24/visual-assert-beta-3-released/</link>
		<comments>http://jpassing.com/2009/11/24/visual-assert-beta-3-released/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 17:05:27 +0000</pubDate>
		<dc:creator>jpassing</dc:creator>
				<category><![CDATA[cfix]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Visual Assert]]></category>
		<category><![CDATA[addin]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[unit testing]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://jpassing.wordpress.com/?p=542</guid>
		<description><![CDATA[A third beta release of Visual Assert is now available for download on www.visualassert.com. Visual Assert, in case you have not tried it yet, is an Add-In for Visual Studio that adds unit testing capabilities to the Visual C++ IDE: Based on the cfix unit testing framework, Visual Assert allows unit tests to be written, [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=542&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>A third beta release of <a href='http://www.visualassert.com/'>Visual Assert</a> is now <a href='http://www.visualassert.com/unit-testing-framework/download.html'>available for download on www.visualassert.com</a>.</p>
<p>Visual Assert, in case you have not tried it yet, is an Add-In for Visual Studio that adds unit testing capabilities to the Visual C++ IDE: Based on the <a href='http://www.cfix-testing.org/'>cfix unit testing framework</a>, Visual Assert allows unit tests to be written, run, and debugged from within the IDE. Pretty much like Junit/Eclipse, TestDriven.Net or MSTest, but for real, native code &#8212; code written in C or C++.</p>
<h3>Bugs, bugs, bugs, bugs</h3>
<p>Alas, there were still a few of them in the previous two beta releases. Luckily though, almost all I received from users or found by internal testing were relatively minor in nature. Still, I want Visual Assert to be as high quality as possible and decided to add this third beta release into the schedule and take the time to focus on &#8212; you guessed it &#8212; bugfixing, bugfixing, bugfixing, and bugfixing.</p>
<p>Speaking of bug reports, I have to thank all users of Visual Assert and cfix who reported bugs, suggested new features or provided general feedback. Your input has been, and still is highly appreciated. Although I had to postpone any feature suggestions to a later release, I tried hard to resolve all bugs and have them fixed in this new release.</p>
<h3>Download, Try it, Share Your Opinion</h3>
<p>Of course, using the new Beta version is free. So whether you have already used the previous beta or not, whether you are a unit testing newbie or write unit tests on a daily basis, be sure to give the new version a try. And of course, do not forget to let me know about your feedback, suggestions, found bugs, etc.!</p>
<div style='padding-left:50px;padding-bottom:20px;'>
<p><a href='http://www.visualassert.com/download/VisualAssert_1.0.2.3612.msi'><br />
<b>Download Visual Assert Beta 3</b><br />
Version 1.0.2.3612<br />
</a>
</div>
<br />Posted in cfix, Testing, Tools, Visual Assert Tagged: addin, c, cfix, tdd, Testing, unit testing, Visual Assert, Visual Studio <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=542&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2009/11/24/visual-assert-beta-3-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.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.1 released</title>
		<link>http://jpassing.com/2009/11/07/cfix-1-5-1-released/</link>
		<comments>http://jpassing.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[cfix]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools]]></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 [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=543&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<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>
<br />Posted in cfix, Testing, Tools Tagged: bugfix, cfix, qa, release, unittesting <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=543&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2009/11/07/cfix-1-5-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.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.com/2009/10/21/ltcg-issues-with-the-win7amd64-environment-of-wdk-7600/</link>
		<comments>http://jpassing.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[cfix]]></category>
		<category><![CDATA[WDK]]></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 [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=533&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<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>
<br />Posted in cfix, WDK Tagged: ddk, library, ltcg, WDK, win7 <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=533&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2009/10/21/ltcg-issues-with-the-win7amd64-environment-of-wdk-7600/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://2.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.com/2009/10/13/launched-ntrace-org/</link>
		<comments>http://jpassing.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 [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=530&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<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>
<br />Posted in NTrace, Tools Tagged: dtrace, dynamic tracing, fbt, lille, NTrace, tracing, wcre, Windows, x86 <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=530&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2009/10/13/launched-ntrace-org/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.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.com/2009/10/09/mixing-32-and-64-bit-components-in-a-single-msi/</link>
		<comments>http://jpassing.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 [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=408&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<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>
<br />Posted in Windows Installer Tagged: 64-bit, amd64, COM, i386, MSI, Registry, Windows Installer, WOW <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=408&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2009/10/09/mixing-32-and-64-bit-components-in-a-single-msi/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://2.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.com/2009/10/06/ill-be-at-wcre-2009-presenting-ntrace/</link>
		<comments>http://jpassing.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 [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=522&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<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>
<br />Posted in Kernel, NTrace Tagged: conference, fbt, france, Kernel, NT, NTrace, reverse engineering, tracing, wcre, Windows <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=522&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2009/10/06/ill-be-at-wcre-2009-presenting-ntrace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.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.com/2009/09/05/visual-assert-beta-2-released/</link>
		<comments>http://jpassing.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[cfix]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[Visual Assert]]></category>
		<category><![CDATA[Visual Studio]]></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 [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=467&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<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>
<br />Posted in cfix, Testing, Visual Assert, Visual Studio Tagged: addin, cfix, qa, tdd, test-driven, unit testing, Visual Assert, Visual Studio <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jpassing.com&#038;blog=1468393&#038;post=467&#038;subd=jpassing&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jpassing.com/2009/09/05/visual-assert-beta-2-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.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>
