16 CONST DEVMODEA
* lpInitData
19 ANSI_STRING DriverA
, DeviceA
, OutputA
;
20 UNICODE_STRING DriverU
, DeviceU
, OutputU
;
22 DEVMODEW
*lpInitDataW
;
25 * If needed, convert to Unicode
26 * any string parameter.
29 if (NULL
!= lpszDriver
)
31 RtlInitAnsiString(&DriverA
, (LPSTR
)lpszDriver
);
32 RtlAnsiStringToUnicodeString(&DriverU
, &DriverA
, TRUE
);
34 DriverU
.Buffer
= NULL
;
35 if (NULL
!= lpszDevice
)
37 RtlInitAnsiString(&DeviceA
, (LPSTR
)lpszDevice
);
38 RtlAnsiStringToUnicodeString(&DeviceU
, &DeviceA
, TRUE
);
40 DeviceU
.Buffer
= NULL
;
41 if (NULL
!= lpszOutput
)
43 RtlInitAnsiString(&OutputA
, (LPSTR
)lpszOutput
);
44 RtlAnsiStringToUnicodeString(&OutputU
, &OutputA
, TRUE
);
46 OutputU
.Buffer
= NULL
;
48 if (NULL
!= lpInitData
)
50 // lpInitDataW = HeapAllocMem(
55 * Call the Unicode version
66 * Free Unicode parameters.
68 RtlFreeUnicodeString(&DriverU
);
69 RtlFreeUnicodeString(&DeviceU
);
70 RtlFreeUnicodeString(&OutputU
);
73 * Return the possible DC handle.
89 CONST DEVMODEW
* lpInitData
92 UNICODE_STRING Driver
, Device
, Output
;
95 RtlInitUnicodeString(&Driver
, lpwszDriver
);
97 RtlInitUnicodeString(&Driver
, lpwszDevice
);
99 RtlInitUnicodeString(&Driver
, lpwszOutput
);
101 return NtGdiCreateDC((lpwszDriver
? &Driver
: NULL
),
102 (lpwszDevice
? &Device
: NULL
),
103 (lpwszOutput
? &Output
: NULL
),
104 (PDEVMODEW
)lpInitData
);
117 CONST DEVMODEW
* lpdvmInit
120 UNICODE_STRING Driver
, Device
, Output
;
123 RtlInitUnicodeString(&Driver
, lpszDriver
);
125 RtlInitUnicodeString(&Device
, lpszDevice
);
127 RtlInitUnicodeString(&Output
, lpszOutput
);
128 return NtGdiCreateIC ((lpszDriver
? &Driver
: NULL
),
129 (lpszDevice
? &Device
: NULL
),
130 (lpszOutput
? &Output
: NULL
),
131 (CONST PDEVMODEW
)lpdvmInit
);
144 CONST DEVMODEA
* lpdvmInit
148 LPWSTR lpszDriverW
, lpszDeviceW
, lpszOutputW
;
149 UNICODE_STRING Driver
, Device
, Output
;
153 Status
= HEAP_strdupA2W ( &lpszDriverW
, lpszDriver
);
154 if (!NT_SUCCESS (Status
))
155 SetLastError (RtlNtStatusToDosError(Status
));
158 Status
= HEAP_strdupA2W ( &lpszDeviceW
, lpszDevice
);
159 if (!NT_SUCCESS (Status
))
160 SetLastError (RtlNtStatusToDosError(Status
));
163 Status
= HEAP_strdupA2W ( &lpszOutputW
, lpszOutput
);
164 if (!NT_SUCCESS (Status
))
165 SetLastError (RtlNtStatusToDosError(Status
));
169 RosRtlDevModeA2W ( &dvmInitW
, (const LPDEVMODEA
)lpdvmInit
);
171 RtlInitUnicodeString(&Driver
, lpszDriverW
);
172 RtlInitUnicodeString(&Device
, lpszDeviceW
);
173 RtlInitUnicodeString(&Output
, lpszOutputW
);
174 rc
= NtGdiCreateIC ( &Driver
,
177 lpdvmInit
? &dvmInitW
: NULL
);
179 HEAP_free ( lpszOutputW
);
181 HEAP_free ( lpszDeviceW
);
183 HEAP_free ( lpszDriverW
);
194 DeleteObject(HGDIOBJ hObject
)
196 if (0 != ((DWORD
) hObject
& GDI_HANDLE_STOCK_MASK
))
198 DPRINT1("Trying to delete system object 0x%x\n", hObject
);
202 /* deleting a handle that doesn't belong to the caller should be rather rarely
203 so for the sake of speed just try to delete it without checking validity */
204 return NtGdiDeleteObject(hObject
);
218 return NtGdiGetRelAbs(hdc
);
230 // Officially obsolete by Microsoft
232 if (!NtGdiGetDCOrgEx(hdc
, &Pt
))
234 return(MAKELONG(Pt
.x
, Pt
.y
));
243 GetObjectA(HGDIOBJ Handle
, int Size
, LPVOID Buffer
)
249 Type
= NtGdiGetObjectType(Handle
);
255 if (OBJ_FONT
== Type
)
257 if (Size
< sizeof(LOGFONTA
))
259 SetLastError(ERROR_BUFFER_OVERFLOW
);
262 Result
= NtGdiGetObject(Handle
, sizeof(LOGFONTW
), &LogFontW
);
267 RosRtlLogFontW2A((LPLOGFONTA
) Buffer
, &LogFontW
);
268 Result
= sizeof(LOGFONTA
);
272 Result
= NtGdiGetObject(Handle
, Size
, Buffer
);
284 GetObjectW(HGDIOBJ Handle
, int Size
, LPVOID Buffer
)
286 return NtGdiGetObject(Handle
, Size
, Buffer
);
299 return NtUserGetDCBrushColor(hdc
);
311 return NtUserGetDCPenColor(hdc
);
324 return NtUserSetDCBrushColor(hdc
, crColor
);
337 return NtUserSetDCPenColor(hdc
, crColor
);
348 CONST DEVMODEW
*lpInitData
351 return NtGdiResetDC ( hdc
, lpInitData
);
362 CONST DEVMODEA
*lpInitData
367 RosRtlDevModeA2W ( &InitDataW
, (CONST LPDEVMODEA
)lpInitData
);
369 return NtGdiResetDC ( hdc
, &InitDataW
);
383 return NtGdiStartDoc ( hdc
, (DOCINFOW
*)a1
);
398 if(GdiIsHandleValid(h
))
400 LONG Type
= GDI_HANDLE_GET_TYPE(h
);
403 case GDI_OBJECT_TYPE_PEN
:
406 case GDI_OBJECT_TYPE_BRUSH
:
409 case GDI_OBJECT_TYPE_BITMAP
:
412 case GDI_OBJECT_TYPE_FONT
:
415 case GDI_OBJECT_TYPE_PALETTE
:
418 case GDI_OBJECT_TYPE_REGION
:
421 case GDI_OBJECT_TYPE_DC
:
424 case GDI_OBJECT_TYPE_METADC
:
427 case GDI_OBJECT_TYPE_METAFILE
:
430 case GDI_OBJECT_TYPE_ENHMETAFILE
:
431 Ret
= OBJ_ENHMETAFILE
;
433 case GDI_OBJECT_TYPE_ENHMETADC
:
436 case GDI_OBJECT_TYPE_EXTPEN
:
439 case GDI_OBJECT_TYPE_MEMDC
:
444 DPRINT1("GetObjectType: Magic 0x%08x not implemented\n", Type
);