title: Cannot get SHGetKnownFolderPath() function working
body: <p>I am having troubles using SHGetKnownFolderPath() function. 
  I am getting the following error message: 
  <code>Type error in argument 1 to 'SHGetKnownFolderPath'; expected 'const struct _GUID *' but found 'struct _GUID'.</code></p>
  
  <p>In the <code>KnowFolders.h</code> we have the following relevant definitions:</p>
  
  <pre><code>#define DEFINE_KNOWN_FOLDER(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
      EXTERN_C const GUID name
  ...
  DEFINE_KNOWN_FOLDER(FOLDERID_ProgramFiles,0x905e63b6,0xc1bf,0x494e,0xb2,0x9c,0x65,0xb7,0x32,0xd3,0xd2,0x1a);
  </code></pre>
  
  <p>I am using Pelles C compiler .</p>
  
  <p>This is my sample code:</p>
  
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;wchar.h&gt;
  #include &lt;KnownFolders.h&gt;
  #include &lt;shlobj.h&gt;
  
  int wmain(int argc, wchar_t **argv) {
  
      PWSTR path = NULL;
  
      HRESULT hr = SHGetKnownFolderPath(FOLDERID_ProgramFiles, 0, NULL, &amp;path);    
  
      if (SUCCEEDED(hr)){
  
          wprintf(L"%ls", path);
      }
  
      CoTaskMemFree(path);
  
      return 0;
  }
  </code></pre>
  
  <p>How to fix this error message?</p>
  
  <p><strong>EDIT</strong> I have found code examples with SHGetKnownFolderPath(); all of
  them execute the function without the pointer. For instance:</p>
  
  <pre><code>hr = SHGetKnownFolderPath(FOLDERID_Public, 0, NULL, &amp;pszPath);
  if (SUCCEEDED(hr))
  {
      wprintf(L"FOLDERID_Public: %s\n", pszPath);
      CoTaskMemFree(pszPath);
  }
  </code></pre>
  
  <p><a href="http://www.getcodesamples.com/src/3E9DECF9/DDEC135B" rel="nofollow">CppShellKnownFolders.cpp</a></p>