ReactOS 0.4.15-dev-6054-gbddd8b0
pdevobj.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for pdevobj.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

 DBG_DEFAULT_CHANNEL (EngPDev)
 
BOOL APIENTRY MultiEnableDriver (_In_ ULONG iEngineVersion, _In_ ULONG cj, _Inout_bytecount_(cj) PDRVENABLEDATA pded)
 
NTSTATUS NTAPI InitPDEVImpl (VOID)
 
PPDEVOBJ PDEVOBJ_AllocPDEV (VOID)
 
static VOID PDEVOBJ_vDeletePDEV (PPDEVOBJ ppdev)
 
VOID NTAPI PDEVOBJ_vRelease (_Inout_ PPDEVOBJ ppdev)
 
BOOL NTAPI PDEVOBJ_bEnablePDEV (_In_ PPDEVOBJ ppdev, _In_ PDEVMODEW pdevmode, _In_ PWSTR pwszLogAddress)
 
VOID NTAPI PDEVOBJ_vCompletePDEV (PPDEVOBJ ppdev)
 
static VOID PDEVOBJ_vFilterDriverHooks (_In_ PPDEVOBJ ppdev)
 
PSURFACE NTAPI PDEVOBJ_pSurface (PPDEVOBJ ppdev)
 
VOID PDEVOBJ_vEnableDisplay (_Inout_ PPDEVOBJ ppdev)
 
BOOL PDEVOBJ_bDisableDisplay (_Inout_ PPDEVOBJ ppdev)
 
VOID NTAPI PDEVOBJ_vRefreshModeList (PPDEVOBJ ppdev)
 
PPDEVOBJ PDEVOBJ_Create (_In_opt_ PGRAPHICS_DEVICE pGraphicsDevice, _In_opt_ PDEVMODEW pdm, _In_ ULONG dwAccelerationLevel, _In_ ULONG ldevtype)
 
FORCEINLINE VOID SwitchPointer (_Inout_ PVOID pvPointer1, _Inout_ PVOID pvPointer2)
 
BOOL NTAPI PDEVOBJ_bDynamicModeChange (PPDEVOBJ ppdev, PPDEVOBJ ppdev2)
 
BOOL NTAPI PDEVOBJ_bSwitchMode (PPDEVOBJ ppdev, PDEVMODEW pdm)
 
PPDEVOBJ NTAPI EngpGetPDEV (_In_opt_ PUNICODE_STRING pustrDeviceName)
 
LONG PDEVOBJ_lChangeDisplaySettings (_In_opt_ PUNICODE_STRING pustrDeviceName, _In_opt_ PDEVMODEW RequestedMode, _In_opt_ PMDEVOBJ pmdevOld, _Out_ PMDEVOBJ *ppmdevNew, _In_ BOOL bSearchClosestMode)
 
INT NTAPI PDEVOBJ_iGetColorManagementCaps (PPDEVOBJ ppdev)
 
VOID NTAPI PDEVOBJ_vGetDeviceCaps (IN PPDEVOBJ ppdev, OUT PDEVCAPS pDevCaps)
 
BOOL APIENTRY EngQueryDeviceAttribute (_In_ HDEV hdev, _In_ ENG_DEVICE_ATTRIBUTE devAttr, _In_reads_bytes_(cjInSize) PVOID pvIn, _In_ ULONG cjInSize, _Out_writes_bytes_(cjOutSize) PVOID pvOut, _In_ ULONG cjOutSize)
 
_Must_inspect_result_ _Ret_z_ LPWSTR APIENTRY EngGetDriverName (_In_ HDEV hdev)
 
INT APIENTRY NtGdiGetDeviceCaps (HDC hdc, INT Index)
 
 _Success_ (return!=FALSE)
 
DHPDEV APIENTRY NtGdiGetDhpdev (IN HDEV hdev)
 
PSIZEL FASTCALL PDEVOBJ_sizl (PPDEVOBJ ppdev, PSIZEL psizl)
 

Variables

static PPDEVOBJ gppdevList = NULL
 
static HSEMAPHORE ghsemPDEV
 
DRVFN gPanDispDrvFn []
 
ULONG gPanDispDrvCount
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 10 of file pdevobj.c.

Function Documentation

◆ _Success_()

_Success_ ( return!  = FALSE)

Definition at line 1210 of file pdevobj.c.

1216{
1217 PDC pdc;
1218 DEVCAPS devcaps;
1219 BOOL bResult = TRUE;
1220
1221 /* Lock the given DC */
1222 pdc = DC_LockDc(hDC);
1223 if (!pdc)
1224 {
1226 return FALSE;
1227 }
1228
1229 /* Get the data */
1230 PDEVOBJ_vGetDeviceCaps(pdc->ppdev, &devcaps);
1231
1232 /* Unlock the DC */
1233 DC_UnlockDc(pdc);
1234
1235 /* Copy data to caller */
1236 _SEH2_TRY
1237 {
1238 ProbeForWrite(pDevCaps, sizeof(DEVCAPS), 1);
1239 RtlCopyMemory(pDevCaps, &devcaps, sizeof(DEVCAPS));
1240 }
1242 {
1244 bResult = FALSE;
1245 }
1246 _SEH2_END;
1247
1248 return bResult;
1249}
static HDC hDC
Definition: 3dtext.c:33
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:238
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:220
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
_Out_ PDEVCAPS pDevCaps
Definition: ntgdi.h:2664
VOID NTAPI PDEVOBJ_vGetDeviceCaps(IN PPDEVOBJ ppdev, OUT PDEVCAPS pDevCaps)
Definition: pdevobj.c:964
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
Definition: polytest.cpp:41
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:37
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( EngPDev  )

◆ EngGetDriverName()

_Must_inspect_result_ _Ret_z_ LPWSTR APIENTRY EngGetDriverName ( _In_ HDEV  hdev)

Definition at line 1049 of file pdevobj.c.

1050{
1051 PPDEVOBJ ppdev = (PPDEVOBJ)hdev;
1052
1053 ASSERT(ppdev);
1054 ASSERT(ppdev->pldev);
1055 ASSERT(ppdev->pldev->pGdiDriverInfo);
1056 ASSERT(ppdev->pldev->pGdiDriverInfo->DriverName.Buffer);
1057
1058 return ppdev->pldev->pGdiDriverInfo->DriverName.Buffer;
1059}
struct _PDEVOBJ * PPDEVOBJ
Definition: mdevobj.h:6
#define ASSERT(a)
Definition: mode.c:44
struct _LDEVOBJ * pldev
Definition: pdevobj.h:119
_In_ HDEV hdev
Definition: winddi.h:3449

◆ EngpGetPDEV()

PPDEVOBJ NTAPI EngpGetPDEV ( _In_opt_ PUNICODE_STRING  pustrDeviceName)

Definition at line 726 of file pdevobj.c.

728{
729 UNICODE_STRING ustrCurrent;
730 PPDEVOBJ ppdev = NULL;
731 PGRAPHICS_DEVICE pGraphicsDevice;
732 ULONG i;
733
734 /* Acquire PDEV lock */
736
737 /* Did the caller pass a device name? */
738 if (pustrDeviceName)
739 {
740 /* Loop all present PDEVs */
741 for (i = 0; i < gpmdev->cDev; i++)
742 {
743 /* Get a pointer to the GRAPHICS_DEVICE */
744 pGraphicsDevice = gpmdev->dev[i].ppdev->pGraphicsDevice;
745
746 /* Compare the name */
747 RtlInitUnicodeString(&ustrCurrent, pGraphicsDevice->szWinDeviceName);
748 if (RtlEqualUnicodeString(pustrDeviceName, &ustrCurrent, FALSE))
749 {
750 /* Found! */
751 ppdev = gpmdev->dev[i].ppdev;
752 break;
753 }
754 }
755 }
756 else if (gpmdev)
757 {
758 /* Otherwise use the primary PDEV */
759 ppdev = gpmdev->ppdevGlobal;
760 }
761
762 /* Did we find one? */
763 if (ppdev)
764 {
765 /* Yes, reference the PDEV */
766 PDEVOBJ_vReference(ppdev);
767 }
768
769 /* Release PDEV lock */
771
772 return ppdev;
773}
#define NULL
Definition: types.h:112
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
Definition: eng.c:235
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PMDEVOBJ gpmdev
Definition: mdevobj.c:14
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
static HSEMAPHORE ghsemPDEV
Definition: pdevobj.c:15
FORCEINLINE VOID PDEVOBJ_vReference(_In_ PPDEVOBJ ppdev)
Definition: pdevobj.h:161
WCHAR szWinDeviceName[CCHDEVICENAME/2]
Definition: pdevobj.h:60
PPDEVOBJ ppdev
Definition: mdevobj.h:10
PPDEVOBJ ppdevGlobal
Definition: mdevobj.h:16
ULONG cDev
Definition: mdevobj.h:15
MDEVDISPLAY dev[0]
Definition: mdevobj.h:17
PGRAPHICS_DEVICE pGraphicsDevice
Definition: pdevobj.h:127
uint32_t ULONG
Definition: typedefs.h:59
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)

Referenced by GreCreateCompatibleDC(), GreOpenDCW(), NtGdiExtEscape(), UserChangeDisplaySettings(), UserEnumCurrentDisplaySettings(), and UserEnumDisplaySettings().

