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 DPRINT1("Setting pixel format from win32k!\n");
126 pdc
= DC_LockDc(hdc
);
129 EngSetLastError(ERROR_INVALID_HANDLE
);
133 if (!pdc
->ipfdDevMax
)
134 IntGetipfdDevMax(pdc
);
137 ipfd
> pdc
->ipfdDevMax
)
139 EngSetLastError(ERROR_INVALID_PARAMETER
);
143 UserEnterExclusive();
144 hWnd
= UserGethWnd(hdc
, &pWndObj
);
149 EngSetLastError(ERROR_INVALID_WINDOW_STYLE
);
156 WndObj is needed so exit on NULL pointer.
159 pso
= pWndObj
->psoOwner
;
162 EngSetLastError(ERROR_INVALID_PIXEL_FORMAT
);
166 if (ppdev
->flFlags
& PDEV_META_DEVICE
)
172 if (ppdev
->DriverFunctions
.SetPixelFormat
)
174 Ret
= ppdev
->DriverFunctions
.SetPixelFormat(
197 pdc
= DC_LockDc(hdc
);
200 EngSetLastError(ERROR_INVALID_HANDLE
);
204 UserEnterExclusive();
205 hWnd
= UserGethWnd(hdc
, &pWndObj
);
210 EngSetLastError(ERROR_INVALID_WINDOW_STYLE
);
217 WndObj is needed so exit on NULL pointer.
220 pso
= pWndObj
->psoOwner
;
223 EngSetLastError(ERROR_INVALID_PIXEL_FORMAT
);
227 if (ppdev
->flFlags
& PDEV_META_DEVICE
)
233 if (ppdev
->DriverFunctions
.SwapBuffers
)
235 Ret
= ppdev
->DriverFunctions
.SwapBuffers(pso
, pWndObj
);