How to: Publish Windows Explorer Shell Extensions and Control Panel Applets


Introduction


With the introduction of TS RemoteApps in Windows Server 2008 Beta3, terminal server administrators now have the option to provide users with multiple individual applications, without exposing the Windows Desktop. When planning for providing applications in this manner, one should keep in mind that users often will need access to certain control panel applets, or portions of the explorer shell, that typically are accessed via the Windows Desktop. 


The following examples will show how to publish these items with two commonly used Windows Server 2003 Terminal Server add-on suites, Citrix Presentation Server 4.0 and Provision Networks VAS (Virtual Access Suite), and how these compare to what is possible with Windows Server 2008 Beta 3 TS RemoteApps.


Printers Control Panel Applet


One of the most commonly required control panel applets to which users will require access is the printers control panel. This requirement exists because not all applications expose the following options:



  • select a printer other than the user’s default printer
  • change the default printer
  • change printer settings
  • add a printer
  • delete a printer

While “Printers and Faxes” is listed in the Windows Control Panel, it is not a standard control panel applet (file with the extension .cpl).  The Printers and Faxes Control Panel Applet is actually a Windows Explorer Shell Extension. Shell Extensions are Dynamic Link Libraries (file with the extension .dll), that are typically exposed via Windows Explorer Menu Items, right-click menu items, etc.. and are listed in the Windows Registry at HKEY_Classes_Root\CLSID\{Globally_Unique_Identifier}



Since the Windows Registry is not the easiest tool for most people to navigate, I’d recommend that administrators without expert knowledge of the Windows Registry use a freeware tool like ShellExView to browse the available Shell Extensions.


ShellExView provides a simple to use UI to browse and view the properties of the available Shell Extensions.



One of the goals when publishing applications is to provide the functionality that the end users need, without exposing the underlying file system or Windows Desktop. When publishing the Printers Control Panel, this means being able to launch the Printers Control Panel, and not allowing the user to browse to other control panel applets, local or network file resources.


With Citrix Presentation Server and Provision Networks VAS, this is done in the following manner:



  1. Create a directory on the Windows Terminal Server named:
    “Printers.{2227A280-3AEA-1069-A2DE-08002B30309D}”
  2. Create a copy of “explorer.exe” and save it with a recognizable name, i.e. “PrintExplorer.exe
  3. Publish:
    “%WinDir%\PrintExplorer.exe /n,/root, %SystemDrive%\Printers.{2227A280-3AEA-1069-A2DE-08002B30309D}”




  1. Select the appropriate printers icon from shell32.dll.
  2. Configure the application to use Session Sharing, so the Printers Control Panel launches in the same Terminal Server Session as the user’s running applications.

With Windows Server 2008 Beta 3 TS RemoteApp Manager the process is similar:



  1. Create a directory on the Windows Terminal Server named:
    “Printers.{2227A280-3AEA-1069-A2DE-08002B30309D}”
  2. Add “explorer.exe” as a TS RemoteApp
  3. From the Properties of the TS RemoteApp, select:
    Always use the following command-line arguments
  4. Enter the following as the command-line argument:
    c:\Printers.{2227A280-3AEA-1069-A2DE-08002B30309D}


Windows Server 2008 Beta 3 does not seem to allow:



  • Launching a copy of explorer.exe
  • Launching the printers control panel in a single pane explorer window, with the “/n” switch
  • Use of the “/root” switch to obfuscate the local and remote file system.

Rundll32


It should be noted that, as with most other things in the Windows OS, there is more than one way to launch an explorer shell extension.


Rundll32.exe can be used to spawn explorer shell extensions, such as:



  • Add Printer Dialog:
    RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL AddPrinter
  • Connect to Printer Dialog:
     RUNDLL32 WINSPOOL.DRV,ConnectToPrinterDlg
  • Swap Mouse Buttons:
    RUNDLL32 USER32.DLL,SwapMouseButton
  • Map Network Drive Dialog:
    RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL Connect
  • Disconnect Network Drive Dialog:
    RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL Disconnect

