HOWTO: Determine the Currently Installed Display DriverID: Q169590
|
This article demonstrates a technique for an application to determine the currently installed display system device driver on Windows 95.
In most cases, it is recommended that applications not rely on the hardware-
dependent information that this technique provides. There is no API
available to provide this information directly, and parsing the Registry is
problematic for several reasons. The most reliable method is to ask the
display system itself for the information.
The display system drivers use a data structure called 'DISPLAYINFO' for
various purposes, but you need to use it to obtain the Registry DevNode for
the current display driver. Calling the Windows 95 Virtual Display Device
(VDD) VDD_GET_DISPLAY_CONFIG service populates this structure.
To do this, your application can thunk to a 16-bit DLL that allocates a
DISPLAYINFO structure. The 16-bit DLL then uses the Interrupt 2Fh function
1684h interface to call into the Virtual Display Device's
VDD_GET_DISPLAY_CONFIG service. Some application developers might be able
to use the DeviceIOControl() API to complete this step without thunking or
using Interrupt 2Fh. Either way, the VDD will populate the DISPLAYINFO data
structure which has DevNode for the current display system driver, as well
as a lot of other information regarding the display system.
Display driver developers have the option of extending the DISPLAYINFO
structure for their own purposes, so the calling DLL may want to allocate a
larger memory block for the DISPLAYINFO structure because it might be
bigger than what Microsoft documents. How much larger is something you will
need to determine empirically on many different display system drivers.
Once you have the populated DISPLAYINFO structure, you have the DevNode for
the display driver in the diDevNodeHandle member of DISPLAYINFO. You can
now use the Registry APIs to look at the currently installed display
drivers' registry entries. You may already have all the information you
wanted in the DISPLAYINFO structure, and can therefore not bother with the
Registry APIs.
Example code that demonstrates some of this technique is shown in Assembler
code in the Windows 95 Device Driver Kit (DDK) directory:
DDK\Display\Samples\Mini\Mini\Init.asm. This is the code that the ring-3
display driver uses to obtain the DISPLAYINFO structure, which is what you
need to do. C code for this technique is not available. Implementation of
this technique is left as an exercise for the advanced mixed-programming
language developer.
Windows 95 Device Driver Kit.
For more information on calling into VxDs from an application, please see
the following article in the Microsoft Knowledge Base:
Q89705 How VMs Can Communicate with VxDs
Keywords :
Version : 4.0
Platform : WINDOWS
Issue type :
Last Reviewed: March 3, 1999