VirtualizationAdmin.com

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

Patrick Rouse photo
How to publish Windows Explorer shell extensions with Windows Server 2008 Beta 3 TS RemoteApps, Citrix Presentation Server and Provision Networks Virtual Access Suite.

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 Patrick Rouse

Patrick Rouse photo Patrick is the West Coast Sales Engineer for Quest Software, Provision Networks Division, and is based out of San Diego, California. He is the author of www.sessioncomputing.com and has been working with Windows Terminal Services since 2000. Patrick has received the Microsoft Most Valuable Professional (MVP) Award for Windows Server – Terminal Server in each year since 2003 and was a presenter at BriForum - Europe in 2006. In 2006 and 2007 Patrick served as an active member of the Citrix Technology Professional Program, until he tendered his resignation when he accepted his current position at Quest Software.

Click here for Patrick Rouse's section.

Share this article

Receive all the latest articles by email!

Get all articles delivered directly to your mailbox as and when they are released on MSTerminalServices.org! Choose between receiving instant updates with the Real-Time Article Update, or a monthly summary with the Monthly Article Update. Sign up to the MSTerminalServices.org Monthly Newsletter, written by Terminal Server MVP & Citrix CTP Stefan Vermeulen, containing news, tips, interviews, links of the month and much more. Subscribe today and don't miss a thing!



Receive all the latest articles by email!

Receive Real-Time & Monthly MSTerminalServices.org article updates in your mailbox. Enter your email below!
Click for Real-Time sample & Monthly sample

Become an MSTerminalServices.org member!

Discuss your Terminal Services & Citrix issues with thousands of other SBC experts. Click here to join!

Solution Center