Implimented DeleteDC()
[reactos.git] / reactos / lib / gdi32 / objects / dc.c
1 #ifdef UNICODE
2 #undef UNICODE
3 #endif
4
5 #undef WIN32_LEAN_AND_MEAN
6 #include <windows.h>
7 #include <ddk/ntddk.h>
8 #include <win32k/kapi.h>
9
10 HDC
11 STDCALL
12 CreateDCA (
13 LPCSTR lpszDriver,
14 LPCSTR lpszDevice,
15 LPCSTR lpszOutput,
16 CONST DEVMODE * lpInitData
17 )
18 {
19 ANSI_STRING DriverA, DeviceA, OutputA;
20 UNICODE_STRING DriverU, DeviceU, OutputU;
21 HDC hDC;
22
23 /*
24 * If needed, convert to Unicode
25 * any string parameter.
26 */
27
28 if (NULL != lpszDriver)
29 {
30 RtlInitAnsiString(&DriverA, (LPSTR)lpszDriver);
31 RtlAnsiStringToUnicodeString(&DriverU, &DriverA, TRUE);
32 } else
33 DriverU.Buffer = NULL;
34 if (NULL != lpszDevice)
35 {
36 RtlInitAnsiString(&DeviceA, (LPSTR)lpszDevice);
37 RtlAnsiStringToUnicodeString(&DeviceU, &DeviceA, TRUE);
38 } else
39 DeviceU.Buffer = NULL;
40 if (NULL != lpszOutput)
41 {
42 RtlInitAnsiString(&OutputA, (LPSTR)lpszOutput);
43 RtlAnsiStringToUnicodeString(&OutputU, &OutputA, TRUE);
44 } else
45 OutputU.Buffer = NULL;
46
47 /*
48 * Call the Unicode version
49 * of CreateDC.
50 */
51
52 hDC = CreateDCW (
53 DriverU.Buffer,
54 DeviceU.Buffer,
55 OutputU.Buffer,
56 lpInitData
57 );
58 /*
59 * Free Unicode parameters.
60 */
61 RtlFreeUnicodeString(&DriverU);
62 RtlFreeUnicodeString(&DeviceU);
63 RtlFreeUnicodeString(&OutputU);
64
65 /*
66 * Return the possible DC handle.
67 */
68
69 return hDC;
70 }
71
72 HDC
73 STDCALL
74 CreateDCW (
75 LPCWSTR lpwszDriver,
76 LPCWSTR lpwszDevice,
77 LPCWSTR lpwszOutput,
78 CONST DEVMODE * lpInitData
79 )
80 {
81 return W32kCreateDC (
82 lpwszDriver,
83 lpwszDevice,
84 lpwszOutput,
85 lpInitData
86 );
87 }
88
89 BOOL STDCALL DeleteDC( HDC hDC )
90 {
91 return W32kDeleteDC( hDC );
92 }
93
94
95 HDC
96 STDCALL
97 CreateCompatibleDC(
98 HDC hDC
99 )
100 {
101 return W32kCreateCompatableDC(hDC);
102 }
103
104 HGDIOBJ
105 STDCALL
106 SelectObject(
107 HDC hDC,
108 HGDIOBJ hGDIObj
109 )
110 {
111 return W32kSelectObject(hDC, hGDIObj);
112 }