2010-07-14 14:56:53 +00:00
|
|
|
INT
|
|
|
|
Test_NtUserGetIconInfo(PTESTINFO pti)
|
|
|
|
{
|
|
|
|
HICON hIcon;
|
|
|
|
ICONINFO iinfo;
|
|
|
|
HBITMAP mask, color;
|
2010-07-18 16:34:14 +00:00
|
|
|
UNICODE_STRING hInstStr;
|
|
|
|
UNICODE_STRING ResourceStr;
|
|
|
|
DWORD bpp = 0;
|
2010-07-14 14:56:53 +00:00
|
|
|
|
|
|
|
ZeroMemory(&iinfo, sizeof(ICONINFO));
|
|
|
|
|
|
|
|
/* BASIC TESTS */
|
|
|
|
hIcon = (HICON) NtUserCallOneParam(0, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT);
|
|
|
|
TEST(hIcon != NULL);
|
|
|
|
|
|
|
|
/* Last param is unknown */
|
|
|
|
TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == FALSE);
|
|
|
|
TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == FALSE);
|
|
|
|
|
|
|
|
TEST(NtUserDestroyCursor(hIcon, 0) == TRUE);
|
|
|
|
|
|
|
|
mask = CreateBitmap(16,16,1,1,NULL);
|
|
|
|
color = CreateBitmap(16,16,1,16,NULL);
|
|
|
|
|
|
|
|
iinfo.hbmMask = mask;
|
|
|
|
iinfo.hbmColor = color ;
|
|
|
|
iinfo.fIcon = TRUE;
|
|
|
|
iinfo.xHotspot = 8;
|
|
|
|
iinfo.yHotspot = 8;
|
|
|
|
|
|
|
|
hIcon = CreateIconIndirect(&iinfo);
|
|
|
|
TEST(hIcon!=NULL);
|
|
|
|
|
|
|
|
// TODO : test last parameter...
|
|
|
|
TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == TRUE);
|
|
|
|
|
|
|
|
TEST(iinfo.hbmMask != NULL);
|
|
|
|
TEST(iinfo.hbmColor != NULL);
|
|
|
|
TEST(iinfo.fIcon == TRUE);
|
|
|
|
TEST(iinfo.yHotspot == 8);
|
|
|
|
TEST(iinfo.xHotspot == 8);
|
|
|
|
|
|
|
|
TEST(iinfo.hbmMask != mask);
|
|
|
|
TEST(iinfo.hbmColor != color);
|
|
|
|
|
|
|
|
/* Does it make a difference? */
|
|
|
|
TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == TRUE);
|
|
|
|
|
|
|
|
TEST(iinfo.hbmMask != NULL);
|
|
|
|
TEST(iinfo.hbmColor != NULL);
|
|
|
|
TEST(iinfo.fIcon == TRUE);
|
|
|
|
TEST(iinfo.yHotspot == 8);
|
|
|
|
TEST(iinfo.xHotspot == 8);
|
|
|
|
|
|
|
|
TEST(iinfo.hbmMask != mask);
|
|
|
|
TEST(iinfo.hbmColor != color);
|
|
|
|
|
|
|
|
DeleteObject(mask);
|
|
|
|
DeleteObject(color);
|
|
|
|
|
|
|
|
DestroyIcon(hIcon);
|
|
|
|
|
2010-07-18 16:34:14 +00:00
|
|
|
/* Test full param, with local icon */
|
|
|
|
hIcon = LoadImageA(GetModuleHandle(NULL),
|
|
|
|
MAKEINTRESOURCE(IDI_ICON),
|
|
|
|
IMAGE_ICON,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
LR_DEFAULTSIZE);
|
|
|
|
|
|
|
|
TEST(hIcon != NULL);
|
|
|
|
|
|
|
|
RtlInitUnicodeString(&hInstStr, NULL);
|
|
|
|
RtlInitUnicodeString(&ResourceStr, NULL);
|
|
|
|
|
|
|
|
TEST(NtUserGetIconInfo(hIcon,
|
|
|
|
&iinfo,
|
|
|
|
&hInstStr,
|
|
|
|
&ResourceStr,
|
|
|
|
&bpp,
|
|
|
|
FALSE) == TRUE);
|
|
|
|
|
|
|
|
TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer);
|
|
|
|
TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON));
|
|
|
|
TEST(bpp == 32);
|
|
|
|
|
|
|
|
/* Last param doesn't seem to matter*/
|
|
|
|
TEST(NtUserGetIconInfo(hIcon,
|
|
|
|
&iinfo,
|
|
|
|
&hInstStr,
|
|
|
|
&ResourceStr,
|
|
|
|
&bpp,
|
|
|
|
TRUE) == TRUE);
|
|
|
|
|
|
|
|
TESTX(hInstStr.Buffer == NULL, "hInstStr.buffer : %p\n", hInstStr.Buffer);
|
|
|
|
TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(IDI_ICON));
|
|
|
|
TEST(bpp == 32);
|
|
|
|
|
|
|
|
DestroyIcon(hIcon);
|
|
|
|
|
2010-07-18 16:57:32 +00:00
|
|
|
/* Test full param, with foreign icon */
|
|
|
|
hIcon = LoadImageA(GetModuleHandleA("shell32.dll"),
|
|
|
|
MAKEINTRESOURCE(293),
|
|
|
|
IMAGE_ICON,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
LR_DEFAULTSIZE);
|
|
|
|
|
|
|
|
TEST(hIcon != NULL);
|
|
|
|
|
2012-10-30 02:05:52 +00:00
|
|
|
hInstStr.Buffer = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR));
|
|
|
|
hInstStr.MaximumLength = MAX_PATH;
|
|
|
|
hInstStr.Length = 0;
|
2010-07-18 16:57:32 +00:00
|
|
|
RtlInitUnicodeString(&ResourceStr, NULL);
|
|
|
|
|
|
|
|
TEST(NtUserGetIconInfo(hIcon,
|
|
|
|
&iinfo,
|
|
|
|
&hInstStr,
|
|
|
|
&ResourceStr,
|
|
|
|
&bpp,
|
|
|
|
FALSE) == TRUE);
|
|
|
|
|
2012-10-30 02:05:52 +00:00
|
|
|
TEST(hInstStr.Length != 0);
|
|
|
|
hInstStr.Buffer[hInstStr.Length] = 0;
|
|
|
|
printf("%s,%i: hInstStr.buffer : %S\n", __FUNCTION__, __LINE__, hInstStr.Buffer);
|
2010-07-18 16:57:32 +00:00
|
|
|
TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(293));
|
|
|
|
TEST(ResourceStr.Length == 0);
|
|
|
|
TEST(ResourceStr.MaximumLength == 0);
|
|
|
|
TEST(bpp == 32);
|
|
|
|
|
2012-10-30 02:05:52 +00:00
|
|
|
ZeroMemory(hInstStr.Buffer, MAX_PATH*sizeof(WCHAR));
|
|
|
|
hInstStr.Length = 0;
|
2010-07-18 16:57:32 +00:00
|
|
|
RtlInitUnicodeString(&ResourceStr, NULL);
|
|
|
|
|
|
|
|
TEST(NtUserGetIconInfo(hIcon,
|
|
|
|
&iinfo,
|
|
|
|
&hInstStr,
|
|
|
|
&ResourceStr,
|
|
|
|
&bpp,
|
|
|
|
TRUE) == TRUE);
|
|
|
|
|
2012-10-30 02:05:52 +00:00
|
|
|
TEST(hInstStr.Length != 0);
|
|
|
|
hInstStr.Buffer[hInstStr.Length] = 0;
|
|
|
|
printf("%s,%i: hInstStr.buffer : %S\n", __FUNCTION__, __LINE__, hInstStr.Buffer);
|
2010-07-18 16:57:32 +00:00
|
|
|
TEST((LPCTSTR)ResourceStr.Buffer == MAKEINTRESOURCE(293));
|
|
|
|
TEST(bpp == 32);
|
|
|
|
|
|
|
|
DestroyIcon(hIcon);
|
|
|
|
|
2010-07-14 14:56:53 +00:00
|
|
|
return APISTATUS_NORMAL;
|
|
|
|
}
|