title: SHGetFileInfo returns wrong icon for OneDrive folder
body: <p>I am trying to use <code>SHGetFileInfo</code> to get the icon for files and folders. I noticed that it does not work in one case: the OneDrive folder that is in my user profile folder. In that case, the call to SHGetFileInfo succeeds, but I get the default icon for an executable:</p>
  
  <p><img src="https://i.stack.imgur.com/GJpMp.png" alt="What I get instead of the OneDrive icon"></p>
  
  <p>Here is how I call the function:</p>
  
  <pre><code>HIMAGELIST imageList;
  SHFILEINFO shfi;
  
  // Get the path to the OneDrive folder
  LPTSTR src = _T("%USERPROFILE%\\OneDrive");
  TCHAR dest[MAX_PATH];
  ExpandEnvironmentStrings(src, dest, MAX_PATH);
  
  // Load the image from the OneDrive folder
  ZeroMemory(&amp;shfi, sizeof(shfi));
  imageList = (HIMAGELIST)SHGetFileInfo(
      dest,
      FILE_ATTRIBUTE_NORMAL,
      &amp;shfi,
      sizeof(shfi),
      SHGFI_ICON | SHGFI_SYSICONINDEX);
  </code></pre>
  
  <p>And here is how I am drawing the icon:</p>
  
  <pre><code>case WM_PAINT:
  {
      PAINTSTRUCT ps;
      HDC hdc = BeginPaint(hwnd, &amp;ps);
      ImageList_Draw(imageList, shfi.iIcon, hdc, 0, 0, ILD_NORMAL);
      EndPaint(hwnd, &amp;ps);
  }
  break;
  </code></pre>
  
  <p>I made a short self-contained example for the app on pastebin: <a href="http://pastebin.com/bdTvEQT5" rel="nofollow noreferrer">http://pastebin.com/bdTvEQT5</a></p>
  
  <p>In this short self-contained example I omitted any error checking code for brevity. Also, I have hard-coded the location of the folder for the purposes of the example. In my real app I am enumerating the folders in the file system and that's how I am getting the location of the OneDrive folder. The icon extraction code needs to work with any folder that is enumerated.</p>
  
  <p>What am I doing wrong?</p>