8 IntGdiSetBkColor(HDC hDC
, COLORREF color
)
15 if (!(dc
= DC_LockDc(hDC
)))
17 SetLastWin32Error(ERROR_INVALID_HANDLE
);
20 pdcattr
= dc
->pdcattr
;
21 oldColor
= pdcattr
->crBackgroundClr
;
22 pdcattr
->crBackgroundClr
= color
;
23 pdcattr
->ulBackgroundClr
= (ULONG
)color
;
24 pdcattr
->ulDirty_
&= ~(DIRTY_BACKGROUND
|DIRTY_LINE
|DIRTY_FILL
); // Clear Flag if set.
25 hBrush
= pdcattr
->hbrush
;
27 NtGdiSelectBrush(hDC
, hBrush
);
32 IntGdiSetBkMode(HDC hDC
, INT Mode
)
38 if (!(dc
= DC_LockDc(hDC
)))
40 SetLastWin32Error(ERROR_INVALID_HANDLE
);
43 pdcattr
= dc
->pdcattr
;
44 oldMode
= pdcattr
->lBkMode
;
45 pdcattr
->jBkMode
= Mode
;
46 pdcattr
->lBkMode
= Mode
;
53 IntGdiSetTextAlign(HDC hDC
,
63 SetLastWin32Error(ERROR_INVALID_HANDLE
);
66 pdcattr
= dc
->pdcattr
;
67 prevAlign
= pdcattr
->lTextAlign
;
68 pdcattr
->lTextAlign
= Mode
;
75 IntGdiSetTextColor(HDC hDC
,
85 SetLastWin32Error(ERROR_INVALID_HANDLE
);
88 pdcattr
= pdc
->pdcattr
;
90 // What about ulForegroundClr, like in gdi32?
91 crOldColor
= pdcattr
->crForegroundClr
;
92 pdcattr
->crForegroundClr
= color
;
93 DC_vUpdateTextBrush(pdc
);
102 DCU_SetDcUndeletable(HDC hDC
)
104 PDC dc
= DC_LockDc(hDC
);
107 SetLastWin32Error(ERROR_INVALID_HANDLE
);
111 dc
->fs
|= DC_FLAG_PERMANENT
;
118 IntIsPrimarySurface(SURFOBJ
*SurfObj
)
120 if (PrimarySurface
.pSurface
== NULL
)
124 return SurfObj
->hsurf
== PrimarySurface
.pSurface
; // <- FIXME: WTF?
130 NtGdiCancelDC(HDC hDC
)
138 IntGdiSetHookFlags(HDC hDC
, WORD Flags
)
141 DC
*dc
= DC_LockDc(hDC
);
145 SetLastWin32Error(ERROR_INVALID_HANDLE
);
149 wRet
= dc
->fs
& DC_FLAG_DIRTY_RAO
; // Fixme wrong flag!
151 /* "Undocumented Windows" info is slightly confusing.
154 DPRINT("DC %p, Flags %04x\n", hDC
, Flags
);
156 if (Flags
& DCHF_INVALIDATEVISRGN
)
158 /* hVisRgn has to be updated */
159 dc
->fs
|= DC_FLAG_DIRTY_RAO
;
161 else if (Flags
& DCHF_VALIDATEVISRGN
|| 0 == Flags
)
163 dc
->fs
&= ~DC_FLAG_DIRTY_RAO
;
183 DWORD SafeResult
= 0;
184 NTSTATUS Status
= STATUS_SUCCESS
;
188 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
192 pdc
= DC_LockDc(hDC
);
195 SetLastWin32Error(ERROR_INVALID_HANDLE
);
198 pdcattr
= pdc
->pdcattr
;
206 SafeResult
= pdcattr
->lRelAbs
;
209 case GdiGetBreakExtra
:
210 SafeResult
= pdcattr
->lBreakExtra
;
213 case GdiGerCharBreak
:
214 SafeResult
= pdcattr
->cBreak
;
217 case GdiGetArcDirection
:
218 if (pdcattr
->dwLayout
& LAYOUT_RTL
)
219 SafeResult
= AD_CLOCKWISE
- ((pdc
->dclevel
.flPath
& DCPATH_CLOCKWISE
) != 0);
221 SafeResult
= ((pdc
->dclevel
.flPath
& DCPATH_CLOCKWISE
) != 0) + AD_COUNTERCLOCKWISE
;
224 case GdiGetEMFRestorDc
:
227 case GdiGetFontLanguageInfo
:
228 SafeResult
= IntGetFontLanguageInfo(pdc
);
232 SafeResult
= pdc
->dctype
;
236 SafeResult
= pdcattr
->iMapMode
;
239 case GdiGetTextCharExtra
:
240 SafeResult
= pdcattr
->lTextExtra
;
244 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
253 ProbeForWrite(Result
, sizeof(DWORD
), 1);
254 *Result
= SafeResult
;
256 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
258 Status
= _SEH2_GetExceptionCode();
262 if (!NT_SUCCESS(Status
))
264 SetLastNtError(Status
);
275 NtGdiGetAndSetDCDword(
285 DWORD SafeResult
= 0;
286 NTSTATUS Status
= STATUS_SUCCESS
;
290 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
294 pdc
= DC_LockDc(hDC
);
297 SetLastWin32Error(ERROR_INVALID_HANDLE
);
300 pdcattr
= pdc
->pdcattr
;
304 case GdiGetSetCopyCount
:
305 SafeResult
= pdc
->ulCopyCount
;
306 pdc
->ulCopyCount
= dwIn
;
309 case GdiGetSetTextAlign
:
310 SafeResult
= pdcattr
->lTextAlign
;
311 pdcattr
->lTextAlign
= dwIn
;
312 // pdcattr->flTextAlign = dwIn; // Flags!
315 case GdiGetSetRelAbs
:
316 SafeResult
= pdcattr
->lRelAbs
;
317 pdcattr
->lRelAbs
= dwIn
;
320 case GdiGetSetTextCharExtra
:
321 SafeResult
= pdcattr
->lTextExtra
;
322 pdcattr
->lTextExtra
= dwIn
;
325 case GdiGetSetSelectFont
:
328 case GdiGetSetMapperFlagsInternal
:
331 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
335 SafeResult
= pdcattr
->flFontMapper
;
336 pdcattr
->flFontMapper
= dwIn
;
339 case GdiGetSetMapMode
:
340 SafeResult
= IntGdiSetMapMode(pdc
, dwIn
);
343 case GdiGetSetArcDirection
:
344 if (dwIn
!= AD_COUNTERCLOCKWISE
&& dwIn
!= AD_CLOCKWISE
)
346 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
350 if (pdcattr
->dwLayout
& LAYOUT_RTL
) // Right to Left
352 SafeResult
= AD_CLOCKWISE
- ((pdc
->dclevel
.flPath
& DCPATH_CLOCKWISE
) != 0);
353 if (dwIn
== AD_CLOCKWISE
)
355 pdc
->dclevel
.flPath
&= ~DCPATH_CLOCKWISE
;
358 pdc
->dclevel
.flPath
|= DCPATH_CLOCKWISE
;
360 else // Left to Right
362 SafeResult
= ((pdc
->dclevel
.flPath
& DCPATH_CLOCKWISE
) != 0) +
364 if (dwIn
== AD_COUNTERCLOCKWISE
)
366 pdc
->dclevel
.flPath
&= ~DCPATH_CLOCKWISE
;
369 pdc
->dclevel
.flPath
|= DCPATH_CLOCKWISE
;
374 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
383 ProbeForWrite(Result
, sizeof(DWORD
), 1);
384 *Result
= SafeResult
;
386 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
388 Status
= _SEH2_GetExceptionCode();
392 if (!NT_SUCCESS(Status
))
394 SetLastNtError(Status
);