ReactOS  0.4.13-dev-651-g5dbc677
resource.c File Reference
#include <assert.h>
#include <windows.h>
#include "wine/test.h"
Include dependency graph for resource.c:

Go to the source code of this file.

Functions

static UINT (WINAPI *pPrivateExtractIconsA)(LPCSTR
 
static void init_function_pointers (void)
 
static void test_LoadStringW (void)
 
static void test_LoadStringA (void)
 
static void test_accel1 (void)
 
static void test_accel2 (void)
 
static void test_PrivateExtractIcons (void)
 
static void test_LoadImage (void)
 
 START_TEST (resource)
 

Variables

static int
 
static HICON UINT UINT = NULL
 

Function Documentation

◆ init_function_pointers()

static void init_function_pointers ( void  )
static

Definition at line 28 of file resource.c.

29 {
30  HMODULE hmod = GetModuleHandleA("user32.dll");
31  pPrivateExtractIconsA = (void*)GetProcAddress(hmod, "PrivateExtractIconsA");
32 }
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
#define GetProcAddress(x, y)
Definition: compat.h:410

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( resource  )

Definition at line 410 of file resource.c.

411 {
415  test_accel1();
416  test_accel2();
418  test_LoadImage();
419 }
static void test_accel1(void)
Definition: resource.c:138
static void test_PrivateExtractIcons(void)
Definition: resource.c:340
static void init_function_pointers(void)
Definition: resource.c:28
static void test_LoadStringA(void)
Definition: resource.c:80
static void test_LoadStringW(void)
Definition: resource.c:34
static void test_LoadImage(void)
Definition: resource.c:393
static void test_accel2(void)
Definition: resource.c:236

◆ test_accel1()

static void test_accel1 ( void  )
static

Definition at line 138 of file resource.c.

139 {
140  UINT r, n;
141  HACCEL hAccel;
142  ACCEL ac[10];
143 
144  /* now create our own valid accelerator table */
145  n = 0;
146  ac[n].cmd = 1000;
147  ac[n].key = 'A';
148  ac[n++].fVirt = FVIRTKEY | FNOINVERT;
149 
150  ac[n].cmd = 1001;
151  ac[n].key = 'B';
152  ac[n++].fVirt = FNOINVERT;
153 
154  ac[n].cmd = 0;
155  ac[n].key = 0;
156  ac[n++].fVirt = 0;
157 
158  hAccel = CreateAcceleratorTableA( &ac[0], n );
159  ok( hAccel != NULL, "create accelerator table\n");
160 
162  ok( r, "destroy accelerator table\n");
163 
164  /* now try create an invalid one */
165  n = 0;
166  ac[n].cmd = 1000;
167  ac[n].key = 'A';
168  ac[n++].fVirt = FVIRTKEY | FNOINVERT;
169 
170  ac[n].cmd = 0xffff;
171  ac[n].key = 0xffff;
172  ac[n++].fVirt = (SHORT) 0xffff;
173 
174  ac[n].cmd = 0xfff0;
175  ac[n].key = 0xffff;
176  ac[n++].fVirt = (SHORT) 0xfff0;
177 
178  ac[n].cmd = 0xfff0;
179  ac[n].key = 0xffff;
180  ac[n++].fVirt = 0x0000;
181 
182  ac[n].cmd = 0xfff0;
183  ac[n].key = 0xffff;
184  ac[n++].fVirt = 0x0001;
185 
186  hAccel = CreateAcceleratorTableA( &ac[0], n );
187  ok( hAccel != NULL, "create accelerator table\n");
188 
190  ok( r == n, "two entries in table %u/%u\n", r, n);
191 
192  r = CopyAcceleratorTableA( hAccel, &ac[0], n );
193  ok( r == n, "still should be two entries in table %u/%u\n", r, n);
194 
195  n=0;
196  ok( ac[n].cmd == 1000, "cmd 0 not preserved got %x\n", ac[n].cmd);
197  ok( ac[n].key == 'A', "key 0 not preserved got %x\n", ac[n].key);
198  ok( ac[n].fVirt == (FVIRTKEY | FNOINVERT), "fVirt 0 not preserved got %x\n", ac[n].fVirt);
199 
200  if (++n == r) goto done;
201  ok( ac[n].cmd == 0xffff, "cmd 1 not preserved got %x\n", ac[n].cmd);
202  ok( ac[n].key == 0xffff, "key 1 not preserved got %x\n", ac[n].key);
203  ok( ac[n].fVirt == 0x007f, "fVirt 1 wrong got %x\n", ac[n].fVirt);
204 
205  if (++n == r) goto done;
206  ok( ac[n].cmd == 0xfff0, "cmd 2 not preserved got %x\n", ac[n].cmd);
207  ok( (ac[n].key & 0xff) == 0xff, "key 2 not preserved got %x\n", ac[n].key);
208  ok( ac[n].fVirt == 0x0070, "fVirt 2 wrong got %x\n", ac[n].fVirt);
209 
210  if (++n == r) goto done;
211  ok( ac[n].cmd == 0xfff0, "cmd 3 not preserved got %x\n", ac[n].cmd);
212  ok( (ac[n].key & 0xff) == 0xff, "key 3 not preserved got %x\n", ac[n].key);
213  ok( ac[n].fVirt == 0x0000, "fVirt 3 wrong got %x\n", ac[n].fVirt);
214 
215  if (++n == r) goto done;
216  ok( ac[n].cmd == 0xfff0, "cmd 4 not preserved got %x\n", ac[n].cmd);
217  ok( ac[n].key == 0xffff, "key 4 not preserved got %x\n", ac[n].key);
218  ok( ac[n].fVirt == 0x0001, "fVirt 4 wrong got %x\n", ac[n].fVirt);
219 done:
221  ok( r, "destroy accelerator table\n");
222 
223  hAccel = CreateAcceleratorTableA( &ac[0], 0 );
224  ok( !hAccel || broken(hAccel != NULL), /* nt4 */ "zero elements should fail\n");
225 
226  /* these will on crash win2k
227  hAccel = CreateAcceleratorTable( NULL, 1 );
228  hAccel = CreateAcceleratorTable( &ac[0], -1 );
229  */
230 }
#define FNOINVERT
Definition: winuser.h:22
Definition: ftp_var.h:139
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
BYTE fVirt
Definition: winuser.h:2897
WORD cmd
Definition: winuser.h:2899
GLdouble n
Definition: glext.h:7729
HACCEL WINAPI CreateAcceleratorTableA(_In_reads_(cAccel) LPACCEL paccel, _In_ int cAccel)
HACCEL hAccel
Definition: main.c:47
short SHORT
Definition: pedump.c:59
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
WORD key
Definition: winuser.h:2898
int WINAPI CopyAcceleratorTableA(_In_ HACCEL hAccelSrc, _Out_writes_to_opt_(cAccelEntries, return) LPACCEL lpAccelDst, _In_ int cAccelEntries)
#define broken(x)
Definition: _sntprintf.h:21
BOOL WINAPI DestroyAcceleratorTable(_In_ HACCEL)
unsigned int UINT
Definition: ndis.h:50
#define FVIRTKEY
Definition: winuser.h:24
Definition: path.c:42

Referenced by START_TEST().

◆ test_accel2()

static void test_accel2 ( void  )
static

Definition at line 236 of file resource.c.

237 {
238  ACCEL ac[2], out[2];
239  HACCEL hac;
240  int res;
241 
242  ac[0].cmd = 0;
243  ac[0].fVirt = 0;
244  ac[0].key = 0;
245 
246  ac[1].cmd = 0;
247  ac[1].fVirt = 0;
248  ac[1].key = 0;
249 
250  /*
251  * crashes on win2k
252  * hac = CreateAcceleratorTable( NULL, 1 );
253  */
254 
255  /* try a zero count */
256  hac = CreateAcceleratorTableA( &ac[0], 0 );
257  ok( !hac || broken(hac != NULL), /* nt4 */ "fail\n");
258  if (!hac) ok( !DestroyAcceleratorTable( hac ), "destroy failed\n");
259 
260  /* creating one accelerator should work */
261  hac = CreateAcceleratorTableA( &ac[0], 1 );
262  ok( hac != NULL , "fail\n");
263  ok( 1 == CopyAcceleratorTableA( hac, out, 1 ), "copy failed\n");
264  ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
265 
266  /* how about two of the same type? */
267  hac = CreateAcceleratorTableA( &ac[0], 2);
268  ok( hac != NULL , "fail\n");
269  res = CopyAcceleratorTableA( hac, NULL, 100 );
270  ok( res == 2, "copy null failed %d\n", res);
271  res = CopyAcceleratorTableA( hac, NULL, 0 );
272  ok( res == 2, "copy null failed %d\n", res);
273  res = CopyAcceleratorTableA( hac, NULL, 1 );
274  ok( res == 2, "copy null failed %d\n", res);
275  ok( 1 == CopyAcceleratorTableA( hac, out, 1 ), "copy 1 failed\n");
276  ok( 2 == CopyAcceleratorTableA( hac, out, 2 ), "copy 2 failed\n");
277  ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
278  /* ok( !memcmp( ac, out, sizeof ac ), "tables different\n"); */
279 
280  /* how about two of the same type with a non-zero key? */
281  ac[0].key = 0x20;
282  ac[1].key = 0x20;
283  hac = CreateAcceleratorTableA( &ac[0], 2);
284  ok( hac != NULL , "fail\n");
285  ok( 2 == CopyAcceleratorTableA( hac, out, 2 ), "copy 2 failed\n");
286  ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
287  /* ok( !memcmp( ac, out, sizeof ac ), "tables different\n"); */
288 
289  /* how about two of the same type with a non-zero virtual key? */
290  ac[0].fVirt = FVIRTKEY;
291  ac[0].key = 0x40;
292  ac[1].fVirt = FVIRTKEY;
293  ac[1].key = 0x40;
294  hac = CreateAcceleratorTableA( &ac[0], 2);
295  ok( hac != NULL , "fail\n");
296  ok( 2 == CopyAcceleratorTableA( hac, out, 2 ), "copy 2 failed\n");
297  /* ok( !memcmp( ac, out, sizeof ac ), "tables different\n"); */
298  ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
299 
300  /* how virtual key codes */
301  ac[0].fVirt = FVIRTKEY;
302  hac = CreateAcceleratorTableA( &ac[0], 1);
303  ok( hac != NULL , "fail\n");
304  ok( 1 == CopyAcceleratorTableA( hac, out, 2 ), "copy 2 failed\n");
305  /* ok( !memcmp( ac, out, sizeof ac/2 ), "tables different\n"); */
306  ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
307 
308  /* how turning on all bits? */
309  ac[0].cmd = 0xffff;
310  ac[0].fVirt = 0xff;
311  ac[0].key = 0xffff;
312  hac = CreateAcceleratorTableA( &ac[0], 1);
313  ok( hac != NULL , "fail\n");
314  ok( 1 == CopyAcceleratorTableA( hac, out, 1 ), "copy 1 failed\n");
315  /* ok( memcmp( ac, out, sizeof ac/2 ), "tables not different\n"); */
316  ok( out[0].cmd == ac[0].cmd, "cmd modified\n");
317  ok( out[0].fVirt == (ac[0].fVirt&0x7f), "fVirt not modified\n");
318  ok( out[0].key == ac[0].key, "key modified\n");
319  ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
320 
321  /* how turning on all bits? */
322  memset( ac, 0xff, sizeof ac );
323  hac = CreateAcceleratorTableA( &ac[0], 2);
324  ok( hac != NULL , "fail\n");
325  res = CopyAcceleratorTableA( hac, out, 2 );
326  ok( res == 2, "copy 2 failed %d\n", res);
327  /* ok( memcmp( ac, out, sizeof ac ), "tables not different\n"); */
328  ok( out[0].cmd == ac[0].cmd, "cmd modified\n");
329  ok( out[0].fVirt == (ac[0].fVirt&0x7f), "fVirt not modified\n");
330  ok( out[0].key == ac[0].key, "key modified\n");
331  if (res == 2)
332  {
333  ok( out[1].cmd == ac[1].cmd, "cmd modified\n");
334  ok( out[1].fVirt == (ac[1].fVirt&0x7f), "fVirt not modified\n");
335  ok( out[1].key == ac[1].key, "key modified\n");
336  }
337  ok( DestroyAcceleratorTable( hac ), "destroy failed\n");
338 }
Definition: ftp_var.h:139
BYTE fVirt
Definition: winuser.h:2897
WORD cmd
Definition: winuser.h:2899
HACCEL WINAPI CreateAcceleratorTableA(_In_reads_(cAccel) LPACCEL paccel, _In_ int cAccel)
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
WORD key
Definition: winuser.h:2898
static FILE * out
Definition: regtests2xml.c:44
int WINAPI CopyAcceleratorTableA(_In_ HACCEL hAccelSrc, _Out_writes_to_opt_(cAccelEntries, return) LPACCEL lpAccelDst, _In_ int cAccelEntries)
#define broken(x)
Definition: _sntprintf.h:21
BOOL WINAPI DestroyAcceleratorTable(_In_ HACCEL)
GLuint res
Definition: glext.h:9613
#define memset(x, y, z)
Definition: compat.h:39
#define FVIRTKEY
Definition: winuser.h:24
Definition: path.c:42

Referenced by START_TEST().

◆ test_LoadImage()

static void test_LoadImage ( void  )
static

Definition at line 393 of file resource.c.

394 {
395  HBITMAP bmp;
396  HRSRC hres;
397 
399  ok(bmp != NULL, "Could not load a bitmap resource\n");
400  if (bmp) DeleteObject(bmp);
401 
403  ok(hres != NULL, "Could not find a bitmap resource with a numeric string\n");
404 
405  bmp = LoadBitmapA(GetModuleHandleA(NULL), "#100");
406  ok(bmp != NULL, "Could not load a bitmap resource with a numeric string\n");
407  if (bmp) DeleteObject(bmp);
408 }
HBITMAP WINAPI LoadBitmapA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2117
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define MAKEINTRESOURCEA(i)
Definition: winuser.h:581
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
HRESULT hres
Definition: protocol.c:465
BITMAP bmp
Definition: alphablend.c:62
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
static HBITMAP
Definition: button.c:44
#define RT_BITMAP
Definition: pedump.c:364

Referenced by START_TEST().

◆ test_LoadStringA()

static void test_LoadStringA ( void  )
static

Definition at line 80 of file resource.c.

81 {
83  static const char str[] = "String resource"; /* same in resource.rc */
84  char buf[128];
85  struct string_test {
86  unsigned int bufsiz;
87  unsigned int expected;
88  };
89  struct string_test tests[] = {{sizeof buf, sizeof str - 1},
90  {sizeof str, sizeof str - 1},
91  {sizeof str - 1, sizeof str - 2}};
92  unsigned int i;
93  int ret, ret2;
94 
95  assert (sizeof str < sizeof buf);
96  for (i = 0; i < sizeof tests / sizeof tests[0]; i++) {
97  const unsigned int bufsiz = tests[i].bufsiz;
98  const unsigned int expected = tests[i].expected;
99  const int len = LoadStringA (hInst, 0, buf, bufsiz);
100 
101  ok (len == expected, "bufsiz=%d: got %d, expected %d\n",
102  bufsiz, len, expected);
103  if (len != expected) continue;
104  ok (!memcmp (buf, str, len),
105  "bufsiz=%d: got '%s', expected '%.*s'\n",
106  bufsiz, buf, len, str);
107  ok (buf[len] == 0, "bufsiz=%d: NUL termination missing\n",
108  bufsiz);
109  }
110 
111  ret = LoadStringA(hInst, 1, buf, sizeof(buf) );
112  ok( ret > 0, "LoadString failed: ret %d err %d\n", ret, GetLastError());
113  ret2 = LoadStringA( hInst, MAKELONG( 1, 0x8000 ), buf, sizeof(buf));
114  ok( ret2 == ret, "LoadString failed: ret %d err %d\n", ret, GetLastError());
115  ret2 = LoadStringA( hInst, MAKELONG( 1, 0xffff ), buf, sizeof(buf));
116  ok( ret2 == ret, "LoadString failed: ret %d err %d\n", ret, GetLastError());
117 
118  ret = LoadStringA(hInst, 65534, buf, sizeof(buf) );
119  ok( ret > 0, "LoadString failed: ret %d err %d\n", ret, GetLastError());
120  ret2 = LoadStringA( hInst, MAKELONG( 65534, 0x8000 ), buf, sizeof(buf));
121  ok( ret2 == ret, "LoadString failed: ret %d err %d\n", ret, GetLastError());
122  ret2 = LoadStringA( hInst, MAKELONG( 65534, 0xffff ), buf, sizeof(buf));
123  ok( ret2 == ret, "LoadString failed: ret %d err %d\n", ret, GetLastError());
124 
125  ret = LoadStringA(hInst, 0, buf, 0);
126  ok( ret == -1 || broken(ret == 0),
127  "LoadStringA did not return -1 when called with buflen = 0, got %d, err %d\n",
128  ret, GetLastError());
129 
130  SetLastError(0xdeadbeef);
131  buf[0] = 'a';
132  ret = LoadStringA(hInst, 1, buf, 1);
133  ok( !ret, "LoadString returned %d\n", ret);
134  ok( buf[0] == 0, "buf[0] = %c (%x)\n", buf[0], buf[0]);
135  ok( GetLastError() == 0xdeadbeef, "GetLastError() = %d\n", GetLastError());
136 }
struct param_test tests[]
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
int WINAPI LoadStringA(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPSTR lpBuffer, _In_ int cchBufferMax)
#define assert(x)
Definition: debug.h:53
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
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,...)
const WCHAR * str
#define MAKELONG(a, b)
Definition: typedefs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define SetLastError(x)
Definition: compat.h:409
int ret
GLenum GLsizei len
Definition: glext.h:6722
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define broken(x)
Definition: _sntprintf.h:21
HINSTANCE hInst
Definition: dxdiag.c:13
BOOL expected
Definition: store.c:2063

