title: RegOpenKeyEx/RegGetValue return ERROR_FILE_NOT_FOUND on keys that exist
body: <p>The registry functions are returning "not found" on keys that certainly exist. I've got the right charset and using double backslashes, so that's not the problem.</p>
  
  <p>Here is the output from exporting the key:</p>
  
  <pre><code>[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Netmon3]
  "NetmonVersion"="3.4.2350.0"
  "NPLVersion"="03.02"
  "InstallDir"="C:\\prog\\netmon3\\"
  "NetmonEdition"="Capture and Parser Engine"
  </code></pre>
  
  <p>Here is the function call:</p>
  
  <pre><code>x = RegOpenKeyExA(
             HKEY_LOCAL_MACHINE, 
             "SOFTWARE\\Microsoft\\Netmon3", 
             0, 
             KEY_READ, &amp;hKey);
  </code></pre>
  
  <p>The returned value x is 2, meaning <code>ERROR_FILE_NOT_FOUND</code>. Using simply "<code>SOFTWARE\\Microsoft</code>" as the string works fine, though.</p>
  
  <p>Calling RegGetValue() has the same problem:</p>
  
  <pre><code>x = RegGetValueA(
          HKEY_LOCAL_MACHINE,
          "SOFTWARE\\Microsoft\\Netmon3",
          "InstallDir",
          RRF_RT_ANY,
          NULL,
          (PVOID)install_directory,
          &amp;BufferSize
          );
  </code></pre>
  
  <p>Again, I'm getting 2 as the result, meaning not found.</p>
  
  <p>I checked permissions on it, and all "Users" have "Read" permissions on it.</p>
  
  <p>Whatever I'm missing, it's got to see be something obvious, but racking my brains, I can't see it.</p>
  
  <p>--</p>
  
  <p>Marsh Ray has the answer below: I was compiling 32-bit on a 64-bit system, and the Netmon3 install was 64-bit. Changing the build settings to 64-bit fixed the problem.</p>