Porting Steps for Display Drivers

This section contains porting notes that pertain to display drivers only.

Replace DeviceIoControl

The Win32 DeviceIoControl function has been replaced with EngDeviceIoControl. The return value is the inverse of what it used to be: 0 (ERROR_SUCCESS) for success, and non-zero for failure. The new function also takes one less parameter; DeviceIoControl’s last parameter, lpoverlapped, is no longer necessary.

Remove DCI code

DCI support has been permanently removed from the system. Therefore, all DCI code used in your driver must be removed.

Remove VFLATD

VFLATD functionality is not supported for kernel-mode threads. This means that your driver can no longer use this functionality to map a banked frame buffer in the miniport for GDI to write to.

DEC ALPHA Drivers

For drivers that work on the DEC ALPHA only: all calls to the special TRANSLATE_ADDR access macros should be removed. Calls to the WRITE_FAST access macros should be changed to use the WRITE_REGISTER access macros. On the ALPHA, the WRITE_REGISTER and WRITE_PORT macros handle all required address translation by calling into the HAL.

Note The GDI engine is still not equipped to handle sparse frame buffer access.

Other Windows NT 4.0 Display Driver Changes

Because all Windows NT 3.51 drivers are incompatible in Windows NT 4.0, a few things have been cleaned up in the display drivers:

·The default patterns are now provided by the engine. A display driver no longer needs to initialize those patterns. The static array of patterns and the pattern enable/disable routines should be completely removed.

·During driver initialization, DM_INTERLACED should no longer be checked during mode selection.

·Some of the fields in the DEVMODE structure returned by DrvGetModes have changed slightly:

1.The DM_INTERLACED flag in the dmFlag field is obsolete. Its usage must be completely removed.

2.The name of the driver must be stored in the dmDeviceName field.

3.The dmFields field must be filled in with the appropriate bits.

The following is a copy of the sample code found in every Microsoft display driver:

// Zero the entire structure to start off with.

memset(pdm, 0, sizeof(DEVMODEW));

 

// Set the name of the device to the name of the DLL.

memcpy(pdm->dmDeviceName, DLL_NAME, sizeof(DLL_NAME));

 

pdm->dmSpecVersion      = DM_SPECVERSION;

pdm->dmDriverVersion    = DM_SPECVERSION;

pdm->dmSize             = sizeof(DEVMODEW);

pdm->dmDriverExtra      = DRIVER_EXTRA_SIZE;

 

pdm->dmBitsPerPel       = pVideoTemp->NumberOfPlanes *

                          pVideoTemp->BitsPerPlane;

pdm->dmPelsWidth        = pVideoTemp->VisScreenWidth;

pdm->dmPelsHeight       = pVideoTemp->VisScreenHeight;

pdm->dmDisplayFrequency = pVideoTemp->Frequency;

pdm->dmDisplayFlags     = 0;

 

pdm->dmFields           = DM_BITSPERPEL       |

                          DM_PELSWIDTH        |

                          DM_PELSHEIGHT       |

                          DM_DISPLAYFREQUENCY |

                          DM_DISPLAYFLAGS     ;

 

Update Your .inf File

In order for the applet to install the new driver, the OptionType = VIDEO line in the driver's .inf file must be changed to:

OptionType = VIDEO40BETA