ReactOS  0.4.13-dev-100-gc8611ae
cursoricon.c File Reference
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "wingdi.h"
#include "winuser.h"
#include "pshpack1.h"
#include "poppack.h"
Include dependency graph for cursoricon.c:

Go to the source code of this file.

Classes

struct  CURSORICONFILEDIRENTRY
 
struct  CURSORICONFILEDIR
 
struct  ani_header
 
struct  ani_data32x32x32
 
struct  ani_frame32x32x32
 
struct  riff_header_t
 
struct  riff_list_t
 
struct  riff_icon32x32x32_t
 
struct  riff_cursor1_t
 
struct  riff_cursor3_t
 
struct  riff_rate3_t
 
struct  riff_seq3_t
 
struct  riff_cursor3_seq_t
 
struct  test_icon_entries_t
 

Macros

#define RIFF_FOURCC(c0, c1, c2, c3)
 
#define ANI_RIFF_ID   RIFF_FOURCC('R', 'I', 'F', 'F')
 
#define ANI_LIST_ID   RIFF_FOURCC('L', 'I', 'S', 'T')
 
#define ANI_ACON_ID   RIFF_FOURCC('A', 'C', 'O', 'N')
 
#define ANI_anih_ID   RIFF_FOURCC('a', 'n', 'i', 'h')
 
#define ANI_seq__ID   RIFF_FOURCC('s', 'e', 'q', ' ')
 
#define ANI_fram_ID   RIFF_FOURCC('f', 'r', 'a', 'm')
 
#define ANI_icon_ID   RIFF_FOURCC('i', 'c', 'o', 'n')
 
#define ANI_rate_ID   RIFF_FOURCC('r', 'a', 't', 'e')
 
#define ANI_FLAG_ICON   0x1
 
#define ANI_FLAG_SEQUENCE   0x2
 
#define EMPTY_ICON32
 
#define PROC_INIT   (WM_USER+1)
 
#define test_icon_info(a, b, c, d, e)   test_icon_info_dbg((a),(b),(c),(d),(e),__LINE__)
 
#define ARRAY_SIZE(a)   (sizeof(a)/sizeof((a)[0]))
 
#define ICON_WIDTH   32
 
#define ICON_HEIGHT   32
 
#define ICON_AND_SIZE   (ICON_WIDTH*ICON_HEIGHT/8)
 
#define ICON_BPP   32
 
#define ICON_SIZE
 
#define ICON_RES_WIDTH   32
 
#define ICON_RES_HEIGHT   32
 
#define ICON_RES_AND_SIZE   (ICON_WIDTH*ICON_HEIGHT/8)
 
#define ICON_RES_BPP   32
 
#define ICON_RES_SIZE   (sizeof(BITMAPINFOHEADER) + ICON_AND_SIZE + ICON_AND_SIZE*ICON_BPP)
 
#define CRSR_RES_SIZE   (2*sizeof(INT16) + ICON_RES_SIZE)
 
#define ICON_RES_WIDTH   32
 
#define ICON_RES_HEIGHT   32
 
#define ICON_RES_AND_SIZE   (ICON_WIDTH*ICON_HEIGHT/8)
 
#define ICON_RES_BPP   32
 
#define ICON_RES_SIZE   (sizeof(BITMAPINFOHEADER) + ICON_AND_SIZE + ICON_AND_SIZE*ICON_BPP)
 
#define CRSR_RES_SIZE   (2*sizeof(INT16) + ICON_RES_SIZE)
 

Functions

static BOOL (WINAPI *pGetCursorInfo)(CURSORINFO *)
 
static LRESULT CALLBACK callback_child (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK callback_parent (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void do_child (void)
 
static void do_parent (void)
 
static void finish_child_process (void)
 
static void test_child_process (void)
 
static BOOL color_match (COLORREF a, COLORREF b)
 
static void test_CopyImage_Check (HBITMAP bitmap, UINT flags, INT copyWidth, INT copyHeight, INT expectedWidth, INT expectedHeight, WORD expectedDepth, BOOL dibExpected)
 
static void test_CopyImage_Bitmap (int depth)
 
static void test_initial_cursor (void)
 
static void test_icon_info_dbg (HICON hIcon, UINT exp_cx, UINT exp_cy, UINT exp_mask_cy, UINT exp_bpp, int line)
 
static void test_CreateIcon (void)
 
static void test_LoadImageBitmap (const char *test_desc, HBITMAP hbm)
 
static void test_LoadImageFile (const char *test_desc, const unsigned char *image_data, unsigned int image_size, const char *ext, BOOL expect_success)
 
static void create_ico_file (const char *filename, const test_icon_entries_t *test_icon_entries, unsigned entry_cnt)
 
static void test_LoadImage (void)
 
static void test_CreateIconFromResource (void)
 
static int check_cursor_data (HDC hdc, HCURSOR hCursor, void *data, int length)
 
static HCURSOR (WINAPI *pGetCursorFrameInfo)(HCURSOR hCursor
 
static void test_GetCursorFrameInfo (void)
 
static HICON create_test_icon (HDC hdc, int width, int height, int bpp, BOOL maskvalue, UINT32 *color, int colorSize)
 
static void check_alpha_draw (HDC hdc, BOOL drawiconex, BOOL alpha, int bpp, int line)
 
static void check_DrawIcon (HDC hdc, BOOL maskvalue, UINT32 color, int bpp, COLORREF background, COLORREF modern_expected, COLORREF legacy_expected, int line)
 
static void test_DrawIcon (void)
 
static void check_DrawIconEx (HDC hdc, BOOL maskvalue, UINT32 color, int bpp, UINT flags, COLORREF background, COLORREF modern_expected, COLORREF legacy_expected, int line)
 
static void test_DrawIconEx (void)
 
static void check_DrawState_Size (HDC hdc, BOOL maskvalue, UINT32 color, int bpp, HBRUSH hbr, UINT flags, int line)
 
static void check_DrawState_Color (HDC hdc, BOOL maskvalue, UINT32 color, int bpp, HBRUSH hbr, UINT flags, COLORREF background, COLORREF modern_expected, COLORREF legacy_expected, int line)
 
static void test_DrawState (void)
 
static DWORD CALLBACK set_cursor_thread (void *arg)
 
static void test_SetCursor (void)
 
static DWORD CALLBACK show_cursor_thread (void *arg)
 
static void test_ShowCursor (void)
 
static void test_DestroyCursor (void)
 
static void test_PrivateExtractIcons (void)
 
static void test_monochrome_icon (void)
 
 START_TEST (cursoricon)
 

Variables

riff_cursor1_t empty_anicursor
 
riff_cursor3_t empty_anicursor3
 
riff_cursor3_seq_t empty_anicursor3_seq
 
static char ** test_argv
 
static int test_argc
 
static HWND child = 0
 
static HWND parent = 0
 
static HANDLE child_process
 
static ICONINFOEXA *static ICONINFOEXW *static const BOOL is_win64 = (sizeof(void *) > sizeof(int))
 
static const unsigned char gifimage [35]
 
static const unsigned char jpgimage [285]
 
static const unsigned char pngimage [285]
 
static unsigned char bmpimage [70]
 
static const unsigned char bmpcoreimage [38]
 
static const unsigned char gif4pixel [42]
 
static const unsigned char invalid_dwDIBOffset []
 
static const DWORD biSize_tests []
 
static DWORD unk1
 
static DWORD DWORD istep
 
static DWORD DWORD DWORDrate
 
static DWORD DWORD DWORD DWORDsteps
 
static DWORD parent_id
 
static HANDLE event_start
 
static HANDLE event_next
 

Macro Definition Documentation

◆ ANI_ACON_ID

#define ANI_ACON_ID   RIFF_FOURCC('A', 'C', 'O', 'N')

Definition at line 62 of file cursoricon.c.

◆ ANI_anih_ID

#define ANI_anih_ID   RIFF_FOURCC('a', 'n', 'i', 'h')

Definition at line 63 of file cursoricon.c.

◆ ANI_FLAG_ICON

#define ANI_FLAG_ICON   0x1

Definition at line 69 of file cursoricon.c.

◆ ANI_FLAG_SEQUENCE

#define ANI_FLAG_SEQUENCE   0x2

Definition at line 70 of file cursoricon.c.

◆ ANI_fram_ID

#define ANI_fram_ID   RIFF_FOURCC('f', 'r', 'a', 'm')

Definition at line 65 of file cursoricon.c.

◆ ANI_icon_ID

#define ANI_icon_ID   RIFF_FOURCC('i', 'c', 'o', 'n')

Definition at line 66 of file cursoricon.c.

◆ ANI_LIST_ID

#define ANI_LIST_ID   RIFF_FOURCC('L', 'I', 'S', 'T')

Definition at line 61 of file cursoricon.c.

◆ ANI_rate_ID

#define ANI_rate_ID   RIFF_FOURCC('r', 'a', 't', 'e')

Definition at line 67 of file cursoricon.c.

◆ ANI_RIFF_ID

#define ANI_RIFF_ID   RIFF_FOURCC('R', 'I', 'F', 'F')

Definition at line 60 of file cursoricon.c.

◆ ANI_seq__ID

#define ANI_seq__ID   RIFF_FOURCC('s', 'e', 'q', ' ')

Definition at line 64 of file cursoricon.c.

◆ ARRAY_SIZE

#define ARRAY_SIZE (   a)    (sizeof(a)/sizeof((a)[0]))

Definition at line 1057 of file cursoricon.c.

◆ CRSR_RES_SIZE [1/2]

#define CRSR_RES_SIZE   (2*sizeof(INT16) + ICON_RES_SIZE)

◆ CRSR_RES_SIZE [2/2]

#define CRSR_RES_SIZE   (2*sizeof(INT16) + ICON_RES_SIZE)

◆ EMPTY_ICON32

#define EMPTY_ICON32

Definition at line 154 of file cursoricon.c.

◆ ICON_AND_SIZE

#define ICON_AND_SIZE   (ICON_WIDTH*ICON_HEIGHT/8)

◆ ICON_BPP

#define ICON_BPP   32

◆ ICON_HEIGHT

#define ICON_HEIGHT   32

◆ ICON_RES_AND_SIZE [1/2]

#define ICON_RES_AND_SIZE   (ICON_WIDTH*ICON_HEIGHT/8)

◆ ICON_RES_AND_SIZE [2/2]

#define ICON_RES_AND_SIZE   (ICON_WIDTH*ICON_HEIGHT/8)

◆ ICON_RES_BPP [1/2]

#define ICON_RES_BPP   32

◆ ICON_RES_BPP [2/2]

#define ICON_RES_BPP   32

◆ ICON_RES_HEIGHT [1/2]

#define ICON_RES_HEIGHT   32

◆ ICON_RES_HEIGHT [2/2]

#define ICON_RES_HEIGHT   32

◆ ICON_RES_SIZE [1/2]

◆ ICON_RES_SIZE [2/2]

◆ ICON_RES_WIDTH [1/2]

#define ICON_RES_WIDTH   32

◆ ICON_RES_WIDTH [2/2]

#define ICON_RES_WIDTH   32

◆ ICON_SIZE

#define ICON_SIZE
Value:

◆ ICON_WIDTH

#define ICON_WIDTH   32

◆ PROC_INIT

#define PROC_INIT   (WM_USER+1)

Definition at line 302 of file cursoricon.c.

◆ RIFF_FOURCC

#define RIFF_FOURCC (   c0,
  c1,
  c2,
  c3 
)
Value:
( (DWORD)(BYTE)(c0) | ( (DWORD)(BYTE)(c1) << 8 ) | \
( (DWORD)(BYTE)(c2) << 16 ) | ( (DWORD)(BYTE)(c3) << 24 ) )
#define DWORD
Definition: nt_native.h:44
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: mem.h:68

Definition at line 56 of file cursoricon.c.

◆ test_icon_info

#define test_icon_info (   a,
  b,
  c,
  d,
  e 
)    test_icon_info_dbg((a),(b),(c),(d),(e),__LINE__)

Definition at line 793 of file cursoricon.c.

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pGetCursorInfo)
static

◆ callback_child()

static LRESULT CALLBACK callback_child ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 310 of file cursoricon.c.

