2 * PROJECT: ReactOS api tests
3 * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
4 * PURPOSE: Test for PrivateExtractIcons
5 * PROGRAMMER: Hermes Belusca-Maito
13 UINT cIcons
; // Return value from PrivateExtractIconsW
14 BOOL bhIconValid
; // Whether or not the returned icon handle is not NULL.
17 /* Executables with icons */
18 {L
"notepad.exe", 1, TRUE
},
19 {L
"%SystemRoot%\\System32\\cmd.exe", 1, TRUE
},
21 /* Executable without icon */
22 {L
"%SystemRoot%\\System32\\autochk.exe", 0, FALSE
},
25 {L
"%SystemRoot%\\System32\\shell32.dll", 1, TRUE
},
27 /* Non-existing files */
28 {L
"%SystemRoot%\\non-existent-file.sdf", 0xFFFFFFFF, FALSE
},
31 START_TEST(PrivateExtractIcons
)
34 UINT i
, aIconId
, cIcons
;
36 for (i
= 0; i
< _countof(IconTests
); ++i
)
38 /* Always test extraction of the FIRST icon (index 0) */
39 ahIcon
= (HICON
)0xdeadbeef;
41 cIcons
= PrivateExtractIconsW(IconTests
[i
].FilePath
, 0, 16, 16, &ahIcon
, &aIconId
, 1, 0);
42 ok(cIcons
== IconTests
[i
].cIcons
, "PrivateExtractIconsW(%u): got %u, expected %u\n", i
, cIcons
, IconTests
[i
].cIcons
);
43 ok(ahIcon
!= (HICON
)0xdeadbeef, "PrivateExtractIconsW(%u): icon not set\n", i
);
44 ok((IconTests
[i
].bhIconValid
&& ahIcon
) || (!IconTests
[i
].bhIconValid
&& !ahIcon
),
45 "PrivateExtractIconsW(%u): icon expected to be %s, but got 0x%p\n",
46 i
, IconTests
[i
].bhIconValid
? "valid" : "not valid", ahIcon
);
47 ok(aIconId
!= 0xdeadbeef, "PrivateExtractIconsW(%u): id not set\n", i
);
48 if (ahIcon
&& ahIcon
!= (HICON
)0xdeadbeef)