Registering Shell Extension Handlers on Windows NT and Windows 2000 Systems
Because Windows NT and Windows 2000 systems are designed to be used in a managed environment, installing a Shell extension handler might be somewhat different than for Windows 95 and Windows 98 systems. In particular, access to the registry could be administratively restricted, requiring a somewhat different approach to installation than described in the previous section.
Note The following discussion applies to both Windows NT and Windows 2000 systems. However, with Windows 2000 and later systems, setup programs should generally not write directly to the registry. Instead, setup should be accomplished with Windows Installer packages. These tools ensure that software runs well under Windows 2000, and provides access to new capabilities, such as per-user class registration.
Shell extension handlers run in the Shell process. Because it is a system process, the administrator of a Windows NT system can limit Shell extension handlers to those on an approved list by setting the EnforceShellExtensionSecurity value of the Explorer key to 1 (one), as shown here:
HKEY_CURRENT_USER
Software
Microsoft
Windows
CurrentVersion
Policies
Explorer
EnforceShellExtensionSecurity = 1
To place a Shell extension handler on the approved list, create a REG_SZ value whose name is the string form of the handler's GUID under the Approved key.
HKEY_LOCAL_MACHINE
Software
Microsoft
Windows
CurrentVersion
Shell Extensions
Approved
For example, the following example adds the MyCommand and MyPropSheet handlers to the approved list.
HKEY_LOCAL_MACHINE
Software
Microsoft
Windows
CurrentVersion
Shell Extensions
Approved
{00000000-1111-2222-3333-444444444444} = MyCommand
{11111111-2222-3333-4444-555555555555} = MyPropSheet
The Shell does not use the value that is assigned to the GUID, but it should be set to make inspecting the registry easier.
Your setup application can add values to the Approved key only if the person installing the application has sufficient privileges. If the attempt to add an extension handler fails, you should inform the user that administrative privileges are required to fully install the application. If the handler is essential to the application, you should fail the setup and notify the user to contact an administrator.
While there is no need to add values to the Approved key on Windows 95 or Windows 98 systems, there is no harm in doing so. The system will simply ignore them. However, there is no guarantee that the key will exist on these systems. Your setup program must be able to handle this case.