Handle E_PENDING result for IExtractIconW::GetIconLocation

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 17
    • Component/s: client-libs

      When IExtractIconW::GetIconLocation [1] is used with GIL_ASYNC flag, it can return E_PENDING.

      The usage of GIL_ASYNC is the reason why the drives lost their custom icons [2]. If I remove the GIL_ASYNC flag, a customised icon is returned.

      In Remarks section [3], the documentation for GetIconLocation says:
      "When a client sets the GIL_ASYNC flag in uFlags and receives E_PENDING as a return value, it typically creates a background thread to extract the icon. It calls GetIconLocation from that thread, without the GIL_ASYNC flag, to retrieve the icon location. It then calls IExtractIcon::Extract to extract the icon. Returning E_PENDING implies that the object is free threaded. In other words, it can safely be called concurrently by multiple threads."

      [1] https://learn.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-iextracticonw-geticonlocation
      [2] https://github.com/openjdk/jdk/pull/380#issuecomment-704590746
      [3] https://learn.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-iextracticonw-geticonlocation#remarks

            Assignee:
            Alexey Ivanov
            Reporter:
            Alexey Ivanov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: