Modifying an MS-DOS Application or 16-bit Driver

Windows NT provides the functions RegisterModule, UnregisterModule, and DispatchCall for a 16-bit driver or MS-DOS application to call a 32-bit VDD. These functions can be included in a 16-bit application program or driver to bridge the gap between the 16- and 32-bit environments.

During its initialization, the 16-bit driver or MS-DOS application calls RegisterModule, specifying the name of the VDD, the name of the VDD initialization routine, and the name of the VDD dispatch routine to be called each time the 16-bit application or driver calls DispatchCall. The RegisterModule function returns a handle to the VDD. If the VDD has not yet been loaded, RegisterModule loads and initializes it before returning. The application or driver can then use the VDD handle when using DispatchCall, which calls the VDD dispatch function specified in RegisterModule. When the application or driver is finished with the VDD, it can call UnregisterModule to unload the VDD and release its resources.

It is not necessary to modify an MS-DOS application or 16-bit device driver unless you want to directly call your VDD. An unmodified MS-DOS application’s attempts to directly access the hardware are intercepted by the VDM and routed to the appropriate VDD. Modify your application only if you need the additional performance provided by direct high-level interceptions of device access requests.

If the VDD needs to use VDDSimulate16, the 16-bit device driver or its stub will need to change as well. For VDDSimulate16 to complete, the 16-bit driver needs to call VDDUnsimulate16.

The following functions (macros) are provided for 16-bit drivers or MS-DOS applications:

DispatchCall

Passes a request to a DLL.

RegisterModule

Registers a third-party DLL with the VDM.

UnRegisterModule

Unregisters a third-party DLL with the VDM.