title: Why is OpenSubKey() returning null on my Windows 7 64-bit system?
body: <p>Do OpenSubKey() and other Microsoft.Win32 registry functions return null on 64-bit systems when 32-bit registry keys are under Wow6432node in the registry?</p>
  
  <p>I'm working on a unit testing framework that makes a call to OpenSubKey() from the .NET library.</p>
  
  <p>My development system is a Windows&nbsp;7 64-bit environment with <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Visual_Studio_2008" rel="noreferrer">Visual&nbsp;Studio&nbsp;2008</a> SP1 and the Windows&nbsp;7 SDK installed.</p>
  
  <p>The application we're unit testing is a 32-bit application, so the registry is virtualized under <code>HKLM\Software\Wow6432node</code>. When we call:</p>
  
  <pre><code>Registry.LocalMachine.OpenSubKey( @"Software\MyCompany\MyApp\" );
  </code></pre>
  
  <p>Null is returned, however explicitly stating to look here works:</p>
  
  <pre><code>Registry.LocalMachine.OpenSubKey( @"Software\Wow6432node\MyCompany\MyApp\" );
  </code></pre>
  
  <p>From what I understand this function should be agnostic to 32-bit or 64-bit environments and should know to jump to the virtual node.</p>
  
  <p>Even stranger is the fact that the exact same call inside a compiled and installed version of our application is running just fine on the same system and is getting the registry keys necessary to run; which are also being placed in <code>HKLM\Software\Wow6432node</code>.</p>
  
  <p>What should I do?</p>