Rundll32.exe can also be used to open the Control Panel, or specific Control Panel Applets:



  • Control Panel Applet:
    RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL
  • Accessibility Options Control Panel Applet:
    RUNDLL32.EXE SHELL32.DLL,Control_RunDLL access.cpl
  • Add Hardware Wizard Control Panel Applet:
    RUNDLL32.EXE SHELL32.DLL,Control_RunDLL hdwwiz.cpl
  • Add Remove Programs Control Panel Applet:
    RUNDLL32.EXE SHELL32.DLL,Control_RunDLL appwiz.cpl
  • Automatic Updates Control Panel Applet:
    RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL wuaucpl.cpl
  • Date and Time Properties Control Panel Applet:
    RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL timedate.cpl
  • Display Properties Control Panel Applet:
    RUNDLL32.EXE SHELL32.DLL,Control_RunDLL desk.cpl
  • Mouse Properties Control Panel Applet:
    RUNDLL32.EXE SHELL32.DLL,Control_RunDLL main.cpl
  • Network Connections Control Panel Applet:
    RUNDLL32.EXE SHELL32.DLL,Control_RunDLL ncpa.cpl
  • Network Setup Wizard Control Panel Applet:
    RUNDLL32.EXE SHELL32.DLL,Control_RunDLL netsetup.cpl
  • ODBC Data Source Administrator Control Panel Applet:
    RUNDLL32.EXE SHELL32.DLL,Control_RunDLL odbccp32.cpl
  • Phone and Modem Options Control Panel Applet:
    RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL telephon.cpl
  • Power Options Properties Control Panel Applet:
    RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL powercfg.cpl
  • Printers and Faxes Control Panel Applet:
    RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL PrintersFolder
  • Regional Options Control Panel Applet:
    RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL intl.cpl
  • Sound and Audio Devices Control Panel Applet:
    RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL mmsys.cpl
  • Sun Java Control Panel Applet:
    RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL jpicpl32.cpl
  • System Control Panel Applet:
    RUNDLL32.EXE SHELL32.DLL,Control_RunDLL sysdm.cpl
  • User Accounts Control Panel Applet:
    RUNDLL32.EXE SHELL32.DLL,Control_RunDLL nusrmgr.cpl
  • Windows Firewall Control Panel Applet:
    RUNDLL32.EXE SHELL32.DLL,Control_RunDLL firewall.cpl
  • Windows Security Center Control Panel Applet:
    RUNDLL32.EXE SHELL32.DLL,Control_RunDLL wscui.cpl

The Syntax for rundll32.exe is:



  • RUNDLL32.EXE <dllname>,<entrypoint> <optional arguments>”

Suppose one wanted to launch the Display Properties Control Panel, but wanted it to open directly to a specific tab, instead of the default (left most tab). This can be accomplished via:



  • Display Properties Control Panel (Desktop Tab):
    RUNDLL32.EXE SHELL32.DLL,Control_RunDLL desk.cpl,,0
  • Display Properties Control Panel (Screen Saver Tab):
    RUNDLL32.EXE SHELL32.DLL,Control_RunDLL desk.cpl,,1
  • Display Properties Control Panel (Appearance Tab):
    RUNDLL32.EXE SHELL32.DLL,Control_RunDLL desk.cpl,,2

Summary


Windows offers a few different ways to launch Explorer Shell Extensions and Control Panel Applets, whether with explorer.exe, a copy of explorer.exe or with RUNDLL32.DLL. It’s important not to assume that every one of these will work the same on every operating system, and that every one will launch successfully without spawning the Windows Desktop. Testing in your environment is always recommended to avoid unintended results.


References:


How to Open Specific Control Panel Icons(.cpl) and Application Files, (.jar, .doc, .xls, .msc, .mdb, .hlp) as Published Application


How to Publish Print Manager on a Windows NT/2000/2003 Terminal Server


How to run Control Panel tools by typing a command


INFO: Windows Rundll and Rundll32 Interface


Using RUNDLL32.exe in Windows

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top