bf999aba048b9cf0653e517c2789d5d94cfd8eff
[reactos.git] / rostests / apitests / gdi32 / GetObject.c
1 /*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for GetObject
5 * PROGRAMMERS: Timo Kreuzer
6 */
7
8 #include <apitest.h>
9
10 #include <wingdi.h>
11 #include <winddi.h>
12 #include <winuser.h>
13 #include <include/ntgdityp.h>
14 #include <include/ntgdihdl.h>
15
16 void
17 Test_General(void)
18 {
19 struct
20 {
21 LOGBRUSH logbrush;
22 BYTE additional[600];
23 } TestStruct;
24 PLOGBRUSH plogbrush;
25 HBRUSH hBrush;
26 INT ret;
27
28 /* Test null pointer and invalid handles */
29 SetLastError(ERROR_SUCCESS);
30 ok(GetObjectA(0, 0, NULL) == 0, "\n");
31 ok(GetObjectA((HANDLE)-1, 0, NULL) == 0, "\n");
32
33 /* Test invalid habdles of different types */
34 ok(GetObjectA((HANDLE)0x00380000, 0, NULL) == 0, "\n");
35 ok(GetLastError() == ERROR_SUCCESS, "\n");
36 ok(GetObjectA((HANDLE)0x00380000, 10, &TestStruct) == 0, "\n");
37 ok(GetLastError() == ERROR_SUCCESS, "\n");
38 SetLastError(ERROR_SUCCESS);
39 ok(GetObjectA((HANDLE)0x00010000, 0, NULL) == 0, "\n");
40 ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
41 SetLastError(ERROR_SUCCESS);
42 ok(GetObjectA((HANDLE)0x00020000, 0, NULL) == 0, "\n");
43 ok(GetLastError() == ERROR_SUCCESS, "\n");
44 SetLastError(ERROR_SUCCESS);
45 ok(GetObjectA((HANDLE)0x00030000, 0, NULL) == 0, "\n");
46 ok(GetLastError() == ERROR_SUCCESS, "\n");
47 SetLastError(ERROR_SUCCESS);
48 ok(GetObjectA((HANDLE)0x00040000, 0, NULL) == 0, "\n");
49 ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
50 SetLastError(ERROR_SUCCESS);
51 ok(GetObjectA((HANDLE)0x00060000, 0, NULL) == 0, "\n");
52 ok(GetLastError() == ERROR_SUCCESS, "\n");
53 SetLastError(ERROR_SUCCESS);
54 ok(GetObjectA((HANDLE)0x00070000, 0, NULL) == 0, "\n");
55 ok(GetLastError() == ERROR_SUCCESS, "\n");
56 SetLastError(ERROR_SUCCESS);
57 ok(GetObjectA((HANDLE)0x000B0000, 0, NULL) == 0, "\n");
58 ok(GetLastError() == ERROR_SUCCESS, "\n");
59 SetLastError(ERROR_SUCCESS);
60 ok(GetObjectA((HANDLE)0x000C0000, 0, NULL) == 0, "\n");
61 ok(GetLastError() == ERROR_SUCCESS, "\n");
62 SetLastError(ERROR_SUCCESS);
63 ok(GetObjectA((HANDLE)0x000D0000, 0, NULL) == 0, "\n");
64 ok(GetLastError() == ERROR_SUCCESS, "\n");
65 SetLastError(ERROR_SUCCESS);
66 ok(GetObjectA((HANDLE)0x000E0000, 0, NULL) == 0, "\n");
67 ok(GetLastError() == ERROR_SUCCESS, "\n");
68 SetLastError(ERROR_SUCCESS);
69 ok(GetObjectA((HANDLE)0x000F0000, 0, NULL) == 0, "\n");
70 ok(GetLastError() == ERROR_SUCCESS, "\n");
71 SetLastError(ERROR_SUCCESS);
72 ok(GetObjectA((HANDLE)0x00110000, 0, NULL) == 0, "\n");
73 ok(GetLastError() == ERROR_SUCCESS, "\n");
74 SetLastError(ERROR_SUCCESS);
75 ok(GetObjectA((HANDLE)0x00120000, 0, NULL) == 0, "\n");
76 ok(GetLastError() == ERROR_SUCCESS, "\n");
77 SetLastError(ERROR_SUCCESS);
78 ok(GetObjectA((HANDLE)0x00130000, 0, NULL) == 0, "\n");
79 ok(GetLastError() == ERROR_SUCCESS, "\n");
80 SetLastError(ERROR_SUCCESS);
81 ok(GetObjectA((HANDLE)0x00140000, 0, NULL) == 0, "\n");
82 ok(GetLastError() == ERROR_SUCCESS, "\n");
83 SetLastError(ERROR_SUCCESS);
84 ok(GetObjectA((HANDLE)0x00150000, 0, NULL) == 0, "\n");
85 ok(GetLastError() == ERROR_SUCCESS, "\n");
86 SetLastError(ERROR_SUCCESS);
87 ok(GetObjectA((HANDLE)0x00160000, 0, NULL) == 0, "\n");
88 ok(GetLastError() == ERROR_SUCCESS, "\n");
89 SetLastError(ERROR_SUCCESS);
90 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_DC, 0, NULL) == 0, "\n");
91 ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
92 SetLastError(ERROR_SUCCESS);
93 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_DC, 0, NULL) == 0, "\n");
94 ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
95 SetLastError(ERROR_SUCCESS);
96 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_REGION, 0, NULL) == 0, "\n");
97 ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
98 SetLastError(ERROR_SUCCESS);
99 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_REGION, 0, NULL) == 0, "\n");
100 ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
101 SetLastError(ERROR_SUCCESS);
102 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_EMF, 0, NULL) == 0, "\n");
103 ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
104 SetLastError(ERROR_SUCCESS);
105 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_EMF, 0, NULL) == 0, "\n");
106 ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
107 SetLastError(ERROR_SUCCESS);
108 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_METAFILE, 0, NULL) == 0, "\n");
109 ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
110 SetLastError(ERROR_SUCCESS);
111 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_METAFILE, 0, NULL) == 0, "\n");
112 ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
113 SetLastError(ERROR_SUCCESS);
114 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_ENHMETAFILE, 0, NULL) == 0, "\n");
115 ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
116 SetLastError(ERROR_SUCCESS);
117 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_ENHMETAFILE, 0, NULL) == 0, "\n");
118 ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
119
120 /* Test need of alignment */
121 SetLastError(ERROR_SUCCESS);
122 hBrush = GetStockObject(WHITE_BRUSH);
123 plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush);
124 ok(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == sizeof(LOGBRUSH), "\n");
125 plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush + 2);
126 ok(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == sizeof(LOGBRUSH), "\n");
127 plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush + 1);
128 //ok(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == 0, "\n"); // fails on win7
129
130 /* Test invalid buffer */
131 SetLastError(0xbadbad00);
132 ok(GetObjectA(GetStockObject(WHITE_BRUSH), sizeof(LOGBRUSH), (PVOID)0xc0000000) == 0, "\n");
133 ok((GetLastError() == 0xbadbad00) || (GetLastError() == ERROR_NOACCESS), "wrong error: %ld\n", GetLastError());
134 SetLastError(ERROR_SUCCESS);
135 ok(GetObjectW(GetStockObject(BLACK_PEN), sizeof(LOGPEN), (PVOID)0xc0000000) == 0, "\n");
136 ok((GetLastError() == 0xbadbad00) || (GetLastError() == ERROR_NOACCESS), "wrong error: %ld\n", GetLastError());
137 SetLastError(ERROR_SUCCESS);
138 ok(GetObjectW(GetStockObject(21), sizeof(BITMAP), (PVOID)0xc0000000) == 0, "\n");
139 ok((GetLastError() == 0xbadbad00) || (GetLastError() == ERROR_NOACCESS), "wrong error: %ld\n", GetLastError());
140 SetLastError(ERROR_SUCCESS);
141 ok(GetObjectW(GetStockObject(SYSTEM_FONT), sizeof(LOGFONT), (PVOID)0xc0000000) == 0, "\n");
142 ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", GetLastError());
143 SetLastError(ERROR_SUCCESS);
144 _SEH2_TRY
145 {
146 ret = GetObjectA(GetStockObject(SYSTEM_FONT), sizeof(LOGFONT), (PVOID)0xc0000000);
147 }
148 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
149 {
150 ret = -1;
151 }
152 _SEH2_END
153 ok(ret == -1, "should have got an exception\n");
154
155 ok(GetObjectW(GetStockObject(SYSTEM_FONT), 0x50000000, &TestStruct) == 356, "\n");
156 ok(GetObjectW(GetStockObject(WHITE_BRUSH), 0x50000000, &TestStruct) == sizeof(LOGBRUSH), "\n");
157
158
159 /* Test buffer size of 0 */
160 SetLastError(ERROR_SUCCESS);
161 ok_long(GetObjectA(GetStockObject(WHITE_BRUSH), 0, &TestStruct), sizeof(LOGBRUSH));
162 ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", GetLastError());
163 SetLastError(ERROR_SUCCESS);
164 ok(GetObjectA(GetStockObject(BLACK_PEN), 0, &TestStruct) == 0, "\n");
165 ok((GetLastError() == 0xbadbad00) || (GetLastError() == ERROR_NOACCESS), "wrong error: %ld\n", GetLastError());
166 SetLastError(ERROR_SUCCESS);
167 ok(GetObjectW(GetStockObject(SYSTEM_FONT), 0, &TestStruct) == 0, "\n");
168 ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", GetLastError());
169 SetLastError(ERROR_SUCCESS);
170 ok(GetObjectW(GetStockObject(21), 0, &TestStruct) == 0, "\n");
171 ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", GetLastError());
172
173 }
174
175 void
176 Test_Bitmap(void)
177 {
178 HBITMAP hBitmap;
179 BITMAP bitmap;
180 DIBSECTION dibsection;
181 BYTE bData[100] = {0};
182 BYTE Buffer[100] = {48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,0};
183
184 FillMemory(&bitmap, sizeof(BITMAP), 0x77);
185 hBitmap = CreateBitmap(10,10,1,8,bData);
186 ok(hBitmap != 0, "CreateBitmap failed, skipping tests.\n");
187 if (!hBitmap) return;
188
189 SetLastError(ERROR_SUCCESS);
190 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BITMAP, 0, NULL) == sizeof(BITMAP), "\n");
191 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_BITMAP, 0, NULL) == sizeof(BITMAP), "\n");
192 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BITMAP, sizeof(BITMAP), NULL) == sizeof(BITMAP), "\n");
193 ok(GetLastError() == ERROR_SUCCESS, "\n");
194 ok(GetObjectA(hBitmap, sizeof(DIBSECTION), NULL) == sizeof(BITMAP), "\n");
195 ok(GetObjectA(hBitmap, 0, NULL) == sizeof(BITMAP), "\n");
196 ok(GetObjectA((HANDLE)((UINT_PTR)hBitmap & 0x0000ffff), 0, NULL) == sizeof(BITMAP), "\n");
197 ok(GetObjectW((HANDLE)((UINT_PTR)hBitmap & 0x0000ffff), 0, NULL) == sizeof(BITMAP), "\n");
198 ok(GetLastError() == ERROR_SUCCESS, "\n");
199 ok(GetObjectA(hBitmap, 5, NULL) == sizeof(BITMAP), "\n");
200 ok(GetObjectA(hBitmap, -5, NULL) == sizeof(BITMAP), "\n");
201 ok(GetObjectA(hBitmap, 0, Buffer) == 0, "\n");
202 ok(GetObjectA(hBitmap, 5, Buffer) == 0, "\n");
203 ok(GetLastError() == ERROR_SUCCESS, "\n");
204 ok(GetObjectA(hBitmap, sizeof(BITMAP), &bitmap) == sizeof(BITMAP), "\n");
205 ok(GetObjectA(hBitmap, sizeof(BITMAP)+2, &bitmap) == sizeof(BITMAP), "\n");
206 ok(GetObjectA(hBitmap, sizeof(DIBSECTION), &dibsection) == sizeof(BITMAP), "\n");
207 ok(GetObjectA(hBitmap, -5, &bitmap) == sizeof(BITMAP), "\n");
208 ok(GetLastError() == ERROR_SUCCESS, "\n");
209 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BITMAP, sizeof(BITMAP), &bitmap) == 0, "\n");
210 ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", GetLastError());
211
212 // todo: test invalid handle + buffer
213
214 DeleteObject(hBitmap);
215 }
216
217 void
218 Test_Dibsection(void)
219 {
220 BITMAPINFO bmi = {{sizeof(BITMAPINFOHEADER), 10, 9, 1, 16, BI_RGB, 0, 10, 10, 0,0}};
221 HBITMAP hBitmap;
222 BITMAP bitmap;
223 DIBSECTION dibsection;
224 PVOID pData;
225 HDC hDC;
226
227 FillMemory(&dibsection, sizeof(DIBSECTION), 0x77);
228 hDC = GetDC(0);
229 hBitmap = CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS, &pData, NULL, 0);
230 ok(hBitmap != 0, "CreateDIBSection failed with %ld, skipping tests.\n", GetLastError());
231 if (!hBitmap) return;
232
233 ok(GetObjectA((HANDLE)((UINT_PTR)hBitmap & 0x0000ffff), 0, NULL) == sizeof(BITMAP), "\n");
234 ok(GetObjectW((HANDLE)((UINT_PTR)hBitmap & 0x0000ffff), 0, NULL) == sizeof(BITMAP), "\n");
235
236 SetLastError(ERROR_SUCCESS);
237 ok_long(GetObject(hBitmap, sizeof(DIBSECTION), NULL), sizeof(BITMAP));
238 ok_long(GetObject(hBitmap, 0, NULL), sizeof(BITMAP));
239 ok_long(GetObject(hBitmap, 5, NULL), sizeof(BITMAP));
240 ok_long(GetObject(hBitmap, -5, NULL), sizeof(BITMAP));
241 ok_long(GetObject(hBitmap, 0, &dibsection), 0);
242 ok_long(GetObject(hBitmap, 5, &dibsection), 0);
243 ok_long(GetObject(hBitmap, sizeof(BITMAP), &bitmap), sizeof(BITMAP));
244 ok_long(GetObject(hBitmap, sizeof(BITMAP)+2, &bitmap), sizeof(BITMAP));
245 ok_long(bitmap.bmType, 0);
246 ok_long(bitmap.bmWidth, 10);
247 ok_long(bitmap.bmHeight, 9);
248 ok_long(bitmap.bmWidthBytes, 20);
249 ok_long(bitmap.bmPlanes, 1);
250 ok_long(bitmap.bmBitsPixel, 16);
251 ok(bitmap.bmBits == pData, "\n");
252 ok_long(GetObject(hBitmap, sizeof(DIBSECTION), &dibsection), sizeof(DIBSECTION));
253 ok_long(GetObject(hBitmap, sizeof(DIBSECTION)+2, &dibsection), sizeof(DIBSECTION));
254 ok_long(GetObject(hBitmap, -5, &dibsection), sizeof(DIBSECTION));
255 ok_err(ERROR_SUCCESS);
256 DeleteObject(hBitmap);
257 ReleaseDC(0, hDC);
258 }
259
260 void
261 Test_Palette(void)
262 {
263 LOGPALETTE logpal;
264 HPALETTE hPalette;
265 WORD wPalette;
266
267 FillMemory(&wPalette, sizeof(WORD), 0x77);
268 logpal.palVersion = 0x0300;
269 logpal.palNumEntries = 1;
270 logpal.palPalEntry[0].peRed = 0;
271 logpal.palPalEntry[0].peGreen = 0;
272 logpal.palPalEntry[0].peBlue = 0;
273 logpal.palPalEntry[0].peFlags = PC_EXPLICIT;
274 hPalette = CreatePalette(&logpal);
275 ok(hPalette != 0, "CreatePalette failed, skipping tests.\n");
276 if (!hPalette) return;
277
278 ok(GetObjectA((HANDLE)((UINT_PTR)hPalette & 0x0000ffff), 0, NULL) == sizeof(WORD), "\n");
279 ok(GetObjectW((HANDLE)((UINT_PTR)hPalette & 0x0000ffff), 0, NULL) == sizeof(WORD), "\n");
280
281 SetLastError(ERROR_SUCCESS);
282 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_PALETTE, 0, NULL) == sizeof(WORD), "\n");
283 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_PALETTE, 0, NULL) == sizeof(WORD), "\n");
284 ok(GetObject(hPalette, sizeof(WORD), NULL) == sizeof(WORD), "\n");
285 ok(GetObject(hPalette, 0, NULL) == sizeof(WORD), "\n");
286 ok(GetObject(hPalette, 5, NULL) == sizeof(WORD), "\n");
287 ok(GetObject(hPalette, -5, NULL) == sizeof(WORD), "\n");
288 ok(GetObject(hPalette, sizeof(WORD), &wPalette) == sizeof(WORD), "\n");
289 ok(GetObject(hPalette, sizeof(WORD)+2, &wPalette) == sizeof(WORD), "\n");
290 ok(GetObject(hPalette, 0, &wPalette) == 0, "\n");
291 ok(GetObject(hPalette, 1, &wPalette) == 0, "\n");
292 ok(GetObject(hPalette, -1, &wPalette) == sizeof(WORD), "\n");
293 ok(GetLastError() == ERROR_SUCCESS, "\n");
294 DeleteObject(hPalette);
295 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_PALETTE, sizeof(WORD), &wPalette) == 0, "\n");
296 ok(GetLastError() == ERROR_SUCCESS, "\n");
297
298 }
299
300 void
301 Test_Brush(void)
302 {
303 LOGBRUSH logbrush;
304 HBRUSH hBrush;
305
306 FillMemory(&logbrush, sizeof(LOGBRUSH), 0x77);
307 hBrush = CreateSolidBrush(RGB(1,2,3));
308 ok(hBrush != 0, "CreateSolidBrush failed, skipping tests.\n");
309 if (!hBrush) return;
310
311 SetLastError(ERROR_SUCCESS);
312 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BRUSH, 0, NULL) == sizeof(LOGBRUSH), "\n");
313 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_BRUSH, 0, NULL) == sizeof(LOGBRUSH), "\n");
314 ok(GetObject(hBrush, sizeof(WORD), NULL) == sizeof(LOGBRUSH), "\n");
315 ok(GetObject(hBrush, 0, NULL) == sizeof(LOGBRUSH), "\n");
316 ok(GetObject(hBrush, 5, NULL) == sizeof(LOGBRUSH), "\n");
317 ok(GetObject(hBrush, -5, NULL) == sizeof(LOGBRUSH), "\n");
318
319 //ok(GetObject(hBrush, 0, &logbrush) == 0, "\n"); fails on win7
320 ok(logbrush.lbStyle == 0x77777777, "\n");
321 ok(GetObject(hBrush, 5, &logbrush) == sizeof(LOGBRUSH), "\n");
322 ok(logbrush.lbStyle == 0, "\n");
323 ok(logbrush.lbColor == 0x77777701, "\n");
324
325 ok(GetObject(hBrush, sizeof(LOGBRUSH), &logbrush) == sizeof(LOGBRUSH), "\n");
326 ok(GetObject(hBrush, sizeof(LOGBRUSH) - 1, &logbrush) == sizeof(LOGBRUSH), "\n");
327 ok(GetObject(hBrush, 1, &logbrush) == sizeof(LOGBRUSH), "\n");
328 ok(GetObject(hBrush, sizeof(LOGBRUSH)+2, &logbrush) == sizeof(LOGBRUSH), "\n");
329 ok(GetObject(hBrush, -1, &logbrush) == sizeof(LOGBRUSH), "\n");
330 // TODO: test all members
331
332 ok(GetLastError() == ERROR_SUCCESS, "\n");
333 DeleteObject(hBrush);
334
335 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_BRUSH, sizeof(LOGBRUSH), &logbrush) == 0, "\n");
336 ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
337 }
338
339 void
340 Test_DIBBrush(void)
341 {
342 struct
343 {
344 BITMAPINFOHEADER bmiHeader;
345 WORD wColors[4];
346 BYTE jBuffer[16];
347 } PackedDIB =
348 {
349 {sizeof(BITMAPINFOHEADER), 4, 4, 1, 8, BI_RGB, 0, 1, 1, 4, 0},
350 {1, 7, 3, 1},
351 {0,1,2,3, 1,2,3,0, 2,3,0,1, 3,0,1,2},
352 };
353 LOGBRUSH logbrush;
354 HBRUSH hBrush;
355
356 /* Create a DIB brush */
357 hBrush = CreateDIBPatternBrushPt(&PackedDIB, DIB_PAL_COLORS);
358 ok(hBrush != 0, "CreateSolidBrush failed, skipping tests.\n");
359 if (!hBrush) return;
360
361 FillMemory(&logbrush, sizeof(LOGBRUSH), 0x77);
362 SetLastError(ERROR_SUCCESS);
363
364 ok_long(GetObject(hBrush, sizeof(LOGBRUSH), &logbrush), sizeof(LOGBRUSH));
365 ok_long(logbrush.lbStyle, BS_DIBPATTERN);
366 ok_long(logbrush.lbColor, 0);
367 ok_long(logbrush.lbHatch, (ULONG_PTR)&PackedDIB);
368
369 ok_err(ERROR_SUCCESS);
370 DeleteObject(hBrush);
371
372
373 /* Create a DIB brush with undocumented iUsage 2 */
374 hBrush = CreateDIBPatternBrushPt(&PackedDIB, 2);
375 ok(hBrush != 0, "CreateSolidBrush failed, skipping tests.\n");
376 if (!hBrush) return;
377
378 FillMemory(&logbrush, sizeof(LOGBRUSH), 0x77);
379 SetLastError(ERROR_SUCCESS);
380
381 ok_long(GetObject(hBrush, sizeof(LOGBRUSH), &logbrush), sizeof(LOGBRUSH));
382 ok_long(logbrush.lbStyle, BS_DIBPATTERN);
383 ok_long(logbrush.lbColor, 0);
384 ok_long(logbrush.lbHatch, (ULONG_PTR)&PackedDIB);
385
386 ok_err(ERROR_SUCCESS);
387 DeleteObject(hBrush);
388
389 }
390
391 void
392 Test_Pen(void)
393 {
394 LOGPEN logpen;
395 HPEN hPen;
396
397 FillMemory(&logpen, sizeof(LOGPEN), 0x77);
398 hPen = CreatePen(PS_SOLID, 3, RGB(4,5,6));
399 ok(hPen != 0, "CreatePen failed, skipping tests.\n");
400 if (!hPen) return;
401 SetLastError(ERROR_SUCCESS);
402 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_PEN, 0, NULL) == sizeof(LOGPEN), "\n");
403 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_PEN, 0, NULL) == sizeof(LOGPEN), "\n");
404 ok(GetObject(hPen, sizeof(BITMAP), NULL) == sizeof(LOGPEN), "\n");
405 ok(GetObject(hPen, 0, NULL) == sizeof(LOGPEN), "\n");
406 ok(GetObject(hPen, 5, NULL) == sizeof(LOGPEN), "\n");
407 ok(GetObject(hPen, -5, NULL) == sizeof(LOGPEN), "\n");
408 ok(GetObject(hPen, sizeof(LOGPEN), &logpen) == sizeof(LOGPEN), "\n");
409 ok(GetObject(hPen, sizeof(LOGPEN)-1, &logpen) == 0, "\n");
410 ok(GetObject(hPen, sizeof(LOGPEN)+2, &logpen) == sizeof(LOGPEN), "\n");
411 ok(GetObject(hPen, 0, &logpen) == 0, "\n");
412 ok(GetObject(hPen, -5, &logpen) == sizeof(LOGPEN), "\n");
413 //ok(GetLastError() == ERROR_SUCCESS, "\n"); fails on win7
414
415 /* test if the fields are filled correctly */
416 ok(logpen.lopnStyle == PS_SOLID, "\n");
417
418 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_PEN, sizeof(LOGPEN), &logpen) == 0, "\n");
419 ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
420
421 DeleteObject(hPen);
422 }
423
424 void
425 Test_ExtPen(void)
426 {
427 HPEN hPen;
428 EXTLOGPEN extlogpen;
429 LOGBRUSH logbrush;
430 DWORD dwStyles[17] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
431 struct
432 {
433 EXTLOGPEN extlogpen;
434 DWORD dwStyles[50];
435 } elpUserStyle;
436 int i;
437
438 SetLastError(ERROR_SUCCESS);
439 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, NULL) == 0, "\n");
440 ok(GetLastError() == ERROR_INVALID_PARAMETER, "\n");
441 SetLastError(ERROR_SUCCESS);
442 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, NULL) == 0, "\n");
443 ok(GetLastError() == ERROR_INVALID_PARAMETER, "\n");
444
445 FillMemory(&extlogpen, sizeof(EXTLOGPEN), 0x77);
446 logbrush.lbStyle = BS_SOLID;
447 logbrush.lbColor = RGB(1,2,3);
448 logbrush.lbHatch = 22;
449 hPen = ExtCreatePen(PS_GEOMETRIC | PS_DASH, 5, &logbrush, 0, NULL);
450
451 SetLastError(ERROR_SUCCESS);
452 ok(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_EXTPEN, "\n");
453 ok(GetObject(hPen, sizeof(EXTLOGPEN), NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
454 ok(GetObject(hPen, 0, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
455 ok(GetObject((HANDLE)GDI_HANDLE_GET_INDEX(hPen), 0, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
456 ok(GetObject(hPen, 5, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
457 ok(GetObject(hPen, -5, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
458 ok(GetLastError() == ERROR_SUCCESS, "\n");
459 ok(GetObject((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, NULL) == 0, "\n");
460 ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %ld\n", GetLastError());
461 SetLastError(ERROR_SUCCESS);
462 ok(GetObject(hPen, 0, &extlogpen) == 0, "\n");
463 ok((GetLastError() == 0xbadbad00) || (GetLastError() == ERROR_NOACCESS), "wrong error: %ld\n", GetLastError());
464 SetLastError(ERROR_SUCCESS);
465 ok(GetObject(hPen, 4, &extlogpen) == 0, "\n");
466 ok(GetLastError() == ERROR_SUCCESS, "got %ld\n", GetLastError());
467 SetLastError(ERROR_SUCCESS);
468 ok(GetObject((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, &extlogpen) == 0, "\n");
469 ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %ld\n", GetLastError());
470 SetLastError(ERROR_SUCCESS);
471 ok(GetObject((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 4, &extlogpen) == 0, "\n");
472 ok(GetLastError() == ERROR_INVALID_PARAMETER, "got %ld\n", GetLastError());
473 SetLastError(ERROR_SUCCESS);
474 ok(GetObject(hPen, sizeof(EXTLOGPEN) - 5, &extlogpen) == 0, "\n");
475 ok(GetLastError() == ERROR_SUCCESS, "got %ld\n", GetLastError());
476
477 /* Nothing should be filled */
478 ok(extlogpen.elpPenStyle == 0x77777777, "\n");
479 ok(extlogpen.elpWidth == 0x77777777, "\n");
480
481 ok(GetObject(hPen, sizeof(EXTLOGPEN), &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
482 ok(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD), &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
483 ok(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD)-1, &extlogpen) == 0, "\n");
484 ok(GetObject(hPen, sizeof(EXTLOGPEN)+2, &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
485 ok(GetObject(hPen, -5, &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
486
487 /* test if the fields are filled correctly */
488 ok(extlogpen.elpPenStyle == (PS_GEOMETRIC | PS_DASH), "\n");
489 ok(extlogpen.elpWidth == 5, "\n");
490 ok(extlogpen.elpBrushStyle == 0, "\n");
491 ok(extlogpen.elpColor == RGB(1,2,3), "\n");
492 ok(extlogpen.elpHatch == 22, "\n");
493 ok(extlogpen.elpNumEntries == 0, "\n");
494 DeleteObject(hPen);
495
496 /* A maximum of 16 Styles is allowed */
497 hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 16, (CONST DWORD*)&dwStyles);
498 ok(GetObject(hPen, 0, NULL) == sizeof(EXTLOGPEN) + 15*sizeof(DWORD), "\n");
499 ok(GetObject(hPen, sizeof(EXTLOGPEN) + 15*sizeof(DWORD), &elpUserStyle) == sizeof(EXTLOGPEN) + 15*sizeof(DWORD), "\n");
500 for (i = 0; i <= 15; i++)
501 ok(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[i] == i, "%d\n", i);
502 DeleteObject(hPen);
503 }
504
505 void
506 Test_Font(void)
507 {
508 HFONT hFont;
509 union
510 {
511 LOGFONTA logfonta;
512 LOGFONTW logfontw;
513 EXTLOGFONTA extlogfonta;
514 EXTLOGFONTW extlogfontw;
515 ENUMLOGFONTEXA enumlogfontexa;
516 ENUMLOGFONTEXW enumlogfontexw;
517 ENUMLOGFONTEXDVA enumlogfontexdva;
518 ENUMLOGFONTEXDVW enumlogfontexdvw;
519 ENUMLOGFONTA enumlogfonta;
520 ENUMLOGFONTW enumlogfontw;
521 BYTE bData[270];
522 } u;
523 int ret;
524
525 FillMemory(&u, sizeof(u), 0x77);
526 hFont = CreateFontA(8, 8, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
527 ANSI_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
528 ANTIALIASED_QUALITY, DEFAULT_PITCH, "testfont");
529 ok(hFont != 0, "\n");
530
531 SetLastError(ERROR_SUCCESS);
532 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, 0, NULL) == sizeof(LOGFONTA), "\n");
533 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, 0, NULL) == sizeof(LOGFONTW), "\n");
534 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(LOGFONTA), NULL) == sizeof(LOGFONTA), "\n"); // 60
535 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTA), NULL) == sizeof(LOGFONTA), "\n"); // 156
536 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXA), NULL) == sizeof(LOGFONTA), "\n"); // 188
537 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(EXTLOGFONTA), NULL) == sizeof(LOGFONTA), "\n"); // 192
538 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVA), NULL) == sizeof(LOGFONTA), "\n"); // 260
539 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVA)+1, NULL) == sizeof(LOGFONTA), "\n"); // 260
540 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(LOGFONTW), NULL) == sizeof(LOGFONTW), "\n"); // 92
541 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTW), NULL) == sizeof(LOGFONTW), "\n"); // 284
542 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(EXTLOGFONTW), NULL) == sizeof(LOGFONTW), "\n"); // 320
543 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXW), NULL) == sizeof(LOGFONTW), "\n"); // 348
544 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVW), NULL) == sizeof(LOGFONTW), "\n"); // 420
545 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVW)+1, NULL) == sizeof(LOGFONTW), "\n"); // 356!
546 ok(GetLastError() == ERROR_SUCCESS, "got %ld\n", GetLastError());
547
548 ok(GetObjectA(hFont, sizeof(LOGFONTA), NULL) == sizeof(LOGFONTA), "\n");
549 ok(GetObjectA(hFont, 0, NULL) == sizeof(LOGFONTA), "\n");
550 ok(GetObjectA(hFont, 5, NULL) == sizeof(LOGFONTA), "\n");
551 ok(GetObjectA(hFont, -5, NULL) == sizeof(LOGFONTA), "\n");
552 ok(GetObjectA(hFont, 0, &u.logfonta) == 0, "\n");
553 ok(u.logfonta.lfHeight == 0x77777777, "\n");
554
555 ok(GetObjectA(hFont, 5, &u.logfonta) == 5, "\n");
556 ok(u.logfonta.lfHeight == 8, "\n");
557 ok(u.logfonta.lfWidth == 0x77777708, "\n");
558
559 ok(GetObjectA(hFont, 0, &u.logfonta) == 0, "\n");
560 ok(GetObjectA(hFont, -1, &u.logfonta) == sizeof(ENUMLOGFONTEXDVA), "\n");
561 ok(GetObjectA(hFont, 1, &u.logfonta) == 1, "\n"); // 1 -> 1
562 ok(GetObjectA(hFont, sizeof(LOGFONTA) - 1, &u.logfonta) == sizeof(LOGFONTA) - 1, "\n"); // 59 -> 59
563 ok(GetObjectA(hFont, sizeof(LOGFONTA), &u.logfonta) == sizeof(LOGFONTA), "\n"); // 60 -> 60
564 ok(GetObjectA(hFont, sizeof(LOGFONTA) + 1, &u.logfonta) == sizeof(LOGFONTA) + 1, "\n"); // 61 -> 61
565 ok(GetObjectA(hFont, sizeof(LOGFONTW) - 1, &u.logfontw) == sizeof(LOGFONTW) - 1, "\n"); // 91 -> 91
566 ok(GetObjectA(hFont, sizeof(LOGFONTW), &u.logfontw) == sizeof(LOGFONTA), "\n"); // 92 -> 60
567 ok(GetObjectA(hFont, sizeof(LOGFONTW) + 1, &u.logfontw) == sizeof(LOGFONTW) + 1, "\n"); // 93 -> 93
568 ok(GetObjectA(hFont, sizeof(EXTLOGFONTA), &u.extlogfonta) == sizeof(EXTLOGFONTA), "\n"); // 192 -> 192
569 ok(GetObjectA(hFont, sizeof(EXTLOGFONTA)+1, &u.extlogfonta) == sizeof(EXTLOGFONTA)+1, "\n"); // 192+1 -> 192+1
570 ok(GetObjectA(hFont, sizeof(EXTLOGFONTA)+16*4, &u.extlogfonta) == sizeof(EXTLOGFONTA)+16*4, "\n"); // 192+1 -> 192+1
571 ok(GetObjectA(hFont, sizeof(EXTLOGFONTW), &u.extlogfontw) == sizeof(ENUMLOGFONTEXDVA), "\n"); // 320 -> 260
572 ok(GetObjectA(hFont, 261, &u.bData) == 260, "\n"); // no
573
574 ok(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA) - 1, &u.enumlogfontexdvw) == sizeof(ENUMLOGFONTEXDVA) - 1, "\n"); // 419
575 ok(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA), &u.enumlogfontexdvw) == sizeof(ENUMLOGFONTEXDVA), "\n"); // 420
576 ok(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA)+1, &u.enumlogfontexdvw) == sizeof(ENUMLOGFONTEXDVA), "\n"); // 356!
577
578 /* LOGFONT / GetObjectW */
579 FillMemory(&u.logfontw, sizeof(LOGFONTW), 0x77);
580
581 ok(GetObjectW(hFont, sizeof(LOGFONTW), NULL) == sizeof(LOGFONTW), "1\n");
582 ok(GetObjectW(hFont, 0, NULL) == sizeof(LOGFONTW), "\n");
583 ok(GetObjectW(hFont, 5, NULL) == sizeof(LOGFONTW), "\n");
584 ok(GetObjectW(hFont, sizeof(ENUMLOGFONTEXA), NULL) == sizeof(LOGFONTW), "\n");
585 ok(GetObjectW(hFont, -5, NULL) == sizeof(LOGFONTW), "\n");
586 ok(GetObjectW(hFont, 0, &u.logfontw) == 0, "\n");
587 ok(u.logfontw.lfHeight == 0x77777777, "\n");
588
589 ok(GetObjectW(hFont, 5, &u.logfontw) == 5, "\n");
590 ok(u.logfontw.lfHeight == 8, "\n");
591 ok(u.logfontw.lfWidth == 0x77777708, "\n");
592
593 ok(GetObjectA(hFont, sizeof(LOGFONTA), &u.logfonta) == sizeof(LOGFONTA), "\n"); // 60
594 ok(u.logfonta.lfHeight == 8, "\n");
595 ok(GetObjectA(hFont, sizeof(ENUMLOGFONTA), &u.enumlogfonta) == sizeof(ENUMLOGFONTA), "\n"); // 156
596 ok(GetObjectA(hFont, sizeof(ENUMLOGFONTEXA), &u.enumlogfontexa) == sizeof(ENUMLOGFONTEXA), "\n"); // 188
597 ok(GetObjectA(hFont, sizeof(EXTLOGFONTA), &u.extlogfonta) == sizeof(EXTLOGFONTA), "\n"); // 192
598 ok(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA), &u.enumlogfontexdva) == sizeof(ENUMLOGFONTEXDVA), "\n"); // 260
599 ok(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA)+1, &u.enumlogfontexdva) == sizeof(ENUMLOGFONTEXDVA), "\n"); // 260
600
601 ok(GetObjectW(hFont, sizeof(LOGFONTW), &u.logfontw) == sizeof(LOGFONTW), "\n"); // 92
602 ok(GetObjectW(hFont, sizeof(LOGFONTW) + 1, &u.logfontw) == sizeof(LOGFONTW) + 1, "\n"); // 92
603 ok(GetObjectW(hFont, sizeof(LOGFONTW) - 1, &u.logfontw) == sizeof(LOGFONTW) - 1, "\n"); // 92
604 ok(GetObjectW(hFont, sizeof(ENUMLOGFONTW), &u.enumlogfontw) == sizeof(ENUMLOGFONTW), "\n"); // 284
605 ok(GetObjectW(hFont, sizeof(EXTLOGFONTW), &u.extlogfontw) == sizeof(EXTLOGFONTW), "\n"); // 320
606 ok(GetObjectW(hFont, sizeof(ENUMLOGFONTEXW), &u.enumlogfontexw) == sizeof(ENUMLOGFONTEXW), "\n"); // 348
607 ok(GetObjectW(hFont, sizeof(ENUMLOGFONTEXW) + 1, &u.enumlogfontexw) == sizeof(ENUMLOGFONTEXW) + 1, "\n"); // 348
608 ok(GetObjectW(hFont, 355, &u.enumlogfontexdvw) == 355, "\n"); // 419
609
610 ok(GetObjectW(hFont, 356, &u.enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n"); // 419
611 ret = sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD);
612 ret = GetObjectW(hFont, 357, &u.enumlogfontexdvw);
613 ok(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n");
614 ok(GetObjectW(hFont, 357, &u.enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n"); // 419
615 ok(GetObjectW(hFont, sizeof(ENUMLOGFONTEXDVW) - 1, &u.enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n"); // 419
616 ok(GetObjectW(hFont, sizeof(ENUMLOGFONTEXDVW), &u.enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n"); // 420
617 ok(GetObjectW(hFont, sizeof(ENUMLOGFONTEXDVW)+1, &u.enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n"); // 356!
618 ok(GetLastError() == ERROR_SUCCESS, "got %ld\n", GetLastError());
619
620 DeleteObject(hFont);
621 }
622
623 void
624 Test_Colorspace(void)
625 {
626 UCHAR buffer[1000];
627
628 SetLastError(ERROR_SUCCESS);
629 GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 0, NULL);
630 //ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 0, NULL) == 60, "\n");// FIXME: what structure? fails on win7
631 ok_err(ERROR_INSUFFICIENT_BUFFER);
632 SetLastError(ERROR_SUCCESS);
633 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 0, NULL) == 0, "\n");
634 ok_err(ERROR_INSUFFICIENT_BUFFER);
635 SetLastError(ERROR_SUCCESS);
636 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 327, buffer) == 0, "\n");
637 ok_err(ERROR_INSUFFICIENT_BUFFER);
638 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 328, buffer) == 0, "\n");
639 ok_err(ERROR_INVALID_PARAMETER);
640
641 ok_long(GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 328, NULL), 0);
642 ok_err(ERROR_INSUFFICIENT_BUFFER);
643 }
644
645 void
646 Test_MetaDC(void)
647 {
648 /* Windows does not SetLastError() on a metadc, but it doesn't seem to do anything with it */
649 HDC hMetaDC;
650 BYTE buffer[1000];
651
652 hMetaDC = CreateMetaFile(NULL);
653 ok(hMetaDC != 0, "CreateMetaFile failed, skipping tests.\n");
654 if(!hMetaDC) return;
655
656 ok(((UINT_PTR)hMetaDC & GDI_HANDLE_TYPE_MASK) == GDI_OBJECT_TYPE_METADC, "\n");
657
658 SetLastError(ERROR_SUCCESS);
659 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_METADC, 0, NULL) == 0, "\n");
660 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_METADC, 100, &buffer) == 0, "\n");
661 ok(GetObjectA(hMetaDC, 0, NULL) == 0, "\n");
662 ok(GetObjectA(hMetaDC, 1000, &buffer) == 0, "\n");
663 ok(GetLastError() == ERROR_SUCCESS, "got %ld\n", GetLastError());
664 }
665
666 void
667 Test_Region(void)
668 {
669 HRGN hRgn;
670 hRgn = CreateRectRgn(0,0,5,5);
671 SetLastError(ERROR_SUCCESS);
672 ok(GetObjectW(hRgn, 0, NULL) == 0, "\n");
673 ok(GetLastError() == ERROR_INVALID_HANDLE, "\n");
674 DeleteObject(hRgn);
675 }
676
677 START_TEST(GetObject)
678 {
679
680 Test_Font();
681 Test_Colorspace();
682 Test_General();
683 Test_Bitmap();
684 Test_Dibsection();
685 Test_Palette();
686 Test_Brush();
687 Test_DIBBrush();
688 Test_Pen();
689 Test_ExtPen(); // not implemented yet in ROS
690 Test_MetaDC();
691 Test_Region();
692 }
693