DrvGetModes function

The DrvGetModes function lists the modes supported by a given device.


ULONG DrvGetModes(
  _In_      HANDLE   hDriver,
            ULONG    cjSize,
  _Out_opt_ DEVMODEW *pdm


hDriver [in]

Handle to the driver for which the modes must be enumerated. This is the handle passed in the hDriver parameter of the DrvEnablePDEV function.


Specifies the size in bytes of the buffer pointed to by pdm.

pdm [out, optional]

Pointer to the buffer containing DEVMODEW structure(s) for the driver to fill in, or NULL.

Return value

The driver should return the number of bytes written to the buffer if pdm is not NULL. If pdmis NULL, the driver should return the number of bytes required to hold all mode data. The driver should return zero if an error occurs.


This function must be implemented in all display drivers.

Window Manager dynamically loads all display drivers associated with a miniport driver (based on the InstalledDisplayDrivers key in the registry). Each display driver is called to retrieve the list of modes supported by that combination of loaded drivers. For example, the VGA64K display driver only returns the 64K color modes that were returned in the list of modes obtained from the miniport driver.

DrvGetModes can be called before there is an active PDEV.

Refer to the Permedia samples to see a working implementation of DrvGetModes.

Note   The Microsoft Windows Driver Kit (WDK) does not contain the 3Dlabs Permedia2 (3dlabs.htm ) and 3Dlabs Permedia3 (Perm3.htm) sample display drivers. You can get these sample drivers from the Windows Server 2003 SP1 Driver Development Kit (DDK), which you can download from the DDK - Windows Driver Development Kit page of the WDHC website.


Target platform



Winddi.h (include Winddi.h)

See also




Send comments about this topic to Microsoft