311 {
312  switch (msg)
313  {
314  /* Destroy the cursor. */
315  case WM_USER+1:
316  {
318  ICONINFO info;
319  BOOL ret;
320  DWORD error;
321 
322  memset(&info, 0, sizeof(info));
323  ret = GetIconInfo(cursor, &info);
324  todo_wine ok(ret, "GetIconInfoEx failed with error %u\n", GetLastError());
325  todo_wine ok(info.hbmColor != NULL, "info.hmbColor was not set\n");
326  todo_wine ok(info.hbmMask != NULL, "info.hmbColor was not set\n");
327  DeleteObject(info.hbmColor);
328  DeleteObject(info.hbmMask);
329 
330  SetLastError(0xdeadbeef);
332  error = GetLastError();
333  ok(!ret || broken(ret) /* win9x */, "DestroyCursor on the active cursor succeeded.\n");
335  error == 0xdeadbeef, /* vista */
336  "Last error: %u\n", error);
337  return TRUE;
338  }
339  case WM_DESTROY:
340  PostQuitMessage(0);
341  return 0;
342  }
343 
344  return DefWindowProcA(hwnd, msg, wParam, lParam);
345 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define error(str)
Definition: mkdosfs.c:1605
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HICON HCURSOR
Definition: windef.h:284
WPARAM wParam
Definition: combotst.c:138
struct _test_info info[]
Definition: SetCursorPos.c:19
BOOL WINAPI GetIconInfo(_In_ HICON hIcon, _Out_ PICONINFO piconinfo)
Definition: cursoricon.c:2014
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
#define WM_DESTROY
Definition: winuser.h:1591
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
int ret
#define todo_wine
Definition: test.h:154
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_USER
Definition: winuser.h:1856
#define broken(x)
Definition: _sntprintf.h:21
const char cursor[]
Definition: icontest.c:13
#define ERROR_DESTROY_OBJECT_OF_OTHER_THREAD
Definition: winerror.h:916
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI DestroyCursor(_In_ HCURSOR hCursor)
Definition: cursoricon.c:2654
#define memset(x, y, z)
Definition: compat.h:39
LPARAM lParam
Definition: combotst.c:139
static HCURSOR(WINAPI *pGetCursorFrameInfo)(HCURSOR hCursor
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

Referenced by do_child().

◆ callback_parent()

static LRESULT CALLBACK callback_parent ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 347 of file cursoricon.c.

348 {
349  if (msg == PROC_INIT)
350  {
351  child = (HWND) wParam;
352  return TRUE;
353  }
354 
355  return DefWindowProcA(hwnd, msg, wParam, lParam);
356 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define PROC_INIT
Definition: cursoricon.c:302
HANDLE HWND
Definition: compat.h:13
static HWND child
Definition: cursoricon.c:298
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define msg(x)
Definition: auth_time.c:54
LPARAM lParam
Definition: combotst.c:139

Referenced by do_parent().

◆ check_alpha_draw()

static void check_alpha_draw ( HDC  hdc,
BOOL  drawiconex,
BOOL  alpha,
int  bpp,
int  line 
)
static

Definition at line 1805 of file cursoricon.c.

1806 {
1807  HICON hicon;
1808  UINT32 color[2];
1809  COLORREF modern_expected, legacy_expected, result;
1810 
1811  color[0] = 0x00A0B0C0;
1812  color[1] = alpha ? 0xFF000000 : 0x00000000;
1813  modern_expected = alpha ? 0x00FFFFFF : 0x00C0B0A0;
1814  legacy_expected = 0x00C0B0A0;
1815 
1816  hicon = create_test_icon(hdc, 2, 1, bpp, 0, color, sizeof(color));
1817  if (!hicon) return;
1818 
1819  SetPixelV(hdc, 0, 0, 0x00FFFFFF);
1820 
1821  if(drawiconex)
1822  DrawIconEx(hdc, 0, 0, hicon, 2, 1, 0, NULL, DI_NORMAL);
1823  else
1824  DrawIcon(hdc, 0, 0, hicon);
1825 
1826  result = GetPixel(hdc, 0, 0);
1827  ok (color_match(result, modern_expected) || /* Windows 2000 and up */
1828  broken(color_match(result, legacy_expected)), /* Windows NT 4.0, 9X and below */
1829  "%s. Expected a close match to %06X (modern) or %06X (legacy) with %s. "
1830  "Got %06X from line %d\n",
1831  alpha ? "Alpha blending" : "Not alpha blending", modern_expected, legacy_expected,
1832  drawiconex ? "DrawIconEx" : "DrawIcon", result, line);
1833 }
static HICON
Definition: imagelist.c:84
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
unsigned int UINT32
GLuint color
Definition: glext.h:6243
#define ok(value,...)
static HICON create_test_icon(HDC hdc, int width, int height, int bpp, BOOL maskvalue, UINT32 *color, int colorSize)
Definition: cursoricon.c:1769
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
DWORD COLORREF
Definition: windef.h:285
HDC hdc
Definition: main.c:9
#define DI_NORMAL
Definition: wingdi.h:72
#define broken(x)
Definition: _sntprintf.h:21
BOOL WINAPI DrawIcon(_In_ HDC hDC, _In_ int X, _In_ int Y, _In_ HICON hIcon)
Definition: cursoricon.c:1987
static BOOL color_match(COLORREF a, COLORREF b)
Definition: cursoricon.c:481
GLclampf GLclampf GLclampf alpha
Definition: gl.h:1740
DWORD bpp
Definition: surface.c:181
BOOL WINAPI SetPixelV(_In_ HDC, _In_ int, _In_ int, _In_ COLORREF)
GLuint64EXT * result
Definition: glext.h:11304
BOOL WINAPI DrawIconEx(_In_ HDC hdc, _In_ int xLeft, _In_ int yTop, _In_ HICON hIcon, _In_ int cxWidth, _In_ int cyWidth, _In_ UINT istepIfAniCur, _In_opt_ HBRUSH hbrFlickerFreeDraw, _In_ UINT diFlags)
Definition: cursoricon.c:1997

Referenced by test_DrawIcon(), and test_DrawIconEx().

◆ check_cursor_data()

static int check_cursor_data ( HDC  hdc,
HCURSOR  hCursor,
void data,
int  length 
)
static

Definition at line 1478 of file cursoricon.c.

1479 {
1480  char *image = NULL;
1481  BITMAPINFO *info;
1482  ICONINFO iinfo;
1483  DWORD ret;
1484  int i;
1485 
1486  ret = GetIconInfo( hCursor, &iinfo );
1487  ok(ret, "GetIconInfo() failed\n");
1488  if (!ret) return 0;
1489  ret = 0;
1490  info = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( BITMAPINFO, bmiColors[256] ));
1491  ok(info != NULL, "HeapAlloc() failed\n");
1492  if (!info) return 0;
1493 
1494  info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1495  info->bmiHeader.biWidth = 32;
1496  info->bmiHeader.biHeight = 32;
1497  info->bmiHeader.biPlanes = 1;
1498  info->bmiHeader.biBitCount = 32;
1499  info->bmiHeader.biCompression = BI_RGB;
1500  info->bmiHeader.biSizeImage = 32 * 32 * 4;
1501  info->bmiHeader.biXPelsPerMeter = 0;
1502  info->bmiHeader.biYPelsPerMeter = 0;
1503  info->bmiHeader.biClrUsed = 0;
1504  info->bmiHeader.biClrImportant = 0;
1505  image = HeapAlloc( GetProcessHeap(), 0, info->bmiHeader.biSizeImage );
1506  ok(image != NULL, "HeapAlloc() failed\n");
1507  if (!image) goto cleanup;
1508  ret = GetDIBits( hdc, iinfo.hbmColor, 0, 32, image, info, DIB_RGB_COLORS );
1509  ok(ret, "GetDIBits() failed\n");
1510  for (i = 0; ret && i < length / sizeof(COLORREF); i++)
1511  {
1512  ret = color_match( ((COLORREF *)data)[i], ((COLORREF *)image)[i] );
1513  ok(ret, "%04x: Expected 0x%x, actually 0x%x\n", i, ((COLORREF *)data)[i], ((COLORREF *)image)[i] );
1514  }
1515 cleanup:
1516  HeapFree( GetProcessHeap(), 0, image );
1517  HeapFree( GetProcessHeap(), 0, info );
1518  return ret;
1519 }
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
struct _test_info info[]
Definition: SetCursorPos.c:19
BOOL WINAPI GetIconInfo(_In_ HICON hIcon, _Out_ PICONINFO piconinfo)
Definition: cursoricon.c:2014
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 ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
HBITMAP hbmColor
Definition: winuser.h:3080
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
DWORD COLORREF
Definition: windef.h:285
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
HDC hdc
Definition: main.c:9
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
static BOOL color_match(COLORREF a, COLORREF b)
Definition: cursoricon.c:481
int WINAPI GetDIBits(_In_ HDC hdc, _In_ HBITMAP hbm, _In_ UINT start, _In_ UINT cLines, _Out_opt_ LPVOID lpvBits, _At_((LPBITMAPINFOHEADER) lpbmi, _Inout_) LPBITMAPINFO lpbmi, _In_ UINT usage)
char * cleanup(char *str)
Definition: wpickclick.c:99
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define BI_RGB
Definition: precomp.h:35
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_GetCursorFrameInfo().

◆ check_DrawIcon()

static void check_DrawIcon ( HDC  hdc,
BOOL  maskvalue,
UINT32  color,
int  bpp,
COLORREF  background,
COLORREF  modern_expected,
COLORREF  legacy_expected,
int  line 
)
static

Definition at line 1835 of file cursoricon.c.

1837 {
1838  COLORREF result;
1839  HICON hicon = create_test_icon(hdc, 1, 1, bpp, maskvalue, &color, sizeof(color));
1840  if (!hicon) return;
1841  SetPixelV(hdc, 0, 0, background);
1844  DrawIcon(hdc, 0, 0, hicon);
1845  result = GetPixel(hdc, 0, 0);
1846 
1847  ok (color_match(result, modern_expected) || /* Windows 2000 and up */
1848  broken(color_match(result, legacy_expected)), /* Windows NT 4.0, 9X and below */
1849  "Overlaying Mask %d on Color %06X with DrawIcon. "
1850  "Expected a close match to %06X (modern), or %06X (legacy). Got %06X from line %d\n",
1851  maskvalue, color, modern_expected, legacy_expected, result, line);
1852 
1854 
1855  ok (color_match(result, modern_expected) || /* Windows 2000 and up */
1856  broken(color_match(result, legacy_expected)), /* Windows NT 4.0, 9X and below */
1857  "Overlaying Mask %d on Color %06X with DrawIcon. "
1858  "Expected a close match to %06X (modern), or %06X (legacy). Got %06X from line %d\n",
1859  maskvalue, color, modern_expected, legacy_expected, result, line);
1860 
1862 
1863  ok (color_match(result, background),
1864  "Overlaying Mask %d on Color %06X with DrawIcon. "
1865  "Expected unchanged background color %06X. Got %06X from line %d\n",
1866  maskvalue, color, background, result, line);
1867 }
static HICON
Definition: imagelist.c:84
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
GLuint color
Definition: glext.h:6243
#define ok(value,...)
#define SM_CXICON
Definition: winuser.h:962
static HICON create_test_icon(HDC hdc, int width, int height, int bpp, BOOL maskvalue, UINT32 *color, int colorSize)
Definition: cursoricon.c:1769
Definition: parser.c:48
DWORD COLORREF
Definition: windef.h:285
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CYICON
Definition: winuser.h:963
HDC hdc
Definition: main.c:9
#define broken(x)
Definition: _sntprintf.h:21
BOOL WINAPI DrawIcon(_In_ HDC hDC, _In_ int X, _In_ int Y, _In_ HICON hIcon)
Definition: cursoricon.c:1987
static BOOL color_match(COLORREF a, COLORREF b)
Definition: cursoricon.c:481
DWORD bpp
Definition: surface.c:181
BOOL WINAPI SetPixelV(_In_ HDC, _In_ int, _In_ int, _In_ COLORREF)
GLuint64EXT * result
Definition: glext.h:11304

Referenced by test_DrawIcon().

◆ check_DrawIconEx()

static void check_DrawIconEx ( HDC  hdc,
BOOL  maskvalue,
UINT32  color,
int  bpp,
UINT  flags,
COLORREF  background,
COLORREF  modern_expected,
COLORREF  legacy_expected,
int  line 
)
static

Definition at line 1936 of file cursoricon.c.

1938 {
1939  COLORREF result;
1940  HICON hicon = create_test_icon(hdc, 1, 1, bpp, maskvalue, &color, sizeof(color));
1941  if (!hicon) return;
1942  SetPixelV(hdc, 0, 0, background);
1943  DrawIconEx(hdc, 0, 0, hicon, 1, 1, 0, NULL, flags);
1944  result = GetPixel(hdc, 0, 0);
1945 
1946  ok (color_match(result, modern_expected) || /* Windows 2000 and up */
1947  broken(color_match(result, legacy_expected)), /* Windows NT 4.0, 9X and below */
1948  "Overlaying Mask %d on Color %06X with DrawIconEx flags %08X. "
1949  "Expected a close match to %06X (modern) or %06X (legacy). Got %06X from line %d\n",
1950  maskvalue, color, flags, modern_expected, legacy_expected, result, line);
1951 }
static HICON
Definition: imagelist.c:84
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
GLuint color
Definition: glext.h:6243
#define ok(value,...)
static HICON create_test_icon(HDC hdc, int width, int height, int bpp, BOOL maskvalue, UINT32 *color, int colorSize)
Definition: cursoricon.c:1769
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
DWORD COLORREF
Definition: windef.h:285
GLbitfield flags
Definition: glext.h:7161
HDC hdc
Definition: main.c:9
#define broken(x)
Definition: _sntprintf.h:21
static BOOL color_match(COLORREF a, COLORREF b)
Definition: cursoricon.c:481
DWORD bpp
Definition: surface.c:181
BOOL WINAPI SetPixelV(_In_ HDC, _In_ int, _In_ int, _In_ COLORREF)
GLuint64EXT * result
Definition: glext.h:11304
BOOL WINAPI DrawIconEx(_In_ HDC hdc, _In_ int xLeft, _In_ int yTop, _In_ HICON hIcon, _In_ int cxWidth, _In_ int cyWidth, _In_ UINT istepIfAniCur, _In_opt_ HBRUSH hbrFlickerFreeDraw, _In_ UINT diFlags)
Definition: cursoricon.c:1997

Referenced by test_DrawIconEx().

◆ check_DrawState_Color()

static void check_DrawState_Color ( HDC  hdc,
BOOL  maskvalue,
UINT32  color,
int  bpp,
HBRUSH  hbr,
UINT  flags,
COLORREF  background,
COLORREF  modern_expected,
COLORREF  legacy_expected,
int  line 
)
static

Definition at line 2081 of file cursoricon.c.

2083 {
2084  COLORREF result;
2085  HICON hicon = create_test_icon(hdc, 1, 1, bpp, maskvalue, &color, sizeof(color));
2086  if (!hicon) return;
2087  /* Set color of the pixel that will be checked afterwards */
2088  SetPixelV(hdc, 1, 1, background);
2089 
2090  DrawStateA(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 0, 0, ( DST_ICON | flags ));
2091 
2092  /* Check the color of the pixel is correct */
2093  result = GetPixel(hdc, 1, 1);
2094 
2095  ok (color_match(result, modern_expected) || /* Windows 2000 and up */
2096  broken(color_match(result, legacy_expected)), /* Windows NT 4.0, 9X and below */
2097  "DrawState drawing Icon with Overlaying Mask %d on Color %06X with flags %08X. "
2098  "Expected a close match to %06X (modern) or %06X (legacy). Got %06X from line %d\n",
2099  maskvalue, color, (DST_ICON | flags), modern_expected, legacy_expected, result, line);
2100 }
static HICON
Definition: imagelist.c:84
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
GLuint color
Definition: glext.h:6243
#define ok(value,...)
static HICON create_test_icon(HDC hdc, int width, int height, int bpp, BOOL maskvalue, UINT32 *color, int colorSize)
Definition: cursoricon.c:1769
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
Definition: parser.c:48
DWORD COLORREF
Definition: windef.h:285
GLbitfield flags
Definition: glext.h:7161
HDC hdc
Definition: main.c:9
#define broken(x)
Definition: _sntprintf.h:21
static BOOL color_match(COLORREF a, COLORREF b)
Definition: cursoricon.c:481
BOOL WINAPI DrawStateA(_In_ HDC, _In_opt_ HBRUSH, _In_opt_ DRAWSTATEPROC, _In_ LPARAM, _In_ WPARAM, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
DWORD bpp
Definition: surface.c:181
#define DST_ICON
Definition: winuser.h:515
BOOL WINAPI SetPixelV(_In_ HDC, _In_ int, _In_ int, _In_ COLORREF)
GLuint64EXT * result
Definition: glext.h:11304

Referenced by test_DrawState().

◆ check_DrawState_Size()

static void check_DrawState_Size ( HDC  hdc,
BOOL  maskvalue,
UINT32  color,
int  bpp,
HBRUSH  hbr,
UINT  flags,
int  line 
)
static

Definition at line 2029 of file cursoricon.c.

2030 {
2031  COLORREF result, background;
2032  BOOL passed[2];
2033  HICON hicon = create_test_icon(hdc, 1, 1, bpp, maskvalue, &color, sizeof(color));
2034  background = 0x00FFFFFF;
2035  /* Set color of the 2 pixels that will be checked afterwards */
2036  SetPixelV(hdc, 0, 0, background);
2037  SetPixelV(hdc, 2, 2, background);
2038 
2039  /* Let DrawState calculate the size of the icon (it's 1x1) */
2040  DrawStateA(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 0, 0, (DST_ICON | flags ));
2041 
2042  result = GetPixel(hdc, 0, 0);
2043  passed[0] = color_match(result, background);
2044  result = GetPixel(hdc, 2, 2);
2045  passed[0] = passed[0] & color_match(result, background);
2046 
2047  /* Check if manually specifying the icon size DOESN'T work */
2048 
2049  /* IMPORTANT: For Icons, DrawState wants the size of the source image, not the
2050  * size in which it should be ultimately drawn. Therefore giving
2051  * width/height 2x2 if the icon is only 1x1 pixels in size should
2052  * result in drawing it with size 1x1. The size parameters must be
2053  * ignored if a Icon has to be drawn! */
2054  DrawStateA(hdc, hbr, NULL, (LPARAM) hicon, 0, 1, 1, 2, 2, (DST_ICON | flags ));
2055 
2056  result = GetPixel(hdc, 0, 0);
2057  passed[1] = color_match(result, background);
2058  result = GetPixel(hdc, 2, 2);
2059  passed[1] = passed[0] & color_match(result, background);
2060 
2061  if(!passed[0]&&!passed[1])
2062  ok (passed[1],
2063  "DrawState failed to draw a 1x1 Icon in the correct size, independent of the "
2064  "width and height settings passed to it, for Icon with: Overlaying Mask %d on "
2065  "Color %06X with flags %08X. Line %d\n",
2066  maskvalue, color, (DST_ICON | flags), line);
2067  else if(!passed[1])
2068  ok (passed[1],
2069  "DrawState failed to draw a 1x1 Icon in the correct size, if the width and height "
2070  "parameters passed to it are bigger than the real Icon size, for Icon with: Overlaying "
2071  "Mask %d on Color %06X with flags %08X. Line %d\n",
2072  maskvalue, color, (DST_ICON | flags), line);
2073  else
2074  ok (passed[0],
2075  "DrawState failed to draw a 1x1 Icon in the correct size, if the width and height "
2076  "parameters passed to it are 0, for Icon with: Overlaying Mask %d on "
2077  "Color %06X with flags %08X. Line %d\n",
2078  maskvalue, color, (DST_ICON | flags), line);
2079 }
static HICON
Definition: imagelist.c:84
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint color
Definition: glext.h:6243
#define ok(value,...)
static HICON create_test_icon(HDC hdc, int width, int height, int bpp, BOOL maskvalue, UINT32 *color, int colorSize)
Definition: cursoricon.c:1769
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
Definition: parser.c:48
DWORD COLORREF
Definition: windef.h:285
GLbitfield flags
Definition: glext.h:7161
HDC hdc
Definition: main.c:9
static BOOL color_match(COLORREF a, COLORREF b)
Definition: cursoricon.c:481
BOOL WINAPI DrawStateA(_In_ HDC, _In_opt_ HBRUSH, _In_opt_ DRAWSTATEPROC, _In_ LPARAM, _In_ WPARAM, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
DWORD bpp
Definition: surface.c:181
#define DST_ICON
Definition: winuser.h:515
BOOL WINAPI SetPixelV(_In_ HDC, _In_ int, _In_ int, _In_ COLORREF)
GLuint64EXT * result
Definition: glext.h:11304

Referenced by test_DrawState().

◆ color_match()

static BOOL color_match ( COLORREF  a,
COLORREF  b 
)
static

Definition at line 481 of file cursoricon.c.

482 {
483  /* 5-bit accuracy is a sufficient test. This will match as long as
484  * colors are never truncated to less that 3x5-bit accuracy i.e.
485  * palettized. */
486  return (a & 0x00F8F8F8) == (b & 0x00F8F8F8);
487 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by check_alpha_draw(), check_cursor_data(), check_DrawIcon(), check_DrawIconEx(), check_DrawState_Color(), check_DrawState_Size(), and test_LoadImageBitmap().

◆ create_ico_file()

static void create_ico_file ( const char filename,
const test_icon_entries_t test_icon_entries,
unsigned  entry_cnt 
)
static

Definition at line 1150 of file cursoricon.c.

1151 {
1152  CURSORICONFILEDIRENTRY *icon_entry;
1153  BITMAPINFOHEADER *icon_header;
1155  BYTE *buf, *bitmap_ptr;
1156  DWORD bytes_written;
1157  size_t icon_size;
1158  HANDLE file;
1159  unsigned i;
1160  BOOL ret;
1161 
1162  const unsigned icon_bpp = 32;
1163 
1164  icon_size = FIELD_OFFSET(CURSORICONFILEDIR, idEntries[entry_cnt]) + sizeof(BITMAPINFOHEADER)*entry_cnt;
1165  for(i=0; i<entry_cnt; i++)
1166  icon_size += icon_bpp * test_icon_entries[i].width * test_icon_entries[i].height / 8;
1167 
1170 
1171  dir->idReserved = 0;
1172  dir->idType = 1;
1173  dir->idCount = entry_cnt;
1174 
1175  bitmap_ptr = buf + FIELD_OFFSET(CURSORICONFILEDIR, idEntries[entry_cnt]);
1176  for(i=0; i<entry_cnt; i++) {
1177  icon_entry = dir->idEntries+i;
1178  icon_entry->bWidth = test_icon_entries[i].width;
1179  icon_entry->bHeight = test_icon_entries[i].height;
1180  icon_entry->bColorCount = 0;
1181  icon_entry->bReserved = 0;
1182  icon_entry->xHotspot = 1;
1183  icon_entry->yHotspot = 1;
1184  icon_entry->dwDIBSize = sizeof(BITMAPINFOHEADER) + icon_entry->bWidth * icon_entry->bHeight * icon_bpp / 8;
1185  icon_entry->dwDIBOffset = test_icon_entries[i].invalid_offset ? 0xffffffff : bitmap_ptr - buf;
1186 
1187  icon_header = (BITMAPINFOHEADER*)bitmap_ptr;
1188  bitmap_ptr += icon_entry->dwDIBSize;
1189 
1190  icon_header->biSize = sizeof(BITMAPINFOHEADER);
1191  icon_header->biWidth = icon_entry->bWidth;
1192  icon_header->biHeight = icon_entry->bHeight;
1193  icon_header->biPlanes = 1;
1194  icon_header->biBitCount = icon_bpp;
1195  icon_header->biSizeImage = 0; /* Uncompressed bitmap. */
1196  }
1197 
1198  memset(bitmap_ptr, 0xf0, buf+icon_size-bitmap_ptr);
1199 
1200  /* Create the icon. */
1202  ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed. %u\n", GetLastError());
1203  ret = WriteFile(file, buf, icon_size, &bytes_written, NULL);
1204  ok(ret && bytes_written == icon_size, "icon.ico created improperly.\n");
1205  CloseHandle(file);
1206 
1207  HeapFree(GetProcessHeap(), 0, buf);
1208 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
GLint GLint GLsizei width
Definition: gl.h:1546
#define CloseHandle
Definition: compat.h:398
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
const char * filename
Definition: ioapi.h:135
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
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GENERIC_WRITE
Definition: nt_native.h:90
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
unsigned int dir
Definition: maze.c:112
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD biSizeImage
Definition: amvideo.idl:36
int ret
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
unsigned char BYTE
Definition: mem.h:68
#define GENERIC_READ
Definition: compat.h:124
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define CREATE_NEW
Definition: disk.h:69
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:394
iconPos iconPos icon_size
Definition: startmenu.cpp:1416
Definition: fci.c:126

Referenced by test_LoadImage(), and test_PrivateExtractIcons().

◆ create_test_icon()

static HICON create_test_icon ( HDC  hdc,
int  width,
int  height,
int  bpp,
BOOL  maskvalue,
UINT32 color,
int  colorSize 
)
static

Definition at line 1769 of file cursoricon.c.

1771 {
1772  ICONINFO iconInfo;
1773  BITMAPINFO bitmapInfo;
1774  void *buffer = NULL;
1775  UINT32 mask = maskvalue ? 0xFFFFFFFF : 0x00000000;
1776 
1777  memset(&bitmapInfo, 0, sizeof(bitmapInfo));
1778  bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1779  bitmapInfo.bmiHeader.biWidth = width;
1780  bitmapInfo.bmiHeader.biHeight = height;
1781  bitmapInfo.bmiHeader.biPlanes = 1;
1782  bitmapInfo.bmiHeader.biBitCount = bpp;
1783  bitmapInfo.bmiHeader.biCompression = BI_RGB;
1784  bitmapInfo.bmiHeader.biSizeImage = colorSize;
1785 
1786  iconInfo.fIcon = TRUE;
1787  iconInfo.xHotspot = 0;
1788  iconInfo.yHotspot = 0;
1789 
1790  iconInfo.hbmMask = CreateBitmap( width, height, 1, 1, &mask );
1791  if(!iconInfo.hbmMask) return NULL;
1792 
1793  iconInfo.hbmColor = CreateDIBSection(hdc, &bitmapInfo, DIB_RGB_COLORS, &buffer, NULL, 0);
1794  if(!iconInfo.hbmColor || !buffer)
1795  {
1796  DeleteObject(iconInfo.hbmMask);
1797  return NULL;
1798  }
1799 
1800  memcpy(buffer, color, colorSize);
1801 
1802  return CreateIconIndirect(&iconInfo);
1803 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define TRUE
Definition: types.h:120
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1454
DWORD yHotspot
Definition: winuser.h:3078
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLuint buffer
Definition: glext.h:5915
GLenum GLint GLuint mask
Definition: glext.h:6028
unsigned int UINT32
GLuint color
Definition: glext.h:6243
HBITMAP hbmMask
Definition: winuser.h:3079
DWORD biCompression
Definition: amvideo.idl:35
smooth NULL
Definition: ftsmooth.c:416
HBITMAP hbmColor
Definition: winuser.h:3080
BOOL fIcon
Definition: winuser.h:3076
DWORD xHotspot
Definition: winuser.h:3077
DWORD biSizeImage
Definition: amvideo.idl:36
HICON WINAPI CreateIconIndirect(_In_ PICONINFO piconinfo)
Definition: cursoricon.c:2546
HDC hdc
Definition: main.c:9
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
DWORD bpp
Definition: surface.c:181
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define memset(x, y, z)
Definition: compat.h:39
#define BI_RGB
Definition: precomp.h:35
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

Referenced by check_alpha_draw(), check_DrawIcon(), check_DrawIconEx(), check_DrawState_Color(), and check_DrawState_Size().

◆ do_child()

static void do_child ( void  )
static

Definition at line 358 of file cursoricon.c.

359 {
360  WNDCLASSA class;
361  MSG msg;
362  BOOL ret;
363 
364  /* Register a new class. */
365  class.style = CS_GLOBALCLASS;
366  class.lpfnWndProc = callback_child;
367  class.cbClsExtra = 0;
368  class.cbWndExtra = 0;
369  class.hInstance = GetModuleHandleA(NULL);
370  class.hIcon = NULL;
371  class.hCursor = NULL;
372  class.hbrBackground = NULL;
373  class.lpszMenuName = NULL;
374  class.lpszClassName = "cursor_child";
375 
376  SetLastError(0xdeadbeef);
377  ret = RegisterClassA(&class);
378  ok(ret, "Failed to register window class. Error: %u\n", GetLastError());
379 
380  /* Create a window. */
381  child = CreateWindowA("cursor_child", "cursor_child", WS_POPUP | WS_VISIBLE,
382  0, 0, 200, 200, 0, 0, 0, NULL);
383  ok(child != 0, "CreateWindowA failed. Error: %u\n", GetLastError());
384 
385  /* Let the parent know our HWND. */
387 
388  /* Receive messages. */
389  while ((ret = GetMessageA(&msg, 0, 0, 0)))
390  {
391  ok(ret != -1, "GetMessage failed. Error: %u\n", GetLastError());
394  }
395 }
BOOL WINAPI TranslateMessage(_In_ const MSG *)
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define PROC_INIT
Definition: cursoricon.c:302
BOOL WINAPI GetMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
UINT_PTR WPARAM
Definition: windef.h:207
static HWND child
Definition: cursoricon.c:298
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
smooth NULL
Definition: ftsmooth.c:416
static HWND parent
Definition: cursoricon.c:299
#define CS_GLOBALCLASS
Definition: winuser.h:647
static LRESULT CALLBACK callback_child(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: cursoricon.c:310
#define SetLastError(x)
Definition: compat.h:409
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define WS_POPUP
Definition: pedump.c:616
#define msg(x)
Definition: auth_time.c:54
#define WS_VISIBLE
Definition: pedump.c:620
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)

Referenced by START_TEST().

◆ do_parent()

static void do_parent ( void  )
static

Definition at line 397 of file cursoricon.c.

398 {
399  char path_name[MAX_PATH];
402  WNDCLASSA class;
403  MSG msg;
404  BOOL ret;
405 
406  /* Register a new class. */
407  class.style = CS_GLOBALCLASS;
408  class.lpfnWndProc = callback_parent;
409  class.cbClsExtra = 0;
410  class.cbWndExtra = 0;
411  class.hInstance = GetModuleHandleA(NULL);
412  class.hIcon = NULL;
413  class.hCursor = NULL;
414  class.hbrBackground = NULL;
415  class.lpszMenuName = NULL;
416  class.lpszClassName = "cursor_parent";
417 
418  SetLastError(0xdeadbeef);
419  ret = RegisterClassA(&class);
420  ok(ret, "Failed to register window class. Error: %u\n", GetLastError());
421 
422  /* Create a window. */
423  parent = CreateWindowA("cursor_parent", "cursor_parent", WS_POPUP | WS_VISIBLE,
424  0, 0, 200, 200, 0, 0, 0, NULL);
425  ok(parent != 0, "CreateWindowA failed. Error: %u\n", GetLastError());
426 
427  /* Start child process. */
428  memset(&startup, 0, sizeof(startup));
429  startup.cb = sizeof(startup);
430  startup.dwFlags = STARTF_USESHOWWINDOW;
431  startup.wShowWindow = SW_SHOWNORMAL;
432 
433  sprintf(path_name, "%s cursoricon %lx", test_argv[0], (INT_PTR)parent);
434  ok(CreateProcessA(NULL, path_name, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess failed.\n");
435  child_process = info.hProcess;
436 
437  /* Wait for child window handle. */
438  while ((child == 0) && (ret = GetMessageA(&msg, parent, 0, 0)))
439  {
440  ok(ret != -1, "GetMessage failed. Error: %u\n", GetLastError());
443  }
444 }
BOOL WINAPI TranslateMessage(_In_ const MSG *)
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
static char ** test_argv
Definition: cursoricon.c:296
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
BOOL WINAPI GetMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
int startup(int argc, const char *argv[])
Definition: startup.c:430
int32_t INT_PTR
Definition: typedefs.h:62
static LRESULT CALLBACK callback_parent(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: cursoricon.c:347
static HWND child
Definition: cursoricon.c:298
struct _test_info info[]
Definition: SetCursorPos.c:19
#define sprintf(buf, format,...)
Definition: sprintf.c:55
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4184
smooth NULL
Definition: ftsmooth.c:416
static HANDLE child_process
Definition: cursoricon.c:300
#define STARTF_USESHOWWINDOW
Definition: winbase.h:472
static char * path_name(DOS_FILE *file)
Definition: check.c:208
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4772
static HWND parent
Definition: cursoricon.c:299
#define CS_GLOBALCLASS
Definition: winuser.h:647
#define MAX_PATH
Definition: compat.h:26
#define SetLastError(x)
Definition: compat.h:409
int ret
static const WCHAR L[]
Definition: oid.c:1250
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define WS_POPUP
Definition: pedump.c:616
#define msg(x)
Definition: auth_time.c:54
#define WS_VISIBLE
Definition: pedump.c:620
#define memset(x, y, z)
Definition: compat.h:39
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)

Referenced by START_TEST().

◆ finish_child_process()

static void finish_child_process ( void  )
static

Definition at line 446 of file cursoricon.c.

447 {
448  SendMessageA(child, WM_CLOSE, 0, 0);
451 }
#define CloseHandle
Definition: compat.h:398
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static HWND child
Definition: cursoricon.c:298
static HANDLE child_process
Definition: cursoricon.c:300
#define WM_CLOSE
Definition: winuser.h:1603
void winetest_wait_child_process(HANDLE process)

Referenced by START_TEST().

◆ HCURSOR()

static HCURSOR ( WINAPI pGetCursorFrameInfo)
static

Referenced by callback_child().

◆ set_cursor_thread()

static DWORD CALLBACK set_cursor_thread ( void arg)
static

Definition at line 2155 of file cursoricon.c.

2156 {
2157  HCURSOR ret;
2158 
2159  PeekMessageA( 0, 0, 0, 0, PM_NOREMOVE ); /* create a msg queue */
2160  if (parent_id)
2161  {
2163  ok( ret, "AttachThreadInput failed\n" );
2164  }
2165  if (arg) ret = SetCursor( (HCURSOR)arg );
2166  else ret = GetCursor();
2167  return (DWORD_PTR)ret;
2168 }
#define TRUE
Definition: types.h:120
BOOL WINAPI AttachThreadInput(_In_ DWORD, _In_ DWORD, _In_ BOOL)
HICON HCURSOR
Definition: windef.h:284
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PM_NOREMOVE
Definition: winuser.h:1181
unsigned int BOOL
Definition: ntddk_ex.h:94
static DWORD parent_id
Definition: cursoricon.c:2153
#define ok(value,...)
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:421
int ret
uint32_t DWORD_PTR
Definition: typedefs.h:63
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
HCURSOR WINAPI GetCursor(void)
Definition: cursoricon.c:2649

Referenced by test_SetCursor().

◆ show_cursor_thread()

static DWORD CALLBACK show_cursor_thread ( void arg)
static

Definition at line 2273 of file cursoricon.c.

2274 {
2275  DWORD count = (DWORD_PTR)arg;
2276  int ret;
2277 
2278  PeekMessageA( 0, 0, 0, 0, PM_NOREMOVE ); /* create a msg queue */
2279  if (parent_id)
2280  {
2282  ok( ret, "AttachThreadInput failed\n" );
2283  }
2284  if (!count) ret = ShowCursor( FALSE );
2285  else while (count--) ret = ShowCursor( TRUE );
2286  SetEvent( event_start );
2288  return ret;
2289 }
#define TRUE
Definition: types.h:120
#define DWORD_PTR
Definition: treelist.c:76
BOOL WINAPI AttachThreadInput(_In_ DWORD, _In_ DWORD, _In_ BOOL)
GLuint GLuint GLsizei count
Definition: gl.h:1545
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define PM_NOREMOVE
Definition: winuser.h:1181
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
unsigned int BOOL
Definition: ntddk_ex.h:94
static DWORD parent_id
Definition: cursoricon.c:2153
#define ok(value,...)
static HANDLE event_next
Definition: cursoricon.c:2271
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:421
int WINAPI ShowCursor(_In_ BOOL bShow)
Definition: cursoricon.c:2642
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static HANDLE event_start
Definition: cursoricon.c:2271

Referenced by test_ShowCursor().

◆ START_TEST()

START_TEST ( cursoricon  )

Definition at line 2671 of file cursoricon.c.

2672 {
2673  pGetCursorInfo = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetCursorInfo" );
2674  pGetIconInfoExA = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetIconInfoExA" );
2675  pGetIconInfoExW = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetIconInfoExW" );
2676  pGetCursorFrameInfo = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetCursorFrameInfo" );
2678 
2679  if (test_argc >= 3)
2680  {
2681  /* Child process. */
2682  sscanf (test_argv[2], "%x", (unsigned int *) &parent);
2683 
2684  ok(parent != NULL, "Parent not found.\n");
2685  if (parent == NULL)
2686  ExitProcess(1);
2687 
2688  do_child();
2689  return;
2690  }
2691 
2699  test_CreateIcon();
2700  test_LoadImage();
2703  test_DrawIcon();
2704  test_DrawIconEx();
2705  test_DrawState();
2706  test_SetCursor();
2707  test_ShowCursor();
2711  do_parent();
2714 }
static void do_parent(void)
Definition: cursoricon.c:397
static void test_SetCursor(void)
Definition: cursoricon.c:2170
static void test_initial_cursor(void)
Definition: cursoricon.c:695
static char ** test_argv
Definition: cursoricon.c:296
static void test_CreateIconFromResource(void)
Definition: cursoricon.c:1337
static void test_LoadImage(void)
Definition: cursoricon.c:1210
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1517
static void test_CopyImage_Bitmap(int depth)
Definition: cursoricon.c:542
static void test_DrawIconEx(void)
Definition: cursoricon.c:1953
static void test_DrawIcon(void)
Definition: cursoricon.c:1869
static void do_child(void)
Definition: cursoricon.c:358
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP int __cdecl sscanf(_In_z_ const char *_Src, _In_z_ _Scanf_format_string_ const char *_Format,...)
static void test_GetCursorFrameInfo(void)
Definition: cursoricon.c:1522
static int test_argc
Definition: cursoricon.c:297
static HWND parent
Definition: cursoricon.c:299
static void test_DrawState(void)
Definition: cursoricon.c:2102
int winetest_get_mainargs(char ***pargv)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
static void test_CreateIcon(void)
Definition: cursoricon.c:795
static void test_DestroyCursor(void)
Definition: cursoricon.c:2397
#define GetProcAddress(x, y)
Definition: compat.h:410
static void test_child_process(void)
Definition: cursoricon.c:453
static void finish_child_process(void)
Definition: cursoricon.c:446
static void test_ShowCursor(void)
Definition: cursoricon.c:2291
static void test_PrivateExtractIcons(void)
Definition: cursoricon.c:2535
static void test_monochrome_icon(void)
Definition: cursoricon.c:2554

◆ test_child_process()

static void test_child_process ( void  )
static

Definition at line 453 of file cursoricon.c.

454 {
455  static const BYTE bmp_bits[4096];
456  HCURSOR cursor;
457  ICONINFO cursorInfo;
458  UINT display_bpp;
459  HDC hdc;
460 
461  /* Create and set a dummy cursor. */
462  hdc = GetDC(0);
463  display_bpp = GetDeviceCaps(hdc, BITSPIXEL);
464  ReleaseDC(0, hdc);
465 
466  cursorInfo.fIcon = FALSE;
467  cursorInfo.xHotspot = 0;
468  cursorInfo.yHotspot = 0;
469  cursorInfo.hbmMask = CreateBitmap(32, 32, 1, 1, bmp_bits);
470  cursorInfo.hbmColor = CreateBitmap(32, 32, 1, display_bpp, bmp_bits);
471 
472  cursor = CreateIconIndirect(&cursorInfo);
473  ok(cursor != NULL, "CreateIconIndirect returned %p.\n", cursor);
474 
475  SetCursor(cursor);
476 
477  /* Destroy the cursor. */
479 }
#define BITSPIXEL
Definition: wingdi.h:719
HDC WINAPI GetDC(_In_opt_ HWND)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
DWORD yHotspot
Definition: winuser.h:3078
static HDC
Definition: imagelist.c:92
HICON HCURSOR
Definition: windef.h:284
static HWND child
Definition: cursoricon.c:298
HBITMAP hbmMask
Definition: winuser.h:3079
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
HBITMAP hbmColor
Definition: winuser.h:3080
BOOL fIcon
Definition: winuser.h:3076
DWORD xHotspot
Definition: winuser.h:3077
HICON WINAPI CreateIconIndirect(_In_ PICONINFO piconinfo)
Definition: cursoricon.c:2546
HDC hdc
Definition: main.c:9
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
unsigned char BYTE
Definition: mem.h:68
#define WM_USER
Definition: winuser.h:1856
const char cursor[]
Definition: icontest.c:13
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
unsigned int UINT
Definition: ndis.h:50
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

Referenced by START_TEST().

◆ test_CopyImage_Bitmap()

static void test_CopyImage_Bitmap ( int  depth)
static

Definition at line 542 of file cursoricon.c.

543 {
544  HBITMAP ddb, dib;
545  HDC screenDC;
546  BITMAPINFO * info;
547  VOID * bits;
548  int screen_depth;
549  unsigned int i;
550 
551  /* Create a device-independent bitmap (DIB) */
552  info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
553  info->bmiHeader.biSize = sizeof(info->bmiHeader);
554  info->bmiHeader.biWidth = 2;
555  info->bmiHeader.biHeight = 2;
556  info->bmiHeader.biPlanes = 1;
557  info->bmiHeader.biBitCount = depth;
558  info->bmiHeader.biCompression = BI_RGB;
559 
560  for (i=0; i < 256; i++)
561  {
562  info->bmiColors[i].rgbRed = i;
563  info->bmiColors[i].rgbGreen = i;
564  info->bmiColors[i].rgbBlue = 255 - i;
565  info->bmiColors[i].rgbReserved = 0;
566  }
567 
569 
570  /* Create a device-dependent bitmap (DDB) */
571  screenDC = GetDC(NULL);
572  screen_depth = GetDeviceCaps(screenDC, BITSPIXEL);
573  if (depth == 1 || depth == screen_depth)
574  {
575  ddb = CreateBitmap(2, 2, 1, depth, NULL);
576  }
577  else
578  {
579  ddb = NULL;
580  }
581  ReleaseDC(NULL, screenDC);
582 
583  if (ddb != NULL)
584  {
585  test_CopyImage_Check(ddb, 0, 0, 0, 2, 2, depth == 1 ? 1 : screen_depth, FALSE);
586  test_CopyImage_Check(ddb, 0, 0, 5, 2, 5, depth == 1 ? 1 : screen_depth, FALSE);
587  test_CopyImage_Check(ddb, 0, 5, 0, 5, 2, depth == 1 ? 1 : screen_depth, FALSE);
588  test_CopyImage_Check(ddb, 0, 5, 5, 5, 5, depth == 1 ? 1 : screen_depth, FALSE);
589 
590  test_CopyImage_Check(ddb, LR_MONOCHROME, 0, 0, 2, 2, 1, FALSE);
591  test_CopyImage_Check(ddb, LR_MONOCHROME, 5, 0, 5, 2, 1, FALSE);
592  test_CopyImage_Check(ddb, LR_MONOCHROME, 0, 5, 2, 5, 1, FALSE);
593  test_CopyImage_Check(ddb, LR_MONOCHROME, 5, 5, 5, 5, 1, FALSE);
594 
599 
600  /* LR_MONOCHROME is ignored if LR_CREATEDIBSECTION is present */
605 
606  DeleteObject(ddb);
607  }
608 
609  if (depth != 1)
610  {
611  test_CopyImage_Check(dib, 0, 0, 0, 2, 2, screen_depth, FALSE);
612  test_CopyImage_Check(dib, 0, 5, 0, 5, 2, screen_depth, FALSE);
613  test_CopyImage_Check(dib, 0, 0, 5, 2, 5, screen_depth, FALSE);
614  test_CopyImage_Check(dib, 0, 5, 5, 5, 5, screen_depth, FALSE);
615  }
616 
617  test_CopyImage_Check(dib, LR_MONOCHROME, 0, 0, 2, 2, 1, FALSE);
618  test_CopyImage_Check(dib, LR_MONOCHROME, 5, 0, 5, 2, 1, FALSE);
619  test_CopyImage_Check(dib, LR_MONOCHROME, 0, 5, 2, 5, 1, FALSE);
620  test_CopyImage_Check(dib, LR_MONOCHROME, 5, 5, 5, 5, 1, FALSE);
621 
626 
627  /* LR_MONOCHROME is ignored if LR_CREATEDIBSECTION is present */
632 
633  DeleteObject(dib);
634 
635  if (depth == 1)
636  {
637  /* Special case: A monochrome DIB is converted to a monochrome DDB if
638  the colors in the color table are black and white.
639 
640  Skip this test on Windows 95, it always creates a monochrome DDB
641  in this case */
642 
643  if (!(GetVersion() & 0x80000000))
644  {
645  info->bmiHeader.biBitCount = 1;
646  info->bmiColors[0].rgbRed = 0xFF;
647  info->bmiColors[0].rgbGreen = 0;
648  info->bmiColors[0].rgbBlue = 0;
649  info->bmiColors[1].rgbRed = 0;
650  info->bmiColors[1].rgbGreen = 0xFF;
651  info->bmiColors[1].rgbBlue = 0;
652 
654  test_CopyImage_Check(dib, 0, 0, 0, 2, 2, screen_depth, FALSE);
655  test_CopyImage_Check(dib, 0, 5, 0, 5, 2, screen_depth, FALSE);
656  test_CopyImage_Check(dib, 0, 0, 5, 2, 5, screen_depth, FALSE);
657  test_CopyImage_Check(dib, 0, 5, 5, 5, 5, screen_depth, FALSE);
658  DeleteObject(dib);
659 
660  info->bmiHeader.biBitCount = 1;
661  info->bmiColors[0].rgbRed = 0;
662  info->bmiColors[0].rgbGreen = 0;
663  info->bmiColors[0].rgbBlue = 0;
664  info->bmiColors[1].rgbRed = 0xFF;
665  info->bmiColors[1].rgbGreen = 0xFF;
666  info->bmiColors[1].rgbBlue = 0xFF;
667 
669  test_CopyImage_Check(dib, 0, 0, 0, 2, 2, 1, FALSE);
670  test_CopyImage_Check(dib, 0, 5, 0, 5, 2, 1, FALSE);
671  test_CopyImage_Check(dib, 0, 0, 5, 2, 5, 1, FALSE);
672  test_CopyImage_Check(dib, 0, 5, 5, 5, 5, 1, FALSE);
673  DeleteObject(dib);
674 
675  info->bmiHeader.biBitCount = 1;
676  info->bmiColors[0].rgbRed = 0xFF;
677  info->bmiColors[0].rgbGreen = 0xFF;
678  info->bmiColors[0].rgbBlue = 0xFF;
679  info->bmiColors[1].rgbRed = 0;
680  info->bmiColors[1].rgbGreen = 0;
681  info->bmiColors[1].rgbBlue = 0;
682 
684  test_CopyImage_Check(dib, 0, 0, 0, 2, 2, 1, FALSE);
685  test_CopyImage_Check(dib, 0, 5, 0, 5, 2, 1, FALSE);
686  test_CopyImage_Check(dib, 0, 0, 5, 2, 5, 1, FALSE);
687  test_CopyImage_Check(dib, 0, 5, 5, 5, 5, 1, FALSE);
688  DeleteObject(dib);
689  }
690  }
691 
693 }
#define BITSPIXEL
Definition: wingdi.h:719
#define TRUE
Definition: types.h:120
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
DWORD WINAPI GetVersion(VOID)
Definition: version.c:22
struct _test_info info[]
Definition: SetCursorPos.c:19
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
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
static void test_CopyImage_Check(HBITMAP bitmap, UINT flags, INT copyWidth, INT copyHeight, INT expectedWidth, INT expectedHeight, WORD expectedDepth, BOOL dibExpected)
Definition: cursoricon.c:489
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LR_MONOCHROME
Definition: winuser.h:1078
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
#define LR_CREATEDIBSECTION
Definition: winuser.h:1088
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static const BYTE dib[]
Definition: ole2.c:201
static HBITMAP
Definition: button.c:44
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define BI_RGB
Definition: precomp.h:35
#define HeapFree(x, y, z)
Definition: compat.h:394
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

Referenced by START_TEST().

◆ test_CopyImage_Check()

static void test_CopyImage_Check ( HBITMAP  bitmap,
UINT  flags,
INT  copyWidth,
INT  copyHeight,
INT  expectedWidth,
INT  expectedHeight,
WORD  expectedDepth,
BOOL  dibExpected 
)
static

Definition at line 489 of file cursoricon.c.

491 {
492  HBITMAP copy;
493  BITMAP origBitmap;
494  BITMAP copyBitmap;
495  BOOL orig_is_dib;
496  BOOL copy_is_dib;
497 
498  copy = CopyImage(bitmap, IMAGE_BITMAP, copyWidth, copyHeight, flags);
499  ok(copy != NULL, "CopyImage() failed\n");
500  if (copy != NULL)
501  {
502  GetObjectA(bitmap, sizeof(origBitmap), &origBitmap);
503  GetObjectA(copy, sizeof(copyBitmap), &copyBitmap);
504  orig_is_dib = (origBitmap.bmBits != NULL);
505  copy_is_dib = (copyBitmap.bmBits != NULL);
506 
507  if (copy_is_dib && dibExpected
508  && copyBitmap.bmBitsPixel == 24
509  && (expectedDepth == 16 || expectedDepth == 32))
510  {
511  /* Windows 95 doesn't create DIBs with a depth of 16 or 32 bit */
512  if (GetVersion() & 0x80000000)
513  {
514  expectedDepth = 24;
515  }
516  }
517 
518  if (copy_is_dib && !dibExpected && !(flags & LR_CREATEDIBSECTION))
519  {
520  /* It's not forbidden to create a DIB section if the flag
521  LR_CREATEDIBSECTION is absent.
522  Windows 9x does this if the bitmap has a depth that doesn't
523  match the screen depth, Windows NT doesn't */
524  dibExpected = TRUE;
525  expectedDepth = origBitmap.bmBitsPixel;
526  }
527 
528  ok((!(dibExpected ^ copy_is_dib)
529  && (copyBitmap.bmWidth == expectedWidth)
530  && (copyBitmap.bmHeight == expectedHeight)
531  && (copyBitmap.bmBitsPixel == expectedDepth)),
532  "CopyImage ((%s, %dx%d, %u bpp), %d, %d, %#x): Expected (%s, %dx%d, %u bpp), got (%s, %dx%d, %u bpp)\n",
533  orig_is_dib ? "DIB" : "DDB", origBitmap.bmWidth, origBitmap.bmHeight, origBitmap.bmBitsPixel,
534  copyWidth, copyHeight, flags,
535  dibExpected ? "DIB" : "DDB", expectedWidth, expectedHeight, expectedDepth,
536  copy_is_dib ? "DIB" : "DDB", copyBitmap.bmWidth, copyBitmap.bmHeight, copyBitmap.bmBitsPixel);
537 
539  }
540 }
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define TRUE
Definition: types.h:120
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
DWORD WINAPI GetVersion(VOID)
Definition: version.c:22
HANDLE WINAPI CopyImage(_In_ HANDLE hImage, _In_ UINT uType, _In_ int cxDesired, _In_ int cyDesired, _In_ UINT fuFlags)
Definition: cursoricon.c:1956
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
Definition: uimain.c:88
GLbitfield flags
Definition: glext.h:7161
Definition: bl.h:1331
#define LR_CREATEDIBSECTION
Definition: winuser.h:1088
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
#define IMAGE_BITMAP
Definition: winuser.h:211
static HBITMAP
Definition: button.c:44

Referenced by test_CopyImage_Bitmap().

◆ test_CreateIcon()

static void test_CreateIcon ( void  )
static

Definition at line 795 of file cursoricon.c.

796 {
797  static const BYTE bmp_bits[1024];
798  HICON hIcon;
799  HBITMAP hbmMask, hbmColor;
800  BITMAPINFO *bmpinfo;
801  ICONINFO info;
802  HDC hdc;
803  void *bits;
804  UINT display_bpp;
805  int i;
806 
807  hdc = GetDC(0);
808  display_bpp = GetDeviceCaps(hdc, BITSPIXEL);
809 
810  /* these crash under XP
811  hIcon = CreateIcon(0, 16, 16, 1, 1, bmp_bits, NULL);
812  hIcon = CreateIcon(0, 16, 16, 1, 1, NULL, bmp_bits);
813  */
814 
815  hIcon = CreateIcon(0, 16, 16, 1, 1, bmp_bits, bmp_bits);
816  ok(hIcon != 0, "CreateIcon failed\n");
817  test_icon_info(hIcon, 16, 16, 32, 1);
819 
820  hIcon = CreateIcon(0, 16, 16, 1, display_bpp, bmp_bits, bmp_bits);
821  ok(hIcon != 0, "CreateIcon failed\n");
822  test_icon_info(hIcon, 16, 16, 16, display_bpp);
824 
825  hbmMask = CreateBitmap(16, 16, 1, 1, bmp_bits);
826  ok(hbmMask != 0, "CreateBitmap failed\n");
827  hbmColor = CreateBitmap(16, 16, 1, display_bpp, bmp_bits);
828  ok(hbmColor != 0, "CreateBitmap failed\n");
829 
830  info.fIcon = TRUE;
831  info.xHotspot = 8;
832  info.yHotspot = 8;
833  info.hbmMask = 0;
834  info.hbmColor = 0;
835  SetLastError(0xdeadbeaf);
837  ok(!hIcon, "CreateIconIndirect should fail\n");
838  ok(GetLastError() == 0xdeadbeaf, "wrong error %u\n", GetLastError());
839 
840  info.fIcon = TRUE;
841  info.xHotspot = 8;
842  info.yHotspot = 8;
843  info.hbmMask = 0;
844  info.hbmColor = hbmColor;
845  SetLastError(0xdeadbeaf);
847  ok(!hIcon, "CreateIconIndirect should fail\n");
848  ok(GetLastError() == 0xdeadbeaf, "wrong error %u\n", GetLastError());
849 
850  info.fIcon = TRUE;
851  info.xHotspot = 8;
852  info.yHotspot = 8;
853  info.hbmMask = hbmMask;
854  info.hbmColor = hbmColor;
856  ok(hIcon != 0, "CreateIconIndirect failed\n");
857  test_icon_info(hIcon, 16, 16, 16, display_bpp);
859 
860  DeleteObject(hbmMask);
861  DeleteObject(hbmColor);
862 
863  hbmMask = CreateBitmap(16, 32, 1, 1, bmp_bits);
864  ok(hbmMask != 0, "CreateBitmap failed\n");
865 
866  info.fIcon = TRUE;
867  info.xHotspot = 8;
868  info.yHotspot = 8;
869  info.hbmMask = hbmMask;
870  info.hbmColor = 0;
871  SetLastError(0xdeadbeaf);
873  ok(hIcon != 0, "CreateIconIndirect failed\n");
874  test_icon_info(hIcon, 16, 16, 32, 1);
876  DeleteObject(hbmMask);
877 
878  for (i = 0; i <= 4; i++)
879  {
880  hbmMask = CreateBitmap(1, i, 1, 1, bmp_bits);
881  ok(hbmMask != 0, "CreateBitmap failed\n");
882 
883  info.fIcon = TRUE;
884  info.xHotspot = 0;
885  info.yHotspot = 0;
886  info.hbmMask = hbmMask;
887  info.hbmColor = 0;
888  SetLastError(0xdeadbeaf);
890  ok(hIcon != 0, "CreateIconIndirect failed\n");
891  test_icon_info(hIcon, 1, i / 2, max(i,1), 1);
893  DeleteObject(hbmMask);
894  }
895 
896  /* test creating an icon from a DIB section */
897 
898  bmpinfo = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET(BITMAPINFO,bmiColors[256]));
899  bmpinfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
900  bmpinfo->bmiHeader.biWidth = 32;
901  bmpinfo->bmiHeader.biHeight = 32;
902  bmpinfo->bmiHeader.biPlanes = 1;
903  bmpinfo->bmiHeader.biBitCount = 8;
904  bmpinfo->bmiHeader.biCompression = BI_RGB;
905  hbmColor = CreateDIBSection( hdc, bmpinfo, DIB_RGB_COLORS, &bits, NULL, 0 );
906  ok(hbmColor != NULL, "Expected a handle to the DIB\n");
907  if (bits)
908  memset( bits, 0x55, 32 * 32 * bmpinfo->bmiHeader.biBitCount / 8 );
909  bmpinfo->bmiHeader.biBitCount = 1;
910  hbmMask = CreateDIBSection( hdc, bmpinfo, DIB_RGB_COLORS, &bits, NULL, 0 );
911  ok(hbmMask != NULL, "Expected a handle to the DIB\n");
912  if (bits)
913  memset( bits, 0x55, 32 * 32 * bmpinfo->bmiHeader.biBitCount / 8 );
914 
915  info.fIcon = TRUE;
916  info.xHotspot = 8;
917  info.yHotspot = 8;
918  info.hbmMask = hbmColor;
919  info.hbmColor = hbmMask;
920  SetLastError(0xdeadbeaf);
922  ok(hIcon != 0, "CreateIconIndirect failed\n");
923  test_icon_info(hIcon, 32, 32, 32, 8);
925  DeleteObject(hbmColor);
926 
927  bmpinfo->bmiHeader.biBitCount = 16;
928  hbmColor = CreateDIBSection( hdc, bmpinfo, DIB_RGB_COLORS, &bits, NULL, 0 );
929  ok(hbmColor != NULL, "Expected a handle to the DIB\n");
930  if (bits)
931  memset( bits, 0x55, 32 * 32 * bmpinfo->bmiHeader.biBitCount / 8 );
932 
933  info.fIcon = TRUE;
934  info.xHotspot = 8;
935  info.yHotspot = 8;
936  info.hbmMask = hbmColor;
937  info.hbmColor = hbmMask;
938  SetLastError(0xdeadbeaf);
940  ok(hIcon != 0, "CreateIconIndirect failed\n");
941  test_icon_info(hIcon, 32, 32, 32, 8);
943  DeleteObject(hbmColor);
944 
945  bmpinfo->bmiHeader.biBitCount = 32;
946  hbmColor = CreateDIBSection( hdc, bmpinfo, DIB_RGB_COLORS, &bits, NULL, 0 );
947  ok(hbmColor != NULL, "Expected a handle to the DIB\n");
948  if (bits)
949  memset( bits, 0x55, 32 * 32 * bmpinfo->bmiHeader.biBitCount / 8 );
950 
951  info.fIcon = TRUE;
952  info.xHotspot = 8;
953  info.yHotspot = 8;
954  info.hbmMask = hbmColor;
955  info.hbmColor = hbmMask;
956  SetLastError(0xdeadbeaf);
958  ok(hIcon != 0, "CreateIconIndirect failed\n");
959  test_icon_info(hIcon, 32, 32, 32, 8);
961 
962  DeleteObject(hbmMask);
963  DeleteObject(hbmColor);
964  HeapFree( GetProcessHeap(), 0, bmpinfo );
965 
966  ReleaseDC(0, hdc);
967 }
#define BITSPIXEL
Definition: wingdi.h:719
#define max(a, b)
Definition: svc.c:63
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
BOOL WINAPI DestroyIcon(_In_ HICON hIcon)
Definition: cursoricon.c:2022
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1454
HICON WINAPI CreateIcon(_In_opt_ HINSTANCE hInstance, _In_ int nWidth, _In_ int nHeight, _In_ BYTE cPlanes, _In_ BYTE cBitsPixel, _In_ const BYTE *lpbANDbits, _In_ const BYTE *lpbXORbits)
Definition: cursoricon.c:2364
HDC WINAPI GetDC(_In_opt_ HWND)
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
static HDC
Definition: imagelist.c:92
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
struct _test_info info[]
Definition: SetCursorPos.c:19
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
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
DWORD biCompression
Definition: amvideo.idl:35
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define SetLastError(x)
Definition: compat.h:409
HICON WINAPI CreateIconIndirect(_In_ PICONINFO piconinfo)
Definition: cursoricon.c:2546
HDC hdc
Definition: main.c:9
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
unsigned char BYTE
Definition: mem.h:68
HICON hIcon
Definition: msconfig.c:44
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define test_icon_info(a, b, c, d, e)
Definition: cursoricon.c:793
unsigned int UINT
Definition: ndis.h:50
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static HBITMAP
Definition: button.c:44
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define memset(x, y, z)
Definition: compat.h:39
#define BI_RGB
Definition: precomp.h:35
#define HeapFree(x, y, z)
Definition: compat.h:394
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

Referenced by START_TEST().

◆ test_CreateIconFromResource()

static void test_CreateIconFromResource ( void  )
static

Definition at line 1337 of file cursoricon.c.

1338 {
1339  HANDLE handle;
1340  BOOL ret;
1341  DWORD error;
1342  BITMAPINFOHEADER *icon_header;
1343  INT16 *hotspot;
1344  ICONINFO icon_info;
1345 
1346 #define ICON_RES_WIDTH 32
1347 #define ICON_RES_HEIGHT 32
1348 #define ICON_RES_AND_SIZE (ICON_WIDTH*ICON_HEIGHT/8)
1349 #define ICON_RES_BPP 32
1350 #define ICON_RES_SIZE \
1351  (sizeof(BITMAPINFOHEADER) + ICON_AND_SIZE + ICON_AND_SIZE*ICON_BPP)
1352 #define CRSR_RES_SIZE (2*sizeof(INT16) + ICON_RES_SIZE)
1353 
1354  /* Set icon data. */
1356 
1357  /* Cursor resources have an extra hotspot, icon resources not. */
1358  hotspot[0] = 3;
1359  hotspot[1] = 3;
1360 
1361  icon_header = (BITMAPINFOHEADER *) (hotspot + 2);
1362  icon_header->biSize = sizeof(BITMAPINFOHEADER);
1363  icon_header->biWidth = ICON_WIDTH;
1364  icon_header->biHeight = ICON_HEIGHT*2;
1365  icon_header->biPlanes = 1;
1366  icon_header->biBitCount = ICON_BPP;
1367  icon_header->biSizeImage = 0; /* Uncompressed bitmap. */
1368 
1369  /* Test creating a cursor. */
1370  SetLastError(0xdeadbeef);
1371  handle = CreateIconFromResource((PBYTE) hotspot, CRSR_RES_SIZE, FALSE, 0x00030000);
1372  ok(handle != NULL, "Create cursor failed.\n");
1373 
1374  /* Test the icon information. */
1375  SetLastError(0xdeadbeef);
1376  ret = GetIconInfo(handle, &icon_info);
1377  ok(ret, "GetIconInfo() failed.\n");
1378  error = GetLastError();
1379  ok(error == 0xdeadbeef, "Last error: %u\n", error);
1380 
1381  if (ret)
1382  {
1383  ok(icon_info.fIcon == FALSE, "fIcon != FALSE.\n");
1384  ok(icon_info.xHotspot == 3, "xHotspot is %u.\n", icon_info.xHotspot);
1385  ok(icon_info.yHotspot == 3, "yHotspot is %u.\n", icon_info.yHotspot);
1386  ok(icon_info.hbmColor != NULL || broken(!icon_info.hbmColor) /* no color cursor support */,
1387  "No hbmColor!\n");
1388  ok(icon_info.hbmMask != NULL, "No hbmMask!\n");
1389  }
1390 
1391  if (pGetIconInfoExA)
1392  {
1393  ICONINFOEXA infoex;
1394  infoex.cbSize = sizeof(infoex);
1395  ret = pGetIconInfoExA( handle, &infoex );
1396  ok( ret, "GetIconInfoEx failed err %d\n", GetLastError() );
1397  ok( infoex.wResID == 0, "GetIconInfoEx wrong resid %x\n", infoex.wResID );
1398  ok( infoex.szModName[0] == 0, "GetIconInfoEx wrong module %s\n", infoex.szModName );
1399  ok( infoex.szResName[0] == 0, "GetIconInfoEx wrong name %s\n", infoex.szResName );
1400  }
1401 
1402  /* Clean up. */
1403  SetLastError(0xdeadbeef);
1405  ok(ret, "DestroyCursor() failed.\n");
1406  error = GetLastError();
1407  ok(error == 0xdeadbeef, "Last error: %u\n", error);
1408 
1409  /* Test creating an icon. */
1410  SetLastError(0xdeadbeef);
1412  0x00030000);
1413  ok(handle != NULL, "Create icon failed.\n");
1414 
1415  /* Test the icon information. */
1416  SetLastError(0xdeadbeef);
1417  ret = GetIconInfo(handle, &icon_info);
1418  ok(ret, "GetIconInfo() failed.\n");
1419  error = GetLastError();
1420  ok(error == 0xdeadbeef, "Last error: %u\n", error);
1421 
1422  if (ret)
1423  {
1424  ok(icon_info.fIcon == TRUE, "fIcon != TRUE.\n");
1425  /* Icons always have hotspot in the middle */
1426  ok(icon_info.xHotspot == ICON_WIDTH/2, "xHotspot is %u.\n", icon_info.xHotspot);
1427  ok(icon_info.yHotspot == ICON_HEIGHT/2, "yHotspot is %u.\n", icon_info.yHotspot);
1428  ok(icon_info.hbmColor != NULL, "No hbmColor!\n");
1429  ok(icon_info.hbmMask != NULL, "No hbmMask!\n");
1430  }
1431 
1432  /* Clean up. */
1433  SetLastError(0xdeadbeef);
1435  ok(ret, "DestroyCursor() failed.\n");
1436  error = GetLastError();
1437  ok(error == 0xdeadbeef, "Last error: %u\n", error);
1438 
1439  /* Rejection of NULL pointer crashes at least on WNT4WSSP6, W2KPROSP4, WXPPROSP3
1440  *
1441  * handle = CreateIconFromResource(NULL, ICON_RES_SIZE, TRUE, 0x00030000);
1442  * ok(handle == NULL, "Invalid pointer accepted (%p)\n", handle);
1443  */
1444  HeapFree(GetProcessHeap(), 0, hotspot);
1445 
1446  /* Test creating an animated cursor. */
1447  empty_anicursor.frames[0].data.icon_info.idType = 2; /* type: cursor */
1451  ok(handle != NULL, "Create cursor failed.\n");
1452 
1453  /* Test the animated cursor's information. */
1454  SetLastError(0xdeadbeef);
1455  ret = GetIconInfo(handle, &icon_info);
1456  ok(ret, "GetIconInfo() failed.\n");
1457  error = GetLastError();
1458  ok(error == 0xdeadbeef, "Last error: %u\n", error);
1459 
1460  if (ret)
1461  {
1462  ok(icon_info.fIcon == FALSE, "fIcon != FALSE.\n");
1463  ok(icon_info.xHotspot == 3, "xHotspot is %u.\n", icon_info.xHotspot);
1464  ok(icon_info.yHotspot == 3, "yHotspot is %u.\n", icon_info.yHotspot);
1465  ok(icon_info.hbmColor != NULL || broken(!icon_info.hbmColor) /* no color cursor support */,
1466  "No hbmColor!\n");
1467  ok(icon_info.hbmMask != NULL, "No hbmMask!\n");
1468  }
1469 
1470  /* Clean up. */
1471  SetLastError(0xdeadbeef);
1473  ok(ret, "DestroyCursor() failed.\n");
1474  error = GetLastError();
1475  ok(error == 0xdeadbeef, "Last error: %u\n", error);
1476 }
#define CRSR_RES_SIZE
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define TRUE
Definition: types.h:120
#define error(str)
Definition: mkdosfs.c:1605
DWORD yHotspot
Definition: winuser.h:3078
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
WORD wResID
Definition: winuser.h:3091
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
CHAR szResName[MAX_PATH]
Definition: winuser.h:3093
CURSORICONFILEDIRENTRY idEntries[1]
Definition: olepicture.c:108
BOOL WINAPI GetIconInfo(_In_ HICON hIcon, _Out_ PICONINFO piconinfo)
Definition: cursoricon.c:2014
#define ICON_HEIGHT
unsigned int BOOL
Definition: ntddk_ex.h:94
CURSORICONFILEDIR icon_info
Definition: cursoricon.c:90
HBITMAP hbmMask
Definition: winuser.h:3079
#define ok(value,...)
#define ICON_BPP
smooth NULL
Definition: ftsmooth.c:416
#define ICON_RES_SIZE
HBITMAP hbmColor
Definition: winuser.h:3080
BOOL fIcon
Definition: winuser.h:3076
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD xHotspot
Definition: winuser.h:3077
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD biSizeImage
Definition: amvideo.idl:36
#define SetLastError(x)
Definition: compat.h:409
riff_icon32x32x32_t frames[1]
Definition: cursoricon.c:119
int ret
CHAR szModName[MAX_PATH]
Definition: winuser.h:3092
HICON WINAPI CreateIconFromResource(_In_ PBYTE presbits, _In_ DWORD dwResSize, _In_ BOOL fIcon, _In_ DWORD dwVer)
Definition: cursoricon.c:2402
#define broken(x)
Definition: _sntprintf.h:21
ani_frame32x32x32 data
Definition: cursoricon.c:110
riff_cursor1_t empty_anicursor
Definition: cursoricon.c:193
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
DWORD cbSize
Definition: winuser.h:3085
BOOL WINAPI DestroyCursor(_In_ HCURSOR hCursor)
Definition: cursoricon.c:2654
BYTE * PBYTE
Definition: pedump.c:66
#define ICON_WIDTH
#define HeapFree(x, y, z)
Definition: compat.h:394
signed short INT16

Referenced by START_TEST().

◆ test_DestroyCursor()

static void test_DestroyCursor ( void  )
static

Definition at line 2397 of file cursoricon.c.

2398 {
2399  static const BYTE bmp_bits[4096];
2400  ICONINFO cursorInfo, new_info;
2401  HCURSOR cursor, cursor2, new_cursor;
2402  BOOL ret;
2403  DWORD error;
2404  UINT display_bpp;
2405  HDC hdc;
2406 
2407  hdc = GetDC(0);
2408  display_bpp = GetDeviceCaps(hdc, BITSPIXEL);
2409  ReleaseDC(0, hdc);
2410 
2411  cursorInfo.fIcon = FALSE;
2412  cursorInfo.xHotspot = 0;
2413  cursorInfo.yHotspot = 0;
2414  cursorInfo.hbmMask = CreateBitmap(32, 32, 1, 1, bmp_bits);
2415  cursorInfo.hbmColor = CreateBitmap(32, 32, 1, display_bpp, bmp_bits);
2416 
2417  cursor = CreateIconIndirect(&cursorInfo);
2418  ok(cursor != NULL, "CreateIconIndirect returned %p\n", cursor);
2419  if(!cursor) {
2420  return;
2421  }
2422  SetCursor(cursor);
2423 
2424  SetLastError(0xdeadbeef);
2426  ok(!ret || broken(ret) /* succeeds on win9x */, "DestroyCursor on the active cursor succeeded\n");
2427  error = GetLastError();
2428  ok(error == 0xdeadbeef, "Last error: %u\n", error);
2429 
2430  new_cursor = GetCursor();
2431  if (ret) /* win9x replaces cursor by another one on destroy */
2432  ok(new_cursor != cursor, "GetCursor returned %p/%p\n", new_cursor, cursor);
2433  else
2434  ok(new_cursor == cursor, "GetCursor returned %p/%p\n", new_cursor, cursor);
2435 
2436  SetLastError(0xdeadbeef);
2437  ret = GetIconInfo( cursor, &new_info );
2438  ok( !ret || broken(ret), /* nt4 */ "GetIconInfo succeeded\n" );
2440  broken(GetLastError() == 0xdeadbeef), /* win9x */
2441  "wrong error %u\n", GetLastError() );
2442 
2443  if (ret) /* nt4 delays destruction until cursor changes */
2444  {
2445  DeleteObject( new_info.hbmColor );
2446  DeleteObject( new_info.hbmMask );
2447 
2448  SetLastError(0xdeadbeef);
2449  ret = DestroyCursor( cursor );
2450  ok( !ret, "DestroyCursor succeeded\n" );
2451  ok( GetLastError() == ERROR_INVALID_CURSOR_HANDLE || GetLastError() == 0xdeadbeef,
2452  "wrong error %u\n", GetLastError() );
2453 
2454  SetLastError(0xdeadbeef);
2455  cursor2 = SetCursor( cursor );
2456  ok( cursor2 == cursor, "SetCursor returned %p/%p\n", cursor2, cursor);
2457  ok( GetLastError() == ERROR_INVALID_CURSOR_HANDLE || GetLastError() == 0xdeadbeef,
2458  "wrong error %u\n", GetLastError() );
2459  }
2460  else
2461  {
2462  SetLastError(0xdeadbeef);
2463  cursor2 = CopyCursor( cursor );
2464  ok(!cursor2, "CopyCursor succeeded\n" );
2466  broken(GetLastError() == 0xdeadbeef), /* win9x */
2467  "wrong error %u\n", GetLastError() );
2468 
2469  SetLastError(0xdeadbeef);
2470  ret = DestroyCursor( cursor );
2471  if (new_cursor != cursor) /* win9x */
2472  ok( ret, "DestroyCursor succeeded\n" );
2473  else
2474  ok( !ret, "DestroyCursor succeeded\n" );
2475  ok( GetLastError() == ERROR_INVALID_CURSOR_HANDLE || GetLastError() == 0xdeadbeef,
2476  "wrong error %u\n", GetLastError() );
2477 
2478  SetLastError(0xdeadbeef);
2479  cursor2 = SetCursor( cursor );
2480  ok(!cursor2, "SetCursor returned %p/%p\n", cursor2, cursor);
2481  ok( GetLastError() == ERROR_INVALID_CURSOR_HANDLE || GetLastError() == 0xdeadbeef,
2482  "wrong error %u\n", GetLastError() );
2483  }
2484 
2485  cursor2 = GetCursor();
2486  ok(cursor2 == new_cursor, "GetCursor returned %p/%p\n", cursor2, new_cursor);
2487 
2488  SetLastError(0xdeadbeef);
2489  cursor2 = SetCursor( 0 );
2490  if (new_cursor != cursor) /* win9x */
2491  ok(cursor2 == new_cursor, "SetCursor returned %p/%p\n", cursor2, cursor);
2492  else
2493  ok(!cursor2, "SetCursor returned %p/%p\n", cursor2, cursor);
2494  ok( GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError() );
2495 
2496  cursor2 = GetCursor();
2497  ok(!cursor2, "GetCursor returned %p/%p\n", cursor2, cursor);
2498 
2499  SetLastError(0xdeadbeef);
2501  if (new_cursor != cursor) /* win9x */
2502  ok( ret, "DestroyCursor succeeded\n" );
2503  else
2504  ok( !ret, "DestroyCursor succeeded\n" );
2505  ok( GetLastError() == ERROR_INVALID_CURSOR_HANDLE || GetLastError() == 0xdeadbeef,
2506  "wrong error %u\n", GetLastError() );
2507 
2508  DeleteObject(cursorInfo.hbmMask);
2509  DeleteObject(cursorInfo.hbmColor);
2510 
2511  /* Try testing DestroyCursor() now using LoadCursor() cursors. */
2513 
2514  SetLastError(0xdeadbeef);
2516  ok(ret || broken(!ret) /* fails on win9x */, "DestroyCursor on the active cursor failed.\n");
2517  error = GetLastError();
2518  ok(error == 0xdeadbeef, "Last error: 0x%08x\n", error);
2519 
2520  /* Try setting the cursor to a destroyed OEM cursor. */
2521  SetLastError(0xdeadbeef);
2522  SetCursor(cursor);
2523  error = GetLastError();
2524  ok(error == 0xdeadbeef, "Last error: 0x%08x\n", error);
2525 
2526  /* Check if LoadCursor() returns the same handle with the same icon. */
2527  cursor2 = LoadCursorA(NULL, (LPCSTR)IDC_ARROW);
2528  ok(cursor2 == cursor, "cursor == %p, cursor2 == %p\n", cursor, cursor2);
2529 
2530  /* Check if LoadCursor() returns the same handle with a different icon. */
2531  cursor2 = LoadCursorA(NULL, (LPCSTR)IDC_WAIT);
2532  ok(cursor2 != cursor, "cursor == %p, cursor2 == %p\n", cursor, cursor2);
2533 }
#define BITSPIXEL
Definition: wingdi.h:719
#define ERROR_INVALID_CURSOR_HANDLE
Definition: winerror.h:883
#define error(str)
Definition: mkdosfs.c:1605
HDC WINAPI GetDC(_In_opt_ HWND)
DWORD yHotspot
Definition: winuser.h:3078
#define CopyCursor(c)
Definition: winuser.h:4104
static HDC
Definition: imagelist.c:92
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HICON HCURSOR
Definition: windef.h:284
BOOL WINAPI GetIconInfo(_In_ HICON hIcon, _Out_ PICONINFO piconinfo)
Definition: cursoricon.c:2014
unsigned int BOOL
Definition: ntddk_ex.h:94
HBITMAP hbmMask
Definition: winuser.h:3079
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
#define IDC_WAIT
Definition: winuser.h:684
HBITMAP hbmColor
Definition: winuser.h:3080
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE hInstance, _In_ LPCSTR lpCursorName)
Definition: cursoricon.c:2059
const char * LPCSTR
Definition: xmlstorage.h:183
BOOL fIcon
Definition: winuser.h:3076
DWORD xHotspot
Definition: winuser.h:3077
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
HICON WINAPI CreateIconIndirect(_In_ PICONINFO piconinfo)
Definition: cursoricon.c:2546
int ret
HDC hdc
Definition: main.c:9
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
unsigned char BYTE
Definition: mem.h:68
#define broken(x)
Definition: _sntprintf.h:21
const char cursor[]
Definition: icontest.c:13
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
HCURSOR WINAPI GetCursor(void)
Definition: cursoricon.c:2649
unsigned int UINT
Definition: ndis.h:50
#define IDC_ARROW
Definition: winuser.h:682
BOOL WINAPI DestroyCursor(_In_ HCURSOR hCursor)
Definition: cursoricon.c:2654
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)

Referenced by START_TEST().

◆ test_DrawIcon()

static void test_DrawIcon ( void  )
static

Definition at line 1869 of file cursoricon.c.

1870 {
1871  BITMAPINFO bitmapInfo;
1872  HDC hdcDst = NULL;
1873  HBITMAP bmpDst = NULL;
1874  HBITMAP bmpOld = NULL;
1875  void *bits = 0;
1876 
1878  ok(hdcDst != 0, "CreateCompatibleDC(0) failed to return a valid DC\n");
1879  if (!hdcDst)
1880  return;
1881 
1882  if(GetDeviceCaps(hdcDst, BITSPIXEL) <= 8)
1883  {
1884  skip("Windows will distort DrawIcon colors at 8-bpp and less due to palettizing.\n");
1885  goto cleanup;
1886  }
1887 
1888  memset(&bitmapInfo, 0, sizeof(bitmapInfo));
1889  bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1890  bitmapInfo.bmiHeader.biWidth = GetSystemMetrics(SM_CXICON)+1;
1891  bitmapInfo.bmiHeader.biHeight = GetSystemMetrics(SM_CYICON)+1;
1892  bitmapInfo.bmiHeader.biBitCount = 32;
1893  bitmapInfo.bmiHeader.biPlanes = 1;
1894  bitmapInfo.bmiHeader.biCompression = BI_RGB;
1895  bitmapInfo.bmiHeader.biSizeImage = sizeof(UINT32);
1896 
1897  bmpDst = CreateDIBSection(hdcDst, &bitmapInfo, DIB_RGB_COLORS, &bits, NULL, 0);
1898  ok (bmpDst && bits, "CreateDIBSection failed to return a valid bitmap and buffer\n");
1899  if (!bmpDst || !bits)
1900  goto cleanup;
1901  bmpOld = SelectObject(hdcDst, bmpDst);
1902 
1903  /* Mask is only heeded if alpha channel is always zero */
1904  check_DrawIcon(hdcDst, FALSE, 0x00A0B0C0, 32, 0x00FFFFFF, 0x00C0B0A0, 0x00C0B0A0, __LINE__);
1905  check_DrawIcon(hdcDst, TRUE, 0x00A0B0C0, 32, 0x00FFFFFF, 0x003F4F5F, 0x003F4F5F, __LINE__);
1906 
1907  /* Test alpha blending */
1908  /* Windows 2000 and up will alpha blend, earlier Windows versions will not */
1909  check_DrawIcon(hdcDst, FALSE, 0xFFA0B0C0, 32, 0x00FFFFFF, 0x00C0B0A0, 0x00C0B0A0, __LINE__);
1910  check_DrawIcon(hdcDst, TRUE, 0xFFA0B0C0, 32, 0x00FFFFFF, 0x00C0B0A0, 0x003F4F5F, __LINE__);
1911 
1912  check_DrawIcon(hdcDst, FALSE, 0x80A0B0C0, 32, 0x00000000, 0x00605850, 0x00C0B0A0, __LINE__);
1913  check_DrawIcon(hdcDst, TRUE, 0x80A0B0C0, 32, 0x00000000, 0x00605850, 0x00C0B0A0, __LINE__);
1914  check_DrawIcon(hdcDst, FALSE, 0x80A0B0C0, 32, 0x00FFFFFF, 0x00DFD7CF, 0x00C0B0A0, __LINE__);
1915  check_DrawIcon(hdcDst, TRUE, 0x80A0B0C0, 32, 0x00FFFFFF, 0x00DFD7CF, 0x003F4F5F, __LINE__);
1916 
1917  check_DrawIcon(hdcDst, FALSE, 0x01FFFFFF, 32, 0x00000000, 0x00010101, 0x00FFFFFF, __LINE__);
1918  check_DrawIcon(hdcDst, TRUE, 0x01FFFFFF, 32, 0x00000000, 0x00010101, 0x00FFFFFF, __LINE__);
1919 
1920  /* Test detecting of alpha channel */
1921  /* If a single pixel's alpha channel is non-zero, the icon
1922  will be alpha blended, otherwise it will be draw with
1923  and + xor blts. */
1924  check_alpha_draw(hdcDst, FALSE, FALSE, 32, __LINE__);
1925  check_alpha_draw(hdcDst, FALSE, TRUE, 32, __LINE__);
1926 
1927 cleanup:
1928  if(bmpOld)
1929  SelectObject(hdcDst, bmpOld);
1930  if(bmpDst)
1931  DeleteObject(bmpDst);
1932  if(hdcDst)
1933  DeleteDC(hdcDst);
1934 }
#define BITSPIXEL
Definition: wingdi.h:719
#define TRUE
Definition: types.h:120
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1454
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
unsigned int UINT32
DWORD biCompression
Definition: amvideo.idl:35
#define ok(value,...)
#define SM_CXICON
Definition: winuser.h:962
smooth NULL
Definition: ftsmooth.c:416
int WINAPI GetSystemMetrics(_In_ int)
DWORD biSizeImage
Definition: amvideo.idl:36
#define SM_CYICON
Definition: winuser.h:963
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
static HDC hdcDst
Definition: xlate.c:32
BOOL WINAPI DeleteDC(_In_ HDC)
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
#define skip(...)
char * cleanup(char *str)
Definition: wpickclick.c:99
static HBITMAP
Definition: button.c:44
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define memset(x, y, z)
Definition: compat.h:39
static void check_alpha_draw(HDC hdc, BOOL drawiconex, BOOL alpha, int bpp, int line)
Definition: cursoricon.c:1805
#define BI_RGB
Definition: precomp.h:35
static void check_DrawIcon(HDC hdc, BOOL maskvalue, UINT32 color, int bpp, COLORREF background, COLORREF modern_expected, COLORREF legacy_expected, int line)
Definition: cursoricon.c:1835

Referenced by START_TEST().

◆ test_DrawIconEx()

static void test_DrawIconEx ( void  )
static

Definition at line 1953 of file cursoricon.c.

1954 {
1955  BITMAPINFO bitmapInfo;
1956  HDC hdcDst = NULL;
1957  HBITMAP bmpDst = NULL;
1958  HBITMAP bmpOld = NULL;
1959  void *bits = 0;
1960 
1962  ok(hdcDst != 0, "CreateCompatibleDC(0) failed to return a valid DC\n");
1963  if (!hdcDst)
1964  return;
1965 
1966  if(GetDeviceCaps(hdcDst, BITSPIXEL) <= 8)
1967  {
1968  skip("Windows will distort DrawIconEx colors at 8-bpp and less due to palettizing.\n");
1969  goto cleanup;
1970  }
1971 
1972  memset(&bitmapInfo, 0, sizeof(bitmapInfo));
1973  bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1974  bitmapInfo.bmiHeader.biWidth = 1;
1975  bitmapInfo.bmiHeader.biHeight = 1;
1976  bitmapInfo.bmiHeader.biBitCount = 32;
1977  bitmapInfo.bmiHeader.biPlanes = 1;
1978  bitmapInfo.bmiHeader.biCompression = BI_RGB;
1979  bitmapInfo.bmiHeader.biSizeImage = sizeof(UINT32);
1980  bmpDst = CreateDIBSection(hdcDst, &bitmapInfo, DIB_RGB_COLORS, &bits, NULL, 0);
1981  ok (bmpDst && bits, "CreateDIBSection failed to return a valid bitmap and buffer\n");
1982  if (!bmpDst || !bits)
1983  goto cleanup;
1984  bmpOld = SelectObject(hdcDst, bmpDst);
1985 
1986  /* Test null, image only, and mask only drawing */
1987  check_DrawIconEx(hdcDst, FALSE, 0x00A0B0C0, 32, 0, 0x00102030, 0x00102030, 0x00102030, __LINE__);
1988  check_DrawIconEx(hdcDst, TRUE, 0x00A0B0C0, 32, 0, 0x00102030, 0x00102030, 0x00102030, __LINE__);
1989 
1990  check_DrawIconEx(hdcDst, FALSE, 0x80A0B0C0, 32, DI_MASK, 0x00123456, 0x00000000, 0x00000000, __LINE__);
1991  check_DrawIconEx(hdcDst, TRUE, 0x80A0B0C0, 32, DI_MASK, 0x00123456, 0x00FFFFFF, 0x00FFFFFF, __LINE__);
1992 
1993  check_DrawIconEx(hdcDst, FALSE, 0x00A0B0C0, 32, DI_IMAGE, 0x00FFFFFF, 0x00C0B0A0, 0x00C0B0A0, __LINE__);
1994  check_DrawIconEx(hdcDst, TRUE, 0x00A0B0C0, 32, DI_IMAGE, 0x00FFFFFF, 0x00C0B0A0, 0x00C0B0A0, __LINE__);
1995 
1996  /* Test normal drawing */
1997  check_DrawIconEx(hdcDst, FALSE, 0x00A0B0C0, 32, DI_NORMAL, 0x00FFFFFF, 0x00C0B0A0, 0x00C0B0A0, __LINE__);
1998  check_DrawIconEx(hdcDst, TRUE, 0x00A0B0C0, 32, DI_NORMAL, 0x00FFFFFF, 0x003F4F5F, 0x003F4F5F, __LINE__);
1999  check_DrawIconEx(hdcDst, FALSE, 0xFFA0B0C0, 32, DI_NORMAL, 0x00FFFFFF, 0x00C0B0A0, 0x00C0B0A0, __LINE__);
2000 
2001  /* Test alpha blending */
2002  /* Windows 2000 and up will alpha blend, earlier Windows versions will not */
2003  check_DrawIconEx(hdcDst, TRUE, 0xFFA0B0C0, 32, DI_NORMAL, 0x00FFFFFF, 0x00C0B0A0, 0x003F4F5F, __LINE__);
2004 
2005  check_DrawIconEx(hdcDst, FALSE, 0x80A0B0C0, 32, DI_NORMAL, 0x00000000, 0x00605850, 0x00C0B0A0, __LINE__);
2006  check_DrawIconEx(hdcDst, TRUE, 0x80A0B0C0, 32, DI_NORMAL, 0x00000000, 0x00605850, 0x00C0B0A0, __LINE__);
2007  check_DrawIconEx(hdcDst, FALSE, 0x80A0B0C0, 32, DI_NORMAL, 0x00FFFFFF, 0x00DFD7CF, 0x00C0B0A0, __LINE__);
2008  check_DrawIconEx(hdcDst, TRUE, 0x80A0B0C0, 32, DI_NORMAL, 0x00FFFFFF, 0x00DFD7CF, 0x003F4F5F, __LINE__);
2009 
2010  check_DrawIconEx(hdcDst, FALSE, 0x01FFFFFF, 32, DI_NORMAL, 0x00000000, 0x00010101, 0x00FFFFFF, __LINE__);
2011  check_DrawIconEx(hdcDst, TRUE, 0x01FFFFFF, 32, DI_NORMAL, 0x00000000, 0x00010101, 0x00FFFFFF, __LINE__);
2012 
2013  /* Test detecting of alpha channel */
2014  /* If a single pixel's alpha channel is non-zero, the icon
2015  will be alpha blended, otherwise it will be draw with
2016  and + xor blts. */
2017  check_alpha_draw(hdcDst, TRUE, FALSE, 32, __LINE__);
2018  check_alpha_draw(hdcDst, TRUE, TRUE, 32, __LINE__);
2019 
2020 cleanup:
2021  if(bmpOld)
2022  SelectObject(hdcDst, bmpOld);
2023  if(bmpDst)
2024  DeleteObject(bmpDst);
2025  if(hdcDst)
2026  DeleteDC(hdcDst);
2027 }
#define BITSPIXEL
Definition: wingdi.h:719
#define TRUE
Definition: types.h:120
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1454
#define DI_MASK
Definition: wingdi.h:71
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
unsigned int UINT32
DWORD biCompression
Definition: amvideo.idl:35
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
static void check_DrawIconEx(HDC hdc, BOOL maskvalue, UINT32 color, int bpp, UINT flags, COLORREF background, COLORREF modern_expected, COLORREF legacy_expected, int line)
Definition: cursoricon.c:1936
DWORD biSizeImage
Definition: amvideo.idl:36
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define DI_NORMAL
Definition: wingdi.h:72
static HDC hdcDst
Definition: xlate.c:32
BOOL WINAPI DeleteDC(_In_ HDC)
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
#define skip(...)
char * cleanup(char *str)
Definition: wpickclick.c:99
static HBITMAP
Definition: button.c:44
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define memset(x, y, z)
Definition: compat.h:39
static void check_alpha_draw(HDC hdc, BOOL drawiconex, BOOL alpha, int bpp, int line)
Definition: cursoricon.c:1805
#define BI_RGB
Definition: precomp.h:35
#define DI_IMAGE
Definition: wingdi.h:70

Referenced by START_TEST().

◆ test_DrawState()

static void test_DrawState ( void  )
static

Definition at line 2102 of file cursoricon.c.

2103 {
2104  BITMAPINFO bitmapInfo;
2105  HDC hdcDst = NULL;
2106  HBITMAP bmpDst = NULL;
2107  HBITMAP bmpOld = NULL;
2108  void *bits = 0;
2109 
2111  ok(hdcDst != 0, "CreateCompatibleDC(0) failed to return a valid DC\n");
2112  if (!hdcDst)
2113  return;
2114 
2115  if(GetDeviceCaps(hdcDst, BITSPIXEL) <= 8)
2116  {
2117  skip("Windows will distort DrawIconEx colors at 8-bpp and less due to palettizing.\n");
2118  goto cleanup;
2119  }
2120 
2121  memset(&bitmapInfo, 0, sizeof(bitmapInfo));
2122  bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
2123  bitmapInfo.bmiHeader.biWidth = 3;
2124  bitmapInfo.bmiHeader.biHeight = 3;
2125  bitmapInfo.bmiHeader.biBitCount = 32;
2126  bitmapInfo.bmiHeader.biPlanes = 1;
2127  bitmapInfo.bmiHeader.biCompression = BI_RGB;
2128  bitmapInfo.bmiHeader.biSizeImage = sizeof(UINT32);
2129  bmpDst = CreateDIBSection(hdcDst, &bitmapInfo, DIB_RGB_COLORS, &bits, NULL, 0);
2130  ok (bmpDst && bits, "CreateDIBSection failed to return a valid bitmap and buffer\n");
2131  if (!bmpDst || !bits)
2132  goto cleanup;
2133  bmpOld = SelectObject(hdcDst, bmpDst);
2134 
2135  /* potential flags to test with DrawState are: */
2136  /* DSS_DISABLED embosses the icon */
2137  /* DSS_MONO draw Icon using a brush as parameter 5 */
2138  /* DSS_NORMAL draw Icon without any modifications */
2139  /* DSS_UNION draw the Icon dithered */
2140 
2141  check_DrawState_Size(hdcDst, FALSE, 0x00A0B0C0, 32, 0, DSS_NORMAL, __LINE__);
2142  check_DrawState_Color(hdcDst, FALSE, 0x00A0B0C0, 32, 0, DSS_NORMAL, 0x00FFFFFF, 0x00C0B0A0, 0x00C0B0A0, __LINE__);
2143 
2144 cleanup:
2145  if(bmpOld)
2146  SelectObject(hdcDst, bmpOld);
2147  if(bmpDst)
2148  DeleteObject(bmpDst);
2149  if(hdcDst)
2150  DeleteDC(hdcDst);
2151 }
#define BITSPIXEL
Definition: wingdi.h:719
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1454
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
static HDC
Definition: imagelist.c:92
static void check_DrawState_Size(HDC hdc, BOOL maskvalue, UINT32 color, int bpp, HBRUSH hbr, UINT flags, int line)
Definition: cursoricon.c:2029
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
unsigned int UINT32
DWORD biCompression
Definition: amvideo.idl:35
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
static void check_DrawState_Color(HDC hdc, BOOL maskvalue, UINT32 color, int bpp, HBRUSH hbr, UINT flags, COLORREF background, COLORREF modern_expected, COLORREF legacy_expected, int line)
Definition: cursoricon.c:2081
DWORD biSizeImage
Definition: amvideo.idl:36
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
static HDC hdcDst
Definition: xlate.c:32
BOOL WINAPI DeleteDC(_In_ HDC)
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
#define skip(...)
#define DSS_NORMAL
Definition: winuser.h:517
char * cleanup(char *str)
Definition: wpickclick.c:99
static HBITMAP
Definition: button.c:44
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define memset(x, y, z)
Definition: compat.h:39
#define BI_RGB
Definition: precomp.h:35

Referenced by START_TEST().

◆ test_GetCursorFrameInfo()

static void test_GetCursorFrameInfo ( void  )
static

Definition at line 1522 of file cursoricon.c.

1523 {
1524  DWORD frame_identifier[] = { 0x10Ad, 0xc001, 0x1c05 };
1525  HBITMAP bmp = NULL, bmpOld = NULL;
1526  DWORD rate, steps;
1527  BITMAPINFOHEADER *icon_header;
1528  BITMAPINFO bitmapInfo;
1529  HDC hdc = NULL;
1530  void *bits = 0;
1531  INT16 *hotspot;
1532  HANDLE h1, h2;
1533  BOOL ret;
1534  int i;
1535 
1536  if (!pGetCursorFrameInfo)
1537  {
1538  win_skip( "GetCursorFrameInfo not supported, skipping tests.\n" );
1539  return;
1540  }
1541 
1542  hdc = CreateCompatibleDC(0);
1543  ok(hdc != 0, "CreateCompatibleDC(0) failed to return a valid DC\n");
1544  if (!hdc)
1545  return;
1546 
1547  memset(&bitmapInfo, 0, sizeof(bitmapInfo));
1548  bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
1549  bitmapInfo.bmiHeader.biWidth = 3;
1550  bitmapInfo.bmiHeader.biHeight = 3;
1551  bitmapInfo.bmiHeader.biBitCount = 32;
1552  bitmapInfo.bmiHeader.biPlanes = 1;
1553  bitmapInfo.bmiHeader.biCompression = BI_RGB;
1554  bitmapInfo.bmiHeader.biSizeImage = sizeof(UINT32);
1555  bmp = CreateDIBSection(hdc, &bitmapInfo, DIB_RGB_COLORS, &bits, NULL, 0);
1556  ok (bmp && bits, "CreateDIBSection failed to return a valid bitmap and buffer\n");
1557  if (!bmp || !bits)
1558  goto cleanup;
1559  bmpOld = SelectObject(hdc, bmp);
1560 
1561 #define ICON_RES_WIDTH 32
1562 #define ICON_RES_HEIGHT 32
1563 #define ICON_RES_AND_SIZE (ICON_WIDTH*ICON_HEIGHT/8)
1564 #define ICON_RES_BPP 32
1565 #define ICON_RES_SIZE \
1566  (sizeof(BITMAPINFOHEADER) + ICON_AND_SIZE + ICON_AND_SIZE*ICON_BPP)
1567 #define CRSR_RES_SIZE (2*sizeof(INT16) + ICON_RES_SIZE)
1568 
1569  /* Set icon data. */
1571 
1572  /* Cursor resources have an extra hotspot, icon resources not. */
1573  hotspot[0] = 3;
1574  hotspot[1] = 3;
1575 
1576  icon_header = (BITMAPINFOHEADER *) (hotspot + 2);
1577  icon_header->biSize = sizeof(BITMAPINFOHEADER);
1578  icon_header->biWidth = ICON_WIDTH;
1579  icon_header->biHeight = ICON_HEIGHT*2;
1580  icon_header->biPlanes = 1;
1581  icon_header->biBitCount = ICON_BPP;
1582  icon_header->biSizeImage = 0; /* Uncompressed bitmap. */
1583 
1584  /* Creating a static cursor. */
1585  SetLastError(0xdeadbeef);
1586  h1 = CreateIconFromResource((PBYTE) hotspot, CRSR_RES_SIZE, FALSE, 0x00030000);
1587  ok(h1 != NULL, "Create cursor failed (error = %d).\n", GetLastError());
1588 
1589  /* Check GetCursorFrameInfo behavior on a static cursor */
1590  rate = steps = 0xdead;
1591  h2 = pGetCursorFrameInfo(h1, 0xdead, 0xdead, &rate, &steps);
1592  ok(h1 == h2, "GetCursorFrameInfo() failed: (%p != %p).\n", h1, h2);
1593  ok(rate == 0, "GetCursorFrameInfo() unexpected param 4 value (0x%x != 0x0).\n", rate);
1594  ok(steps == 1, "GetCursorFrameInfo() unexpected param 5 value (%d != 1).\n", steps);
1595 
1596  /* Clean up static cursor. */
1597  SetLastError(0xdeadbeef);
1598  ret = DestroyCursor(h1);
1599  ok(ret, "DestroyCursor() failed (error = %d).\n", GetLastError());
1600 
1601  /* Creating a single-frame animated cursor. */
1602  empty_anicursor.frames[0].data.icon_info.idType = 2; /* type: cursor */
1605  memcpy( &empty_anicursor.frames[0].data.bmi_data.data[0], &frame_identifier[0], sizeof(DWORD) );
1606  SetLastError(0xdeadbeef);
1607  h1 = CreateIconFromResource((PBYTE) &empty_anicursor, sizeof(empty_anicursor), FALSE, 0x00030000);
1608  ok(h1 != NULL, "Create cursor failed (error = %d).\n", GetLastError());
1609 
1610  /* Check GetCursorFrameInfo behavior on a single-frame animated cursor */
1611  rate = steps = 0xdead;
1612  h2 = pGetCursorFrameInfo(h1, 0xdead, 0, &rate, &steps);
1613  ok(h1 == h2, "GetCursorFrameInfo() failed: (%p != %p).\n", h1, h2);
1614  ret = check_cursor_data( hdc, h2, &frame_identifier[0], sizeof(DWORD) );
1615  ok(ret, "GetCursorFrameInfo() returned wrong cursor data for frame 0.\n");
1616  ok(rate == 0x0, "GetCursorFrameInfo() unexpected param 4 value (0x%x != 0x0).\n", rate);
1618  "GetCursorFrameInfo() unexpected param 5 value (%d != 1).\n", steps);
1619 
1620  /* Clean up single-frame animated cursor. */
1621  SetLastError(0xdeadbeef);
1622  ret = DestroyCursor(h1);
1623  ok(ret, "DestroyCursor() failed (error = %d).\n", GetLastError());
1624 
1625  /* Creating a multi-frame animated cursor. */
1627  {
1628  empty_anicursor3.frames[i].data.icon_info.idType = 2; /* type: cursor */
1631  memcpy( &empty_anicursor3.frames[i].data.bmi_data.data[0], &frame_identifier[i], sizeof(DWORD) );
1632  }
1633  SetLastError(0xdeadbeef);
1634  h1 = CreateIconFromResource((PBYTE) &empty_anicursor3, sizeof(empty_anicursor3), FALSE, 0x00030000);
1635  ok(h1 != NULL, "Create cursor failed (error = %d).\n", GetLastError());
1636 
1637  /* Check number of steps in multi-frame animated cursor */
1638  i=0;
1639  while (DrawIconEx(hdc, 0, 0, h1, 32, 32, i, NULL, DI_NORMAL))
1640  i++;
1642  "Unexpected number of steps in cursor (%d != %d)\n",
1644 
1645  /* Check GetCursorFrameInfo behavior on a multi-frame animated cursor */
1647  {
1648  rate = steps = 0xdead;
1649  h2 = pGetCursorFrameInfo(h1, 0xdead, i, &rate, &steps);
1650  ok(h1 != h2 && h2 != 0, "GetCursorFrameInfo() failed for cursor %p: (%p, %p).\n", h1, h1, h2);
1651  ret = check_cursor_data( hdc, h2, &frame_identifier[i], sizeof(DWORD) );
1652  ok(ret, "GetCursorFrameInfo() returned wrong cursor data for frame %d.\n", i);
1654  "GetCursorFrameInfo() unexpected param 4 value (0x%x != 0x%x).\n",
1657  "GetCursorFrameInfo() unexpected param 5 value (%d != %d).\n",
1659  }
1660 
1661  /* Check GetCursorFrameInfo behavior on rate 3 of a multi-frame animated cursor */
1662  rate = steps = 0xdead;
1663  h2 = pGetCursorFrameInfo(h1, 0xdead, 3, &rate, &steps);
1664  ok(h2 == 0, "GetCursorFrameInfo() failed for cursor %p: (%p != 0).\n", h1, h2);
1665  ok(rate == 0xdead || broken(rate == empty_anicursor3.header.header.display_rate) /*win2k*/
1666  || broken(rate == ~0) /*win2k (sporadic)*/,
1667  "GetCursorFrameInfo() unexpected param 4 value (0x%x != 0xdead).\n", rate);
1668  ok(steps == 0xdead || broken(steps == empty_anicursor3.header.header.num_steps) /*win2k*/
1669  || broken(steps == 0) /*win2k (sporadic)*/,
1670  "GetCursorFrameInfo() unexpected param 5 value (0x%x != 0xdead).\n", steps);
1671 
1672  /* Clean up multi-frame animated cursor. */
1673  SetLastError(0xdeadbeef);
1674  ret = DestroyCursor(h1);
1675  ok(ret, "DestroyCursor() failed (error = %d).\n", GetLastError());
1676 
1677  /* Create a multi-frame animated cursor with num_steps == 1 */
1679  SetLastError(0xdeadbeef);
1680  h1 = CreateIconFromResource((PBYTE) &empty_anicursor3, sizeof(empty_anicursor3), FALSE, 0x00030000);
1681  ok(h1 != NULL, "Create cursor failed (error = %d).\n", GetLastError());
1682 
1683  /* Check number of steps in multi-frame animated cursor (mismatch between steps and frames) */
1684  i=0;
1685  while (DrawIconEx(hdc, 0, 0, h1, 32, 32, i, NULL, DI_NORMAL))
1686  i++;
1688  "Unexpected number of steps in cursor (%d != %d)\n",
1690 
1691  /* Check GetCursorFrameInfo behavior on rate 0 for a multi-frame animated cursor (with num_steps == 1) */
1692  rate = steps = 0xdead;
1693  h2 = pGetCursorFrameInfo(h1, 0xdead, 0, &rate, &steps);
1694  ok(h1 != h2 && h2 != 0, "GetCursorFrameInfo() failed for cursor %p: (%p, %p).\n", h1, h1, h2);
1695  ret = check_cursor_data( hdc, h2, &frame_identifier[0], sizeof(DWORD) );
1696  ok(ret, "GetCursorFrameInfo() returned wrong cursor data for frame 0.\n");
1698  "GetCursorFrameInfo() unexpected param 4 value (0x%x != 0x%x).\n",
1700  ok(steps == ~0 || broken(steps == empty_anicursor3.header.header.num_steps) /*win2k*/,
1701  "GetCursorFrameInfo() unexpected param 5 value (%d != ~0).\n", steps);
1702 
1703  /* Check GetCursorFrameInfo behavior on rate 1 for a multi-frame animated cursor (with num_steps == 1) */
1704  rate = steps = 0xdead;
1705  h2 = pGetCursorFrameInfo(h1, 0xdead, 1, &rate, &steps);
1706  ok(h2 == 0, "GetCursorFrameInfo() failed for cursor %p: (%p != 0).\n", h1, h2);
1707  ok(rate == 0xdead || broken(rate == empty_anicursor3.header.header.display_rate) /*win2k*/
1708  || broken(rate == ~0) /*win2k (sporadic)*/,
1709  "GetCursorFrameInfo() unexpected param 4 value (0x%x != 0xdead).\n", rate);
1710  ok(steps == 0xdead || broken(steps == empty_anicursor3.header.header.num_steps) /*win2k*/
1711  || broken(steps == 0) /*win2k (sporadic)*/,
1712  "GetCursorFrameInfo() unexpected param 5 value (%d != 0xdead).\n", steps);
1713 
1714  /* Clean up multi-frame animated cursor. */
1715  SetLastError(0xdeadbeef);
1716  ret = DestroyCursor(h1);
1717  ok(ret, "DestroyCursor() failed (error = %d).\n", GetLastError());
1718 
1719  /* Creating a multi-frame animated cursor with rate data. */
1721  {
1722  empty_anicursor3_seq.frames[i].data.icon_info.idType = 2; /* type: cursor */
1725  memcpy( &empty_anicursor3_seq.frames[i].data.bmi_data.data[0], &frame_identifier[i], sizeof(DWORD) );
1726  }
1727  SetLastError(0xdeadbeef);
1729  ok(h1 != NULL, "Create cursor failed (error = %x).\n", GetLastError());
1730 
1731  /* Check number of steps in multi-frame animated cursor with rate data */
1732  i=0;
1733  while (DrawIconEx(hdc, 0, 0, h1, 32, 32, i, NULL, DI_NORMAL))
1734  i++;
1736  "Unexpected number of steps in cursor (%d != %d)\n",
1738 
1739  /* Check GetCursorFrameInfo behavior on a multi-frame animated cursor with rate data */
1741  {
1742  int frame_id = empty_anicursor3_seq.seq.order[i];
1743 
1744  rate = steps = 0xdead;
1745  h2 = pGetCursorFrameInfo(h1, 0xdead, i, &rate, &steps);
1746  ok(h1 != h2 && h2 != 0, "GetCursorFrameInfo() failed for cursor %p: (%p, %p).\n", h1, h1, h2);
1747  ret = check_cursor_data( hdc, h2, &frame_identifier[frame_id], sizeof(DWORD) );
1748  ok(ret, "GetCursorFrameInfo() returned wrong cursor data for frame %d.\n", i);
1750  "GetCursorFrameInfo() unexpected param 4 value (0x%x != 0x%x).\n",
1753  "GetCursorFrameInfo() unexpected param 5 value (%d != %d).\n",
1755  }
1756 
1757  /* Clean up multi-frame animated cursor with rate data. */
1758  SetLastError(0xdeadbeef);
1759  ret = DestroyCursor(h1);
1760  ok(ret, "DestroyCursor() failed (error = %d).\n", GetLastError());
1761 
1762  HeapFree(GetProcessHeap(), 0, hotspot);
1763 cleanup:
1764  if(bmpOld) SelectObject(hdc, bmpOld);
1765  if(bmp) DeleteObject(bmp);
1766  if(hdc) DeleteDC(hdc);
1767 }
#define CRSR_RES_SIZE
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1454
GLint x0
Definition: linetemp.h:95
riff_rate3_t rates
Definition: cursoricon.c:149
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
CURSORICONFILEDIRENTRY idEntries[1]
Definition: olepicture.c:108
static int check_cursor_data(HDC hdc, HCURSOR hCursor, void *data, int length)
Definition: cursoricon.c:1478
riff_cursor3_t empty_anicursor3
Definition: cursoricon.c:222
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
riff_icon32x32x32_t frames[3]
Definition: cursoricon.c:151
#define ICON_HEIGHT
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
riff_cursor3_seq_t empty_anicursor3_seq
Definition: cursoricon.c:253
unsigned int UINT32
unsigned int BOOL
Definition: ntddk_ex.h:94
CURSORICONFILEDIR icon_info
Definition: cursoricon.c:90
DWORD biCompression
Definition: amvideo.idl:35
#define ok(value,...)
#define ICON_BPP
static DWORD DWORD DWORD DWORD * steps
Definition: cursoricon.c:1521
smooth NULL
Definition: ftsmooth.c:416
riff_header_t header
Definition: cursoricon.c:117
ani_data32x32x32 bmi_data
Definition: cursoricon.c:92
DWORD order[3]
Definition: cursoricon.c:140
BYTE data[32 *32 *4]
Definition: cursoricon.c:85
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
riff_seq3_t seq
Definition: cursoricon.c:148
DWORD num_steps
Definition: cursoricon.c:75
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD biSizeImage
Definition: amvideo.idl:36
#define SetLastError(x)
Definition: compat.h:409
BITMAP bmp
Definition: alphablend.c:62
riff_header_t header
Definition: cursoricon.c:147
riff_icon32x32x32_t frames[1]
Definition: cursoricon.c:119
int ret
DWORD rate[3]
Definition: cursoricon.c:134
HDC hdc
Definition: main.c:9
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define DI_NORMAL
Definition: wingdi.h:72
riff_header_t header
Definition: cursoricon.c:126
HICON WINAPI CreateIconFromResource(_In_ PBYTE presbits, _In_ DWORD dwResSize, _In_ BOOL fIcon, _In_ DWORD dwVer)
Definition: cursoricon.c:2402
#define broken(x)
Definition: _sntprintf.h:21
ani_frame32x32x32 data
Definition: cursoricon.c:110
riff_cursor1_t empty_anicursor
Definition: cursoricon.c:193
static DWORD DWORD DWORD * rate
Definition: cursoricon.c:1521
DWORD display_rate
Definition: cursoricon.c:80
BOOL WINAPI DeleteDC(_In_ HDC)
DWORD num_frames
Definition: cursoricon.c:74
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
BOOL WINAPI DestroyCursor(_In_ HCURSOR hCursor)
Definition: cursoricon.c:2654
char * cleanup(char *str)
Definition: wpickclick.c:99
static HBITMAP
Definition: button.c:44
#define DIB_RGB_COLORS
Definition: wingdi.h:366
ani_header header
Definition: cursoricon.c:98
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141
BYTE * PBYTE
Definition: pedump.c:66
#define BI_RGB
Definition: precomp.h:35
#define ICON_WIDTH
#define HeapFree(x, y, z)
Definition: compat.h:394
BOOL WINAPI DrawIconEx(_In_ HDC hdc, _In_ int xLeft, _In_ int yTop, _In_ HICON hIcon, _In_ int cxWidth, _In_ int cyWidth, _In_ UINT istepIfAniCur, _In_opt_ HBRUSH hbrFlickerFreeDraw, _In_ UINT diFlags)
Definition: cursoricon.c:1997
riff_icon32x32x32_t frames[3]
Definition: cursoricon.c:128
signed short INT16

Referenced by START_TEST().

◆ test_icon_info_dbg()

static void test_icon_info_dbg ( HICON  hIcon,
UINT  exp_cx,
UINT  exp_cy,
UINT  exp_mask_cy,
UINT  exp_bpp,
int  line 
)
static

Definition at line 712 of file cursoricon.c.

713 {
714  ICONINFO info;
715  DWORD ret;
716  BITMAP bmMask, bmColor;
717 
718  ret = GetIconInfo(hIcon, &info);
719  ok_(__FILE__, line)(ret, "GetIconInfo failed\n");
720 
721  /* CreateIcon under XP causes info.fIcon to be 0 */
722  ok_(__FILE__, line)(info.xHotspot == exp_cx/2, "info.xHotspot = %u\n", info.xHotspot);
723  ok_(__FILE__, line)(info.yHotspot == exp_cy/2, "info.yHotspot = %u\n", info.yHotspot);
724  ok_(__FILE__, line)(info.hbmMask != 0, "info.hbmMask is NULL\n");
725 
726  ret = GetObjectA(info.hbmMask, sizeof(bmMask), &bmMask);
727  ok_(__FILE__, line)(ret == sizeof(bmMask), "GetObject(info.hbmMask) failed, ret %u\n", ret);
728 
729  if (exp_bpp == 1)
730  ok_(__FILE__, line)(info.hbmColor == 0, "info.hbmColor should be NULL\n");
731 
732  if (info.hbmColor)
733  {
734  HDC hdc;
735  UINT display_bpp;
736 
737  hdc = GetDC(0);
738  display_bpp = GetDeviceCaps(hdc, BITSPIXEL);
739  ReleaseDC(0, hdc);
740 
741  ret = GetObjectA(info.hbmColor, sizeof(bmColor), &bmColor);
742  ok_(__FILE__, line)(ret == sizeof(bmColor), "GetObject(info.hbmColor) failed, ret %u\n", ret);
743 
744  ok_(__FILE__, line)(bmColor.bmBitsPixel == display_bpp /* XP */ ||
745  bmColor.bmBitsPixel == exp_bpp /* Win98 */,
746  "bmColor.bmBitsPixel = %d\n", bmColor.bmBitsPixel);
747  ok_(__FILE__, line)(bmColor.bmWidth == exp_cx, "bmColor.bmWidth = %d\n", bmColor.bmWidth);
748  ok_(__FILE__, line)(bmColor.bmHeight == exp_cy, "bmColor.bmHeight = %d\n", bmColor.bmHeight);
749 
750  ok_(__FILE__, line)(bmMask.bmBitsPixel == 1, "bmMask.bmBitsPixel = %d\n", bmMask.bmBitsPixel);
751  ok_(__FILE__, line)(bmMask.bmWidth == exp_cx, "bmMask.bmWidth = %d\n", bmMask.bmWidth);
752  ok_(__FILE__, line)(bmMask.bmHeight == exp_mask_cy, "bmMask.bmHeight = %d\n", bmMask.bmHeight);
753  }
754  else
755  {
756  ok_(__FILE__, line)(bmMask.bmBitsPixel == 1, "bmMask.bmBitsPixel = %d\n", bmMask.bmBitsPixel);
757  ok_(__FILE__, line)(bmMask.bmWidth == exp_cx, "bmMask.bmWidth = %d\n", bmMask.bmWidth);
758  ok_(__FILE__, line)(bmMask.bmHeight == exp_mask_cy, "bmMask.bmHeight = %d\n", bmMask.bmHeight);
759  }
760  if (pGetIconInfoExA)
761  {
762  ICONINFOEXA infoex;
763 
764  memset( &infoex, 0xcc, sizeof(infoex) );
765  SetLastError( 0xdeadbeef );
766  infoex.cbSize = sizeof(infoex) - 1;
767  ret = pGetIconInfoExA( hIcon, &infoex );
768  ok_(__FILE__, line)(!ret, "GetIconInfoEx succeeded\n");
769  ok_(__FILE__, line)(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %d\n", GetLastError());
770 
771  SetLastError( 0xdeadbeef );
772  infoex.cbSize = sizeof(infoex) + 1;
773  ret = pGetIconInfoExA( hIcon, &infoex );
774  ok_(__FILE__, line)(!ret, "GetIconInfoEx succeeded\n");
775  ok_(__FILE__, line)(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %d\n", GetLastError());
776 
777  SetLastError( 0xdeadbeef );
778  infoex.cbSize = sizeof(infoex);
779  ret = pGetIconInfoExA( (HICON)0xdeadbabe, &infoex );
780  ok_(__FILE__, line)(!ret, "GetIconInfoEx succeeded\n");
782  "wrong error %d\n", GetLastError());
783 
784  infoex.cbSize = sizeof(infoex);
785  ret = pGetIconInfoExA( hIcon, &infoex );
786  ok_(__FILE__, line)(ret, "GetIconInfoEx failed err %d\n", GetLastError());
787  ok_(__FILE__, line)(infoex.wResID == 0, "GetIconInfoEx wrong resid %x\n", infoex.wResID);
788  ok_(__FILE__, line)(infoex.szModName[0] == 0, "GetIconInfoEx wrong module %s\n", infoex.szModName);
789  ok_(__FILE__, line)(infoex.szResName[0] == 0, "GetIconInfoEx wrong name %s\n", infoex.szResName);
790  }
791 }
int WINAPI GetObjectA(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define BITSPIXEL
Definition: wingdi.h:719
#define ERROR_INVALID_CURSOR_HANDLE
Definition: winerror.h:883
static HICON
Definition: imagelist.c:84
#define ok_(x1, x2)
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
WORD wResID
Definition: winuser.h:3091
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
CHAR szResName[MAX_PATH]
Definition: winuser.h:3093
struct _test_info info[]
Definition: SetCursorPos.c:19
BOOL WINAPI GetIconInfo(_In_ HICON hIcon, _Out_ PICONINFO piconinfo)
Definition: cursoricon.c:2014
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
Definition: parser.c:48
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
int ret
CHAR szModName[MAX_PATH]
Definition: winuser.h:3092
HDC hdc
Definition: main.c:9
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
HICON hIcon
Definition: msconfig.c:44
Definition: bl.h:1331
unsigned int UINT
Definition: ndis.h:50
DWORD cbSize
Definition: winuser.h:3085
#define memset(x, y, z)
Definition: compat.h:39

◆ test_initial_cursor()

static void test_initial_cursor ( void  )
static

Definition at line 695 of file cursoricon.c.

696 {
697  HCURSOR cursor, cursor2;
698  DWORD error;
699 
700  cursor = GetCursor();
701 
702  /* Check what handle GetCursor() returns if a cursor is not set yet. */
703  SetLastError(0xdeadbeef);
704  cursor2 = LoadCursorA(NULL, (LPCSTR)IDC_WAIT);
705  todo_wine {
706  ok(cursor == cursor2, "cursor (%p) is not IDC_WAIT (%p).\n", cursor, cursor2);
707  }
708  error = GetLastError();
709  ok(error == 0xdeadbeef, "Last error: 0x%08x\n", error);
710 }
#define error(str)
Definition: mkdosfs.c:1605
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HICON HCURSOR
Definition: windef.h:284
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
#define IDC_WAIT
Definition: winuser.h:684
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE hInstance, _In_ LPCSTR lpCursorName)
Definition: cursoricon.c:2059
const char * LPCSTR
Definition: xmlstorage.h:183
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
#define todo_wine
Definition: test.h:154
const char cursor[]
Definition: icontest.c:13
HCURSOR WINAPI GetCursor(void)
Definition: cursoricon.c:2649

Referenced by START_TEST().

◆ test_LoadImage()

static void test_LoadImage ( void  )
static

Definition at line 1210 of file cursoricon.c.

1211 {
1212  HANDLE handle;
1213  BOOL ret;
1214  DWORD error;
1215  BITMAPINFOHEADER *bitmap_header;
1216  ICONINFO icon_info;
1217  int i;
1218 
1219 #define ICON_WIDTH 32
1220 #define ICON_HEIGHT 32
1221 #define ICON_AND_SIZE (ICON_WIDTH*ICON_HEIGHT/8)
1222 #define ICON_BPP 32
1223 #define ICON_SIZE \
1224  (sizeof(CURSORICONFILEDIR) + sizeof(BITMAPINFOHEADER) \
1225  + ICON_AND_SIZE + ICON_AND_SIZE*ICON_BPP)
1226 
1227  static const test_icon_entries_t icon_desc = {32, 32};
1228 
1229  create_ico_file("icon.ico", &icon_desc, 1);
1230 
1231  /* Test loading an icon as a cursor. */
1232  SetLastError(0xdeadbeef);
1233  handle = LoadImageA(NULL, "icon.ico", IMAGE_CURSOR, 0, 0, LR_LOADFROMFILE);
1234  ok(handle != NULL, "LoadImage() failed.\n");
1235  error = GetLastError();
1236  ok(error == 0 ||
1237  broken(error == 0xdeadbeef) || /* Win9x */
1238  broken(error == ERROR_BAD_PATHNAME), /* Win98, WinMe */
1239  "Last error: %u\n", error);
1240 
1241  /* Test the icon information. */
1242  SetLastError(0xdeadbeef);
1243  ret = GetIconInfo(handle, &icon_info);
1244  ok(ret, "GetIconInfo() failed.\n");
1245  error = GetLastError();
1246  ok(error == 0xdeadbeef, "Last error: %u\n", error);
1247 
1248  if (ret)
1249  {
1250  ok(icon_info.fIcon == FALSE, "fIcon != FALSE.\n");
1251  ok(icon_info.xHotspot == 1, "xHotspot is %u.\n", icon_info.xHotspot);
1252  ok(icon_info.yHotspot == 1, "yHotspot is %u.\n", icon_info.yHotspot);
1253  ok(icon_info.hbmColor != NULL || broken(!icon_info.hbmColor) /* no color cursor support */,
1254  "No hbmColor!\n");
1255  ok(icon_info.hbmMask != NULL, "No hbmMask!\n");
1256  }
1257 
1258  if (pGetIconInfoExA)
1259  {
1260  ICONINFOEXA infoex;
1261  infoex.cbSize = sizeof(infoex);
1262  ret = pGetIconInfoExA( handle, &infoex );
1263  ok( ret, "GetIconInfoEx failed err %d\n", GetLastError() );
1264  ok( infoex.wResID == 0, "GetIconInfoEx wrong resid %x\n", infoex.wResID );
1265  ok( infoex.szModName[0] == 0, "GetIconInfoEx wrong module %s\n", infoex.szModName );
1266  ok( infoex.szResName[0] == 0, "GetIconInfoEx wrong name %s\n", infoex.szResName );
1267  }
1268  else win_skip( "GetIconInfoEx not available\n" );
1269 
1270  /* Clean up. */
1271  SetLastError(0xdeadbeef);
1273  ok(ret, "DestroyCursor() failed.\n");
1274  error = GetLastError();
1275  ok(error == 0xdeadbeef, "Last error: %u\n", error);
1276 
1277  DeleteFileA("icon.ico");
1278 
1279  /* Test a system icon */
1280  handle = LoadIconA( 0, (LPCSTR)IDI_HAND );
1281  ok(handle != NULL, "LoadImage() failed.\n");
1282  if (pGetIconInfoExA)
1283  {
1284  ICONINFOEXA infoexA;
1285  ICONINFOEXW infoexW;
1286  infoexA.cbSize = sizeof(infoexA);
1287  ret = pGetIconInfoExA( handle, &infoexA );
1288  ok( ret, "GetIconInfoEx failed err %d\n", GetLastError() );
1289  ok( infoexA.wResID == (UINT_PTR)IDI_HAND, "GetIconInfoEx wrong resid %x\n", infoexA.wResID );
1290  /* the A version is broken on 64-bit, it truncates the string after the first char */
1291  if (is_win64 && infoexA.szModName[0] && infoexA.szModName[1] == 0)
1292  trace( "GetIconInfoExA broken on Win64\n" );
1293  else
1294  ok( GetModuleHandleA(infoexA.szModName) == GetModuleHandleA("user32.dll"),
1295  "GetIconInfoEx wrong module %s\n", infoexA.szModName );
1296  ok( infoexA.szResName[0] == 0, "GetIconInfoEx wrong name %s\n", infoexA.szResName );
1297  infoexW.cbSize = sizeof(infoexW);
1298  ret = pGetIconInfoExW( handle, &infoexW );
1299  ok( ret, "GetIconInfoEx failed err %d\n", GetLastError() );
1300  ok( infoexW.wResID == (UINT_PTR)IDI_HAND, "GetIconInfoEx wrong resid %x\n", infoexW.wResID );
1301  ok( GetModuleHandleW(infoexW.szModName) == GetModuleHandleA("user32.dll"),
1302  "GetIconInfoEx wrong module %s\n", wine_dbgstr_w(infoexW.szModName) );
1303  ok( infoexW.szResName[0] == 0, "GetIconInfoEx wrong name %s\n", wine_dbgstr_w(infoexW.szResName) );
1304  }
1305  SetLastError(0xdeadbeef);
1307 
1308  test_LoadImageFile("BMP", bmpimage, sizeof(bmpimage), "bmp", 1);
1309  test_LoadImageFile("BMP (coreinfo)", bmpcoreimage, sizeof(bmpcoreimage), "bmp", 1);
1310  test_LoadImageFile("GIF", gifimage, sizeof(gifimage), "gif", 0);
1311  test_LoadImageFile("GIF (2x2 pixel)", gif4pixel, sizeof(gif4pixel), "gif", 0);
1312  test_LoadImageFile("JPG", jpgimage, sizeof(jpgimage), "jpg", 0);
1313  test_LoadImageFile("PNG", pngimage, sizeof(pngimage), "png", 0);
1314 
1315  /* Check failure for broken BMP images */
1316  bitmap_header = (BITMAPINFOHEADER *)(bmpimage + sizeof(BITMAPFILEHEADER));
1317 
1318  bitmap_header->biHeight = 65536;
1319  test_LoadImageFile("BMP (too high)", bmpimage, sizeof(bmpimage), "bmp", 0);
1320  bitmap_header->biHeight = 1;
1321 
1322  bitmap_header->biWidth = 65536;
1323  test_LoadImageFile("BMP (too wide)", bmpimage, sizeof(bmpimage), "bmp", 0);
1324  bitmap_header->biWidth = 1;
1325 
1326  for (i = 0; i < ARRAY_SIZE(biSize_tests); i++) {
1327  bitmap_header->biSize = biSize_tests[i];
1328  test_LoadImageFile("BMP (broken biSize)", bmpimage, sizeof(bmpimage), "bmp", 0);
1329  }
1330  bitmap_header->biSize = sizeof(BITMAPINFOHEADER);
1331 
1332  test_LoadImageFile("Cursor (invalid dwDIBOffset)", invalid_dwDIBOffset, sizeof(invalid_dwDIBOffset), "cur", 0);
1333 }