Converting a Windows NT 4.0 Miniport Driver to Windows 2000
A good Windows NT 4.0 and previous miniport driver can easily become a Windows 2000 and later miniport driver. The following are some of the updates necessary to provide Plug and Play support, which is required in Windows 2000 and later miniport drivers:
See Plug and Play and Power Management in Video Miniport Drivers (Windows 2000 Model) for a list of new functions that must be implemented. Be sure to initialize the new members of VIDEO_HW_INITIALIZATION_DATA to point to these new functions.
Update your HwVidFindAdapter function. For devices on an enumerable bus, HwVidFindAdapter must be changed as follows:
- Remove most of your device detection code. This is because a call to HwVidFindAdapter on Windows 2000 means that the PnP manager has already detected the device.
- Call VideoPortGetAccessRanges to obtain the bus-relative physical addresses to which the device will respond. These addresses are assigned by the PnP manager.
- If the driver supports more than one device type, determine the type of device.
- Ignore the Again parameter. This is because the system will call HwVidFindAdapter only once per device.
For a device on a nonenumerable bus such as ISA, PnP still attempts to start the device, although it is the responsibility of HwVidFindAdapter to determine whether the device is actually present.
Update the .Mfg section of the driver's INF file to include the device and vendor ID. This is required so that the PnP manager can associate the device with its INF file. Samples of the Windows NT 4.0 and updated Windows 2000 and later .Mfg sections follow:
[ABC.Mfg] ; Windows NT V4.0 INF %ABC% ABC Graphics Accelerator A = abc %ABC% ABC Graphics Accelerator B = abc [ABC.Mfg] ; Windows 2000 and later INF %ABC% ABC Graphics Accelerator A = abc, PCI\VEN_ABCD&DEV_0123 %ABC% ABC Graphics Accelerator B = abc, PCI\VEN_ABCD&DEV_4567
You can use the geninf.exe tool that is included with the Driver Development Kit (DDK) to generate an INF. (The DDK preceded the Windows Driver Kit [WDK].) Keep in mind, however, that geninf.exe does not create an INF for Windows NT 4.0. You must modify the INF file produced by geninf.exe if you intend to support Windows NT 4.0. See Creating Graphics INF Files for more details.
The Windows 2000 and later video port supports Windows NT 4.0 miniport drivers as legacy drivers. The graphics adapter for a legacy miniport driver cannot be removed from the system while the system is running, nor are legacy miniport drivers automatically detected when added to a running system.