## The COINSTALLER Sample

The COINSTALLER Sample accompanies Chapter 15 and illustrates how to write a coinstaller DLL using Microsoft Foundation Classes.

The sample includes two components:

- SampleCoinstallerDummy.SYS (SYS subdirectory) is a WDM driver for a non-existent hardware device.
- SAMCOIN.DLL (DLL subdirectory) is a device-specific coinstaller DLL for that device.

### Building COINSTALLER

To build COINSTALLER.SYS, follow the general instructions for building a WDM sample. The Microsoft Visual C++ project file is named SampleCoinstallerDummy.dsp in the SYS subdirectory.

To build SAMCOIN.EXE, follow the general instructions for building user-mode programs. The Microsoft Visual C++ project file is named SampleCoinstaller.DSP in the DLL subdirectory.

### Testing COINSTALLER

Since Windows 98/Me does't support coinstaller DLLs, there's not much point in testing this sample in that environmnet.

Follow the instructions for using FASTINST to install the dummy device. The INF file is named SampleCoinstallerDummy.inf in the SYS directory. During the install, setup will present a custom wizard page to allow you to change the ProgrammersShoeSize parameter. This wizard page is intended purely to show you how you can perform some user interaction during setup. It's not the best example of this genre, perhaps, because the change won't take effect until you manually disable and reenable the device.

Once the device is installed, the Device Manager property sheet will include a Shoe Size page that you can use to change the value of ProgrammersShoeSize. This property page gives you an option to force a device restart after you click on OK to dismiss the property sheet.

### What to look for

This sample contains the following noteworthy things, all in the dll directory:

- The coinstaller and external dialog classes in CoInstaller.cpp and ExternalDialog.cpp. These are general-purpose classes that you can copy to your own MFC-based coinstaller project.
- The CShoeSize wizard page in ShoeSize.cpp.
- The CShoeSizeProperty property page in ShoeSizeProperty.cpp.
- The SampleCoinstaller.cpp file itself, which shows how to combine the various classes into a coinstaller DLL.