## The MULFUNC Sample

The MULFUNC Sample accompanies Chapter 11 and illustrates how to create a driver for a non-standard multifunction device.

You would not use the MULFUNC method for a USB, PCI, or PCMCIA multifunction device unless the device doesn't conform to the bus specification. Refer to the DDK documentation on multifunction devices for more information.

The sample includes four components:

- MULFUNC.SYS (SYS subdirectory) is a WDM driver for a non-existent multifunction device.
- CHILDA.SYS (ChildA subdirectory) is a WDM driver for one of the functions of the MULFUNC device.
- CHILDB.SYS (ChildB subdirectory) is a WDM driver for the other function of the MULFUNC device.
- SUBALLOC.SYS (SUBALLOC subdirectory) is a WDM filter driver that "suballocates" I/O resources belonging to the parent multifunction device for use by the child function drivers.

### Building MULFUNC

To build MULFUNC.SYS, CHILDA.SYS, CHILDB.SYS and SUBALLOC.SYS, follow the general instructions for building a WDM sample. The Microsoft Visual C++ project files are named MULFUNC.DSP, CHILDA.DSP, CHILDB.DSP and SUBALLOC.DSP in the SYS, CHILDA, CHILDB and SUBALLOC subdirectories, respectively.

### Testing MULFUNC

Install the MULFUNC "device". Follow the general instructions for using FastInst in Windows XP or Windows 98/Me. The INF file is named SYS\DEVICE.INF.

Following the installation of MULFUNC, the system will automatically install the CHILDA and CHILDB drivers. You will see this happening because I didn't take any steps to suppress the user interface.

### What to look for

The hard part of writing a multifunction driver is handling PnP requests sent down to the PDO from a child device and maintaining the list of child PDOs. Refer to PlugPlayFdo.cpp and PlugPlayPdo.cpp in the sys directory, and pay close attention to the prose description in the book of what the IRP_MJ_PNP dispatch routine does.