ReactOS 0.4.15-dev-8109-gd7be748
wingl.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for wingl.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static INT FASTCALL IntGetipfdDevMax (PDC pdc)
 
 _Success_ (return !=0)
 
BOOL APIENTRY NtGdiSetPixelFormat (_In_ HDC hdc, _In_ INT ipfd)
 
BOOL APIENTRY NtGdiSwapBuffers (_In_ HDC hdc)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file wingl.c.

Function Documentation

◆ _Success_()

_Success_ ( return = 0)

Definition at line 41 of file wingl.c.

50{
51 PDC pdc;
52 PPDEVOBJ ppdev;
53 INT Ret = 0;
55
56 if ((ppfd == NULL) && (cjpfd != 0)) return 0;
57
58 pdc = DC_LockDc(hdc);
59 if (!pdc)
60 {
62 return 0;
63 }
64
65 if (!pdc->ipfdDevMax)
66 {
67 if (!IntGetipfdDevMax(pdc))
68 {
69 /* EngSetLastError ? */
70 goto Exit;
71 }
72 }
73
74 if (!ppfd)
75 {
76 Ret = pdc->ipfdDevMax;
77 goto Exit;
78 }
79
80 if ((ipfd < 1) || (ipfd > pdc->ipfdDevMax))
81 {
83 goto Exit;
84 }
85
86 ppdev = pdc->ppdev;
87
88 if (ppdev->flFlags & PDEV_META_DEVICE)
89 {
91 goto Exit;
92 }
93
95 {
97 ppdev->dhpdev,
98 ipfd,
99 sizeof(pfdSafe),
100 &pfdSafe);
101 }
102
103 if (Ret && cjpfd)
104 {
106 {
109 RtlCopyMemory(ppfd, &pfdSafe, cjpfd);
110 }
112 {
114 }
115 _SEH2_END;
116 }
117
118Exit:
119 DC_UnlockDc(pdc);
120 return Ret;
121}
#define UNIMPLEMENTED
Definition: debug.h:118
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:238
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:220
#define NULL
Definition: types.h:112
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
HDC hdc
Definition: main.c:9
#define min(a, b)
Definition: monoChain.cc:55
static INT FASTCALL IntGetipfdDevMax(PDC pdc)
Definition: wingl.c:17
_In_ INT ipfd
Definition: ntgdi.h:474
@ PDEV_META_DEVICE
Definition: pdevobj.h:20
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
static void Exit(void)
Definition: sock.c:1330
Definition: polytest.cpp:41
PFN_DrvDescribePixelFormat DescribePixelFormat
Definition: ntgdityp.h:624
FLONG flFlags
Definition: pdevobj.h:87
DHPDEV dhpdev
Definition: pdevobj.h:120
DRIVER_FUNCTIONS DriverFunctions
Definition: pdevobj.h:137
int32_t INT
Definition: typedefs.h:58
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:31
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22
_In_ LONG _In_ ULONG cjpfd
Definition: winddi.h:3489
_In_ LONG _In_ ULONG _Out_opt_ PIXELFORMATDESCRIPTOR * ppfd
Definition: winddi.h:3490

◆ IntGetipfdDevMax()

static INT FASTCALL IntGetipfdDevMax ( PDC  pdc)
static

Definition at line 17 of file wingl.c.

18{
19 INT Ret = 0;
20 PPDEVOBJ ppdev = pdc->ppdev;
21
22 if (ppdev->flFlags & PDEV_META_DEVICE)
23 {
24 return 0;
25 }
26
28 {
30 ppdev->dhpdev,
31 1,
32 0,
33 NULL);
34 }
35
36 if (Ret) pdc->ipfdDevMax = Ret;
37
38 return Ret;
39}

Referenced by _Success_(), and NtGdiSetPixelFormat().

◆ NtGdiSetPixelFormat()

BOOL APIENTRY NtGdiSetPixelFormat ( _In_ HDC  hdc,
_In_ INT  ipfd 
)

Definition at line 126 of file wingl.c.

129{
130 PDC pdc;
131 PPDEVOBJ ppdev;
132 HWND hWnd;
133 PWNDOBJ pWndObj;
134 SURFOBJ *pso = NULL;
135 BOOL Ret = FALSE;
136
137 DPRINT1("Setting pixel format from win32k!\n");
138
139 pdc = DC_LockDc(hdc);
140 if (!pdc)
141 {
143 return FALSE;
144 }
145
146 if (!pdc->ipfdDevMax)
147 IntGetipfdDevMax(pdc);
148
149 if ( ipfd < 1 ||
150 ipfd > pdc->ipfdDevMax )
151 {
153 goto Exit;
154 }
155
157 hWnd = UserGethWnd(hdc, &pWndObj);
158 UserLeave();
159
160 if (!hWnd)
161 {
163 goto Exit;
164 }
165
166 ppdev = pdc->ppdev;
167
168 /*
169 WndObj is needed so exit on NULL pointer.
170 */
171 if (pWndObj)
172 pso = pWndObj->psoOwner;
173 else
174 {
176 goto Exit;
177 }
178
179 if (ppdev->flFlags & PDEV_META_DEVICE)
180 {
182 goto Exit;
183 }
184
186 {
187 Ret = ppdev->DriverFunctions.SetPixelFormat(
188 pso,
189 ipfd,
190 hWnd);
191 }
192
193Exit:
194 DC_UnlockDc(pdc);
195 return Ret;
196}
HWND hWnd
Definition: settings.c:17
#define DPRINT1
Definition: precomp.h:8
HWND FASTCALL UserGethWnd(HDC, PWNDOBJ *)
Definition: windc.c:953
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
VOID FASTCALL UserLeave(VOID)
Definition: ntuser.c:251
VOID FASTCALL UserEnterExclusive(VOID)
Definition: ntuser.c:242
PFN_DrvSetPixelFormat SetPixelFormat
Definition: ntgdityp.h:623
SURFOBJ * psoOwner
Definition: winddi.h:1230
_In_ HANDLE _In_ SURFOBJ * pso
Definition: winddi.h:3665
#define ERROR_INVALID_PIXEL_FORMAT
Definition: winerror.h:1179
#define ERROR_INVALID_WINDOW_STYLE
Definition: winerror.h:1181

◆ NtGdiSwapBuffers()

BOOL APIENTRY NtGdiSwapBuffers ( _In_ HDC  hdc)

Definition at line 200 of file wingl.c.

202{
203 PDC pdc;
204 PPDEVOBJ ppdev;
205 HWND hWnd;
206 PWNDOBJ pWndObj;
207 SURFOBJ *pso = NULL;
208 BOOL Ret = FALSE;
209
210 pdc = DC_LockDc(hdc);
211 if (!pdc)
212 {
214 return FALSE;
215 }
216
218 hWnd = UserGethWnd(hdc, &pWndObj);
219 UserLeave();
220
221 if (!hWnd)
222 {
224 goto Exit;
225 }
226
227 ppdev = pdc->ppdev;
228
229 /*
230 WndObj is needed so exit on NULL pointer.
231 */
232 if (pWndObj)
233 pso = pWndObj->psoOwner;
234 else
235 {
237 goto Exit;
238 }
239
240 if (ppdev->flFlags & PDEV_META_DEVICE)
241 {
243 goto Exit;
244 }
245
246 if (ppdev->DriverFunctions.SwapBuffers)
247 {
248 Ret = ppdev->DriverFunctions.SwapBuffers(pso, pWndObj);
249 }
250
251Exit:
252 DC_UnlockDc(pdc);
253 return Ret;
254}
PFN_DrvSwapBuffers SwapBuffers
Definition: ntgdityp.h:625