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 your DriverProc returns for the DRV_OPEN message becomes the dwDriverID parameter for all subsequent messages sent to your driver. You can use this value for your own purposes. For example, you can use it to identify a structure containing information about the client who opened you.