52 if (ppdev->
dhpdev == dhpdev)
break;
113 ASSERT(ppdev->cPdevRefs >= 0);
116 if (ppdev->cPdevRefs == 0)
123 TRACE(
"DrvDisableSurface(dhpdev %p)\n", ppdev->dhpdev);
124 ppdev->pfn.DisableSurface(ppdev->dhpdev);
134 if (ppdev->dhpdev !=
NULL)
137 TRACE(
"DrvDisablePDEV(dhpdev %p)\n", ppdev->dhpdev);
138 ppdev->pfn.DisablePDEV(ppdev->dhpdev);
150 while (!found && ppdevCurrent->
ppdevNext)
158 ppdevCurrent->
ppdevNext = ppdev->ppdevNext;
183 pfnEnablePDEV = ppdev->pfn.EnablePDEV;
186 TRACE(
"DrvEnablePDEV(pdevmode %p (%dx%dx%d %d Hz) hdev %p (%S))\n",
188 ppdev->pGraphicsDevice ? pdevmode->dmPelsWidth : 0,
189 ppdev->pGraphicsDevice ? pdevmode->dmPelsHeight : 0,
190 ppdev->pGraphicsDevice ? pdevmode->dmBitsPerPel : 0,
191 ppdev->pGraphicsDevice ? pdevmode->dmDisplayFrequency : 0,
193 ppdev->pGraphicsDevice ? ppdev->pGraphicsDevice->szNtDeviceName :
L"");
194 ppdev->dhpdev = pfnEnablePDEV(pdevmode,
203 ppdev->pGraphicsDevice ? ppdev->pGraphicsDevice->pwszDescription :
NULL,
204 ppdev->pGraphicsDevice ? ppdev->pGraphicsDevice->DeviceObject :
NULL);
205 TRACE(
"DrvEnablePDEV(pdevmode %p hdev %p) => dhpdev %p\n", pdevmode, ppdev, ppdev->dhpdev);
206 if (ppdev->dhpdev ==
NULL)
208 ERR(
"Failed to enable PDEV\n");
213 if (ppdev->gdiinfo.ulLogPixelsX == 0)
214 ppdev->gdiinfo.ulLogPixelsX = 96;
216 if (ppdev->gdiinfo.ulLogPixelsY == 0)
217 ppdev->gdiinfo.ulLogPixelsY = 96;
234 if (ppdev->ahsurf[
i] ==
NULL)
238 TRACE(
"PDEVOBJ_bEnablePDEV - dhpdev = %p\n", ppdev->dhpdev);
249 TRACE(
"DrvCompletePDEV(dhpdev %p hdev %p)\n", ppdev->
dhpdev, ppdev);
259 ULONG dwAccelerationLevel = ppdev->dwAccelerationLevel;
266 if (dwAccelerationLevel >= 1)
272 if (dwAccelerationLevel >= 2)
283 if (dwAccelerationLevel >= 3)
290 if (dwAccelerationLevel >= 4)
293 ppdev->pSurface->flags &= ~HOOK_FLAGS |
302 if (dwAccelerationLevel >= 5)
320 TRACE(
"DrvEnableSurface(dhpdev %p)\n", ppdev->
dhpdev);
322 TRACE(
"DrvEnableSurface(dhpdev %p) => hsurf %p\n", ppdev->
dhpdev, hsurf);
325 ERR(
"Failed to create PDEV surface!\n");
342PDEVOBJ_bEnableDirectDraw(
349 TRACE(
"DxDdEnableDirectDraw(ppdev %p)\n", ppdev);
350 Success = pfnDdEnableDirectDraw((HDEV)ppdev,
TRUE);
351 TRACE(
"DxDdEnableDirectDraw(ppdev %p) => %d\n", ppdev,
Success);
357PDEVOBJ_vResumeDirectDraw(
363 TRACE(
"DxDdResumeDirectDraw(ppdev %p)\n", ppdev);
364 pfnDdResumeDirectDraw((HDEV)ppdev, 0);
368PDEVOBJ_vSuspendDirectDraw(
374 TRACE(
"DxDdSuspendDirectDraw(ppdev %p)\n", ppdev);
375 pfnDdSuspendDirectDraw((HDEV)ppdev, 0);
379PDEVOBJ_vSwitchDirectDraw(
386 TRACE(
"DxDdDynamicModeChange(ppdev %p, ppdev2 %p)\n", ppdev, ppdev2);
387 pfnDdDynamicModeChange((HDEV)ppdev, (HDEV)ppdev2, 0);
403 TRACE(
"DrvAssertMode(dhpdev %p, TRUE)\n", ppdev->dhpdev);
404 assertVal = ppdev->pfn.AssertMode(ppdev->dhpdev,
TRUE);
405 TRACE(
"DrvAssertMode(dhpdev %p, TRUE) => %d\n", ppdev->dhpdev, assertVal);
406 }
while (!assertVal);
408 ppdev->flFlags &= ~PDEV_DISABLED;
421 PDEVOBJ_vSuspendDirectDraw(ppdev);
424 TRACE(
"DrvAssertMode(dhpdev %p, FALSE)\n", ppdev->dhpdev);
425 assertVal = ppdev->pfn.AssertMode(ppdev->dhpdev,
FALSE);
426 TRACE(
"DrvAssertMode(dhpdev %p, FALSE) => %d\n", ppdev->dhpdev, assertVal);
477 TRACE(
"PDEVOBJ_Create(%p %p %d)\n", pGraphicsDevice, pdm, ldevtype);
522 ERR(
"Could not load display driver '%S'\n",
531 ERR(
"failed to allocate a PDEV\n");
561 ppdev->
pldev = pldev;
572 pdm->dmPanningWidth = pdm->dmPelsWidth;
574 pdm->dmPanningHeight = pdm->dmPelsHeight;
588 ERR(
"Failed to enable PDEV!\n");
601 ERR(
"Failed to create surface\n");
609 if (!PDEVOBJ_bEnableDirectDraw(ppdev))
611 ERR(
"Failed to enable DirectDraw\n");
640 PVOID *ppvPointer1 = pvPointer1;
641 PVOID *ppvPointer2 = pvPointer2;
644 pvTemp = *ppvPointer1;
645 *ppvPointer1 = *ppvPointer2;
646 *ppvPointer2 = pvTemp;
703 PDEVOBJ_vSwitchDirectDraw(ppdev, ppdev2);
726 DPRINT1(
"PDEVOBJ_bSwitchMode, ppdev = %p, pSurface = %p\n", ppdev, ppdev->
pSurface);
734 DPRINT1(
"PDEVOBJ_bDisableDisplay() failed\n");
737 PDEVOBJ_vResumeDirectDraw(ppdev);
746 DPRINT1(
"Failed to create a new PDEV\n");
754 DPRINT1(
"PDEVOBJ_pSurface failed\n");
761 PDEVOBJ_vSuspendDirectDraw(ppdev);
762 PDEVOBJ_vSuspendDirectDraw(ppdevTmp);
768 DPRINT1(
"PDEVOBJ_bDynamicModeChange() failed\n");
775 PDEVOBJ_vResumeDirectDraw(ppdev);
776 PDEVOBJ_vResumeDirectDraw(ppdevTmp);
784 ppdev->
pEDDgpl->hDev = (HDEV)ppdev;
878 TRACE(
"PDEVOBJ_lChangeDisplaySettings('%wZ' '%dx%dx%d (%d Hz)' %p %p)\n",
880 RequestedMode ? RequestedMode->dmPelsWidth : 0,
881 RequestedMode ? RequestedMode->dmPelsHeight : 0,
882 RequestedMode ? RequestedMode->dmBitsPerPel : 0,
883 RequestedMode ? RequestedMode->dmDisplayFrequency : 0,
884 pmdevOld, ppmdevNew);
889 if (!pGraphicsDevice)
891 ERR(
"Wrong device name provided: '%wZ'\n", pustrDeviceName);
896 else if (RequestedMode)
899 if (!pGraphicsDevice)
901 ERR(
"Wrong device'\n");
911 ERR(
"DrvProbeAndCaptureDevmode() failed\n");
942 ERR(
"Failed to create new MDEV\n");
952 if (pustrDeviceName && pmdevOld)
955 for (
i = 0;
i < pmdevOld->cDev;
i++)
957 for (
j = 0;
j < pmdev->
cDev;
j++)
969 ERR(
"Failed to apply new settings\n");
976 if (
j == pmdev->
cDev)
985 if (pmdev->
cDev == 1)
993 if (!pmdev->ppdevGlobal)
995 WARN(
"Failed to create meta-device. Using only first display\n");
997 pmdev->ppdevGlobal = pmdev->dev[0].ppdev;
1004 for (
i = 0;
i < pmdevOld->cDev;
i++)
1006 for (
j = 0;
j < pmdev->
cDev;
j++)
1011 if (
j == pmdev->
cDev)
1023 if (pdm && pdm != RequestedMode)
1040 ret = CM_GAMMA_RAMP;
1044 ret |= CM_CMYK_COLOR;
1046 ret |= CM_DEVICE_ICM;
1057 PGDIINFO pGdiInfo = &ppdev->gdiinfo;
1125 if (cjOutSize >=
sizeof(
DWORD))
1145 ASSERT(ppdev->
pldev->pGdiDriverInfo->DriverName.Buffer);
1147 return ppdev->
pldev->pGdiDriverInfo->DriverName.Buffer;
1249 case SHADEBLENDCAPS:
1302NtGdiGetDeviceCapsAll(
#define InterlockedDecrement
#define DBG_DEFAULT_CHANNEL(ch)
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
FORCEINLINE PDC DC_LockDc(HDC hdc)
#define ERROR_INVALID_HANDLE
static void cleanup(void)
PPDEVOBJ NTAPI DbgLookupDHPDEV(DHPDEV dhpdev)
#define DXG_INDEX_DxDdDynamicModeChange
BOOLEAN(NTAPI * PGD_DXDDENABLEDIRECTDRAW)(PVOID, BOOLEAN)
#define DXG_INDEX_DxDdResumeDirectDraw
#define DXG_INDEX_DxDdEnableDirectDraw
#define DXG_INDEX_DxDdSuspendDirectDraw
HSURF gahsurfHatch[HS_DDI_MAX]
#define ExAllocatePoolWithTag(hernya, size, tag)
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
VOID WINAPI EngReleaseSemaphore(IN HSEMAPHORE hsem)
HSEMAPHORE WINAPI EngCreateSemaphore(VOID)
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
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
#define EXCEPTION_EXECUTE_HANDLER
VOID(APIENTRY * PGD_DXDDSUSPENDDIRECTDRAW)(HDEV, ULONG_PTR)
VOID(APIENTRY * PGD_DXDDRESUMEDIRECTDRAW)(HDEV, ULONG_PTR)
VOID(APIENTRY * PGD_DXDDDYNAMICMODECHANGE)(HDEV, HDEV, ULONG_PTR)
#define RtlEqualMemory(dst, src, len)
PLDEVOBJ NTAPI LDEVOBJ_pLoadDriver(_In_z_ LPWSTR pwszDriverName, _In_ ULONG ldevtype)
BOOL LDEVOBJ_bBuildDevmodeList(_Inout_ PGRAPHICS_DEVICE pGraphicsDevice)
BOOL LDEVOBJ_bProbeAndCaptureDevmode(_Inout_ PGRAPHICS_DEVICE pGraphicsDevice, _In_ PDEVMODEW RequestedMode, _Out_ PDEVMODEW *pSelectedMode, _In_ BOOL bSearchClosestMode)
PLDEVOBJ LDEVOBJ_pLoadInternal(_In_ PFN_DrvEnableDriver pfnEnableDriver, _In_ ULONG ldevtype)
VOID MDEVOBJ_vDestroy(_Inout_ PMDEVOBJ pmdev)
PMDEVOBJ MDEVOBJ_Create(_In_opt_ PUNICODE_STRING pustrDeviceName, _In_opt_ PDEVMODEW pdm)
BOOL MDEVOBJ_bDisable(_Inout_ PMDEVOBJ pmdev)
VOID MDEVOBJ_vEnable(_Inout_ PMDEVOBJ pmdev)
struct _PDEVOBJ * PPDEVOBJ
#define ExFreePoolWithTag(_P, _T)
#define _Inout_bytecount_(size)
#define _In_reads_bytes_(s)
#define _Must_inspect_result_
#define _Out_writes_bytes_(s)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
#define MmSystemRangeStart
PPDEVOBJ NTAPI EngpGetPDEV(_In_opt_ PUNICODE_STRING pustrDeviceName)
BOOL NTAPI PDEVOBJ_bEnablePDEV(_In_ PPDEVOBJ ppdev, _In_ PDEVMODEW pdevmode, _In_ PWSTR pwszLogAddress)
BOOL APIENTRY MultiEnableDriver(_In_ ULONG iEngineVersion, _In_ ULONG cj, _Inout_bytecount_(cj) PDRVENABLEDATA pded)
static VOID PDEVOBJ_vFilterDriverHooks(_In_ PPDEVOBJ ppdev)
BOOL PDEVOBJ_bDisableDisplay(_Inout_ PPDEVOBJ ppdev)
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)
LONG PDEVOBJ_lChangeDisplaySettings(_In_opt_ PUNICODE_STRING pustrDeviceName, _In_opt_ PDEVMODEW RequestedMode, _In_opt_ PMDEVOBJ pmdevOld, _Out_ PMDEVOBJ *ppmdevNew, _In_ BOOL bSearchClosestMode)
static HSEMAPHORE ghsemPDEV
PPDEVOBJ PDEVOBJ_Create(_In_opt_ PGRAPHICS_DEVICE pGraphicsDevice, _In_opt_ PDEVMODEW pdm, _In_ ULONG dwAccelerationLevel, _In_ ULONG ldevtype)
BOOL NTAPI PDEVOBJ_bDynamicModeChange(PPDEVOBJ ppdev, PPDEVOBJ ppdev2)
static PPDEVOBJ gppdevList
PSIZEL FASTCALL PDEVOBJ_sizl(PPDEVOBJ ppdev, PSIZEL psizl)
DHPDEV APIENTRY NtGdiGetDhpdev(IN HDEV hdev)
INT NTAPI PDEVOBJ_iGetColorManagementCaps(PPDEVOBJ ppdev)
VOID NTAPI PDEVOBJ_vRefreshModeList(PPDEVOBJ ppdev)
BOOL NTAPI PDEVOBJ_bSwitchMode(PPDEVOBJ ppdev, PDEVMODEW pdm)
INT APIENTRY NtGdiGetDeviceCaps(HDC hdc, INT Index)
VOID NTAPI PDEVOBJ_vRelease(_Inout_ PPDEVOBJ ppdev)
VOID NTAPI PDEVOBJ_vGetDeviceCaps(IN PPDEVOBJ ppdev, OUT PDEVCAPS pDevCaps)
PSURFACE NTAPI PDEVOBJ_pSurface(PPDEVOBJ ppdev)
VOID PDEVOBJ_vEnableDisplay(_Inout_ PPDEVOBJ ppdev)
PPDEVOBJ PDEVOBJ_AllocPDEV(VOID)
static VOID PDEVOBJ_vDeletePDEV(PPDEVOBJ ppdev)
FORCEINLINE VOID SwitchPointer(_Inout_ PVOID pvPointer1, _Inout_ PVOID pvPointer2)
NTSTATUS NTAPI InitPDEVImpl(VOID)
VOID NTAPI PDEVOBJ_vCompletePDEV(PPDEVOBJ ppdev)
FORCEINLINE VOID PDEVOBJ_vReference(_In_ PPDEVOBJ ppdev)
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
struct _DEVMODEINFO * pdmiNext
PFN_DrvMovePointer MovePointer
PFN_DrvCompletePDEV CompletePDEV
PFN_DrvEnableSurface EnableSurface
PDEVMODEENTRY pDevModeList
WCHAR szWinDeviceName[CCHDEVICENAME/2]
PDEVMODEINFO pdevmodeInfo
PDEVICE_OBJECT DeviceObject
SYSTEM_GDI_DRIVER_INFORMATION * pGdiDriverInfo
struct _PDEVOBJ * ppdevNext
DWORD dwAccelerationLevel
struct _EDD_DIRECTDRAW_GLOBAL * pEDDgpl
PGRAPHICS_DEVICE pGraphicsDevice
PFN_DrvMovePointer pfnMovePointer
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define STATUS_INSUFFICIENT_RESOURCES
_In_ WDFCOLLECTION _In_ ULONG Index
PGRAPHICS_DEVICE NTAPI EngpFindGraphicsDevice(_In_opt_ PUNICODE_STRING pustrDevice, _In_ ULONG iDevNum)
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
#define SURFACE_ShareUnlockSurface(pBMObj)
#define SURFACE_ShareLockSurface(hBMObj)
VOID NTAPI GDIOBJ_vReferenceObjectByPointer(POBJ pobj)
#define PALETTE_ShareLockPalette(hpal)
#define PALETTE_ShareUnlockPalette(ppal)
DRVFN gpDxFuncs[DXG_INDEX_DxDdIoctl+1]
#define INDEX_DrvSetPointerShape
#define GCAPS2_CHANGEGAMMARAMP
_Requires_lock_not_held_ hsem ENGAPI VOID APIENTRY EngDeleteSemaphore(_Inout_ __drv_freesMem(Mem) HSEMAPHORE hsem)
typedef DHPDEV(APIENTRY FN_DrvEnablePDEV)(_In_ DEVMODEW *pdm
#define HOOK_TRANSPARENTBLT
_In_ DD_SURFACE_LOCAL * pSurface
ENGAPI VOID APIENTRY EngAcquireSemaphore(_Inout_ HSEMAPHORE hsem)
ENGAPI VOID APIENTRY EngMovePointer(_In_ SURFOBJ *pso, _In_ LONG x, _In_ LONG y, _In_ RECTL *prcl)
_In_ LPWSTR pwszLogAddress
#define HOOK_GRADIENTFILL
typedef HSURF(APIENTRY FN_DrvEnableSurface)(_In_ DHPDEV dhpdev)
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
FN_DrvEnablePDEV * PFN_DrvEnablePDEV
ENGAPI VOID APIENTRY EngUnloadImage(_In_ HANDLE hModule)
#define INDEX_DrvCreateDeviceBitmap
enum _ENG_DEVICE_ATTRIBUTE ENG_DEVICE_ATTRIBUTE
#define DISPLAY_DEVICE_PRIMARY_DEVICE
#define DISPLAY_DEVICE_ATTACHED_TO_DESKTOP
#define DISP_CHANGE_BADMODE
#define DISP_CHANGE_SUCCESSFUL
#define DISP_CHANGE_BADPARAM
#define DISP_CHANGE_FAILED