Introduction
A .cpl file is a Control Panel application, also called an applet: a
module that adds one or more items to the Windows Control Panel. Microsoft’s page on
message processing calls a Control Panel item a “.cpl item” and speaks of the
“.dll file” that supports the items and of releasing “the DLL”, so an applet is a
DLL, a PE
file. The pages consulted do not say where Control Panel looks for applets.
A file dropped on any page opens in the explorer, with its structure, resources and code, like any PE file.
What is particular: CPlApplet
The CPlApplet callback function processes all messages that Windows
sends to a Control Panel item, in a specific order, described by Microsoft as
follows. Whether the function is exported under that name from the file is not stated
by the pages consulted; any exports can be read in the
export directory.
| Message | Purpose (Microsoft) |
|---|---|
CPL_INIT | Sent first, when Windows loads the item. The function initialises, for example allocates memory, and returns nonzero; if it returns zero Windows ends communication and releases the DLL. |
CPL_GETCOUNT | Sent next if CPL_INIT succeeded, immediately after it, with both parameters zero. Returns the number of Control Panel items (dialog boxes) the file supports. |
CPL_INQUIRE and CPL_NEWINQUIRE | One of each per item. The function fills in a CPLINFO or NEWCPLINFO structure with the item’s name, icon and a descriptive string. Most applets process CPL_INQUIRE, whose result Windows can cache, and ignore CPL_NEWINQUIRE. |
CPL_DBLCLK | The user has chosen the item’s icon; can arrive any number of times. The function shows the item’s dialog box. |
CPL_STARTWPARMS | Sent if an item is invoked with input parameters, for example from a command prompt, with the parameter string. |
CPL_STOP | Once for each item before the controlling application ends; the function frees memory allocated for its dialog box. |
CPL_EXIT | After the last CPL_STOP; the function frees what remains and unregisters private window classes. Windows then calls FreeLibrary. |
Not described
Unknown
- Discovery: where and how Control Panel finds applets is not described by the pages consulted.
Known, not yet covered
- Reference: the exact values of the messages and the layout of the info structures; the page gives their names and roles only.
Links
Software
Reference
- Control Panel Message Processing – the CPlApplet function and the order of its messages
- CPL_GETCOUNT – the message that asks for the number of dialog boxes
- PE Format – Microsoft’s specification of PE32 and PE32+