◆ EngQueryDeviceAttribute()

BOOL APIENTRY EngQueryDeviceAttribute ( _In_ HDEV  hdev,
_In_ ENG_DEVICE_ATTRIBUTE  devAttr,
_In_reads_bytes_(cjInSize) PVOID  pvIn,
_In_ ULONG  cjInSize,
_Out_writes_bytes_(cjOutSize) PVOID  pvOut,
_In_ ULONG  cjOutSize 
)

Exported functions

Definition at line 1023 of file pdevobj.c.

1030{
1031 PPDEVOBJ ppdev = (PPDEVOBJ)hdev;
1032
1033 if (devAttr != QDA_ACCELERATION_LEVEL)
1034 return FALSE;
1035
1036 if (cjOutSize >= sizeof(DWORD))
1037 {
1038 /* Set all Accelerations Level Key to enabled Full 0 to 5 turned off. */
1039 *(DWORD*)pvOut = ppdev->dwAccelerationLevel;
1040 return TRUE;
1041 }
1042
1043 return FALSE;
1044}
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwAccelerationLevel
Definition: pdevobj.h:132
@ QDA_ACCELERATION_LEVEL
Definition: winddi.h:2231

◆ InitPDEVImpl()

NTSTATUS NTAPI InitPDEVImpl ( VOID  )

Definition at line 30 of file pdevobj.c.

31{
34 return STATUS_SUCCESS;
35}
HSEMAPHORE WINAPI EngCreateSemaphore(VOID)
Definition: eng.c:75
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

Referenced by DriverEntry().

◆ MultiEnableDriver()

BOOL APIENTRY MultiEnableDriver ( _In_ ULONG  iEngineVersion,
_In_ ULONG  cj,
_Inout_bytecount_(cj) PDRVENABLEDATA  pded 
)

Definition at line 17 of file multidisp.c.

21{
23 return FALSE;
24}
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by PDEVOBJ_Create().

◆ NtGdiGetDeviceCaps()

INT APIENTRY NtGdiGetDeviceCaps ( HDC  hdc,
INT  Index 
)

Definition at line 1064 of file pdevobj.c.

1067{
1068 PDC pdc;
1069 DEVCAPS devcaps;
1070
1071 /* Lock the given DC */
1072 pdc = DC_LockDc(hdc);
1073 if (!pdc)
1074 {
1076 return 0;
1077 }
1078
1079 /* Get the data */
1080 PDEVOBJ_vGetDeviceCaps(pdc->ppdev, &devcaps);
1081
1082 /* Unlock the DC */
1083 DC_UnlockDc(pdc);
1084
1085 /* Return capability */
1086 switch (Index)
1087 {
1088 case DRIVERVERSION:
1089 return devcaps.ulVersion;
1090
1091 case TECHNOLOGY:
1092 return devcaps.ulTechnology;
1093
1094 case HORZSIZE:
1095 return devcaps.ulHorzSize;
1096
1097 case VERTSIZE:
1098 return devcaps.ulVertSize;
1099
1100 case HORZRES:
1101 return devcaps.ulHorzRes;
1102
1103 case VERTRES:
1104 return devcaps.ulVertRes;
1105
1106 case LOGPIXELSX:
1107 return devcaps.ulLogPixelsX;
1108
1109 case LOGPIXELSY:
1110 return devcaps.ulLogPixelsY;
1111
1112 case BITSPIXEL:
1113 return devcaps.ulBitsPixel;
1114
1115 case PLANES:
1116 return devcaps.ulPlanes;
1117
1118 case NUMBRUSHES:
1119 return -1;
1120
1121 case NUMPENS:
1122 return devcaps.ulNumPens;
1123
1124 case NUMFONTS:
1125 return devcaps.ulNumFonts;
1126
1127 case NUMCOLORS:
1128 return devcaps.ulNumColors;
1129
1130 case ASPECTX:
1131 return devcaps.ulAspectX;
1132
1133 case ASPECTY:
1134 return devcaps.ulAspectY;
1135
1136 case ASPECTXY:
1137 return devcaps.ulAspectXY;
1138
1139 case CLIPCAPS:
1140 return CP_RECTANGLE;
1141
1142 case SIZEPALETTE:
1143 return devcaps.ulSizePalette;
1144
1145 case NUMRESERVED:
1146 return 20;
1147
1148 case COLORRES:
1149 return devcaps.ulColorRes;
1150
1151 case DESKTOPVERTRES:
1152 return devcaps.ulVertRes;
1153
1154 case DESKTOPHORZRES:
1155 return devcaps.ulHorzRes;
1156
1157 case BLTALIGNMENT:
1158 return devcaps.ulBltAlignment;
1159
1160 case SHADEBLENDCAPS:
1161 return devcaps.ulShadeBlend;
1162
1163 case COLORMGMTCAPS:
1164 return devcaps.ulColorMgmtCaps;
1165
1166 case PHYSICALWIDTH:
1167 return devcaps.ulPhysicalWidth;
1168
1169 case PHYSICALHEIGHT:
1170 return devcaps.ulPhysicalHeight;
1171
1172 case PHYSICALOFFSETX:
1173 return devcaps.ulPhysicalOffsetX;
1174
1175 case PHYSICALOFFSETY:
1176 return devcaps.ulPhysicalOffsetY;
1177
1178 case VREFRESH:
1179 return devcaps.ulVRefresh;
1180
1181 case RASTERCAPS:
1182 return devcaps.ulRasterCaps;
1183
1184 case CURVECAPS:
1185 return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
1187
1188 case LINECAPS:
1191
1192 case POLYGONALCAPS:
1195
1196 case TEXTCAPS:
1197 return devcaps.ulTextCaps;
1198
1199 case CAPS1:
1200 case PDEVICESIZE:
1201 case SCALINGFACTORX:
1202 case SCALINGFACTORY:
1203 default:
1204 return 0;
1205 }
1206
1207 return 0;
1208}
#define CAPS1
Definition: mmsystem.h:934
HDC hdc
Definition: main.c:9
ULONG ulVertSize
Definition: ntgdityp.h:303
ULONG ulPhysicalOffsetX
Definition: ntgdityp.h:321
ULONG ulNumFonts
Definition: ntgdityp.h:309
ULONG ulTechnology
Definition: ntgdityp.h:299
ULONG ulTextCaps
Definition: ntgdityp.h:323
ULONG ulAspectY
Definition: ntgdityp.h:313
ULONG ulLogPixelsX
Definition: ntgdityp.h:315
ULONG ulLogPixelsY
Definition: ntgdityp.h:316
ULONG ulVersion
Definition: ntgdityp.h:298
ULONG ulAspectX
Definition: ntgdityp.h:312
ULONG ulHorzSize
Definition: ntgdityp.h:302
ULONG ulBltAlignment
Definition: ntgdityp.h:327
ULONG ulSizePalette
Definition: ntgdityp.h:317
ULONG ulBitsPixel
Definition: ntgdityp.h:306
ULONG ulColorMgmtCaps
Definition: ntgdityp.h:333
ULONG ulHorzRes
Definition: ntgdityp.h:304
ULONG ulPhysicalHeight
Definition: ntgdityp.h:320
ULONG ulColorRes
Definition: ntgdityp.h:318
ULONG ulNumPens
Definition: ntgdityp.h:308
ULONG ulPhysicalOffsetY
Definition: ntgdityp.h:322
ULONG ulPhysicalWidth
Definition: ntgdityp.h:319
ULONG ulVertRes
Definition: ntgdityp.h:305
ULONG ulRasterCaps
Definition: ntgdityp.h:311
ULONG ulNumColors
Definition: ntgdityp.h:310
ULONG ulShadeBlend
Definition: ntgdityp.h:332
ULONG ulAspectXY
Definition: ntgdityp.h:314
ULONG ulPlanes
Definition: ntgdityp.h:307
ULONG ulVRefresh
Definition: ntgdityp.h:324
_In_ WDFCOLLECTION _In_ ULONG Index
#define NUMRESERVED
Definition: wingdi.h:733
#define PHYSICALOFFSETY
Definition: wingdi.h:738
#define NUMBRUSHES
Definition: wingdi.h:722
#define LC_WIDESTYLED
Definition: wingdi.h:777
#define RASTERCAPS
Definition: wingdi.h:745
#define CC_CIRCLES
Definition: wingdi.h:761
#define HORZRES
Definition: wingdi.h:716
#define CC_WIDESTYLED
Definition: wingdi.h:767
#define ASPECTX
Definition: wingdi.h:727
#define PC_RECTANGLE
Definition: wingdi.h:797
#define CC_WIDE
Definition: wingdi.h:765
#define CC_INTERIORS
Definition: wingdi.h:768
#define PHYSICALHEIGHT
Definition: wingdi.h:736
#define CP_RECTANGLE
Definition: wingdi.h:826
#define COLORRES
Definition: wingdi.h:734
#define SCALINGFACTORX
Definition: wingdi.h:739
#define BLTALIGNMENT
Definition: wingdi.h:744
#define LC_STYLED
Definition: wingdi.h:776
#define PC_SCANLINE
Definition: wingdi.h:799
#define VERTSIZE
Definition: wingdi.h:715
#define LOGPIXELSY
Definition: wingdi.h:719
#define PHYSICALOFFSETX
Definition: wingdi.h:737
#define SIZEPALETTE
Definition: wingdi.h:732
#define DRIVERVERSION
Definition: wingdi.h:705
#define NUMCOLORS
Definition: wingdi.h:725
#define POLYGONALCAPS
Definition: wingdi.h:779
#define CC_ELLIPSES
Definition: wingdi.h:764
#define LC_POLYMARKER
Definition: wingdi.h:774
#define HORZSIZE
Definition: wingdi.h:714
#define PDEVICESIZE
Definition: wingdi.h:730
#define TEXTCAPS
Definition: wingdi.h:806
#define SCALINGFACTORY
Definition: wingdi.h:740
#define VREFRESH
Definition: wingdi.h:741
#define VERTRES
Definition: wingdi.h:717
#define LC_POLYLINE
Definition: wingdi.h:772
#define CC_ROUNDRECT
Definition: wingdi.h:769
#define PC_WINDPOLYGON
Definition: wingdi.h:798
#define CURVECAPS
Definition: wingdi.h:759
#define PHYSICALWIDTH
Definition: wingdi.h:735
#define PC_WIDE
Definition: wingdi.h:801
#define LC_WIDE
Definition: wingdi.h:775
#define PLANES
Definition: wingdi.h:721
#define DESKTOPHORZRES
Definition: wingdi.h:742
#define CC_PIE
Definition: wingdi.h:762
#define LOGPIXELSX
Definition: wingdi.h:718
#define CC_STYLED
Definition: wingdi.h:766
#define BITSPIXEL
Definition: wingdi.h:720
#define PC_STYLED
Definition: wingdi.h:802
#define CC_CHORD
Definition: wingdi.h:763
#define NUMFONTS
Definition: wingdi.h:724
#define PC_INTERIORS
Definition: wingdi.h:804
#define LC_INTERIORS
Definition: wingdi.h:778
#define PC_POLYGON
Definition: wingdi.h:794
#define LINECAPS
Definition: wingdi.h:770
#define ASPECTY
Definition: wingdi.h:728
#define NUMPENS
Definition: wingdi.h:723
#define LC_MARKER
Definition: wingdi.h:773
#define DESKTOPVERTRES
Definition: wingdi.h:743
#define CLIPCAPS
Definition: wingdi.h:731
#define ASPECTXY
Definition: wingdi.h:729
#define TECHNOLOGY
Definition: wingdi.h:706
#define PC_WIDESTYLED
Definition: wingdi.h:803