Referenced by START_TEST().

◆ test_LoadStringW()

static void test_LoadStringW ( void  )
static

Definition at line 34 of file resource.c.

35 {
37  WCHAR copiedstringw[128], returnedstringw[128], *resourcepointer = NULL;
38  char copiedstring[128], returnedstring[128];
39  int length1, length2, retvalue;
40 
41  /* Check that the string which is returned by LoadStringW matches
42  the string at the pointer returned by LoadStringW when called with buflen = 0 */
43  SetLastError(0xdeadbeef);
44  length1 = LoadStringW(hInst, 2, (WCHAR *) &resourcepointer, 0); /* get pointer to resource. */
45  if (!length1)
46  {
48  win_skip( "LoadStringW not implemented\n" );
49  else
50  win_skip( "LoadStringW does not return a pointer to the resource\n" );
51  return;
52  }
53  length2 = LoadStringW(hInst, 2, returnedstringw, sizeof(returnedstringw) /sizeof(WCHAR)); /* get resource string */
54  ok(length2 > 0, "LoadStringW failed to load resource 2, ret %d, err %d\n", length2, GetLastError());
55  ok(length1 == length2, "LoadStringW returned different values dependent on buflen. ret1 %d, ret2 %d\n",
56  length1, length2);
57  ok(length1 > 0 && resourcepointer != NULL, "LoadStringW failed to get pointer to resource 2, ret %d, err %d\n",
58  length1, GetLastError());
59 
60  /* Copy the resource since it is not '\0' terminated, and add '\0' to the end */
61  if(resourcepointer != NULL) /* Check that the resource pointer was loaded to avoid access violation */
62  {
63  memcpy(copiedstringw, resourcepointer, length1 * sizeof(WCHAR));
64  copiedstringw[length1] = '\0';
65  /* check that strings match */
66  WideCharToMultiByte( CP_ACP, 0, returnedstringw, -1, returnedstring, 128, NULL, NULL );
67  WideCharToMultiByte( CP_ACP, 0, copiedstringw, -1, copiedstring, 128, NULL, NULL );
68  ok(!memcmp(copiedstringw, returnedstringw, (length2 + 1)*sizeof(WCHAR)),
69  "strings don't match: returnedstring = %s, copiedstring = %s\n", returnedstring, copiedstring);
70  }
71 
72  /* check that calling LoadStringW with buffer = NULL returns zero */
73  retvalue = LoadStringW(hInst, 2, NULL, 0);
74  ok(!retvalue, "LoadStringW returned a non-zero value when called with buffer = NULL, retvalue = %d\n", retvalue);
75  /* check again, with a different buflen value, that calling LoadStringW with buffer = NULL returns zero */
76  retvalue = LoadStringW(hInst, 2, NULL, 128);
77  ok(!retvalue, "LoadStringW returned a non-zero value when called with buffer = NULL, retvalue = %d\n", retvalue);
78 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SetLastError(x)
Definition: compat.h:409
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
HINSTANCE hInst
Definition: dxdiag.c:13
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_PrivateExtractIcons()

static void test_PrivateExtractIcons ( void  )
static

Definition at line 340 of file resource.c.

340  {
341  const CHAR szShell32Dll[] = "shell32.dll";
342  HICON ahIcon[256];
343  UINT i, aIconId[256], cIcons, cIcons2;
344 
345  if (!pPrivateExtractIconsA) return;
346 
347  cIcons = pPrivateExtractIconsA("", 0, 16, 16, ahIcon, aIconId, 1, 0);
348  ok(cIcons == ~0u, "got %u\n", cIcons);
349 
350  cIcons = pPrivateExtractIconsA("notepad.exe", 0, 16, 16, NULL, NULL, 1, 0);
351  ok(cIcons == 1 || broken(cIcons == 2) /* win2k */, "got %u\n", cIcons);
352 
353  ahIcon[0] = (HICON)0xdeadbeef;
354  cIcons = pPrivateExtractIconsA("notepad.exe", 0, 16, 16, ahIcon, NULL, 1, 0);
355  ok(cIcons == 1, "got %u\n", cIcons);
356  ok(ahIcon[0] != (HICON)0xdeadbeef, "icon not set\n");
357  DestroyIcon(ahIcon[0]);
358 
359  ahIcon[0] = (HICON)0xdeadbeef;
360  aIconId[0] = 0xdeadbeef;
361  cIcons = pPrivateExtractIconsA("notepad.exe", 0, 16, 16, ahIcon, aIconId, 1, 0);
362  ok(cIcons == 1, "got %u\n", cIcons);
363  ok(ahIcon[0] != (HICON)0xdeadbeef, "icon not set\n");
364  ok(aIconId[0] != 0xdeadbeef, "id not set\n");
365  DestroyIcon(ahIcon[0]);
366 
367  cIcons = pPrivateExtractIconsA(szShell32Dll, 0, 16, 16, NULL, NULL, 0, 0);
368  cIcons2 = pPrivateExtractIconsA(szShell32Dll, 4, MAKELONG(32,16), MAKELONG(32,16),
369  NULL, NULL, 256, 0);
370  ok((cIcons == cIcons2) && (cIcons > 0),
371  "Icon count should be independent of requested icon sizes and base icon index! "
372  "(cIcons=%d, cIcons2=%d)\n", cIcons, cIcons2);
373 
374  cIcons = pPrivateExtractIconsA(szShell32Dll, 0, 16, 16, ahIcon, aIconId, 0, 0);
375  ok(cIcons == 0, "Zero icons requested, got cIcons=%d\n", cIcons);
376 
377  cIcons = pPrivateExtractIconsA(szShell32Dll, 0, 16, 16, ahIcon, aIconId, 3, 0);
378  ok(cIcons == 3, "Three icons requested got cIcons=%d\n", cIcons);
379  for (i = 0; i < cIcons; i++) DestroyIcon(ahIcon[i]);
380 
381  /* count must be a multiple of two when getting two sizes */
382  cIcons = pPrivateExtractIconsA(szShell32Dll, 0, MAKELONG(16,32), MAKELONG(16,32),
383  ahIcon, aIconId, 3, 0);
384  ok(cIcons == 0 /* vista */ || cIcons == 4, "Three icons requested got cIcons=%d\n", cIcons);
385  for (i = 0; i < cIcons; i++) DestroyIcon(ahIcon[i]);
386 
387  cIcons = pPrivateExtractIconsA(szShell32Dll, 0, MAKELONG(16,32), MAKELONG(16,32),
388  ahIcon, aIconId, 4, 0);
389  ok(cIcons == 4, "Four icons requested got cIcons=%d\n", cIcons);
390  for (i = 0; i < cIcons; i++) DestroyIcon(ahIcon[i]);
391 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
static HICON
Definition: imagelist.c:84
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
char CHAR
Definition: xmlstorage.h:175
UINT cIcons
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,...)
#define MAKELONG(a, b)
Definition: typedefs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define broken(x)
Definition: _sntprintf.h:21
unsigned int UINT
Definition: ndis.h:50

Referenced by START_TEST().

◆ UINT()

static UINT ( WINAPI pPrivateExtractIconsA)
static

Variable Documentation

◆ int

int

Definition at line 26 of file resource.c.

◆ UINT

Definition at line 26 of file resource.c.