How to register a shell extension

You can register a shell extension with the help of the regsvr32.exe command-line utility included in the Windows operating system. To do it, you should run it with the full path to your dll file specified as a parameter:

Start command-line utility
Register shell extension

To unregister your extension, you should run the same utility and specify not only the path but also the /u option:

Unregister shell extension

64-bit systems have both the 64-bit version and the 32-bit version of regsvr32 included in them. Moreover, if you pass your 32-bit extension to the 64-bit version of regsvr32, regsvr32 will automatically run the 32-bit version of regsvr32 and pass the name of the extension to it. The opposite is true as well. It allows any version of Regsvr32 to correctly register both 32- and 64-bit extensions.

Administrator privileges are required to register a shell extension. So you have to register it using an account that has the corresponding privileges on Windows XP and earlier. Starting from Windows Vista, it is possible to request administrator privileges. So if you do not have administrator privileges on these systems, it is recommended to run the regsvr32.exe utility from the command-line prompt launched with the "Run as administrator" command:

Start command-line utility

The Shell Ace library includes the RegExtension shell extension. If you choose to install this extension during the installation of Shell Ace, you can use RegExtension to register/unregister your extensions. When RegExtension is registered in the system, it adds the Register and Unregister items to the context menu opened with a right click on a dll file. Selecting one of these items will start the procedure of either registering or unregistering the dll file:

RegExtension

If the current user has no administrator privileges, the extension will request them by showing the corresponding dialog box where you should confirm granting administrator privileges.

The RegExtension extension also adds additional buttons to the Explorer toolbar (only in Windows XP and Windows 7):

RegExtension
RegExtension

These additional buttons work similarly to the corresponding items on the context menu.

When you distribute your extensions, it is recommended to register them with the regsvr32 utility because it calls the functions of the Shell Ace library in the end. It is recommended to do it because hidden keys can be added together with the actual registration of the COM object during the registration of extensions.

Thus, for instance, the DisableLowProcessIsolation key can be written when you register your Preview handler extension depending on the data load methods you use in the extension. By default, Explorer tries to pass a file stream to the Preview handler and, if it fails, stops working with the extension and if you read data from a file instead of a stream in your extension, your extension will not work in this situation. The DisableLowProcessIsolation key is used to solve this problem. It makes Explorer pass a file name instead of a stream to the extension.

Similar hidden keys considerably affect the performance of extensions and if you register your extension with the help of the regsvr32 utility, you do not have to keep in mind a lot of small details and can focus on the important thing - the functionality of your extension.

See also: