454fb6518714a7568641805ccf42f58c36520d78
[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 int STDCALL
11 GetClipBox(HDC hDc, LPRECT Rect)
12 {
13 return(W32kGetClipBox(hDc, Rect));
14 }
15
16
17 HDC
18 STDCALL
19 CreateDCA (
20 LPCSTR lpszDriver,
21 LPCSTR lpszDevice,
22 LPCSTR lpszOutput,
23 CONST DEVMODEA * lpInitData
24 )
25 {
26 ANSI_STRING DriverA, DeviceA, OutputA;
27 UNICODE_STRING DriverU, DeviceU, OutputU;
28 HDC hDC;
29 DEVMODEW *lpInitDataW;
30
31 /*
32 * If needed, convert to Unicode
33 * any string parameter.
34 */
35
36 if (NULL != lpszDriver)
37 {
38 RtlInitAnsiString(&DriverA, (LPSTR)lpszDriver);
39 RtlAnsiStringToUnicodeString(&DriverU, &DriverA, TRUE);
40 } else
41 DriverU.Buffer = NULL;
42 if (NULL != lpszDevice)
43 {
44 RtlInitAnsiString(&DeviceA, (LPSTR)lpszDevice);
45 RtlAnsiStringToUnicodeString(&DeviceU, &DeviceA, TRUE);
46 } else
47 DeviceU.Buffer = NULL;
48 if (NULL != lpszOutput)
49 {
50 RtlInitAnsiString(&OutputA, (LPSTR)lpszOutput);
51 RtlAnsiStringToUnicodeString(&OutputU, &OutputA, TRUE);
52 } else
53 OutputU.Buffer = NULL;
54
55 if (NULL != lpInitData)
56 {
57 // lpInitDataW = HeapAllocMem(
58 } else
59 lpInitDataW = NULL;
60
61 /*
62 * Call the Unicode version
63 * of CreateDC.
64 */
65
66 hDC = CreateDCW (
67 DriverU.Buffer,
68 DeviceU.Buffer,
69 OutputU.Buffer,
70 NULL);
71 // lpInitDataW);
72 /*
73 * Free Unicode parameters.
74 */
75 RtlFreeUnicodeString(&DriverU);
76 RtlFreeUnicodeString(&DeviceU);
77 RtlFreeUnicodeString(&OutputU);
78
79 /*
80 * Return the possible DC handle.
81 */
82
83 return hDC;
84 }
85
86 HDC
87 STDCALL
88 CreateDCW (
89 LPCWSTR lpwszDriver,
90 LPCWSTR lpwszDevice,
91 LPCWSTR lpwszOutput,
92 CONST DEVMODEW * lpInitData
93 )
94 {
95 return W32kCreateDC (
96 lpwszDriver,
97 lpwszDevice,
98 lpwszOutput,
99 (PDEVMODEW)lpInitData
100 );
101 }
102
103 BOOL STDCALL DeleteDC( HDC hDC )
104 {
105 return W32kDeleteDC( hDC );
106 }
107
108
109 HDC
110 STDCALL
111 CreateCompatibleDC(
112 HDC hDC
113 )
114 {
115 return W32kCreateCompatableDC(hDC);
116 }
117
118 HGDIOBJ
119 STDCALL
120 SelectObject(
121 HDC hDC,
122 HGDIOBJ hGDIObj
123 )
124 {
125 return W32kSelectObject(hDC, hGDIObj);
126 }
127
128 int
129 STDCALL
130 SetMapMode(
131 HDC a0,
132 int a1
133 )
134 {
135 return W32kSetMapMode( a0, a1 );
136 }
137
138 BOOL
139 STDCALL
140 SetViewportOrgEx(
141 HDC a0,
142 int a1,
143 int a2,
144 LPPOINT a3
145 )
146 {
147 return W32kSetViewportOrgEx( a0, a1, a2, a3 );
148 }
149
150 BOOL
151 STDCALL
152 SetWindowOrgEx(
153 HDC a0,
154 int a1,
155 int a2,
156 LPPOINT a3
157 )
158 {
159 return W32kSetWindowOrgEx( a0, a1, a2, a3 );
160 }
161
162
163 BOOL
164 STDCALL
165 DeleteObject(
166 HGDIOBJ a0
167 )
168 {
169 return W32kDeleteObject(a0);
170 }