3.4.10 Multiple-Resolution Drivers

A multiple-resolution display driver provides the code and resources needed to support all resolutions of a given display device. In previous versions of Windows, separate display drivers were required for each resolution. In Windows 3.1, a single display driver can handle all resolutions.

A multiple-resolution driver must provide the following:

Icons and cursors for each supported resolution

GetDriverResourceID function

Installation information

3.4.10.1 Resources and Resource Mapping

In many cases, the only difference between the device resolutions for the driver is the size of the resources and the horizontal and vertical dimensions. A driver can support multiple resolutions as long as it can determine which resolution Windows expects it to use.

To support multiple resolutions in a single display driver, Windows checks for the GetDriverResourceID function in the driver, and calls it before loading the driver's resources and dimensions. This gives the driver a chance to check the SYSTEM.INI file for information specifying the desired resolution. The GetDriverResourceID function can then map the request resource identifier to the identifier of the corresponding resource for the desired resolution. In this way, the driver makes sure Windows loads the appropriate resources for the selected resolution.

Display drivers that support multiple resolutions must export the GetDriverResourceID function and provide a set of appropriate resources for each resolution.

3.4.10.2 Installation Information

Users select the desired resolution for the display using the Setup program. To display each screen resolution, Setup checks the [display] section in the SETUP.INF or OEMSETUP.INF file. There must be one line for each resolution. For example, if a video adapater named “ZGA” has three resolutions (640x480, 800x600, and 1024x768), the [display] section should look something like this:

[display]

zga1=1:zga.drv,"ZGA (640x480)","100,96,96",3:zgacolor.2gr,..., zgalo

zga2=1:zga.drv,"ZGA (800x600)","100,96,96",3:zgacolor.2gr,..., zgamed

zga3=1:zga.drv,"ZGA (1024x768)","100,120,120",3:zgacolor.2gr,..., zgahi

Setup installs the same driver (ZGA.DRV), grabbers, virtual display device, and other related components. However, the last field in the line specifies an additional section in the SETUP.INF or OEMSETUP.INF file that contains resolution-specific information.

The resolution-specific information allows Windows Setup to copy files and write profile data for later use by the display driver. Setup can write the information to the SYSTEM.INI file in the section and format understood by the driver. When a display driver is initialized, it can use the Windows functions GetPrivateProfileInt or GetPrivateProfileString to read the user-specified screen resolution from the appropriate section of SYSTEM.INI. This will let the driver decide what resource ID to return to Windows by the GetDriverResourceID function.

The following examples show how resolution-specific information sections might look in the SETUP.INF or OEMSETUP.INF file:

[zgalo]

4:zgalo.dll,0:system,,,,

[zgamed]

,,system.ini,zga.drv,,"ZGAres=800x600"

[zgahi]

4:zgahi.dll,0:system,system.ini,zga.drv,"ZGAres=800x600","ZGAMode=Hi"

For more information about the resolution-specific information sections, see the Microsoft Windows Device Driver Adaptation Guide.