The DRV_OPEN Message

On the DRV_OPEN system message, the lParam2 parameter specifies which device is being opened. This value is 0 for the first device and 1 for the second device.

The value that DriverProc returns for the DRV_OPEN message becomes the dwDriverID parameter for all subsequent messages sent to this driver. The driver can use this value for its own purposes. For example, a driver can use it to identify a structure containing information about the client that opened it.