title: Visual C++ RegGetValue() fails in program where it shouldn't
body: <p>I'm making a C++ program using Visual C++ 2008 Express that gets the paths to specific apps from the registry, display a list of those that are installed, allows the user to pick one to configure, then launch the selected app.</p>
  
  <p>This program is supposed to retrieve the paths to (currently) three apps by using RegGetValue (from windows.h).</p>
  
  <p>While it works with Apps n°1 and 3, it fails with app n°2.</p>
  
  <p>The part of the source that handles the registry is available on Pastebin: <a href="http://pastebin.com/9X2hjGqh" rel="nofollow">http://pastebin.com/9X2hjGqh</a>.</p>
  
  <p>I get error n°234 (ERROR_MORE_DATA) when I add a cout to get the function's return.</p>
  
  <hr>
  
  <p>RegGetValue syntax:</p>
  
  <pre><code>LONG WINAPI RegGetValue(
    _In_         HKEY hkey,
    _In_opt_     LPCTSTR lpSubKey,
    _In_opt_     LPCTSTR lpValue,
    _In_opt_     DWORD dwFlags,
    _Out_opt_    LPDWORD pdwType,
    _Out_opt_    PVOID pvData,
    _Inout_opt_  LPDWORD pcbData
  );
  </code></pre>
  
  <p>Full reference here: <a href="http://msdn.microsoft.com/en-us/library/ms724875(v=VS.85).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms724875(v=VS.85).aspx</a></p>