Control Panel applet
As my current is an audio driver on both Windows and Mac OS X, an applet to configure the device without launch the sophisticated application is convenient for the end-user to manipulate device quickly.
On Windows, Control Panel is the ideal way to do it. Actually Control Panel applies for all components running in the background, or automatically (e.g. service, driver or just a Non-GUI application).
Control Panel applets are just standard DLLs with a particular set of entry points and a .cpl extension. Place such a file in the Windows System directory and the next time you start up control panel your applet will be there.
About how to program a Control Panel applet, WDK provides a sample "Audio Control Panel Application". And I even found that there's a framework on CodeProject (http://www.codeproject.com/KB/winsdk/cjbcontrolpanelapplet.aspx). Here I just want to share the way of how to debug it.
WinDbg is usually a good choose for such kind of case.
1. In its File menu, click Open Executable.
2. In the following dialog, first of all, locate current folder into [SystemRoot]/System32/, and then
type RunDll32.exe in the File Name textbox.
3. In the Arguments blank, type the below line:
Shell32.dll,Control_RunDLL CPL
As CPL has to be installed in [SystemRoot]/System32/ folder, we don't need any path prefix for it
here. Of course, we need CPL to be debug version and type proper symbol path in WinDbg
configuration to make debug session available.
Co-Installer
Windows WDM driver framework support co-installer mechanism to allow driver vendor intercept and customize driver installation. Co-installer is a user-mode Win32 DLL. Typically, a co-installer performs installation tasks that require dynamic information that is not available when the INF for its device or device class is written.
Driver installation on Windows will be handled by the operating system vis Setup API. While developing a co-installer, we don't need to create a InstallShield package for it. The update driver action in Device Manage has the same effect. Consequently the debug approach of co-installer can be done like below:
1. Open Device Manager firstly.
2. Launch WinDbg, and in its File menu, click Attach to a Process...
3. In the following dialog, select mmc.exe, and start debug session.
As the co-installer won't be called until the actual driver installation process starts, here we need a trick to make co-installer attach to the debugger by itself. Put a DebugBreak() in the entry fucntion of co-installer can achieve that. After the co-installer has been called and hit this break statement, WinDbg can capture it.