Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-19122

SHGetFileInfo with SHGFI_USEFILEATTRIBUTES causes SHGFI_ICON to return the wrong class icon for .exe files

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • None
    • None

    Description

      If SHGFI_USEFILEATTRIBUTES is specified, it is supposed to return the default .exe icon if the supplied path does not exist or if the .exe does not have embedded icons.

      static void MakeIconWindow(LPCWSTR path, UINT att, UINT flags)
      {
          SHFILEINFO fi;
          if (SHGetFileInfoW(path, att, &fi, sizeof(fi), SHGFI_ICON|SHGFI_SMALLICON|SHGFI_SHELLICONSIZE|flags))
          {
              static int x = 0;
              HWND hWnd = CreateWindowEx(WS_EX_TOOLWINDOW|WS_EX_APPWINDOW, TEXT("STATIC"), path, SS_ICON|SS_REALSIZEIMAGE|WS_POPUP|WS_VISIBLE, x, 0, 32, 32, 0, 0, 0, 0);
              SendMessage(hWnd, STM_SETIMAGE, IMAGE_ICON, (LPARAM) fi.hIcon);
              x += 32;
          }
      }
      static void Bug()
      {
          WCHAR path[MAX_PATH];
          lstrcatW(path+GetSystemDirectory(path, MAX_PATH), L"\\ping.exe"); // a real exe without embedded icon
          MakeIconWindow(path, 0, 0);
          MakeIconWindow(L"doesnotexist.exe", 0, SHGFI_USEFILEATTRIBUTES); // .exe icon
          MakeIconWindow(L"doesnotexist", 0, SHGFI_USEFILEATTRIBUTES); // default file icon
          MessageBoxA(0, "Stop?", 0, 0);
      }
      

       

      This might be a Wine bug.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              whindsaks whindsaks
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: