ReactOS 0.4.15-dev-7961-gdcf9eb0
GetObject.c File Reference
#include "precomp.h"
#include <pseh/pseh2.h>
Include dependency graph for GetObject.c:

Go to the source code of this file.

Macros

#define INVALID_POINTER   ((PVOID)(ULONG_PTR)0xdeadbeefdeadbeefULL)
 

Functions

void Test_General (void)
 
void Test_Bitmap (void)
 
void Test_Dibsection (void)
 
void Test_Palette (void)
 
void Test_Brush (void)
 
void Test_DIBBrush (void)
 
void Test_Pen (void)
 
void Test_ExtPen (void)
 
void Test_Font (void)
 
void Test_Colorspace (void)
 
void Test_MetaDC (void)
 
void Test_Region (void)
 
void Test_CursorIcon ()
 
 START_TEST (GetObject)
 

Variables

UCHAR src_mask []
 

Macro Definition Documentation

◆ INVALID_POINTER

#define INVALID_POINTER   ((PVOID)(ULONG_PTR)0xdeadbeefdeadbeefULL)

Definition at line 12 of file GetObject.c.

Function Documentation

◆ START_TEST()

START_TEST ( GetObject  )

Definition at line 747 of file GetObject.c.

748{
749
750 Test_Font();
752 Test_General();
753 Test_Bitmap();
755 Test_Palette();
756 Test_Brush();
758 Test_Pen();
759 Test_ExtPen(); // not implemented yet in ROS
760 Test_MetaDC();
761 Test_Region();
763}
void Test_MetaDC(void)
Definition: GetObject.c:694
void Test_Font(void)
Definition: GetObject.c:554
void Test_CursorIcon()
Definition: GetObject.c:725
void Test_Pen(void)
Definition: GetObject.c:440
void Test_Palette(void)
Definition: GetObject.c:294
void Test_Region(void)
Definition: GetObject.c:715
void Test_Bitmap(void)
Definition: GetObject.c:209
void Test_DIBBrush(void)
Definition: GetObject.c:388
void Test_General(void)
Definition: GetObject.c:36
void Test_Brush(void)
Definition: GetObject.c:334
void Test_Dibsection(void)
Definition: GetObject.c:251
void Test_ExtPen(void)
Definition: GetObject.c:473
void Test_Colorspace(void)
Definition: GetObject.c:672

◆ Test_Bitmap()

void Test_Bitmap ( void  )

Definition at line 209 of file GetObject.c.

210{
213 DIBSECTION dibsection;
214 BYTE bData[100] = {0};
215 BYTE Buffer[100] = {48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,0};
216
217 FillMemory(&bitmap, sizeof(BITMAP), 0x77);
218 hBitmap = CreateBitmap(10,10,1,8,bData);
219 ok(hBitmap != 0, "CreateBitmap failed, skipping tests.\n");
220 if (!hBitmap) return;
221
223 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BITMAP, 0, NULL) == sizeof(BITMAP), "\n");
224 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_BITMAP, 0, NULL) == sizeof(BITMAP), "\n");
225 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BITMAP, sizeof(BITMAP), NULL) == sizeof(BITMAP), "\n");
226 ok(GetLastError() == ERROR_SUCCESS, "\n");
227 ok(GetObjectA(hBitmap, sizeof(DIBSECTION), NULL) == sizeof(BITMAP), "\n");
228 ok(GetObjectA(hBitmap, 0, NULL) == sizeof(BITMAP), "\n");
229 ok(GetObjectA((HANDLE)((UINT_PTR)hBitmap & 0x0000ffff), 0, NULL) == sizeof(BITMAP), "\n");
230 ok(GetObjectW((HANDLE)((UINT_PTR)hBitmap & 0x0000ffff), 0, NULL) == sizeof(BITMAP), "\n");
231 ok(GetLastError() == ERROR_SUCCESS, "\n");
232 ok(GetObjectA(hBitmap, 5, NULL) == sizeof(BITMAP), "\n");
233 ok(GetObjectA(hBitmap, -5, NULL) == sizeof(BITMAP), "\n");
234 ok(GetObjectA(hBitmap, 0, Buffer) == 0, "\n");
235 ok(GetObjectA(hBitmap, 5, Buffer) == 0, "\n");
236 ok(GetLastError() == ERROR_SUCCESS, "\n");
237 ok(GetObjectA(hBitmap, sizeof(BITMAP), &bitmap) == sizeof(BITMAP), "\n");
238 ok(GetObjectA(hBitmap, sizeof(BITMAP)+2, &bitmap) == sizeof(BITMAP), "\n");
239 ok(GetObjectA(hBitmap, sizeof(DIBSECTION), &dibsection) == sizeof(BITMAP), "\n");
240 ok(GetObjectA(hBitmap, -5, &bitmap) == sizeof(BITMAP), "\n");
241 ok(GetLastError() == ERROR_SUCCESS, "\n");
242 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BITMAP, sizeof(BITMAP), &bitmap) == 0, "\n");
243 ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", GetLastError());
244
245 // todo: test invalid handle + buffer
246
248}
#define ok(value,...)
Definition: atltest.h:57
Definition: bufpool.h:45
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
static HBITMAP hBitmap
Definition: timezone.c:26
#define SetLastError(x)
Definition: compat.h:752
#define FillMemory(BUF, SIZ, MASK)
Definition: strucsup.c:31
pKey DeleteObject()
#define GDI_OBJECT_TYPE_BITMAP
Definition: gdi.h:48
static HBITMAP
Definition: button.c:44
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
Definition: bl.h:1331
Definition: uimain.c:89
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
unsigned char BYTE
Definition: xxhash.c:193

Referenced by START_TEST().

◆ Test_Brush()

void Test_Brush ( void  )

Definition at line 334 of file GetObject.c.

335{
336 LOGBRUSH logbrush;
337 HBRUSH hBrush;
338
339 FillMemory(&logbrush, sizeof(LOGBRUSH), 0x77);
340 hBrush = CreateSolidBrush(RGB(1,2,3));
341 ok(hBrush != 0, "CreateSolidBrush failed, skipping tests.\n");
342 if (!hBrush) return;
343
345 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_BRUSH, 0, NULL) == sizeof(LOGBRUSH), "\n");
346 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_BRUSH, 0, NULL) == sizeof(LOGBRUSH), "\n");
347 ok(GetObject(hBrush, sizeof(WORD), NULL) == sizeof(LOGBRUSH), "\n");
348 ok(GetObject(hBrush, 0, NULL) == sizeof(LOGBRUSH), "\n");
349 ok(GetObject(hBrush, 5, NULL) == sizeof(LOGBRUSH), "\n");
350 ok(GetObject(hBrush, -5, NULL) == sizeof(LOGBRUSH), "\n");
351
352 //ok(GetObject(hBrush, 0, &logbrush) == 0, "\n"); fails on win7
353 ok(logbrush.lbStyle == 0x77777777, "\n");
354 ok(GetObject(hBrush, 5, &logbrush) == sizeof(LOGBRUSH), "\n");
355 ok(logbrush.lbStyle == 0, "\n");
356 ok(logbrush.lbColor == 0x77777701, "\n");
357
358 ok(GetObject(hBrush, sizeof(LOGBRUSH), &logbrush) == sizeof(LOGBRUSH), "\n");
359 ok(GetObject(hBrush, sizeof(LOGBRUSH) - 1, &logbrush) == sizeof(LOGBRUSH), "\n");
360 ok(GetObject(hBrush, 1, &logbrush) == sizeof(LOGBRUSH), "\n");
361 ok(GetObject(hBrush, sizeof(LOGBRUSH)+2, &logbrush) == sizeof(LOGBRUSH), "\n");
362 ok(GetObject(hBrush, -1, &logbrush) == sizeof(LOGBRUSH), "\n");
363 // TODO: test all members
364
365 ok(GetLastError() == ERROR_SUCCESS, "\n");
366 DeleteObject(hBrush);
367
368 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_BRUSH, sizeof(LOGBRUSH), &logbrush) == 0, "\n");
369 ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
370
371 /* Test handle fixup */
372 hBrush = (HBRUSH)((ULONG_PTR)GetStockObject(WHITE_BRUSH) & 0xFFFF);
373 ok(GetObjectW(hBrush, sizeof(LOGBRUSH), &logbrush) == sizeof(LOGBRUSH),
374 "GetObject(0x%p, ...) failed.\n", hBrush);
375
376#ifdef _WIN64
377 /* Test upper 32 bits */
378 hBrush = (HBRUSH)((ULONG64)GetStockObject(WHITE_BRUSH) | 0xFFFFFFFF00000000ULL);
379 ok(GetObjectW(hBrush, sizeof(LOGBRUSH), &logbrush) == sizeof(LOGBRUSH),
380 "GetObject(0x%p, ...) failed.\n", hBrush);
381 hBrush = (HBRUSH)((ULONG64)GetStockObject(WHITE_BRUSH) | 0x537F9F2F00000000ULL);
382 ok(GetObjectW(hBrush, sizeof(LOGBRUSH), &logbrush) == sizeof(LOGBRUSH),
383 "GetObject(0x%p, ...) failed.\n", hBrush);
384#endif
385}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define RGB(r, g, b)
Definition: precomp.h:71
unsigned short WORD
Definition: ntddk_ex.h:93
#define GDI_OBJECT_TYPE_BRUSH
Definition: gdi.h:52
unsigned __int64 ULONG64
Definition: imports.h:198
UINT lbStyle
Definition: wingdi.h:1747
COLORREF lbColor
Definition: wingdi.h:1748
uint32_t ULONG_PTR
Definition: typedefs.h:65
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WHITE_BRUSH
Definition: wingdi.h:902
#define GetObject
Definition: wingdi.h:4468
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)

Referenced by START_TEST().

◆ Test_Colorspace()

void Test_Colorspace ( void  )

Definition at line 672 of file GetObject.c.

673{
674 UCHAR buffer[1000];
675
678 //ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 0, NULL) == 60, "\n");// FIXME: what structure? fails on win7
688
689 //ok_long(GetObjectA((HANDLE)GDI_OBJECT_TYPE_COLORSPACE, 328, NULL), 0); // FIXME: fails on WHS
690 //ok_err(ERROR_INSUFFICIENT_BUFFER);
691}
#define ok_err(error)
Definition: atltest.h:124
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define GDI_OBJECT_TYPE_COLORSPACE
Definition: gdi.h:56
GLuint buffer
Definition: glext.h:5915
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by START_TEST().

◆ Test_CursorIcon()

void Test_CursorIcon ( )

Definition at line 725 of file GetObject.c.

726{
727 BITMAP bmp;
728 HBITMAP hbmMask;
729 CURSORINFO CursorInfo;
730
731 /* On XP sp3 GetObject reports a 32x32 bitmap. */
732 hbmMask = CreateBitmap(32, 64, 1, 1, src_mask);
733 GetObjectW(hbmMask, sizeof(BITMAP), &bmp);
734 ok(bmp.bmWidth == (bmp.bmHeight / 2), "ERR UNICODE CursorIcon RECT got %ldx%ld\n", bmp.bmWidth, bmp.bmHeight);
735 ok(bmp.bmHeight == 64, "ERR UNICODE CursorIcon Height got %ld\n", bmp.bmHeight);
736 DeleteObject(hbmMask);
737
738 CursorInfo.cbSize = sizeof(CURSORINFO);
739 GetCursorInfo(&CursorInfo);
740 ok(CursorInfo.hCursor != NULL, "Invalid HCURSOR Handler\n");
741 ok(CursorInfo.flags != 0, "Mouse cursor is hidden\n");
742 GetObject(CursorInfo.hCursor, sizeof(BITMAP), &bmp);
743 ok(bmp.bmWidth == bmp.bmHeight / 2, "ERR CursorIcon RECT got %ldx%ld\n", bmp.bmWidth, bmp.bmHeight);
744 ok(bmp.bmHeight == 64, "ERR CursorIcon Height got %ld\n", bmp.bmHeight);
745}
UCHAR src_mask[]
Definition: GetObject.c:14
BITMAP bmp
Definition: alphablend.c:62
DWORD flags
Definition: winuser.h:3720
DWORD cbSize
Definition: winuser.h:3719
HCURSOR hCursor
Definition: winuser.h:3721
BOOL WINAPI GetCursorInfo(_Inout_ PCURSORINFO)
struct tagCURSORINFO CURSORINFO

Referenced by START_TEST().

◆ Test_DIBBrush()

void Test_DIBBrush ( void  )

Definition at line 388 of file GetObject.c.

389{
390 struct
391 {
392 BITMAPINFOHEADER bmiHeader;
393 WORD wColors[4];
394 BYTE jBuffer[16];
395 } PackedDIB =
396 {
397 {sizeof(BITMAPINFOHEADER), 4, 4, 1, 8, BI_RGB, 0, 1, 1, 4, 0},
398 {1, 7, 3, 1},
399 {0,1,2,3, 1,2,3,0, 2,3,0,1, 3,0,1,2},
400 };
401 LOGBRUSH logbrush;
402 HBRUSH hBrush;
403
404 /* Create a DIB brush */
405 hBrush = CreateDIBPatternBrushPt(&PackedDIB, DIB_PAL_COLORS);
406 ok(hBrush != 0, "CreateSolidBrush failed, skipping tests.\n");
407 if (!hBrush) return;
408
409 FillMemory(&logbrush, sizeof(LOGBRUSH), 0x77);
411
412 ok_long(GetObject(hBrush, sizeof(LOGBRUSH), &logbrush), sizeof(LOGBRUSH));
413 ok_long(logbrush.lbStyle, BS_DIBPATTERN);
414 ok_long(logbrush.lbColor, 0);
415 ok_long(logbrush.lbHatch, (ULONG_PTR)&PackedDIB);
416
418 DeleteObject(hBrush);
419
420
421 /* Create a DIB brush with undocumented iUsage 2 */
422 hBrush = CreateDIBPatternBrushPt(&PackedDIB, 2);
423 ok(hBrush != 0, "CreateSolidBrush failed, skipping tests.\n");
424 if (!hBrush) return;
425
426 FillMemory(&logbrush, sizeof(LOGBRUSH), 0x77);
428
429 ok_long(GetObject(hBrush, sizeof(LOGBRUSH), &logbrush), sizeof(LOGBRUSH));
430 ok_long(logbrush.lbStyle, BS_DIBPATTERN);
431 ok_long(logbrush.lbColor, 0);
432 ok_long(logbrush.lbHatch, (ULONG_PTR)&PackedDIB);
433
435 DeleteObject(hBrush);
436
437}
#define ok_long(expression, result)
Definition: atltest.h:133
#define BI_RGB
Definition: precomp.h:56
ULONG_PTR lbHatch
Definition: wingdi.h:1749
#define DIB_PAL_COLORS
Definition: wingdi.h:366
#define BS_DIBPATTERN
Definition: wingdi.h:1092
HBRUSH WINAPI CreateDIBPatternBrushPt(_In_ const VOID *pvPackedDIB, _In_ UINT uUsage)

Referenced by START_TEST().

◆ Test_Dibsection()

void Test_Dibsection ( void  )

Definition at line 251 of file GetObject.c.

252{
253 BITMAPINFO bmi = {{sizeof(BITMAPINFOHEADER), 10, 9, 1, 16, BI_RGB, 0, 10, 10, 0,0}};
256 DIBSECTION dibsection;
257 PVOID pData;
258 HDC hDC;
259
260 FillMemory(&dibsection, sizeof(DIBSECTION), 0x77);
261 hDC = GetDC(0);
263 ok(hBitmap != 0, "CreateDIBSection failed with %ld, skipping tests.\n", GetLastError());
264 if (!hBitmap) return;
265
266 ok(GetObjectA((HANDLE)((UINT_PTR)hBitmap & 0x0000ffff), 0, NULL) == sizeof(BITMAP), "\n");
267 ok(GetObjectW((HANDLE)((UINT_PTR)hBitmap & 0x0000ffff), 0, NULL) == sizeof(BITMAP), "\n");
268
270 ok_long(GetObject(hBitmap, sizeof(DIBSECTION), NULL), sizeof(BITMAP));
271 ok_long(GetObject(hBitmap, 0, NULL), sizeof(BITMAP));
272 ok_long(GetObject(hBitmap, 5, NULL), sizeof(BITMAP));
273 ok_long(GetObject(hBitmap, -5, NULL), sizeof(BITMAP));
274 ok_long(GetObject(hBitmap, 0, &dibsection), 0);
275 ok_long(GetObject(hBitmap, 5, &dibsection), 0);
276 ok_long(GetObject(hBitmap, sizeof(BITMAP), &bitmap), sizeof(BITMAP));
277 ok_long(GetObject(hBitmap, sizeof(BITMAP)+2, &bitmap), sizeof(BITMAP));
278 ok_long(bitmap.bmType, 0);
279 ok_long(bitmap.bmWidth, 10);
280 ok_long(bitmap.bmHeight, 9);
281 ok_long(bitmap.bmWidthBytes, 20);
282 ok_long(bitmap.bmPlanes, 1);
283 ok_long(bitmap.bmBitsPixel, 16);
284 ok(bitmap.bmBits == pData, "\n");
285 ok_long(GetObject(hBitmap, sizeof(DIBSECTION), &dibsection), sizeof(DIBSECTION));
286 ok_long(GetObject(hBitmap, sizeof(DIBSECTION)+2, &dibsection), sizeof(DIBSECTION));
287 ok_long(GetObject(hBitmap, -5, &dibsection), sizeof(DIBSECTION));
290 ReleaseDC(0, hDC);
291}
static HDC hDC
Definition: 3dtext.c:33
static HDC
Definition: imagelist.c:92
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
#define DIB_RGB_COLORS
Definition: wingdi.h:367
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by START_TEST().

◆ Test_ExtPen()

void Test_ExtPen ( void  )

Definition at line 473 of file GetObject.c.

474{
475 HPEN hPen;
476 EXTLOGPEN extlogpen;
477 LOGBRUSH logbrush;
478 DWORD dwStyles[17] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
479 struct
480 {
481 EXTLOGPEN extlogpen;
482 DWORD dwStyles[50];
483 } elpUserStyle;
484 int i;
485
492
493 FillMemory(&extlogpen, sizeof(EXTLOGPEN), 0x77);
494 logbrush.lbStyle = BS_SOLID;
495 logbrush.lbColor = RGB(1,2,3);
496 logbrush.lbHatch = 22;
497 hPen = ExtCreatePen(PS_GEOMETRIC | PS_DASH, 5, &logbrush, 0, NULL);
498
501 ok(GetObject(hPen, sizeof(EXTLOGPEN), NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
502 ok(GetObject(hPen, 0, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
503 ok(GetObject((HANDLE)GDI_HANDLE_GET_INDEX(hPen), 0, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
504 ok(GetObject(hPen, 5, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
505 ok(GetObject(hPen, -5, NULL) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
506 ok(GetLastError() == ERROR_SUCCESS, "\n");
509 SetLastError(0xbadbad00);
510 ok(GetObject(hPen, 0, &extlogpen) == 0, "\n");
511 ok((GetLastError() == 0xbadbad00) || (GetLastError() == ERROR_NOACCESS), "wrong error: %ld\n", GetLastError());
513 ok(GetObject(hPen, 4, &extlogpen) == 0, "\n");
514 ok(GetLastError() == ERROR_SUCCESS, "got %ld\n", GetLastError());
516 ok(GetObject((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 0, &extlogpen) == 0, "\n");
519 ok(GetObject((HANDLE)GDI_OBJECT_TYPE_EXTPEN, 4, &extlogpen) == 0, "\n");
522 ok(GetObject(hPen, sizeof(EXTLOGPEN) - 5, &extlogpen) == 0, "\n");
523 ok(GetLastError() == ERROR_SUCCESS, "got %ld\n", GetLastError());
524
525 /* Nothing should be filled */
526 ok(extlogpen.elpPenStyle == 0x77777777, "\n");
527 ok(extlogpen.elpWidth == 0x77777777, "\n");
528
529 ok(GetObject(hPen, sizeof(EXTLOGPEN), &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
530 ok(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD), &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
531 ok(GetObject(hPen, sizeof(EXTLOGPEN)-sizeof(DWORD)-1, &extlogpen) == 0, "\n");
532 ok(GetObject(hPen, sizeof(EXTLOGPEN)+2, &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
533 ok(GetObject(hPen, -5, &extlogpen) == sizeof(EXTLOGPEN)-sizeof(DWORD), "\n");
534
535 /* test if the fields are filled correctly */
536 ok(extlogpen.elpPenStyle == (PS_GEOMETRIC | PS_DASH), "\n");
537 ok(extlogpen.elpWidth == 5, "\n");
538 ok(extlogpen.elpBrushStyle == 0, "\n");
539 ok(extlogpen.elpColor == RGB(1,2,3), "\n");
540 ok(extlogpen.elpHatch == 22, "\n");
541 ok(extlogpen.elpNumEntries == 0, "\n");
542 DeleteObject(hPen);
543
544 /* A maximum of 16 Styles is allowed */
545 hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 16, (CONST DWORD*)&dwStyles);
546 ok(GetObject(hPen, 0, NULL) == sizeof(EXTLOGPEN) + 15*sizeof(DWORD), "\n");
547 ok(GetObject(hPen, sizeof(EXTLOGPEN) + 15*sizeof(DWORD), &elpUserStyle) == sizeof(EXTLOGPEN) + 15*sizeof(DWORD), "\n");
548 for (i = 0; i <= 15; i++)
549 ok(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[i] == i, "%d\n", i);
550 DeleteObject(hPen);
551}
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GDI_HANDLE_GET_INDEX(h)
Definition: gdi.h:28
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
#define GDI_OBJECT_TYPE_EXTPEN
Definition: gdi.h:55
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define CONST
Definition: pedump.c:81
DWORD elpNumEntries
Definition: wingdi.h:1947
DWORD elpWidth
Definition: wingdi.h:1943
DWORD elpPenStyle
Definition: wingdi.h:1942
UINT elpBrushStyle
Definition: wingdi.h:1944
ULONG_PTR elpHatch
Definition: wingdi.h:1946
COLORREF elpColor
Definition: wingdi.h:1945
#define ERROR_NOACCESS
Definition: winerror.h:578
#define PS_DASH
Definition: wingdi.h:587
HPEN WINAPI ExtCreatePen(_In_ DWORD iPenStyle, _In_ DWORD cWidth, _In_ const LOGBRUSH *plbrush, _In_ DWORD cStyle, _In_reads_opt_(cStyle) const DWORD *pstyle)
#define PS_GEOMETRIC
Definition: wingdi.h:583
#define PS_USERSTYLE
Definition: wingdi.h:592
#define BS_SOLID
Definition: wingdi.h:1086

Referenced by START_TEST().

◆ Test_Font()

void Test_Font ( void  )

Definition at line 554 of file GetObject.c.

555{
556 HFONT hFont;
557 union
558 {
559 LOGFONTA logfonta;
560 LOGFONTW logfontw;
561 EXTLOGFONTA extlogfonta;
562 EXTLOGFONTW extlogfontw;
563 ENUMLOGFONTEXA enumlogfontexa;
564 ENUMLOGFONTEXW enumlogfontexw;
565 ENUMLOGFONTEXDVA enumlogfontexdva;
566 ENUMLOGFONTEXDVW enumlogfontexdvw;
567 ENUMLOGFONTA enumlogfonta;
568 ENUMLOGFONTW enumlogfontw;
569 BYTE bData[270];
570 } u;
571 int ret;
572
573 FillMemory(&u, sizeof(u), 0x77);
574 hFont = CreateFontA(8, 8, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
577 ok(hFont != 0, "\n");
578
580 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, 0, NULL) == sizeof(LOGFONTA), "\n");
581 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, 0, NULL) == sizeof(LOGFONTW), "\n");
582 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(LOGFONTA), NULL) == sizeof(LOGFONTA), "\n"); // 60
583 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTA), NULL) == sizeof(LOGFONTA), "\n"); // 156
584 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXA), NULL) == sizeof(LOGFONTA), "\n"); // 188
585 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(EXTLOGFONTA), NULL) == sizeof(LOGFONTA), "\n"); // 192
586 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVA), NULL) == sizeof(LOGFONTA), "\n"); // 260
587 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVA)+1, NULL) == sizeof(LOGFONTA), "\n"); // 260
588 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(LOGFONTW), NULL) == sizeof(LOGFONTW), "\n"); // 92
589 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTW), NULL) == sizeof(LOGFONTW), "\n"); // 284
590 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(EXTLOGFONTW), NULL) == sizeof(LOGFONTW), "\n"); // 320
591 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXW), NULL) == sizeof(LOGFONTW), "\n"); // 348
592 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVW), NULL) == sizeof(LOGFONTW), "\n"); // 420
593 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_FONT, sizeof(ENUMLOGFONTEXDVW)+1, NULL) == sizeof(LOGFONTW), "\n"); // 356!
594 ok(GetLastError() == ERROR_SUCCESS, "got %ld\n", GetLastError());
595
596 ok(GetObjectA(hFont, sizeof(LOGFONTA), NULL) == sizeof(LOGFONTA), "\n");
597 ok(GetObjectA(hFont, 0, NULL) == sizeof(LOGFONTA), "\n");
598 ok(GetObjectA(hFont, 5, NULL) == sizeof(LOGFONTA), "\n");
599 ok(GetObjectA(hFont, -5, NULL) == sizeof(LOGFONTA), "\n");
600 ok(GetObjectA(hFont, 0, &u.logfonta) == 0, "\n");
601 ok(u.logfonta.lfHeight == 0x77777777, "\n");
602
603 ok(GetObjectA(hFont, 5, &u.logfonta) == 5, "\n");
604 ok(u.logfonta.lfHeight == 8, "\n");
605 ok(u.logfonta.lfWidth == 0x77777708, "\n");
606
607 ok(GetObjectA(hFont, 0, &u.logfonta) == 0, "\n");
608 ok(GetObjectA(hFont, -1, &u.logfonta) == sizeof(ENUMLOGFONTEXDVA), "\n");
609 ok(GetObjectA(hFont, 1, &u.logfonta) == 1, "\n"); // 1 -> 1
610 ok(GetObjectA(hFont, sizeof(LOGFONTA) - 1, &u.logfonta) == sizeof(LOGFONTA) - 1, "\n"); // 59 -> 59
611 ok(GetObjectA(hFont, sizeof(LOGFONTA), &u.logfonta) == sizeof(LOGFONTA), "\n"); // 60 -> 60
612 ok(GetObjectA(hFont, sizeof(LOGFONTA) + 1, &u.logfonta) == sizeof(LOGFONTA) + 1, "\n"); // 61 -> 61
613 ok(GetObjectA(hFont, sizeof(LOGFONTW) - 1, &u.logfontw) == sizeof(LOGFONTW) - 1, "\n"); // 91 -> 91
614 ok(GetObjectA(hFont, sizeof(LOGFONTW), &u.logfontw) == sizeof(LOGFONTA), "\n"); // 92 -> 60
615 ok(GetObjectA(hFont, sizeof(LOGFONTW) + 1, &u.logfontw) == sizeof(LOGFONTW) + 1, "\n"); // 93 -> 93
616 ok(GetObjectA(hFont, sizeof(EXTLOGFONTA), &u.extlogfonta) == sizeof(EXTLOGFONTA), "\n"); // 192 -> 192
617 ok(GetObjectA(hFont, sizeof(EXTLOGFONTA)+1, &u.extlogfonta) == sizeof(EXTLOGFONTA)+1, "\n"); // 192+1 -> 192+1
618 ok(GetObjectA(hFont, sizeof(EXTLOGFONTA)+16*4, &u.extlogfonta) == sizeof(EXTLOGFONTA)+16*4, "\n"); // 192+1 -> 192+1
619 ok(GetObjectA(hFont, sizeof(EXTLOGFONTW), &u.extlogfontw) == sizeof(ENUMLOGFONTEXDVA), "\n"); // 320 -> 260
620 ok(GetObjectA(hFont, 261, &u.bData) == 260, "\n"); // no
621
622 ok(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA) - 1, &u.enumlogfontexdvw) == sizeof(ENUMLOGFONTEXDVA) - 1, "\n"); // 419
623 ok(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA), &u.enumlogfontexdvw) == sizeof(ENUMLOGFONTEXDVA), "\n"); // 420
624 ok(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA)+1, &u.enumlogfontexdvw) == sizeof(ENUMLOGFONTEXDVA), "\n"); // 356!
625
626 /* LOGFONT / GetObjectW */
627 FillMemory(&u.logfontw, sizeof(LOGFONTW), 0x77);
628
629 ok(GetObjectW(hFont, sizeof(LOGFONTW), NULL) == sizeof(LOGFONTW), "1\n");
630 ok(GetObjectW(hFont, 0, NULL) == sizeof(LOGFONTW), "\n");
631 ok(GetObjectW(hFont, 5, NULL) == sizeof(LOGFONTW), "\n");
632 ok(GetObjectW(hFont, sizeof(ENUMLOGFONTEXA), NULL) == sizeof(LOGFONTW), "\n");
633 ok(GetObjectW(hFont, -5, NULL) == sizeof(LOGFONTW), "\n");
634 ok(GetObjectW(hFont, 0, &u.logfontw) == 0, "\n");
635 ok(u.logfontw.lfHeight == 0x77777777, "\n");
636
637 ok(GetObjectW(hFont, 5, &u.logfontw) == 5, "\n");
638 ok(u.logfontw.lfHeight == 8, "\n");
639 ok(u.logfontw.lfWidth == 0x77777708, "\n");
640
641 ok(GetObjectA(hFont, sizeof(LOGFONTA), &u.logfonta) == sizeof(LOGFONTA), "\n"); // 60
642 ok(u.logfonta.lfHeight == 8, "\n");
643 ok(GetObjectA(hFont, sizeof(ENUMLOGFONTA), &u.enumlogfonta) == sizeof(ENUMLOGFONTA), "\n"); // 156
644 ok(GetObjectA(hFont, sizeof(ENUMLOGFONTEXA), &u.enumlogfontexa) == sizeof(ENUMLOGFONTEXA), "\n"); // 188
645 ok(GetObjectA(hFont, sizeof(EXTLOGFONTA), &u.extlogfonta) == sizeof(EXTLOGFONTA), "\n"); // 192
646 ok(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA), &u.enumlogfontexdva) == sizeof(ENUMLOGFONTEXDVA), "\n"); // 260
647 ok(GetObjectA(hFont, sizeof(ENUMLOGFONTEXDVA)+1, &u.enumlogfontexdva) == sizeof(ENUMLOGFONTEXDVA), "\n"); // 260
648
649 ok(GetObjectW(hFont, sizeof(LOGFONTW), &u.logfontw) == sizeof(LOGFONTW), "\n"); // 92
650 ok(GetObjectW(hFont, sizeof(LOGFONTW) + 1, &u.logfontw) == sizeof(LOGFONTW) + 1, "\n"); // 92
651 ok(GetObjectW(hFont, sizeof(LOGFONTW) - 1, &u.logfontw) == sizeof(LOGFONTW) - 1, "\n"); // 92
652 ok(GetObjectW(hFont, sizeof(ENUMLOGFONTW), &u.enumlogfontw) == sizeof(ENUMLOGFONTW), "\n"); // 284
653 ok(GetObjectW(hFont, sizeof(EXTLOGFONTW), &u.extlogfontw) == sizeof(EXTLOGFONTW), "\n"); // 320
654 ok(GetObjectW(hFont, sizeof(ENUMLOGFONTEXW), &u.enumlogfontexw) == sizeof(ENUMLOGFONTEXW), "\n"); // 348
655 ok(GetObjectW(hFont, sizeof(ENUMLOGFONTEXW) + 1, &u.enumlogfontexw) == sizeof(ENUMLOGFONTEXW) + 1, "\n"); // 348
656 ok(GetObjectW(hFont, 355, &u.enumlogfontexdvw) == 355, "\n"); // 419
657
658 ok(GetObjectW(hFont, 356, &u.enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n"); // 419
659 ret = sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD);
660 ret = GetObjectW(hFont, 357, &u.enumlogfontexdvw);
661 ok(ret == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n");
662 ok(GetObjectW(hFont, 357, &u.enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n"); // 419
663 ok(GetObjectW(hFont, sizeof(ENUMLOGFONTEXDVW) - 1, &u.enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n"); // 419
664 ok(GetObjectW(hFont, sizeof(ENUMLOGFONTEXDVW), &u.enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n"); // 420
665 ok(GetObjectW(hFont, sizeof(ENUMLOGFONTEXDVW)+1, &u.enumlogfontexdvw) == sizeof(ENUMLOGFONTEXW) + 2*sizeof(DWORD), "\n"); // 356!
666 ok(GetLastError() == ERROR_SUCCESS, "got %ld\n", GetLastError());
667
669}
HFONT hFont
Definition: main.c:53
#define FALSE
Definition: types.h:117
#define GDI_OBJECT_TYPE_FONT
Definition: gdi.h:50
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
int ret
#define CLIP_CHARACTER_PRECIS
Definition: wingdi.h:427
#define DEFAULT_PITCH
Definition: wingdi.h:443
#define ANTIALIASED_QUALITY
Definition: wingdi.h:440
struct tagENUMLOGFONTEXW ENUMLOGFONTEXW
#define OUT_CHARACTER_PRECIS
Definition: wingdi.h:417
#define ANSI_CHARSET
Definition: wingdi.h:383
#define FW_NORMAL
Definition: wingdi.h:373
HFONT WINAPI CreateFontA(_In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_opt_ LPCSTR)

Referenced by START_TEST().

◆ Test_General()

void Test_General ( void  )

Definition at line 36 of file GetObject.c.

37{
38 struct
39 {
40 LOGBRUSH logbrush;
41 BYTE additional[600];
42 } TestStruct;
43 PLOGBRUSH plogbrush;
44 HBRUSH hBrush;
45 HPEN hpen;
46 INT ret;
47
48 /* Test null pointer and invalid handles */
50 ok(GetObjectA(0, 0, NULL) == 0, "\n");
51 ok(GetObjectA((HANDLE)-1, 0, NULL) == 0, "\n");
52
53 /* Test invalid habdles of different types */
54 ok(GetObjectA((HANDLE)0x00380000, 0, NULL) == 0, "\n");
55 ok(GetLastError() == ERROR_SUCCESS, "\n");
56 ok(GetObjectA((HANDLE)0x00380000, 10, &TestStruct) == 0, "\n");
57 ok(GetLastError() == ERROR_SUCCESS, "\n");
59 ok(GetObjectA((HANDLE)0x00010000, 0, NULL) == 0, "\n");
62 ok(GetObjectA((HANDLE)0x00020000, 0, NULL) == 0, "\n");
63 ok(GetLastError() == ERROR_SUCCESS, "\n");
65 ok(GetObjectA((HANDLE)0x00030000, 0, NULL) == 0, "\n");
66 ok(GetLastError() == ERROR_SUCCESS, "\n");
68 ok(GetObjectA((HANDLE)0x00040000, 0, NULL) == 0, "\n");
71 ok(GetObjectA((HANDLE)0x00060000, 0, NULL) == 0, "\n");
72 ok(GetLastError() == ERROR_SUCCESS, "\n");
74 ok(GetObjectA((HANDLE)0x00070000, 0, NULL) == 0, "\n");
75 ok(GetLastError() == ERROR_SUCCESS, "\n");
77 ok(GetObjectA((HANDLE)0x000B0000, 0, NULL) == 0, "\n");
78 ok(GetLastError() == ERROR_SUCCESS, "\n");
80 ok(GetObjectA((HANDLE)0x000C0000, 0, NULL) == 0, "\n");
81 ok(GetLastError() == ERROR_SUCCESS, "\n");
83 ok(GetObjectA((HANDLE)0x000D0000, 0, NULL) == 0, "\n");
84 ok(GetLastError() == ERROR_SUCCESS, "\n");
86 ok(GetObjectA((HANDLE)0x000E0000, 0, NULL) == 0, "\n");
87 ok(GetLastError() == ERROR_SUCCESS, "\n");
89 ok(GetObjectA((HANDLE)0x000F0000, 0, NULL) == 0, "\n");
90 ok(GetLastError() == ERROR_SUCCESS, "\n");
92 ok(GetObjectA((HANDLE)0x00110000, 0, NULL) == 0, "\n");
93 ok(GetLastError() == ERROR_SUCCESS, "\n");
95 ok(GetObjectA((HANDLE)0x00120000, 0, NULL) == 0, "\n");
96 ok(GetLastError() == ERROR_SUCCESS, "\n");
98 ok(GetObjectA((HANDLE)0x00130000, 0, NULL) == 0, "\n");
99 ok(GetLastError() == ERROR_SUCCESS, "\n");
101 ok(GetObjectA((HANDLE)0x00140000, 0, NULL) == 0, "\n");
102 ok(GetLastError() == ERROR_SUCCESS, "\n");
104 ok(GetObjectA((HANDLE)0x00150000, 0, NULL) == 0, "\n");
105 ok(GetLastError() == ERROR_SUCCESS, "\n");
107 ok(GetObjectA((HANDLE)0x00160000, 0, NULL) == 0, "\n");
108 ok(GetLastError() == ERROR_SUCCESS, "\n");
110 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_DC, 0, NULL) == 0, "\n");
113 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_DC, 0, NULL) == 0, "\n");
122 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_EMF, 0, NULL) == 0, "\n");
125 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_EMF, 0, NULL) == 0, "\n");
139
140 /* Test need of alignment */
142 hBrush = GetStockObject(WHITE_BRUSH);
143 plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush);
144 ok(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == sizeof(LOGBRUSH), "\n");
145 plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush + 2);
146 ok(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == sizeof(LOGBRUSH), "\n");
147 plogbrush = (PVOID)((ULONG_PTR)&TestStruct.logbrush + 1);
148 //ok(GetObject(hBrush, sizeof(LOGBRUSH), plogbrush) == 0, "\n"); // fails on win7
149
150 /* Test invalid buffer */
151 SetLastError(0xbadbad00);
153 ok((GetLastError() == 0xbadbad00) || (GetLastError() == ERROR_NOACCESS), "wrong error: %ld\n", GetLastError());
154 SetLastError(0xbadbad00);
156 ok((GetLastError() == 0xbadbad00) || (GetLastError() == ERROR_NOACCESS), "wrong error: %ld\n", GetLastError());
157 SetLastError(0xbadbad00);
158 ok(GetObjectW(GetStockObject(21), sizeof(BITMAP), INVALID_POINTER) == 0, "\n");
159 ok((GetLastError() == 0xbadbad00) || (GetLastError() == ERROR_NOACCESS), "wrong error: %ld\n", GetLastError());
160 SetLastError(0xbadbad00);
162 ok(GetLastError() == 0xbadbad00, "wrong error: %ld\n", GetLastError());
165 {
167 }
169 {
170 ret = -1;
171 }
173 ok(ret == -1, "should have got an exception\n");
174
175 ok(GetObjectW(GetStockObject(SYSTEM_FONT), 0x50000000, &TestStruct) == 356, "\n");
176 ok(GetObjectW(GetStockObject(WHITE_BRUSH), 0x50000000, &TestStruct) == sizeof(LOGBRUSH), "\n");
177
178
179 /* Test buffer size of 0 */
180 SetLastError(0xbadbad00);
181 hBrush = CreateSolidBrush(123);
182 ok(hBrush != NULL, "Failed to create brush\n");
183 ok_long(GetObjectA(hBrush, 0, &TestStruct), 0);
184 ok_err(0xbadbad00);
185 DeleteObject(hBrush);
186 SetLastError(0xbadbad00);
187 hpen = CreatePen(PS_SOLID, 1, 123);
188 ok(hpen != NULL, "Failed to create pen\n");
190 ok((GetLastError() == 0xbadbad00) || (GetLastError() == ERROR_NOACCESS), "wrong error: %ld\n", GetLastError());
191 SetLastError(0xbadbad00);
192 TestStruct.logbrush.lbStyle = BS_SOLID;
193 TestStruct.logbrush.lbColor = RGB(1,2,3);
194 TestStruct.logbrush.lbHatch = 0;
195 hpen = ExtCreatePen(PS_GEOMETRIC | PS_SOLID, 1, &TestStruct.logbrush, 0, NULL);
196 ok(hpen != NULL, "Failed to create pen\n");
198 ok((GetLastError() == 0xbadbad00) || (GetLastError() == ERROR_NOACCESS), "wrong error: %ld\n", GetLastError());
199 SetLastError(0xbadbad00);
201 ok_err(0xbadbad00);
202 SetLastError(0xbadbad00);
203 ok(GetObjectW(GetStockObject(21), 0, &TestStruct) == 0, "\n");
204 ok_err(0xbadbad00);
205
206}
#define INVALID_POINTER
Definition: GetObject.c:12
static HPEN hpen
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define GDI_OBJECT_TYPE_REGION
Definition: gdi.h:47
#define GDI_OBJECT_TYPE_DC
Definition: gdi.h:46
#define GDI_OBJECT_TYPE_ENHMETAFILE
Definition: gdi.h:59
#define GDI_OBJECT_TYPE_EMF
Definition: gdi.h:53
#define GDI_OBJECT_TYPE_METAFILE
Definition: gdi.h:58
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
void * PVOID
Definition: typedefs.h:50
int32_t INT
Definition: typedefs.h:58
#define BLACK_PEN
Definition: wingdi.h:903
#define SYSTEM_FONT
Definition: wingdi.h:911
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define PS_SOLID
Definition: wingdi.h:586

Referenced by START_TEST().

◆ Test_MetaDC()

void Test_MetaDC ( void  )

Definition at line 694 of file GetObject.c.

695{
696 /* Windows does not SetLastError() on a metadc, but it doesn't seem to do anything with it */
697 HDC hMetaDC;
698 BYTE buffer[1000];
699
700 hMetaDC = CreateMetaFile(NULL);
701 ok(hMetaDC != 0, "CreateMetaFile failed, skipping tests.\n");
702 if(!hMetaDC) return;
703
705
708 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_METADC, 100, &buffer) == 0, "\n");
709 ok(GetObjectA(hMetaDC, 0, NULL) == 0, "\n");
710 ok(GetObjectA(hMetaDC, 1000, &buffer) == 0, "\n");
711 ok(GetLastError() == ERROR_SUCCESS, "got %ld\n", GetLastError());
712}
#define GDI_HANDLE_TYPE_MASK
Definition: gdi.h:17
#define GDI_OBJECT_TYPE_METADC
Definition: gdi.h:57
#define CreateMetaFile
Definition: wingdi.h:4447

Referenced by START_TEST().

◆ Test_Palette()

void Test_Palette ( void  )

Definition at line 294 of file GetObject.c.

295{
296 LOGPALETTE logpal;
297 HPALETTE hPalette;
298 WORD wPalette;
299
300 FillMemory(&wPalette, sizeof(WORD), 0x77);
301 logpal.palVersion = 0x0300;
302 logpal.palNumEntries = 1;
303 logpal.palPalEntry[0].peRed = 0;
304 logpal.palPalEntry[0].peGreen = 0;
305 logpal.palPalEntry[0].peBlue = 0;
306 logpal.palPalEntry[0].peFlags = PC_EXPLICIT;
307 hPalette = CreatePalette(&logpal);
308 ok(hPalette != 0, "CreatePalette failed, skipping tests.\n");
309 if (!hPalette) return;
310
311 ok(GetObjectA((HANDLE)((UINT_PTR)hPalette & 0x0000ffff), 0, NULL) == sizeof(WORD), "\n");
312 ok(GetObjectW((HANDLE)((UINT_PTR)hPalette & 0x0000ffff), 0, NULL) == sizeof(WORD), "\n");
313
315 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_PALETTE, 0, NULL) == sizeof(WORD), "\n");
316 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_PALETTE, 0, NULL) == sizeof(WORD), "\n");
317 ok(GetObject(hPalette, sizeof(WORD), NULL) == sizeof(WORD), "\n");
318 ok(GetObject(hPalette, 0, NULL) == sizeof(WORD), "\n");
319 ok(GetObject(hPalette, 5, NULL) == sizeof(WORD), "\n");
320 ok(GetObject(hPalette, -5, NULL) == sizeof(WORD), "\n");
321 ok(GetObject(hPalette, sizeof(WORD), &wPalette) == sizeof(WORD), "\n");
322 ok(GetObject(hPalette, sizeof(WORD)+2, &wPalette) == sizeof(WORD), "\n");
323 ok(GetObject(hPalette, 0, &wPalette) == 0, "\n");
324 ok(GetObject(hPalette, 1, &wPalette) == 0, "\n");
325 ok(GetObject(hPalette, -1, &wPalette) == sizeof(WORD), "\n");
326 ok(GetLastError() == ERROR_SUCCESS, "\n");
327 DeleteObject(hPalette);
328 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_PALETTE, sizeof(WORD), &wPalette) == 0, "\n");
329 ok(GetLastError() == ERROR_SUCCESS, "\n");
330
331}
#define GDI_OBJECT_TYPE_PALETTE
Definition: gdi.h:49
WORD palNumEntries
Definition: wingdi.h:1834
WORD palVersion
Definition: wingdi.h:1833
HPALETTE WINAPI CreatePalette(_In_reads_(_Inexpressible_(2 *sizeof(WORD)+plpal->palNumEntries *sizeof(PALETTEENTRY))) const LOGPALETTE *)
#define PC_EXPLICIT
Definition: wingdi.h:880

Referenced by START_TEST().

◆ Test_Pen()

void Test_Pen ( void  )

Definition at line 440 of file GetObject.c.

441{
442 LOGPEN logpen;
443 HPEN hPen;
444
445 FillMemory(&logpen, sizeof(LOGPEN), 0x77);
446 hPen = CreatePen(PS_SOLID, 3, RGB(4,5,6));
447 ok(hPen != 0, "CreatePen failed, skipping tests.\n");
448 if (!hPen) return;
450 ok(GetObjectA((HANDLE)GDI_OBJECT_TYPE_PEN, 0, NULL) == sizeof(LOGPEN), "\n");
451 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_PEN, 0, NULL) == sizeof(LOGPEN), "\n");
452 ok(GetObject(hPen, sizeof(BITMAP), NULL) == sizeof(LOGPEN), "\n");
453 ok(GetObject(hPen, 0, NULL) == sizeof(LOGPEN), "\n");
454 ok(GetObject(hPen, 5, NULL) == sizeof(LOGPEN), "\n");
455 ok(GetObject(hPen, -5, NULL) == sizeof(LOGPEN), "\n");
456 ok(GetObject(hPen, sizeof(LOGPEN), &logpen) == sizeof(LOGPEN), "\n");
457 ok(GetObject(hPen, sizeof(LOGPEN)-1, &logpen) == 0, "\n");
458 ok(GetObject(hPen, sizeof(LOGPEN)+2, &logpen) == sizeof(LOGPEN), "\n");
459 ok(GetObject(hPen, 0, &logpen) == 0, "\n");
460 ok(GetObject(hPen, -5, &logpen) == sizeof(LOGPEN), "\n");
461 //ok(GetLastError() == ERROR_SUCCESS, "\n"); fails on win7
462
463 /* test if the fields are filled correctly */
464 ok(logpen.lopnStyle == PS_SOLID, "\n");
465
466 ok(GetObjectW((HANDLE)GDI_OBJECT_TYPE_PEN, sizeof(LOGPEN), &logpen) == 0, "\n");
467 ok(GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
468
469 DeleteObject(hPen);
470}
#define GDI_OBJECT_TYPE_PEN
Definition: gdi.h:54
UINT lopnStyle
Definition: wingdi.h:1845

Referenced by START_TEST().

◆ Test_Region()

void Test_Region ( void  )

Definition at line 715 of file GetObject.c.

716{
717 HRGN hRgn;
718 hRgn = CreateRectRgn(0,0,5,5);
720 ok(GetObjectW(hRgn, 0, NULL) == 0, "\n");
723}
static HRGN hRgn
Definition: mapping.c:33
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)

Referenced by START_TEST().

Variable Documentation

◆ src_mask

UCHAR src_mask[]
Initial value:
= {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
}

Definition at line 14 of file GetObject.c.

Referenced by shader_glsl_cross(), shader_glsl_texdp3(), shader_glsl_texdp3tex(), shader_glsl_texm3x2depth(), shader_glsl_texm3x2pad(), shader_glsl_texm3x2tex(), shader_glsl_texm3x3(), shader_glsl_texm3x3pad(), shader_glsl_texm3x3spec(), shader_glsl_texm3x3tex(), shader_glsl_texm3x3vspec(), surface_depth_blt_fbo(), and Test_CursorIcon().