ReactOS 0.4.15-dev-6049-ge54b32b
NtUserGetIconInfo.c File Reference
#include <win32nt.h>
Include dependency graph for NtUserGetIconInfo.c:

Go to the source code of this file.

Functions

 START_TEST (NtUserGetIconInfo)
 

Function Documentation

◆ START_TEST()

START_TEST ( NtUserGetIconInfo  )

Definition at line 10 of file NtUserGetIconInfo.c.

11{
13 ICONINFO iinfo;
15 UNICODE_STRING hInstStr;
16 UNICODE_STRING ResourceStr;
17 DWORD bpp = 0;
18
19 ZeroMemory(&iinfo, sizeof(ICONINFO));
20
21 /* BASIC TESTS */
23 TEST(hIcon != NULL);
24
25 /* Last param is unknown */
26 TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == FALSE);
27 TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == FALSE);
28
30
31 mask = CreateBitmap(16,16,1,1,NULL);
32 color = CreateBitmap(16,16,1,16,NULL);
33
34 iinfo.hbmMask = mask;
35 iinfo.hbmColor = color ;
36 iinfo.fIcon = TRUE;
37 iinfo.xHotspot = 8;
38 iinfo.yHotspot = 8;
39
40 hIcon = CreateIconIndirect(&iinfo);
41 TEST(hIcon!=NULL);
42
43 // TODO : test last parameter...
44 TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == TRUE);
45
46 TEST(iinfo.hbmMask != NULL);
47 TEST(iinfo.hbmColor != NULL);
48 TEST(iinfo.fIcon == TRUE);
49 TEST(iinfo.yHotspot == 8);
50 TEST(iinfo.xHotspot == 8);
51
52 TEST(iinfo.hbmMask != mask);
53 TEST(iinfo.hbmColor != color);
54
55 /* Does it make a difference? */
56 TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == TRUE);
57
58 TEST(iinfo.hbmMask != NULL);
59 TEST(iinfo.hbmColor != NULL);
60 TEST(iinfo.fIcon == TRUE);
61 TEST(iinfo.yHotspot == 8);
62 TEST(iinfo.xHotspot == 8);
63
64 TEST(iinfo.hbmMask != mask);
65 TEST(iinfo.hbmColor != color);
66
69
71
72 /* Test full param, with local icon */
76 0,
77 0,
79
80 TEST(hIcon != NULL);
81
82 RtlInitUnicodeString(&hInstStr, NULL);
83 RtlInitUnicodeString(&ResourceStr, NULL);
84
85 TEST(NtUserGetIconInfo(hIcon,
86 &iinfo,
87 &hInstStr,
88 &ResourceStr,
89 &bpp,
90 FALSE) == TRUE);
91
92 ok(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer);
93 TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON));
94 TEST(bpp == 32);
95
96 /* Last param doesn't seem to matter*/
97 TEST(NtUserGetIconInfo(hIcon,
98 &iinfo,
99 &hInstStr,
100 &ResourceStr,
101 &bpp,
102 TRUE) == TRUE);
103
104 ok(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer);
105 TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON));
106 TEST(bpp == 32);
107
109
110 /* Test full param, with foreign icon */
111 hIcon = LoadImageA(GetModuleHandleA("shell32.dll"),
112 MAKEINTRESOURCE(293),
114 0,
115 0,
117
118 TEST(hIcon != NULL);
119
120 hInstStr.Buffer = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR));
121 hInstStr.MaximumLength = MAX_PATH;
122 hInstStr.Length = 0;
123 RtlInitUnicodeString(&ResourceStr, NULL);
124
125 TEST(NtUserGetIconInfo(hIcon,
126 &iinfo,
127 &hInstStr,
128 &ResourceStr,
129 &bpp,
130 FALSE) == TRUE);
131
132 TEST(hInstStr.Length != 0);
133 hInstStr.Buffer[hInstStr.Length] = 0;
134 printf("%s,%i: hInstStr.buffer : %S\n", __FUNCTION__, __LINE__, hInstStr.Buffer);
135 TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(293));
136 TEST(ResourceStr.Length == 0);
137 TEST(ResourceStr.MaximumLength == 0);
138 TEST(bpp == 32);
139
140 ZeroMemory(hInstStr.Buffer, MAX_PATH*sizeof(WCHAR));
141 hInstStr.Length = 0;
142 RtlInitUnicodeString(&ResourceStr, NULL);
143
144 TEST(NtUserGetIconInfo(hIcon,
145 &iinfo,
146 &hInstStr,
147 &ResourceStr,
148 &bpp,
149 TRUE) == TRUE);
150
151 TEST(hInstStr.Length != 0);
152 hInstStr.Buffer[hInstStr.Length] = 0;
153 printf("%s,%i: hInstStr.buffer : %S\n", __FUNCTION__, __LINE__, hInstStr.Buffer);
154 TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(293));
155 TEST(bpp == 32);
156
158
159}
#define ok(value,...)
Definition: atltest.h:57
#define IDI_ICON
Definition: resource.h:5
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
DWORD bpp
Definition: surface.c:185
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define __FUNCTION__
Definition: types.h:116
unsigned long DWORD
Definition: ntddk_ex.h:95
#define printf
Definition: freeldr.h:94
pKey DeleteObject()
GLuint color
Definition: glext.h:6243
GLenum GLint GLuint mask
Definition: glext.h:6028
BOOL NTAPI NtUserDestroyCursor(_In_ HANDLE Handle, _In_ BOOL bForce)
Definition: cursoricon.c:793
DWORD_PTR NTAPI NtUserCallOneParam(DWORD_PTR Param, DWORD Routine)
Definition: simplecall.c:153
#define TEST(x)
Definition: precomp.h:20
static HBITMAP
Definition: button.c:44
static HICON
Definition: imagelist.c:84
HICON hIcon
Definition: msconfig.c:44
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
DWORD yHotspot
Definition: winuser.h:3115
BOOL fIcon
Definition: winuser.h:3113
DWORD xHotspot
Definition: winuser.h:3114
HBITMAP hbmColor
Definition: winuser.h:3117
HBITMAP hbmMask
Definition: winuser.h:3116
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT
Definition: w32knapi.h:63
#define ZeroMemory
Definition: winbase.h:1670
#define GetModuleHandle
Definition: winbase.h:3698
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
Definition: cursoricon.c:2550
#define IMAGE_ICON
Definition: winuser.h:212
HANDLE WINAPI LoadImageA(_In_opt_ HINSTANCE hInst, _In_ LPCSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2147
#define LR_DEFAULTSIZE
Definition: winuser.h:1088
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
__wchar_t WCHAR
Definition: xmlstorage.h:180
const CHAR * LPCTSTR
Definition: xmlstorage.h:193