Why does Add or Remove Programs show a large blank space?

Raymond Chen

Raymond

Some people have noticed that certain programs cause the
Add or Remove Programs control panel to create an enormous
amount of blank space. What’s going on?

These are programs that have bad custom uninstall icon registrations.

If you go to the registry key
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall,
you’ll find a list of programs that have registered for appearing
in the Add or Remove Programs control panel.
Some of them might have been so kind as to provide a
“DisplayIcon” value,
thereby saving the control panel the indignity of

having to guess at an appropriate icon
.

Unfortunately, if they put a bad icon registration in that registry
value, the result is a bunch of blank space since the control panel
is trying to reserve space for a bogus icon.

The format of the icon registration is a filename, optionally
followed by a comma and a decimal number.

C:\full\path\to\icon\file.dll
C:\full\path\to\icon\file.dll,123

Since this is not a command line, quotation marks are not necessary
(although they are tolerated).
Furthermore, the number
can be any value except for -1.
Why is -1 forbidden?
Because

the ExtractIcon function

treats the value -1 specially.

If the icon file does not exist in the icon file,
or if the icon number is -1,
then the icon specification is invalid and the
Add or Remove Programs control panel will reserve an odd amount of space
for an icon that doesn’t exist.

Perhaps the Add or Remove Programs control panel should be more
tolerant of invalid icon registrations?
Or should it stay the way it is,
adhering to the
“Don’t bend over backwards to fix buggy
programs; force the program authors to fix their own bugs” policy
that so many of my readers advocate?
(Noting furthermore that refusing to accomodate invalid icon registrations
makes it look like Add or Remove Programs is the buggy one.)

Raymond Chen
Raymond Chen

Follow Raymond