◆ NtGdiGetDhpdev()

DHPDEV APIENTRY NtGdiGetDhpdev ( IN HDEV  hdev)

Definition at line 1253 of file pdevobj.c.

1255{
1256 PPDEVOBJ ppdev;
1257 DHPDEV dhpdev = NULL;
1258
1259 /* Check parameter */
1261 return NULL;
1262
1263 /* Lock PDEV list */
1264 EngAcquireSemaphoreShared(ghsemPDEV);
1265
1266 /* Walk through the list of PDEVs */
1267 for (ppdev = gppdevList; ppdev; ppdev = ppdev->ppdevNext)
1268 {
1269 /* Compare with the given HDEV */
1270 if (ppdev == (PPDEVOBJ)hdev)
1271 {
1272 /* Found the PDEV! Get it's dhpdev and break */
1273 dhpdev = ppdev->dhpdev;
1274 break;
1275 }
1276 }
1277
1278 /* Unlock PDEV list */
1280
1281 return dhpdev;
1282}
#define MmSystemRangeStart
Definition: mm.h:32
static PPDEVOBJ gppdevList
Definition: pdevobj.c:14
struct _PDEVOBJ * ppdevNext
Definition: pdevobj.h:83
DHPDEV dhpdev
Definition: pdevobj.h:120
char * PCHAR
Definition: typedefs.h:51
typedef DHPDEV(APIENTRY FN_DrvEnablePDEV)(_In_ DEVMODEW *pdm

◆ PDEVOBJ_AllocPDEV()

PPDEVOBJ PDEVOBJ_AllocPDEV ( VOID  )

Definition at line 62 of file pdevobj.c.

63{
64 PPDEVOBJ ppdev;
65
67 if (!ppdev)
68 return NULL;
69
70 RtlZeroMemory(ppdev, sizeof(PDEVOBJ));
71
73 if (ppdev->hsemDevLock == NULL)
74 {
76 return NULL;
77 }
78
79 /* Allocate EDD_DIRECTDRAW_GLOBAL for our ReactX driver */
81 if (ppdev->pEDDgpl)
83
84 ppdev->cPdevRefs = 1;
85
86 return ppdev;
87}
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
struct _EDD_DIRECTDRAW_GLOBAL * pEDDgpl
Definition: pdevobj.h:149
LONG cPdevRefs
Definition: pdevobj.h:84
HSEMAPHORE hsemDevLock
Definition: pdevobj.h:89
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define GDITAG_PDEV
Definition: tags.h:75

Referenced by PDEVOBJ_Create().

◆ PDEVOBJ_bDisableDisplay()

BOOL PDEVOBJ_bDisableDisplay ( _Inout_ PPDEVOBJ  ppdev)

Definition at line 360 of file pdevobj.c.

362{
363 BOOL assertVal;
364
365 if (ppdev->flFlags & PDEV_DISABLED)
366 return TRUE;
367
368 TRACE("DrvAssertMode(dhpdev %p, FALSE)\n", ppdev->dhpdev);
369 assertVal = ppdev->pfn.AssertMode(ppdev->dhpdev, FALSE);
370 TRACE("DrvAssertMode(dhpdev %p, FALSE) => %d\n", ppdev->dhpdev, assertVal);
371
372 if (assertVal)
373 ppdev->flFlags |= PDEV_DISABLED;
374
375 return assertVal;
376}
@ PDEV_DISABLED
Definition: pdevobj.h:14
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by MDEVOBJ_bDisable(), PDEVOBJ_bSwitchMode(), PDEVOBJ_Create(), and PDEVOBJ_lChangeDisplaySettings().

◆ PDEVOBJ_bDynamicModeChange()

BOOL NTAPI PDEVOBJ_bDynamicModeChange ( PPDEVOBJ  ppdev,
PPDEVOBJ  ppdev2 
)

Definition at line 584 of file pdevobj.c.

587{
588 union
589 {
591 GDIINFO gdiinfo;
592 DEVINFO devinfo;
593 DWORD StateFlags;
594 } temp;
595
596 /* Exchange driver functions */
597 temp.pfn = ppdev->pfn;
598 ppdev->pfn = ppdev2->pfn;
599 ppdev2->pfn = temp.pfn;
600
601 /* Exchange LDEVs */
602 SwitchPointer(&ppdev->pldev, &ppdev2->pldev);
603
604 /* Exchange DHPDEV */
605 SwitchPointer(&ppdev->dhpdev, &ppdev2->dhpdev);
606
607 /* Exchange surfaces and associate them with their new PDEV */
608 SwitchPointer(&ppdev->pSurface, &ppdev2->pSurface);
609 ppdev->pSurface->SurfObj.hdev = (HDEV)ppdev;
610 ppdev2->pSurface->SurfObj.hdev = (HDEV)ppdev2;
611
612 /* Exchange devinfo */
613 temp.devinfo = ppdev->devinfo;
614 ppdev->devinfo = ppdev2->devinfo;
615 ppdev2->devinfo = temp.devinfo;
616
617 /* Exchange gdiinfo */
618 temp.gdiinfo = ppdev->gdiinfo;
619 ppdev->gdiinfo = ppdev2->gdiinfo;
620 ppdev2->gdiinfo = temp.gdiinfo;
621
622 /* Exchange DEVMODE */
623 SwitchPointer(&ppdev->pdmwDev, &ppdev2->pdmwDev);
624
625 /* Exchange state flags */
626 temp.StateFlags = ppdev->pGraphicsDevice->StateFlags;
628 ppdev2->pGraphicsDevice->StateFlags = temp.StateFlags;
629
630 /* Notify each driver instance of its new HDEV association */
631 ppdev->pfn.CompletePDEV(ppdev->dhpdev, (HDEV)ppdev);
632 ppdev2->pfn.CompletePDEV(ppdev2->dhpdev, (HDEV)ppdev2);
633
634 return TRUE;
635}
FORCEINLINE VOID SwitchPointer(_Inout_ PVOID pvPointer1, _Inout_ PVOID pvPointer2)
Definition: pdevobj.c:569
static calc_node_t temp
Definition: rpn_ieee.c:38
PFN_DrvCompletePDEV CompletePDEV
Definition: ntgdityp.h:570
DWORD StateFlags
Definition: pdevobj.h:66
DRIVER_FUNCTIONS pfn
Definition: pdevobj.h:138
PSURFACE pSurface
Definition: pdevobj.h:124
GDIINFO gdiinfo
Definition: pdevobj.h:123
PDEVMODEW pdmwDev
Definition: pdevobj.h:129
DEVINFO devinfo
Definition: pdevobj.h:122
SURFOBJ SurfObj
Definition: surface.h:8
HDEV hdev
Definition: winddi.h:1208

Referenced by PDEVOBJ_bSwitchMode(), and PDEVOBJ_lChangeDisplaySettings().

◆ PDEVOBJ_bEnablePDEV()

BOOL NTAPI PDEVOBJ_bEnablePDEV ( _In_ PPDEVOBJ  ppdev,
_In_ PDEVMODEW  pdevmode,
_In_ PWSTR  pwszLogAddress 
)

Definition at line 173 of file pdevobj.c.

177{
178 PFN_DrvEnablePDEV pfnEnablePDEV;
179 ULONG i;
180
181 /* Get the DrvEnablePDEV function */
182 pfnEnablePDEV = ppdev->pfn.EnablePDEV;
183
184 /* Call the drivers DrvEnablePDEV function */
185 TRACE("DrvEnablePDEV(pdevmode %p (%dx%dx%d %d Hz) hdev %p (%S))\n",
186 pdevmode,
187 ppdev->pGraphicsDevice ? pdevmode->dmPelsWidth : 0,
188 ppdev->pGraphicsDevice ? pdevmode->dmPelsHeight : 0,
189 ppdev->pGraphicsDevice ? pdevmode->dmBitsPerPel : 0,
190 ppdev->pGraphicsDevice ? pdevmode->dmDisplayFrequency : 0,
191 ppdev,
192 ppdev->pGraphicsDevice ? ppdev->pGraphicsDevice->szNtDeviceName : L"");
193 ppdev->dhpdev = pfnEnablePDEV(pdevmode,
196 ppdev->ahsurf,
197 sizeof(GDIINFO),
198 (PULONG)&ppdev->gdiinfo,
199 sizeof(DEVINFO),
200 &ppdev->devinfo,
201 (HDEV)ppdev,
202 ppdev->pGraphicsDevice ? ppdev->pGraphicsDevice->pwszDescription : NULL,
203 ppdev->pGraphicsDevice ? ppdev->pGraphicsDevice->DeviceObject : NULL);
204 TRACE("DrvEnablePDEV(pdevmode %p hdev %p) => dhpdev %p\n", pdevmode, ppdev, ppdev->dhpdev);
205 if (ppdev->dhpdev == NULL)
206 {
207 ERR("Failed to enable PDEV\n");
208 return FALSE;
209 }
210
211 /* Fix up some values */
212 if (ppdev->gdiinfo.ulLogPixelsX == 0)
213 ppdev->gdiinfo.ulLogPixelsX = 96;
214
215 if (ppdev->gdiinfo.ulLogPixelsY == 0)
216 ppdev->gdiinfo.ulLogPixelsY = 96;
217
218 /* Set raster caps */
219 ppdev->gdiinfo.flRaster = RC_OP_DX_OUTPUT | RC_GDI20_OUTPUT | RC_BIGFONT;
220 if ((ppdev->gdiinfo.ulTechnology != DT_PLOTTER) && (ppdev->gdiinfo.ulTechnology != DT_CHARSTREAM))
221 ppdev->gdiinfo.flRaster |= RC_STRETCHDIB | RC_STRETCHBLT | RC_DIBTODEV | RC_DI_BITMAP | RC_BITMAP64 | RC_BITBLT;
222 if (ppdev->gdiinfo.ulTechnology == DT_RASDISPLAY)
223 ppdev->gdiinfo.flRaster |= RC_FLOODFILL;
224 if (ppdev->devinfo.flGraphicsCaps & GCAPS_PALMANAGED)
225 ppdev->gdiinfo.flRaster |= RC_PALETTE;
226
227 /* Setup Palette */
228 ppdev->ppalSurf = PALETTE_ShareLockPalette(ppdev->devinfo.hpalDefault);
229
230 /* Setup hatch brushes */
231 for (i = 0; i < HS_DDI_MAX; i++)
232 {
233 if (ppdev->ahsurf[i] == NULL)
234 ppdev->ahsurf[i] = gahsurfHatch[i];
235 }
236
237 TRACE("PDEVOBJ_bEnablePDEV - dhpdev = %p\n", ppdev->dhpdev);
238
239 return TRUE;
240}
#define ERR(fmt,...)
Definition: debug.h:110
HSURF gahsurfHatch[HS_DDI_MAX]
Definition: engbrush.c:24
#define L(x)
Definition: ntvdm.h:50
uint32_t * PULONG
Definition: typedefs.h:59
#define PALETTE_ShareLockPalette(hpal)
Definition: palette.h:57
_In_ LPWSTR pwszLogAddress
Definition: winddi.h:3548
#define HS_DDI_MAX
Definition: winddi.h:3954
FN_DrvEnablePDEV * PFN_DrvEnablePDEV
Definition: winddi.h:3558
#define GCAPS_PALMANAGED
Definition: winddi.h:341
#define RC_GDI20_OUTPUT
Definition: wingdi.h:786
#define DT_CHARSTREAM
Definition: wingdi.h:711
#define RC_STRETCHDIB
Definition: wingdi.h:756
#define DT_RASDISPLAY
Definition: wingdi.h:708
#define RC_BITMAP64
Definition: wingdi.h:783
#define RC_BIGFONT
Definition: wingdi.h:781
#define RC_OP_DX_OUTPUT
Definition: wingdi.h:789
#define RC_DIBTODEV
Definition: wingdi.h:750
#define DT_PLOTTER
Definition: wingdi.h:707
#define RC_STRETCHBLT
Definition: wingdi.h:755
#define RC_DI_BITMAP
Definition: wingdi.h:785
#define RC_BITBLT
Definition: wingdi.h:782
#define RC_FLOODFILL
Definition: wingdi.h:751
#define RC_PALETTE
Definition: wingdi.h:790

Referenced by PDEVOBJ_Create().

◆ PDEVOBJ_bSwitchMode()

BOOL NTAPI PDEVOBJ_bSwitchMode ( PPDEVOBJ  ppdev,
PDEVMODEW  pdm 
)

Definition at line 640 of file pdevobj.c.

643{
644 PPDEVOBJ ppdevTmp;
646 BOOL retval = FALSE;
647
648 /* Lock the PDEV */
650
651 /* And everything else */
653
654 DPRINT1("PDEVOBJ_bSwitchMode, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
655
656 // Lookup the GraphicsDevice + select DEVMODE
657 // pdm = LDEVOBJ_bProbeAndCaptureDevmode(ppdev, pdm);
658
659 /* 1. Temporarily disable the current PDEV and reset video to its default mode */
660 if (!PDEVOBJ_bDisableDisplay(ppdev))
661 {
662 DPRINT1("PDEVOBJ_bDisableDisplay() failed\n");
663 goto leave;
664 }
665
666 /* 2. Create new PDEV */
667 ppdevTmp = PDEVOBJ_Create(ppdev->pGraphicsDevice, pdm, 0, LDEV_DEVICE_DISPLAY);
668 if (!ppdevTmp)
669 {
670 DPRINT1("Failed to create a new PDEV\n");
671 goto leave2;
672 }
673
674 /* 3. Create a new surface */
675 pSurface = PDEVOBJ_pSurface(ppdevTmp);
676 if (!pSurface)
677 {
678 DPRINT1("PDEVOBJ_pSurface failed\n");
679 PDEVOBJ_vRelease(ppdevTmp);
680 goto leave2;
681 }
682
683 /* 4. Get DirectDraw information */
684 /* 5. Enable DirectDraw Not traced */
685 /* 6. Copy old PDEV state to new PDEV instance */
686
687 /* 7. Switch the PDEVs */
688 if (!PDEVOBJ_bDynamicModeChange(ppdev, ppdevTmp))
689 {
690 DPRINT1("PDEVOBJ_bDynamicModeChange() failed\n");
691 PDEVOBJ_vRelease(ppdevTmp);
692 goto leave2;
693 }
694
695 /* 8. Disable DirectDraw */
696
697 PDEVOBJ_vRelease(ppdevTmp);
698
699 /* Update primary display capabilities */
700 if (ppdev == gpmdev->ppdevGlobal)
701 {
702 PDEVOBJ_vGetDeviceCaps(ppdev, &GdiHandleTable->DevCaps);
703 }
704
705 /* Success! */
706 retval = TRUE;
707
708leave2:
709 /* Set the new video mode, or restore the original one in case of failure */
711
712leave:
713 /* Unlock everything else */
715 /* Unlock the PDEV */
717
718 DPRINT1("leave, ppdev = %p, pSurface = %p\n", ppdev, ppdev->pSurface);
719
720 return retval;
721}
#define DPRINT1
Definition: precomp.h:8
#define leave
Definition: btrfs_drv.h:138
@ LDEV_DEVICE_DISPLAY
Definition: ldevobj.h:8
BOOL PDEVOBJ_bDisableDisplay(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:360
PPDEVOBJ PDEVOBJ_Create(_In_opt_ PGRAPHICS_DEVICE pGraphicsDevice, _In_opt_ PDEVMODEW pdm, _In_ ULONG dwAccelerationLevel, _In_ ULONG ldevtype)
Definition: pdevobj.c:411
BOOL NTAPI PDEVOBJ_bDynamicModeChange(PPDEVOBJ ppdev, PPDEVOBJ ppdev2)
Definition: pdevobj.c:584
VOID NTAPI PDEVOBJ_vRelease(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:104
PSURFACE NTAPI PDEVOBJ_pSurface(PPDEVOBJ ppdev)
Definition: pdevobj.c:310
VOID PDEVOBJ_vEnableDisplay(_Inout_ PPDEVOBJ ppdev)
Definition: pdevobj.c:340
#define GdiHandleTable
Definition: win32nt.h:35
_In_ DD_SURFACE_LOCAL * pSurface
Definition: winddi.h:3481

Referenced by UserChangeDisplaySettings(), and UserRefreshDisplay().

◆ PDEVOBJ_Create()

PPDEVOBJ PDEVOBJ_Create ( _In_opt_ PGRAPHICS_DEVICE  pGraphicsDevice,
_In_opt_ PDEVMODEW  pdm,
_In_ ULONG  dwAccelerationLevel,
_In_ ULONG  ldevtype 
)

Definition at line 411 of file pdevobj.c.

416{
417 PPDEVOBJ ppdev, ppdevMatch = NULL;
418 PLDEVOBJ pldev;
420
421 TRACE("PDEVOBJ_Create(%p %p %d)\n", pGraphicsDevice, pdm, ldevtype);
422
423 if (ldevtype != LDEV_DEVICE_META)
424 {
425 ASSERT(pGraphicsDevice);
426 ASSERT(pdm);
427 /* Search if we already have a PPDEV with the required characteristics.
428 * We will compare the graphics device, the devmode and the desktop
429 */
430 for (ppdev = gppdevList; ppdev; ppdev = ppdev->ppdevNext)
431 {
432 if (ppdev->pGraphicsDevice == pGraphicsDevice)
433 {
434 PDEVOBJ_vReference(ppdev);
435
436 if (RtlEqualMemory(pdm, ppdev->pdmwDev, sizeof(DEVMODEW)) &&
437 ppdev->dwAccelerationLevel == dwAccelerationLevel)
438 {
439 PDEVOBJ_vReference(ppdev);
440 ppdevMatch = ppdev;
441 }
442 else
443 {
445 }
446
447 PDEVOBJ_vRelease(ppdev);
448 }
449 }
450
451 if (ppdevMatch)
452 {
453 PDEVOBJ_vEnableDisplay(ppdevMatch);
454
455 return ppdevMatch;
456 }
457 }
458
459 /* Try to get a display driver */
460 if (ldevtype == LDEV_DEVICE_META)
461 pldev = LDEVOBJ_pLoadInternal(MultiEnableDriver, ldevtype);
462 else
463 pldev = LDEVOBJ_pLoadDriver(pdm->dmDeviceName, ldevtype);
464 if (!pldev)
465 {
466 ERR("Could not load display driver '%S'\n",
467 (ldevtype == LDEV_DEVICE_META) ? L"" : pdm->dmDeviceName);
468 return NULL;
469 }
470
471 /* Allocate a new PDEVOBJ */
472 ppdev = PDEVOBJ_AllocPDEV();
473 if (!ppdev)
474 {
475 ERR("failed to allocate a PDEV\n");
476 return NULL;
477 }
478
479 if (ldevtype != LDEV_DEVICE_META)
480 {
481 ppdev->pGraphicsDevice = pGraphicsDevice;
482
483 // DxEngGetHdevData asks for Graphics DeviceObject in hSpooler field
484 ppdev->hSpooler = ppdev->pGraphicsDevice->DeviceObject;
485
486 /* Keep selected resolution */
487 if (ppdev->pdmwDev)
489 ppdev->pdmwDev = ExAllocatePoolWithTag(PagedPool, pdm->dmSize + pdm->dmDriverExtra, GDITAG_DEVMODE);
490 if (ppdev->pdmwDev)
491 {
492 RtlCopyMemory(ppdev->pdmwDev, pdm, pdm->dmSize + pdm->dmDriverExtra);
493 /* FIXME: this must be done in a better way */
495 }
496 }
497
498 /* FIXME! */
499 ppdev->flFlags = PDEV_DISPLAY;
500
501 /* HACK: Don't use the pointer */
502 ppdev->Pointer.Exclude.right = -1;
503
504 /* Initialize PDEV */
505 ppdev->pldev = pldev;
506 ppdev->dwAccelerationLevel = dwAccelerationLevel;
507
508 /* Copy the function table */
509 if ((ldevtype == LDEV_DEVICE_DISPLAY && dwAccelerationLevel >= 5) ||
510 pdm->dmFields & (DM_PANNINGWIDTH | DM_PANNINGHEIGHT))
511 {
512 ULONG i;
513
514 /* Initialize missing fields */
515 if (!(pdm->dmFields & DM_PANNINGWIDTH))
516 pdm->dmPanningWidth = pdm->dmPelsWidth;
517 if (!(pdm->dmFields & DM_PANNINGHEIGHT))
518 pdm->dmPanningHeight = pdm->dmPelsHeight;
519
520 /* Replace vtable by panning vtable */
521 for (i = 0; i < gPanDispDrvCount; i++)
523 }
524 else
525 {
526 ppdev->pfn = ppdev->pldev->pfn;
527 }
528
529 /* Call the driver to enable the PDEV */
530 if (!PDEVOBJ_bEnablePDEV(ppdev, pdm, NULL))
531 {
532 ERR("Failed to enable PDEV!\n");
533 PDEVOBJ_vRelease(ppdev);
534 EngUnloadImage(pldev);
535 return NULL;
536 }
537
538 /* Tell the driver that the PDEV is ready */
540
541 /* Create the initial surface */
542 pSurface = PDEVOBJ_pSurface(ppdev);
543 if (!pSurface)
544 {
545 ERR("Failed to create surface\n");
546 PDEVOBJ_vRelease(ppdev);
547 EngUnloadImage(pldev);
548 return NULL;
549 }
550
551 /* Remove some acceleration capabilities from driver */
553
554 /* Set MovePointer function */
555 ppdev->pfnMovePointer = ppdev->pfn.MovePointer;
556 if (!ppdev->pfnMovePointer)
558
559 /* Insert the PDEV into the list */
560 ppdev->ppdevNext = gppdevList;
561 gppdevList = ppdev;
562
563 /* Return the PDEV */
564 return ppdev;
565}
#define RtlEqualMemory(a, b, c)
Definition: kdvm.h:18
PLDEVOBJ NTAPI LDEVOBJ_pLoadDriver(_In_z_ LPWSTR pwszDriverName, _In_ ULONG ldevtype)
Definition: ldevobj.c:347
PLDEVOBJ LDEVOBJ_pLoadInternal(_In_ PFN_DrvEnableDriver pfnEnableDriver, _In_ ULONG ldevtype)
Definition: ldevobj.c:303
@ LDEV_DEVICE_META
Definition: ldevobj.h:10
BOOL NTAPI PDEVOBJ_bEnablePDEV(_In_ PPDEVOBJ ppdev, _In_ PDEVMODEW pdevmode, _In_ PWSTR pwszLogAddress)
Definition: pdevobj.c:173
BOOL APIENTRY MultiEnableDriver(_In_ ULONG iEngineVersion, _In_ ULONG cj, _Inout_bytecount_(cj) PDRVENABLEDATA pded)
Definition: multidisp.c:17
static VOID PDEVOBJ_vFilterDriverHooks(_In_ PPDEVOBJ ppdev)
Definition: pdevobj.c:254
DRVFN gPanDispDrvFn[]
Definition: pandisp.c:477
PPDEVOBJ PDEVOBJ_AllocPDEV(VOID)
Definition: pdevobj.c:62
ULONG gPanDispDrvCount
Definition: pandisp.c:501
VOID NTAPI PDEVOBJ_vCompletePDEV(PPDEVOBJ ppdev)
Definition: pdevobj.c:244
@ PDEV_DISPLAY
Definition: pdevobj.h:7
long right
Definition: polytest.cpp:53
PFN_DrvMovePointer MovePointer
Definition: ntgdityp.h:599
PFN pfn
Definition: winddi.h:531
ULONG iFunc
Definition: winddi.h:530
RECTL Exclude
Definition: pdevobj.h:39
PDEVICE_OBJECT DeviceObject
Definition: pdevobj.h:63
GDIPOINTER Pointer
Definition: pdevobj.h:144
FLONG flFlags
Definition: pdevobj.h:87
HANDLE hSpooler
Definition: pdevobj.h:125
PFN_DrvMovePointer pfnMovePointer
Definition: pdevobj.h:113
PVOID apfn[INDEX_LAST]
Definition: pdevobj.h:139
WORD dmSize
Definition: wingdi.h:1620
#define GDITAG_DEVMODE
Definition: tags.h:73
ENGAPI VOID APIENTRY EngMovePointer(_In_ SURFOBJ *pso, _In_ LONG x, _In_ LONG y, _In_ RECTL *prcl)
Definition: mouse.c:575
ENGAPI VOID APIENTRY EngUnloadImage(_In_ HANDLE hModule)
Definition: ldevobj.c:913
#define DM_PANNINGHEIGHT
Definition: wingdi.h:1278
#define DISPLAY_DEVICE_PRIMARY_DEVICE
Definition: wingdi.h:1398
#define DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
Definition: wingdi.h:1396
#define DM_PANNINGWIDTH
Definition: wingdi.h:1277

Referenced by MDEVOBJ_Create(), PDEVOBJ_bSwitchMode(), and PDEVOBJ_lChangeDisplaySettings().

◆ PDEVOBJ_iGetColorManagementCaps()

INT NTAPI PDEVOBJ_iGetColorManagementCaps ( PPDEVOBJ  ppdev)

Definition at line 943 of file pdevobj.c.

944{
945 INT ret = CM_NONE;
946
947 if (ppdev->flFlags & PDEV_DISPLAY)
948 {
949 if (ppdev->devinfo.iDitherFormat == BMF_8BPP ||
951 ret = CM_GAMMA_RAMP;
952 }
953
955 ret |= CM_CMYK_COLOR;
956 if (ppdev->devinfo.flGraphicsCaps & GCAPS_ICM)
957 ret |= CM_DEVICE_ICM;
958
959 return ret;
960}
FLONG flGraphicsCaps
Definition: winddi.h:390
ULONG iDitherFormat
Definition: winddi.h:395
FLONG flGraphicsCaps2
Definition: winddi.h:399
int32_t INT
Definition: typedefs.h:58
int ret
#define GCAPS2_CHANGEGAMMARAMP
Definition: winddi.h:370
#define BMF_8BPP
Definition: winddi.h:357
#define GCAPS_ICM
Definition: winddi.h:346
#define GCAPS_CMYKCOLOR
Definition: winddi.h:347

Referenced by PDEVOBJ_vGetDeviceCaps().

◆ PDEVOBJ_lChangeDisplaySettings()

LONG PDEVOBJ_lChangeDisplaySettings ( _In_opt_ PUNICODE_STRING  pustrDeviceName,
_In_opt_ PDEVMODEW  RequestedMode,
_In_opt_ PMDEVOBJ  pmdevOld,
_Out_ PMDEVOBJ ppmdevNew,
_In_ BOOL  bSearchClosestMode 
)

Definition at line 776 of file pdevobj.c.

782{
783 PGRAPHICS_DEVICE pGraphicsDevice = NULL;
784 PMDEVOBJ pmdev = NULL;
785 PDEVMODEW pdm = NULL;
787 ULONG i, j;
788
789 TRACE("PDEVOBJ_lChangeDisplaySettings('%wZ' '%dx%dx%d (%d Hz)' %p %p)\n",
790 pustrDeviceName,
791 RequestedMode ? RequestedMode->dmPelsWidth : 0,
792 RequestedMode ? RequestedMode->dmPelsHeight : 0,
793 RequestedMode ? RequestedMode->dmBitsPerPel : 0,
794 RequestedMode ? RequestedMode->dmDisplayFrequency : 0,
795 pmdevOld, ppmdevNew);
796
797 if (pustrDeviceName)
798 {
799 pGraphicsDevice = EngpFindGraphicsDevice(pustrDeviceName, 0);
800 if (!pGraphicsDevice)
801 {
802 ERR("Wrong device name provided: '%wZ'\n", pustrDeviceName);
804 goto cleanup;
805 }
806 }
807 else if (RequestedMode)
808 {
809 pGraphicsDevice = gpPrimaryGraphicsDevice;
810 if (!pGraphicsDevice)
811 {
812 ERR("Wrong device'\n");
814 goto cleanup;
815 }
816 }
817
818 if (pGraphicsDevice)
819 {
820 if (!LDEVOBJ_bProbeAndCaptureDevmode(pGraphicsDevice, RequestedMode, &pdm, bSearchClosestMode))
821 {
822 ERR("DrvProbeAndCaptureDevmode() failed\n");
823 lRet = DISP_CHANGE_BADMODE;
824 goto cleanup;
825 }
826 }
827
828 /* Here, we know that input parameters were correct */
829
830 {
831 /* Create new MDEV. Note that if we provide a device name,
832 * MDEV will only contain one device.
833 * */
834
835 if (pmdevOld)
836 {
837 /* Disable old MDEV */
838 if (MDEVOBJ_bDisable(pmdevOld))
839 {
840 /* Create new MDEV. On failure, reenable old MDEV */
841 pmdev = MDEVOBJ_Create(pustrDeviceName, pdm);
842 if (!pmdev)
843 MDEVOBJ_vEnable(pmdevOld);
844 }
845 }
846 else
847 {
848 pmdev = MDEVOBJ_Create(pustrDeviceName, pdm);
849 }
850
851 if (!pmdev)
852 {
853 ERR("Failed to create new MDEV\n");
854 lRet = DISP_CHANGE_FAILED;
855 goto cleanup;
856 }
857
859 *ppmdevNew = pmdev;
860
861 /* We now have to do the mode switch */
862
863 if (pustrDeviceName && pmdevOld)
864 {
865 /* We changed settings of one device. Add other devices which were already present */
866 for (i = 0; i < pmdevOld->cDev; i++)
867 {
868 for (j = 0; j < pmdev->cDev; j++)
869 {
870 if (pmdev->dev[j].ppdev->pGraphicsDevice == pmdevOld->dev[i].ppdev->pGraphicsDevice)
871 {
872 if (PDEVOBJ_bDynamicModeChange(pmdevOld->dev[i].ppdev, pmdev->dev[j].ppdev))
873 {
874 PPDEVOBJ tmp = pmdevOld->dev[i].ppdev;
875 pmdevOld->dev[i].ppdev = pmdev->dev[j].ppdev;
876 pmdev->dev[j].ppdev = tmp;
877 }
878 else
879 {
880 ERR("Failed to apply new settings\n");
882 ASSERT(FALSE);
883 }
884 break;
885 }
886 }
887 if (j == pmdev->cDev)
888 {
889 PDEVOBJ_vReference(pmdevOld->dev[i].ppdev);
890 pmdev->dev[pmdev->cDev].ppdev = pmdevOld->dev[i].ppdev;
891 pmdev->cDev++;
892 }
893 }
894 }
895
896 if (pmdev->cDev == 1)
897 {
898 pmdev->ppdevGlobal = pmdev->dev[0].ppdev;
899 }
900 else
901 {
902 /* Enable MultiDriver */
904 if (!pmdev->ppdevGlobal)
905 {
906 WARN("Failed to create meta-device. Using only first display\n");
907 PDEVOBJ_vReference(pmdev->dev[0].ppdev);
908 pmdev->ppdevGlobal = pmdev->dev[0].ppdev;
909 }
910 }
911
912 if (pmdevOld)
913 {
914 /* Search PDEVs which were in pmdevOld, but are not anymore in pmdev, and disable them */
915 for (i = 0; i < pmdevOld->cDev; i++)
916 {
917 for (j = 0; j < pmdev->cDev; j++)
918 {
919 if (pmdev->dev[j].ppdev->pGraphicsDevice == pmdevOld->dev[i].ppdev->pGraphicsDevice)
920 break;
921 }
922 if (j == pmdev->cDev)
923 PDEVOBJ_bDisableDisplay(pmdevOld->dev[i].ppdev);
924 }
925 }
926 }
927
928cleanup:
929 if (lRet != DISP_CHANGE_SUCCESSFUL)
930 {
931 *ppmdevNew = NULL;
932 if (pmdev)
933 MDEVOBJ_vDestroy(pmdev);
934 if (pdm && pdm != RequestedMode)
936 }
937
938 return lRet;
939}
#define WARN(fmt,...)
Definition: debug.h:112
static void cleanup(void)
Definition: main.c:1335
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
BOOL LDEVOBJ_bProbeAndCaptureDevmode(_Inout_ PGRAPHICS_DEVICE pGraphicsDevice, _In_ PDEVMODEW RequestedMode, _Out_ PDEVMODEW *pSelectedMode, _In_ BOOL bSearchClosestMode)
Definition: ldevobj.c:737
VOID MDEVOBJ_vDestroy(_Inout_ PMDEVOBJ pmdev)
Definition: mdevobj.c:164
PMDEVOBJ MDEVOBJ_Create(_In_opt_ PUNICODE_STRING pustrDeviceName, _In_opt_ PDEVMODEW pdm)
Definition: mdevobj.c:57
BOOL MDEVOBJ_bDisable(_Inout_ PMDEVOBJ pmdev)
Definition: mdevobj.c:29
VOID MDEVOBJ_vEnable(_Inout_ PMDEVOBJ pmdev)
Definition: mdevobj.c:17
PGRAPHICS_DEVICE NTAPI EngpFindGraphicsDevice(_In_opt_ PUNICODE_STRING pustrDevice, _In_ ULONG iDevNum)
Definition: device.c:641
PGRAPHICS_DEVICE gpPrimaryGraphicsDevice
Definition: device.c:15
#define DISP_CHANGE_BADMODE
Definition: winuser.h:195
#define DISP_CHANGE_SUCCESSFUL
Definition: winuser.h:190
#define DISP_CHANGE_BADPARAM
Definition: winuser.h:193
#define DISP_CHANGE_FAILED
Definition: winuser.h:194

Referenced by co_IntInitializeDesktopGraphics().

◆ PDEVOBJ_pSurface()

PSURFACE NTAPI PDEVOBJ_pSurface ( PPDEVOBJ  ppdev)

Definition at line 310 of file pdevobj.c.

312{
313 HSURF hsurf;
314
315 /* Check if there is no surface for this PDEV yet */
316 if (ppdev->pSurface == NULL)
317 {
318 /* Call the drivers DrvEnableSurface */
319 TRACE("DrvEnableSurface(dhpdev %p)\n", ppdev->dhpdev);
320 hsurf = ppdev->pfn.EnableSurface(ppdev->dhpdev);
321 TRACE("DrvEnableSurface(dhpdev %p) => hsurf %p\n", ppdev->dhpdev, hsurf);
322 if (hsurf== NULL)
323 {
324 ERR("Failed to create PDEV surface!\n");
325 return NULL;
326 }
327
328 /* Get a reference to the surface */
329 ppdev->pSurface = SURFACE_ShareLockSurface(hsurf);
330 NT_ASSERT(ppdev->pSurface != NULL);
331 }
332
333 /* Increment reference count */
335
336 return ppdev->pSurface;
337}
PFN_DrvEnableSurface EnableSurface
Definition: ntgdityp.h:572
BASEOBJECT BaseObject
Definition: surface.h:6
#define SURFACE_ShareLockSurface(hBMObj)
Definition: surface.h:91
VOID NTAPI GDIOBJ_vReferenceObjectByPointer(POBJ pobj)
Definition: gdiobj.c:734
typedef HSURF(APIENTRY FN_DrvEnableSurface)(_In_ DHPDEV dhpdev)
#define NT_ASSERT
Definition: rtlfuncs.h:3310

Referenced by DC_vInitDc(), DC_vUpdateDC(), IntCreatePrimarySurface(), PDEVOBJ_bSwitchMode(), and PDEVOBJ_Create().

◆ PDEVOBJ_sizl()

PSIZEL FASTCALL PDEVOBJ_sizl ( PPDEVOBJ  ppdev,
PSIZEL  psizl 
)

Definition at line 1286 of file pdevobj.c.

1287{
1288 if (ppdev->flFlags & PDEV_META_DEVICE)
1289 {
1290 *psizl = ppdev->szlMetaRes;
1291 }
1292 else
1293 {
1294 psizl->cx = ppdev->gdiinfo.ulHorzRes;
1295 psizl->cy = ppdev->gdiinfo.ulVertRes;
1296 }
1297 return psizl;
1298}
@ PDEV_META_DEVICE
Definition: pdevobj.h:20
ULONG ulVertRes
Definition: winddi.h:883
ULONG ulHorzRes
Definition: winddi.h:882
SIZEL szlMetaRes
Definition: pdevobj.h:108
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28

Referenced by DC_vUpdateDC(), MakeInfoDC(), and UserUpdateMonitorSize().

◆ PDEVOBJ_vCompletePDEV()

VOID NTAPI PDEVOBJ_vCompletePDEV ( PPDEVOBJ  ppdev)

Definition at line 244 of file pdevobj.c.

246{
247 /* Call the drivers DrvCompletePDEV function */
248 TRACE("DrvCompletePDEV(dhpdev %p hdev %p)\n", ppdev->dhpdev, ppdev);
249 ppdev->pfn.CompletePDEV(ppdev->dhpdev, (HDEV)ppdev);
250}

Referenced by PDEVOBJ_Create().

◆ PDEVOBJ_vDeletePDEV()

static VOID PDEVOBJ_vDeletePDEV ( PPDEVOBJ  ppdev)
static

Definition at line 91 of file pdevobj.c.

93{
95 if (ppdev->pdmwDev)
97 if (ppdev->pEDDgpl)
100}
_Requires_lock_not_held_ hsem ENGAPI VOID APIENTRY EngDeleteSemaphore(_Inout_ __drv_freesMem(Mem) HSEMAPHORE hsem)
Definition: semaphor.c:106

Referenced by PDEVOBJ_vRelease().

◆ PDEVOBJ_vEnableDisplay()

VOID PDEVOBJ_vEnableDisplay ( _Inout_ PPDEVOBJ  ppdev)

Definition at line 340 of file pdevobj.c.

342{
343 BOOL assertVal;
344
345 if (!(ppdev->flFlags & PDEV_DISABLED))
346 return;
347
348 /* Try to enable display until success */
349 do
350 {
351 TRACE("DrvAssertMode(dhpdev %p, TRUE)\n", ppdev->dhpdev);
352 assertVal = ppdev->pfn.AssertMode(ppdev->dhpdev, TRUE);
353 TRACE("DrvAssertMode(dhpdev %p, TRUE) => %d\n", ppdev->dhpdev, assertVal);
354 } while (!assertVal);
355
356 ppdev->flFlags &= ~PDEV_DISABLED;
357}

Referenced by MDEVOBJ_bDisable(), MDEVOBJ_vEnable(), PDEVOBJ_bSwitchMode(), and PDEVOBJ_Create().

◆ PDEVOBJ_vFilterDriverHooks()

static VOID PDEVOBJ_vFilterDriverHooks ( _In_ PPDEVOBJ  ppdev)
static

Definition at line 254 of file pdevobj.c.

256{
257 PLDEVOBJ pldev = ppdev->pldev;
258 ULONG dwAccelerationLevel = ppdev->dwAccelerationLevel;
259
260 if (!pldev->pGdiDriverInfo)
261 return;
262 if (pldev->ldevtype != LDEV_DEVICE_DISPLAY)
263 return;
264
265 if (dwAccelerationLevel >= 1)
266 {
268 ppdev->apfn[INDEX_DrvCreateDeviceBitmap] = NULL;
269 }
270
271 if (dwAccelerationLevel >= 2)
272 {
273 /* Remove sophisticated display accelerations */
274 ppdev->pSurface->flags &= ~(HOOK_STRETCHBLT |
280 }
281
282 if (dwAccelerationLevel >= 3)
283 {
284 /* Disable DirectDraw and Direct3D accelerations */
285 /* FIXME: need to call DxDdSetAccelLevel */
287 }
288
289 if (dwAccelerationLevel >= 4)
290 {
291 /* Remove almost all display accelerations */
292 ppdev->pSurface->flags &= ~HOOK_FLAGS |
298
299 }
300
301 if (dwAccelerationLevel >= 5)
302 {
303 /* Disable all display accelerations */
304 /* (nothing to do. Already handled in PDEVOBJ_Create) */
305 }
306}
SYSTEM_GDI_DRIVER_INFORMATION * pGdiDriverInfo
Definition: ldevobj.h:19
LDEVTYPE ldevtype
Definition: ldevobj.h:20
PVOID apfn[INDEX_LAST]
Definition: ldevobj.h:26
#define INDEX_DrvSetPointerShape
Definition: winddi.h:445
#define HOOK_TRANSPARENTBLT
Definition: winddi.h:1434
#define HOOK_STRETCHBLT
Definition: winddi.h:1421
#define HOOK_TEXTOUT
Definition: winddi.h:1423
#define HOOK_GRADIENTFILL
Definition: winddi.h:1436
#define HOOK_BITBLT
Definition: winddi.h:1420
#define HOOK_FILLPATH
Definition: winddi.h:1426
#define INDEX_DrvCreateDeviceBitmap
Definition: winddi.h:426
#define HOOK_ALPHABLEND
Definition: winddi.h:1435
#define HOOK_SYNCHRONIZE
Definition: winddi.h:1431
#define HOOK_COPYBITS
Definition: winddi.h:1429
#define HOOK_LINETO
Definition: winddi.h:1428
#define HOOK_STROKEPATH
Definition: winddi.h:1425

Referenced by PDEVOBJ_Create().

◆ PDEVOBJ_vGetDeviceCaps()

VOID NTAPI PDEVOBJ_vGetDeviceCaps ( IN PPDEVOBJ  ppdev,
OUT PDEVCAPS  pDevCaps 
)

Definition at line 964 of file pdevobj.c.

967{
968 PGDIINFO pGdiInfo = &ppdev->gdiinfo;
969
970 pDevCaps->ulVersion = pGdiInfo->ulVersion;
972 pDevCaps->ulHorzSizeM = (pGdiInfo->ulHorzSize + 500) / 1000;
973 pDevCaps->ulVertSizeM = (pGdiInfo->ulVertSize + 500) / 1000;
974 pDevCaps->ulHorzSize = pGdiInfo->ulHorzSize;
975 pDevCaps->ulVertSize = pGdiInfo->ulVertSize;
976 pDevCaps->ulHorzRes = pGdiInfo->ulHorzRes;
977 pDevCaps->ulVertRes = pGdiInfo->ulVertRes;
978 pDevCaps->ulBitsPixel = pGdiInfo->cBitsPixel;
979 if (pDevCaps->ulBitsPixel == 15) pDevCaps->ulBitsPixel = 16;
980 pDevCaps->ulPlanes = pGdiInfo->cPlanes;
981 pDevCaps->ulNumPens = pGdiInfo->ulNumColors;
982 if (pDevCaps->ulNumPens != -1) pDevCaps->ulNumPens *= 5;
983 pDevCaps->ulNumFonts = 0; // PDEVOBJ_cFonts(ppdev);
984 pDevCaps->ulNumColors = pGdiInfo->ulNumColors;
985 pDevCaps->ulRasterCaps = pGdiInfo->flRaster;
986 pDevCaps->ulAspectX = pGdiInfo->ulAspectX;
987 pDevCaps->ulAspectY = pGdiInfo->ulAspectY;
988 pDevCaps->ulAspectXY = pGdiInfo->ulAspectXY;
992 pDevCaps->ulColorRes = pGdiInfo->ulDACRed +
993 pGdiInfo->ulDACGreen +
994 pGdiInfo->ulDACBlue;
999 pDevCaps->ulTextCaps = pGdiInfo->flTextCaps;
1001 if (pGdiInfo->ulTechnology != DT_PLOTTER)
1003 pDevCaps->ulVRefresh = pGdiInfo->ulVRefresh;
1004 pDevCaps->ulDesktopHorzRes = pGdiInfo->ulHorzRes;
1005 pDevCaps->ulDesktopVertRes = pGdiInfo->ulVertRes;
1011 pDevCaps->ulShadeBlend = pGdiInfo->flShadeBlend;
1013}
INT NTAPI PDEVOBJ_iGetColorManagementCaps(PPDEVOBJ ppdev)
Definition: pdevobj.c:943
ULONG ulDesktopVertRes
Definition: ntgdityp.h:326
ULONG yPanningAlignment
Definition: ntgdityp.h:331
ULONG ulDesktopHorzRes
Definition: ntgdityp.h:325
ULONG xPanningAlignment
Definition: ntgdityp.h:330
ULONG ulPanningHorzRes
Definition: ntgdityp.h:328
ULONG ulHorzSizeM
Definition: ntgdityp.h:300
ULONG ulVertSizeM
Definition: ntgdityp.h:301
ULONG ulPanningVertRes
Definition: ntgdityp.h:329
ULONG ulVertSize
Definition: winddi.h:881
ULONG ulLogPixelsY
Definition: winddi.h:889
ULONG ulDACGreen
Definition: winddi.h:892
ULONG ulPanningHorzRes
Definition: winddi.h:911
ULONG ulPanningVertRes
Definition: winddi.h:912
ULONG ulLogPixelsX
Definition: winddi.h:888
ULONG ulAspectY
Definition: winddi.h:895
ULONG ulTechnology
Definition: winddi.h:879
ULONG ulNumColors
Definition: winddi.h:886
ULONG ulAspectX
Definition: winddi.h:894
ULONG flShadeBlend
Definition: winddi.h:920
ULONG cBitsPixel
Definition: winddi.h:884
ULONG yPanningAlignment
Definition: winddi.h:914
POINTL ptlPhysOffset
Definition: winddi.h:900
ULONG xPanningAlignment
Definition: winddi.h:913
ULONG ulBltAlignment
Definition: winddi.h:910
SIZEL szlPhysSize
Definition: winddi.h:901
ULONG ulHorzSize
Definition: winddi.h:880
ULONG flRaster
Definition: winddi.h:887
ULONG ulDACBlue
Definition: winddi.h:893
ULONG ulVersion
Definition: winddi.h:878
ULONG ulAspectXY
Definition: winddi.h:896
ULONG ulNumPalReg
Definition: winddi.h:902
ULONG flTextCaps
Definition: winddi.h:890
ULONG cPlanes
Definition: winddi.h:885
ULONG ulDACRed
Definition: winddi.h:891
ULONG ulVRefresh
Definition: winddi.h:909
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
#define TC_SO_ABLE
Definition: wingdi.h:819
#define TC_CP_STROKE
Definition: wingdi.h:809
#define TC_OP_CHARACTER
Definition: wingdi.h:807
#define TC_VA_ABLE
Definition: wingdi.h:821
#define TC_UA_ABLE
Definition: wingdi.h:818
#define TC_OP_STROKE
Definition: wingdi.h:808

Referenced by _Success_(), IntCreatePrimarySurface(), NtGdiGetDeviceCaps(), and PDEVOBJ_bSwitchMode().

◆ PDEVOBJ_vRefreshModeList()

VOID NTAPI PDEVOBJ_vRefreshModeList ( PPDEVOBJ  ppdev)

Definition at line 380 of file pdevobj.c.

382{
383 PGRAPHICS_DEVICE pGraphicsDevice;
384 PDEVMODEINFO pdminfo, pdmiNext;
385
386 /* Lock the PDEV */
388
389 pGraphicsDevice = ppdev->pGraphicsDevice;
390
391 /* Clear out the modes */
392 for (pdminfo = pGraphicsDevice->pdevmodeInfo;
393 pdminfo;
394 pdminfo = pdmiNext)
395 {
396 pdmiNext = pdminfo->pdmiNext;
398 }
399 pGraphicsDevice->pdevmodeInfo = NULL;
401 pGraphicsDevice->pDevModeList = NULL;
402
403 /* Update available display mode list */
404 LDEVOBJ_bBuildDevmodeList(pGraphicsDevice);
405
406 /* Unlock PDEV */
408}
BOOL LDEVOBJ_bBuildDevmodeList(_Inout_ PGRAPHICS_DEVICE pGraphicsDevice)
Definition: ldevobj.c:565
struct _DEVMODEINFO * pdmiNext
Definition: pdevobj.h:44
PDEVMODEENTRY pDevModeList
Definition: pdevobj.h:70
PDEVMODEINFO pdevmodeInfo
Definition: pdevobj.h:68
#define GDITAG_GDEVICE
Definition: tags.h:99

Referenced by UserEnumDisplaySettings().

◆ PDEVOBJ_vRelease()

VOID NTAPI PDEVOBJ_vRelease ( _Inout_ PPDEVOBJ  ppdev)

Definition at line 104 of file pdevobj.c.

106{
107 /* Lock loader */
109
110 /* Decrease reference count */
111 InterlockedDecrement(&ppdev->cPdevRefs);
112 ASSERT(ppdev->cPdevRefs >= 0);
113
114 /* Check if references are left */
115 if (ppdev->cPdevRefs == 0)
116 {
117 /* Do we have a surface? */
118 if (ppdev->pSurface)
119 {
120 /* Release the surface and let the driver free it */
121 SURFACE_ShareUnlockSurface(ppdev->pSurface);
122 TRACE("DrvDisableSurface(dhpdev %p)\n", ppdev->dhpdev);
123 ppdev->pfn.DisableSurface(ppdev->dhpdev);
124 }
125
126 /* Do we have a palette? */
127 if (ppdev->ppalSurf)
128 {
129 PALETTE_ShareUnlockPalette(ppdev->ppalSurf);
130 }
131
132 /* Check if the PDEV was enabled */
133 if (ppdev->dhpdev != NULL)
134 {
135 /* Disable the PDEV */
136 TRACE("DrvDisablePDEV(dhpdev %p)\n", ppdev->dhpdev);
137 ppdev->pfn.DisablePDEV(ppdev->dhpdev);
138 }
139
140 /* Remove it from list */
141 if (ppdev == gppdevList)
142 {
143 gppdevList = ppdev->ppdevNext;
144 }
145 else if (gppdevList)
146 {
147 PPDEVOBJ ppdevCurrent = gppdevList;
148 BOOL found = FALSE;
149 while (!found && ppdevCurrent->ppdevNext)
150 {
151 if (ppdevCurrent->ppdevNext == ppdev)
152 found = TRUE;
153 else
154 ppdevCurrent = ppdevCurrent->ppdevNext;
155 }
156 if (found)
157 ppdevCurrent->ppdevNext = ppdev->ppdevNext;
158 }
159
160 /* Unload display driver */
161 EngUnloadImage(ppdev->pldev);
162
163 /* Free it */
164 PDEVOBJ_vDeletePDEV(ppdev);
165 }
166
167 /* Unlock loader */
169}
#define InterlockedDecrement
Definition: armddk.h:52
static VOID PDEVOBJ_vDeletePDEV(PPDEVOBJ ppdev)
Definition: pdevobj.c:91
#define SURFACE_ShareUnlockSurface(pBMObj)
Definition: surface.h:102
#define PALETTE_ShareUnlockPalette(ppal)
Definition: palette.h:59

Referenced by DC_vCleanup(), DxEngUnreferenceHdev(), GreCreateCompatibleDC(), GreOpenDCW(), MDEVOBJ_vDestroy(), NtGdiExtEscape(), PDEVOBJ_bSwitchMode(), PDEVOBJ_Create(), UserChangeDisplaySettings(), UserEnumCurrentDisplaySettings(), UserEnumDisplaySettings(), and UserRefreshDisplay().

◆ SwitchPointer()

FORCEINLINE VOID SwitchPointer ( _Inout_ PVOID  pvPointer1,
_Inout_ PVOID  pvPointer2 
)

Definition at line 569 of file pdevobj.c.

572{
573 PVOID *ppvPointer1 = pvPointer1;
574 PVOID *ppvPointer2 = pvPointer2;
575 PVOID pvTemp;
576
577 pvTemp = *ppvPointer1;
578 *ppvPointer1 = *ppvPointer2;
579 *ppvPointer2 = pvTemp;
580}

Referenced by PDEVOBJ_bDynamicModeChange().

Variable Documentation

◆ ghsemPDEV

HSEMAPHORE ghsemPDEV
static

◆ gPanDispDrvCount

ULONG gPanDispDrvCount
extern

Definition at line 501 of file pandisp.c.

Referenced by PDEVOBJ_Create().

◆ gPanDispDrvFn

DRVFN gPanDispDrvFn[]
extern

Definition at line 477 of file pandisp.c.

Referenced by PDEVOBJ_Create().

◆ gppdevList

PPDEVOBJ gppdevList = NULL
static

Definition at line 14 of file pdevobj.c.

Referenced by NtGdiGetDhpdev(), PDEVOBJ_Create(), and PDEVOBJ_vRelease().