Techwiki:Win32k/GRAPHICS DEVICE

From ReactOS Wiki
Jump to: navigation, search

Windows XP version of GRAPHICS_DEVICE, tag is 'Ggdv' aka GDITAG_GDEVICE.

typedef struct _DEVMODEENTRY
{
   DWORD     dwFlags;
   PDEVMODEW pdm;
} DEVMODEENTRY, *PDEVMODEENTRY;
typedef struct _GRAPHICS_DEVICE
{
   WCHAR            szNtDeviceName[CCHDEVICENAME/2];  // 000
   WCHAR            szWinDeviceName[CCHDEVICENAME/2]; // 020
   PGRAPHICS_DEVICE pNextGraphicsDevice;              // 040
   PGRAPHICS_DEVICE pVgaDevice;                       // 044
   PDEVICE_OBJECT   DeviceObject;                     // 048
   HANDLE           pDeviceHandle;                    // 04C
   DWORD            hkClassDriverConfig;              // 050
   DWORD            StateFlags;                       // 054
   DWORD            cbdevmodeInfo;                    // 058
   PVOID            devmodeInfo;                      // 05C
   DWORD            cDevModes;                        // 060
   PDEVMODEENTRY    pDevModeList;                     // 064
   PWCHAR           pDiplayDrivers;                   // 068 tag is 'Gdrs' = GDITAG_DRVSUP
   LPWSTR           pwszDescription;                  // 06C tag is 'Gdrs' = GDITAG_DRVSUP
   DWORD            dwUnknown                         // 070
   PVOID            pUnknown;                         // 074 tag is 'Ggdv' = GDITAG_GDEVICE
   PFILE_OBJECT     FileObject;                       // 078
   DWORD            ProtocolType;                     // 07C
} GRAPHICS_DEVICE, *PGRAPHICS_DEVICE;

szNtDeviceName

Name of the device, for example "\\Device\\Video<n>", where <n> is the zero based display numer (note: the display numer is not neccessarily equal to the iDevNum value passed to EnumDisplayDevices, as the latter only counts loaded devices, the vga compatible adapter for example, is normally not being enumerated). Another example would be "\\Device\\Disc". You can open the device using this name. A registry entry with this name is present under the HKLM\HARDWARE\DEVICEMAP\VIDEO registry key. This entry is of type REG_SZ and contains the registry path for the display settings (for example "\Registry\Machine\System\CurrentControlSet\Control\Video\{19D0ECD0-F5D9-4A4B-8005-36253C8D799D}\0000"). Windows installs all physical and virtual devices this way.

szWinDeviceName

L"\\\\.\\DISPLAY<np>" or L"\\\\.\\DISPLAYV<nv>", the 'V' stands for virtual devices, <np> is the 1 based number of physical displays, <nv> is the 1 based number of virtual displays. This is the same as returned in DISPLAY_DEVICE.DeviceName when calling EnumDisplayDevices. This is not always equal to the Win device name, that is always "\\\\.\\DISPLAY<n+1>", where <n> is the 1 based number of installed displays.

pNextGraphicsDevice

Next device in the list. Note that the vga compatible adapter is not a member of the list, but attached to the pVgaDevice member of the related display device. For the vga compatible driver this member is equal to the correponding default driver.

pVgaDevice

Pointer to the vga compatible driver of the same display. For a vga compatible driver this member points to the structure itself.

StateFlags

== DISPLAY_DEVICE.StateFlags
can be one of
#define DISPLAY_DEVICE_ATTACHED_TO_DESKTOP 0x00000001
#define DISPLAY_DEVICE_MULTI_DRIVER        0x00000002
#define DISPLAY_DEVICE_PRIMARY_DEVICE      0x00000004
#define DISPLAY_DEVICE_MIRRORING_DRIVER    0x00000008
#define DISPLAY_DEVICE_VGA_COMPATIBLE      0x00000010
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
#define DISPLAY_DEVICE_REMOVABLE           0x00000020
#endif // (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
#if (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN)
#define DISPLAY_DEVICE_UNSAFE_MODES_ON     0x00080000
#endif
#define DISPLAY_DEVICE_TS_COMPATIBLE       0x00200000
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
#define DISPLAY_DEVICE_DISCONNECT          0x02000000
#define DISPLAY_DEVICE_REMOTE              0x04000000
#endif
#define DISPLAY_DEVICE_MODESPRUNED         0x08000000
/* Child device state */
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
#define DISPLAY_DEVICE_ACTIVE              0x00000001
#define DISPLAY_DEVICE_ATTACHED            0x00000002
#endif // (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)


cbdevmodeInfo

Size of the array of DEVMODEW structures, pointed to by devmodeInfo;

devmodeInfo

Pointer to an array of DEVMODEW entries. The members are not static. A list with shortcuts can be found in pDevModeList.

cDevModes

Number of DEVMODEW entries managed my pDevModeList.

pDevModeList

Pointer to an array of DEVMODEENTRY.

pDiplayDrivers

Name(s) of the display drivers without .dll extension, like "nv4disp". Every string is terminated by a '\0'. The last string is terminated by 2 '\0'.

pwszDescription

DISPLAY_DEVICE.DeviceString. Human readable name of the device, like "NVIDIA GeForce 6150"

Remarks

Windows keeps a list of DISPLAY_DEVICE structures in memory. You can get a pointer to the related DISPLAY_DEVICE from the pDisplayDevice member of the PDEV structure.

Configuration Example

  1. 1: "\Device\Video0" "DISPLAY1" "nv4_disp" iDev=0 "\\.\DISPLAY1" "\\??\
  2. 2: "\Device\Video1" "DISPLAY2" "vga framebuf vga256 vga64k" no iDev "\\.\\
  3. 3: "\Device\Video2" "DISPLAY3" "mnmdd" iDev=1 "\\.\DISPLAYV1"
  4. 4: "\Device\Video3" "DISPLAY4" "RDPDD" iDev=2 "\\.\DISPLAYV2"
  5. 5: "\Device\Disc" ??? "TSDDD" no iDev "\\.\DISPLAYV2"
List: #1 -> #3 -> #4 -> #5
       |    /
      #2 ->