2

I have a folder which is displayed in Windows Explorer as:
enter image description here

Inside this folder the hidden desktop.ini has this content:

[.ShellClassInfo]
InfoTip=@Shell32.dll,-12688
IconFile=%SystemRoot%\system32\mydocs.dll
IconIndex=-101

This mydocs.dll actually contains exactly TWO icons, where the second one is the icon used by Windows Explorer to display the above folder.

So shouldn't the last line of the desktop.ini content be IconIndex=1 (supposing Windows starts counting at 0) instead of IconIndex=-101?

I have tried to interpret the -101 value as binary, hexadecimal, octal, but none was translating to a number which would represent the second icon.

So, how is the -101 value pointing to the SECOND icon in mydocs.dll?

user1580348
  • 1,488
  • 5
  • 20
  • 33

1 Answers1

2

The negative IconIndex refers to the inverse of the Resource ID. See this Microsoft dev blog:

In Windows 95, the Extract­Icon function was enhanced so that you could also specify an icon by its resource ID by passing its negative as the icon index.

See also the Microsoft documentation.

In your case, the icon used has a resource ID: 101 and therefore it is shown as -101. After checking my own mydocs.dll, It shows that the resource ID is 101 for the icon you displayed and resource ID: 100 for the first icon (folder with document).

Narvarth
  • 165
  • 1
  • 4
Muffin
  • 66
  • 2
  • Is this a general and RELIABLE rule that resource IDs in desktop.ini always start counting from `100`? – user1580348 Mar 10 '15 at 22:25
  • 2
    @user1580348 It is *not* a reliable rule. It depends on how the developers wrote the resource file for the application when they built the application. See [ICON resource](https://msdn.microsoft.com/en-us/library/windows/desktop/aa381018%28v=vs.85%29.aspx) for more information. The *resourceID* is a "Unique name or a 16-bit unsigned integer value identifying the resource." – DavidPostill Mar 11 '15 at 08:40