59 CComHeapPtr<BITMAPINFO> pInfoBM;
63 pInfoBM->bmiHeader.biSize =
sizeof(pInfoBM->bmiHeader);
67 size = pInfoBM->bmiHeader.biSizeImage;
100 UINT tryFlags[4] = { 0, GIL_FORSHORTCUT, GIL_OPENICON };
111 skip(
"Unable to get my own icon\n");
116 if (!pSHCreateFileExtractIconW)
118 skip(
"SHCreateFileExtractIconW not available\n");
125 CComPtr<IUnknown> spUnknown;
131 CComPtr<IUnknown> spUnknown, spUnknown2;
133 ok(
hr ==
S_OK,
"Expected hr to be S_OK, was 0x%lx for %u\n",
hr,
n);
143 bool useMyIcon =
false;
147 cur.Name = CurrentModule;
151 CComPtr<IExtractIconW> spExtract;
153 ok(
hr ==
S_OK,
"Expected hr to be S_OK, was 0x%lx for %S(%lx)\n",
hr,
cur.Name,
cur.dwFlags);
165 ok(
hr ==
S_FALSE,
"Expected hr to be S_FALSE, was 0x%lx for %S(0x%lx)\n",
hr,
cur.Name,
cur.dwFlags);
169 for (
UINT idFlags = 0; idFlags <
_countof(tryFlags); ++idFlags)
176 ok(
hr ==
S_OK,
"Expected hr to be S_OK, was 0x%lx for %S(0x%lx,0x%x)\n",
hr,
cur.Name,
cur.dwFlags, tryFlags[idFlags]);
180 ok(
wFlags & (GIL_NOTFILENAME|GIL_PERCLASS),
"Expected GIL_NOTFILENAME|GIL_PERCLASS to be set for %S(0x%lx,0x%x)\n",
cur.Name,
cur.dwFlags, tryFlags[idFlags]);
184 hr = spExtract->Extract(
Buffer, ilIndex, &ico,
NULL, 0);
191 CComHeapPtr<BYTE> colorData, maskData;
192 DWORD colorSize = 0, maskSize = 0;
194 GetIconData(ico, colorData, colorSize, maskData, maskSize);
196 if (!colorSize || !maskSize)
205 ok(shfi.
iIcon == ilIndex,
"Expected ilIndex to be 0%x, was 0x%x for %S(0x%lx,0x%x)\n", shfi.
iIcon, ilIndex,
cur.Name,
cur.dwFlags, tryFlags[idFlags]);
208 CComHeapPtr<BYTE> colorDataRef, maskDataRef;
209 DWORD colorSizeRef = 0, maskSizeRef = 0;
210 GetIconData(shfi.
hIcon, colorDataRef, colorSizeRef, maskDataRef, maskSizeRef);
212 ok(colorSizeRef == colorSize,
"Expected %lu, was %lu for %S(0x%lx,0x%x)\n", colorSizeRef, colorSize,
cur.Name,
cur.dwFlags, tryFlags[idFlags]);
213 ok(maskSizeRef == maskSize,
"Expected %lu, was %lu for %S(0x%lx,0x%x)\n", maskSizeRef, maskSize,
cur.Name,
cur.dwFlags, tryFlags[idFlags]);
215 if (colorSizeRef == colorSize)
217 ok(!
memcmp(colorData, colorDataRef, colorSize),
"Expected equal colorData for %S(0x%lx,0x%x)\n",
cur.Name,
cur.dwFlags, tryFlags[idFlags]);
220 if (maskSizeRef == maskSize)
222 ok(!
memcmp(maskData, maskDataRef, maskSize),
"Expected equal maskData for %S(0x%lx,0x%x)\n",
cur.Name,
cur.dwFlags, tryFlags[idFlags]);
229 colorSizeRef = maskSizeRef = 0;
230 GetIconData(myIcon, colorDataRef, colorSizeRef, maskDataRef, maskSizeRef);
232 ok(colorSizeRef == colorSize,
"Expected %lu, was %lu for %S(0x%lx,0x%x)\n", colorSizeRef, colorSize,
cur.Name,
cur.dwFlags, tryFlags[idFlags]);
233 ok(maskSizeRef == maskSize,
"Expected %lu, was %lu for %S(0x%lx,0x%x)\n", maskSizeRef, maskSize,
cur.Name,
cur.dwFlags, tryFlags[idFlags]);
235 if (colorSizeRef == colorSize)
240 ok(
memcmp(colorData, colorDataRef, colorSize),
"Expected colorData to be changed for %S(0x%lx,0x%x)\n",
cur.Name,
cur.dwFlags, tryFlags[idFlags]);
244 ok(!
memcmp(colorData, colorDataRef, colorSize),
"Expected equal colorData for %S(0x%lx,0x%x)\n",
cur.Name,
cur.dwFlags, tryFlags[idFlags]);
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define GetProcAddress(x, y)
#define FILE_ATTRIBUTE_NORMAL
HWND WINAPI DECLSPEC_HOTPATCH GetConsoleWindow(VOID)
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define FILE_ATTRIBUTE_DIRECTORY
const GUID IID_IPersistFile
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
#define SHGFI_SYSICONINDEX
#define SHGFI_USEFILEATTRIBUTES
HRESULT ExpectedQueryInterface
_In_ DWORD _Out_ _In_ WORD wFlags
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)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
#define IID_PPV_ARG(Itype, ppType)