2 * PROJECT: ReactOS win32 kernel mode subsystem
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: win32ss/gdi/ntgdi/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)
45 NtGdiDescribePixelFormat(
49 _Out_writes_bytes_(cjpfd
) PPIXELFORMATDESCRIPTOR ppfd
)
54 PIXELFORMATDESCRIPTOR pfdSafe
;
56 if ((ppfd
== NULL
) && (cjpfd
!= 0)) return 0;
61 EngSetLastError(ERROR_INVALID_HANDLE
);
67 if (!IntGetipfdDevMax(pdc
))
69 /* EngSetLastError ? */
76 Ret
= pdc
->ipfdDevMax
;
80 if ((ipfd
< 1) || (ipfd
> pdc
->ipfdDevMax
))
82 EngSetLastError(ERROR_INVALID_PARAMETER
);
88 if (ppdev
->flFlags
& PDEV_META_DEVICE
)
94 if (ppdev
->DriverFunctions
.DescribePixelFormat
)
96 Ret
= ppdev
->DriverFunctions
.DescribePixelFormat(
107 cjpfd
= min(cjpfd
, sizeof(PIXELFORMATDESCRIPTOR
));
108 ProbeForWrite(ppfd
, cjpfd
, 1);
109 RtlCopyMemory(ppfd
, &pfdSafe
, cjpfd
);
111 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
113 SetLastNtError(_SEH2_GetExceptionCode());
137 DPRINT1("Setting pixel format from win32k!\n");
139 pdc
= DC_LockDc(hdc
);
142 EngSetLastError(ERROR_INVALID_HANDLE
);
146 if (!pdc
->ipfdDevMax
)
147 IntGetipfdDevMax(pdc
);
150 ipfd
> pdc
->ipfdDevMax
)
152 EngSetLastError(ERROR_INVALID_PARAMETER
);
156 UserEnterExclusive();
157 hWnd
= UserGethWnd(hdc
, &pWndObj
);
162 EngSetLastError(ERROR_INVALID_WINDOW_STYLE
);
169 WndObj is needed so exit on NULL pointer.
172 pso
= pWndObj
->psoOwner
;
175 EngSetLastError(ERROR_INVALID_PIXEL_FORMAT
);
179 if (ppdev
->flFlags
& PDEV_META_DEVICE
)
185 if (ppdev
->DriverFunctions
.SetPixelFormat
)
187 Ret
= ppdev
->DriverFunctions
.SetPixelFormat(
210 pdc
= DC_LockDc(hdc
);
213 EngSetLastError(ERROR_INVALID_HANDLE
);
217 UserEnterExclusive();
218 hWnd
= UserGethWnd(hdc
, &pWndObj
);
223 EngSetLastError(ERROR_INVALID_WINDOW_STYLE
);
230 WndObj is needed so exit on NULL pointer.
233 pso
= pWndObj
->psoOwner
;
236 EngSetLastError(ERROR_INVALID_PIXEL_FORMAT
);
240 if (ppdev
->flFlags
& PDEV_META_DEVICE
)
246 if (ppdev
->DriverFunctions
.SwapBuffers
)
248 Ret
= ppdev
->DriverFunctions
.SwapBuffers(pso
, pWndObj
);