Initializing a Mouse Minidriver

Information about a mouse device is stored in the SOFTWARE section of the registry. One of the entries in the registry is the statement mousedriver=name.vxd, where name is the name of a mouse minidriver. VMOUSE searches the registry for occurrences of this statement and loads the corresponding minidrivers. VMOUSE loads the minidrivers when the system is started, or whenever the VMAPI_DETECT_MOUSE API function is called.

When loading a mouse minidriver, VMOUSE sends the SYS_DYNAMIC_DEVICE_INIT message to the minidriver's control procedure. The ECX register contains the address of a Mouse_Instance structure. The minidriver should respond to the SYS_DYNAMIC_DEVICE_INIT message by attempting to detect the mouse device. If it detects the mouse, the minidriver should set the MI_Flags field of the Mouse_Instance structure to MIF_DETECTED, and fill the other fields with information about the mouse device. The minidriver should also set the MIF_DISABLE flag and copy the address of its "disable" function into the MI_Disable field. VMOUSE calls the disable routine whenever the mouse device is disabled and the minidriver should release resources; for example, when a portable machine is placed in a docking station.

The control procedure of a mouse minidriver receives a SYS_DYNAMIC_DEVICE_EXIT message when it is about to be unloaded. A minidriver should respond to the message by freeing any system resources it isusing.

See also Mouse_Instance, VMAPI_DETECT_MOUSE