DriverProc

3.1

  LRESULT CALLBACK DriverProc(dwDriverIdentifier, hDriver, wMessage, lParam1, lParam2)    
  DWORD dwDriverIdentifier; /* identifies installable driver */
  HDRVR hDriver; /* handle of installable driver */
  UINT wMessage; /* message */
  LPARAM lParam1; /* first message parameter */
  LPARAM lParam2; /* second message parameter */

The DriverProc function processes the specified message.

Parameters

dwDriverIdentifier

Specifies an identifier of the installable driver.

hDriver

Identifies the installable driver. This parameter is a unique handle that Windows assigns to the driver.

wMessage

Identifies a message that the driver must process. Following are the messages that Windows or an application can send to an installable driver:

Message Description

DRV_CLOSE Notifies the driver that it should decrement (decrease by one) its usage count and unload the driver if the count is zero.
DRV_CONFIGURE Notifies the driver that it should display a custom-configuration dialog box. (This message should be sent only if the driver returns a nonzero value when the DRV_QUERYCONFIGURE message is processed.)
DRV_DISABLE Notifies the driver that its allocated memory is about to be freed.
DRV_ENABLE Notifies the driver that it has been loaded or reloaded, or that Windows has been enabled.
DRV_FREE Notifies the driver that it will be discarded.
DRV_INSTALL Notifies the driver that it has been successfully installed.
DRV_LOAD Notifies the driver that it has been successfully loaded.
DRV_OPEN Notifies the driver that it is about to be opened.
DRV_POWER Notifies the driver that the device's power source is about to be turned off or turned on.
DRV_QUERYCONFIGURE Determines whether the driver supports the DRV_CONFIGURE message. The message displays a private configuration dialog box.
DRV_REMOVE Notifies the driver that it is about to be removed from the system.

lParam1

Specifies the first message parameter.

lParam2

Specifies the second message parameter.

Return Value

The return value is nonzero if the function is successful. Otherwise, it is zero.

Comments

The DriverProc function is the main function within a Windows installable driver; it is supplied by the driver developer.

When the wMessage parameter is DRV_OPEN, lParam1 is the string following the driver filename from the SYSTEM.INI file and lParam2 is the value given as the lParam parameter in the call to the OpenDriver function.

When the wMessage parameter is DRV_CLOSE, lParam1 and lParam2 are the same values as the lParam1 and lParam2 parameters in the call to the CloseDriver function.

See Also

CloseDriver, OpenDriver