2 * PROJECT: ReactOS win32 kernel mode subsystem
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: subsystems/win32/win32k/objects/wingl.c
17 IntGetipfdDevMax(PDC pdc
)
20 PPDEVOBJ ppdev
= pdc
->ppdev
;
22 if (ppdev
->flFlags
& PDEV_META_DEVICE
)
27 if (ppdev
->DriverFunctions
.DescribePixelFormat
)
29 Ret
= ppdev
->DriverFunctions
.DescribePixelFormat(
36 if (Ret
) pdc
->ipfdDevMax
= Ret
;
41 _Success_(return != 0)
44 NtGdiDescribePixelFormat(
48 _When_(cjpfd
!= 0, _Out_
) PPIXELFORMATDESCRIPTOR ppfd
)
53 PIXELFORMATDESCRIPTOR pfdSafe
;
55 if ((ppfd
== NULL
) && (cjpfd
!= 0)) return 0;
60 EngSetLastError(ERROR_INVALID_HANDLE
);
65 IntGetipfdDevMax(pdc
);
67 if ((ipfd
< 1) || (ipfd
> pdc
->ipfdDevMax
))
69 EngSetLastError(ERROR_INVALID_PARAMETER
);
75 if (ppdev
->flFlags
& PDEV_META_DEVICE
)
81 if (ppdev
->DriverFunctions
.DescribePixelFormat
)
83 Ret
= ppdev
->DriverFunctions
.DescribePixelFormat(
94 cjpfd
= min(cjpfd
, sizeof(PIXELFORMATDESCRIPTOR
));
95 ProbeForWrite(ppfd
, cjpfd
, 1);
96 RtlCopyMemory(ppfd
, &pfdSafe
, cjpfd
);
98 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
100 SetLastNtError(_SEH2_GetExceptionCode());
124 pdc
= DC_LockDc(hdc
);
127 EngSetLastError(ERROR_INVALID_HANDLE
);
131 if (!pdc
->ipfdDevMax
)
132 IntGetipfdDevMax(pdc
);
135 ipfd
> pdc
->ipfdDevMax
)
137 EngSetLastError(ERROR_INVALID_PARAMETER
);
141 UserEnterExclusive();
142 hWnd
= UserGethWnd(hdc
, &pWndObj
);
147 EngSetLastError(ERROR_INVALID_WINDOW_STYLE
);
154 WndObj is needed so exit on NULL pointer.
157 pso
= pWndObj
->psoOwner
;
160 EngSetLastError(ERROR_INVALID_PIXEL_FORMAT
);
164 if (ppdev
->flFlags
& PDEV_META_DEVICE
)
170 if (ppdev
->DriverFunctions
.SetPixelFormat
)
172 Ret
= ppdev
->DriverFunctions
.SetPixelFormat(
195 pdc
= DC_LockDc(hdc
);
198 EngSetLastError(ERROR_INVALID_HANDLE
);
202 UserEnterExclusive();
203 hWnd
= UserGethWnd(hdc
, &pWndObj
);
208 EngSetLastError(ERROR_INVALID_WINDOW_STYLE
);
215 WndObj is needed so exit on NULL pointer.
218 pso
= pWndObj
->psoOwner
;
221 EngSetLastError(ERROR_INVALID_PIXEL_FORMAT
);
225 if (ppdev
->flFlags
& PDEV_META_DEVICE
)
231 if (ppdev
->DriverFunctions
.SwapBuffers
)
233 Ret
= ppdev
->DriverFunctions
.SwapBuffers(pso
, pWndObj
);