25.1 About Installable Drivers
An installable driver is a Windows dynamic-link library (DLL) that a Windows application (or another Windows DLL) can open, enable, query, disable, and close. An application can perform these operations by calling the following functions:
When an application calls the OpenDriver, SendDriverMessage, or CloseDriver function, Windows processes the call and issues one or more of the following driver messages:
DRV_CLOSE |
Notifies an installable driver that Windows will decrement the use count for the driver and send a DRV_FREE message if the use count reaches zero. |
DRV_CONFIGURE |
Notifies an installable driver that it should display a custom-configuration dialog box. (This message should only be sent if the driver returns a nonzero value when the DRV_QUERYCONFIGURE message is processed.) |
DRV_DISABLE |
Notifies an installable driver that the memory that it has allocated is about to be freed. |
DRV_ENABLE |
Notifies an installable driver that it has been loaded or reloaded or that Windows has been enabled. |
DRV_FREE |
Notifies an installable driver that it will be discarded. |
DRV_INSTALL |
Notifies an installable driver that it has been successfully installed. |
DRV_LOAD |
Notifies an installable driver that it has been successfully loaded. |
DRV_OPEN |
Notifies an installable driver that it is about to be opened. |
DRV_POWER |
Notifies an installable driver that the power source for the device is about to be turned off or on. |
DRV_QUERYCONFIGURE |
Queries an installable driver about whether it supports the DRV_CONFIGURE message and can display a private configuration dialog box. |
DRV_REMOVE |
Notifies an installable driver that it is about to be removed from the system. |
These messages, which are defined in the Windows header file (WINDOWS.H), are processed by the main routine in an installable driver. This routine is called the DriverProc function.
Some of the preceding messages should be sent by Windows only when one of the installable driver functions is called by an application. The circumstances under which these messages are sent are described in the following list:
DRV_CLOSE |
Issued by Windows when an application calls the CloseDriver function. |
DRV_DISABLE |
Issued prior to exiting Windows and returning to MS-DOS or when the driver is freed. |
DRV_ENABLE |
Issued when returning to Windows from MS-DOS or the first time the installable driver is loaded. |
DRV_FREE |
Issued by Windows after an application calls the CloseDriver function and the use count is decremented to zero. |
DRV_LOAD |
Issued by Windows after the first OpenDriver call is made for a particular installable driver. |
The remaining messages can be sent by an application to an installable driver by calling the SendDriverMessage function.