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
);
66 if (!IntGetipfdDevMax(pdc
))
68 /* EngSetLastError ? */
75 Ret
= pdc
->ipfdDevMax
;
79 if ((ipfd
< 1) || (ipfd
> pdc
->ipfdDevMax
))
81 EngSetLastError(ERROR_INVALID_PARAMETER
);
87 if (ppdev
->flFlags
& PDEV_META_DEVICE
)
93 if (ppdev
->DriverFunctions
.DescribePixelFormat
)
95 Ret
= ppdev
->DriverFunctions
.DescribePixelFormat(
106 cjpfd
= min(cjpfd
, sizeof(PIXELFORMATDESCRIPTOR
));
107 ProbeForWrite(ppfd
, cjpfd
, 1);
108 RtlCopyMemory(ppfd
, &pfdSafe
, cjpfd
);
110 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
112 SetLastNtError(_SEH2_GetExceptionCode());
136 DPRINT1("Setting pixel format from win32k!\n");
138 pdc
= DC_LockDc(hdc
);
141 EngSetLastError(ERROR_INVALID_HANDLE
);
145 if (!pdc
->ipfdDevMax
)
146 IntGetipfdDevMax(pdc
);
149 ipfd
> pdc
->ipfdDevMax
)
151 EngSetLastError(ERROR_INVALID_PARAMETER
);
155 UserEnterExclusive();
156 hWnd
= UserGethWnd(hdc
, &pWndObj
);
161 EngSetLastError(ERROR_INVALID_WINDOW_STYLE
);
168 WndObj is needed so exit on NULL pointer.
171 pso
= pWndObj
->psoOwner
;
174 EngSetLastError(ERROR_INVALID_PIXEL_FORMAT
);
178 if (ppdev
->flFlags
& PDEV_META_DEVICE
)
184 if (ppdev
->DriverFunctions
.SetPixelFormat
)
186 Ret
= ppdev
->DriverFunctions
.SetPixelFormat(
209 pdc
= DC_LockDc(hdc
);
212 EngSetLastError(ERROR_INVALID_HANDLE
);
216 UserEnterExclusive();
217 hWnd
= UserGethWnd(hdc
, &pWndObj
);
222 EngSetLastError(ERROR_INVALID_WINDOW_STYLE
);
229 WndObj is needed so exit on NULL pointer.
232 pso
= pWndObj
->psoOwner
;
235 EngSetLastError(ERROR_INVALID_PIXEL_FORMAT
);
239 if (ppdev
->flFlags
& PDEV_META_DEVICE
)
245 if (ppdev
->DriverFunctions
.SwapBuffers
)
247 Ret
= ppdev
->DriverFunctions
.SwapBuffers(pso
, pWndObj
);