93{
98
99
100 UINT tryFlags[4] = { 0, GIL_FORSHORTCUT, GIL_OPENICON };
101
103
105 {
109 if (!firet)
110 {
111 skip(
"Unable to get my own icon\n");
112 return;
113 }
114 }
115
116 if (!pSHCreateFileExtractIconW)
117 {
118 skip(
"SHCreateFileExtractIconW not available\n");
119 return;
120 }
121
123 {
124 {
125 CComPtr<IUnknown> spUnknown;
128 }
129
130 {
131 CComPtr<IUnknown> spUnknown, spUnknown2;
133 ok(
hr ==
S_OK,
"Expected hr to be S_OK, was 0x%lx for %u\n",
hr,
n);
134
137 }
138 }
139
141 {
143 bool useMyIcon = false;
144
146 {
147 cur.Name = CurrentModule;
148 useMyIcon = true;
149 }
150
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);
154
156 continue;
157
158
159 {
160 int ilIndex = -1;
163
165 ok(
hr ==
S_FALSE,
"Expected hr to be S_FALSE, was 0x%lx for %S(0x%lx)\n",
hr,
cur.Name,
cur.dwFlags);
166 }
167
168
169 for (
UINT idFlags = 0; idFlags <
_countof(tryFlags); ++idFlags)
170 {
171 int ilIndex = -1;
174
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]);
178 continue;
179
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]);
182
184 hr = spExtract->Extract(
Buffer, ilIndex, &ico,
NULL, 0);
185
186
190
191 CComHeapPtr<BYTE> colorData, maskData;
192 DWORD colorSize = 0, maskSize = 0;
193
194 GetIconData(ico, colorData, colorSize, maskData, maskSize);
195
196 if (!colorSize || !maskSize)
197 continue;
198
201
202 if (!firet)
203 continue;
204
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]);
206
207
208 CComHeapPtr<BYTE> colorDataRef, maskDataRef;
209 DWORD colorSizeRef = 0, maskSizeRef = 0;
210 GetIconData(shfi.
hIcon, colorDataRef, colorSizeRef, maskDataRef, maskSizeRef);
211
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]);
214
215 if (colorSizeRef == colorSize)
216 {
217 ok(!
memcmp(colorData, colorDataRef, colorSize),
"Expected equal colorData for %S(0x%lx,0x%x)\n",
cur.Name,
cur.dwFlags, tryFlags[idFlags]);
218 }
219
220 if (maskSizeRef == maskSize)
221 {
222 ok(!
memcmp(maskData, maskDataRef, maskSize),
"Expected equal maskData for %S(0x%lx,0x%x)\n",
cur.Name,
cur.dwFlags, tryFlags[idFlags]);
223 }
224
225 if (useMyIcon)
226 {
227 colorDataRef.Free();
228 maskDataRef.Free();
229 colorSizeRef = maskSizeRef = 0;
230 GetIconData(myIcon, colorDataRef, colorSizeRef, maskDataRef, maskSizeRef);
231
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]);
234
235 if (colorSizeRef == colorSize)
236 {
237
239 {
240 ok(
memcmp(colorData, colorDataRef, colorSize),
"Expected colorData to be changed for %S(0x%lx,0x%x)\n",
cur.Name,
cur.dwFlags, tryFlags[idFlags]);
241 }
242 else
243 {
244 ok(!
memcmp(colorData, colorDataRef, colorSize),
"Expected equal colorData for %S(0x%lx,0x%x)\n",
cur.Name,
cur.dwFlags, tryFlags[idFlags]);
245 }
246 }
247
248
249
250
251
252
253 }
254 }
255 }
256}
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)
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define FILE_ATTRIBUTE_DIRECTORY
_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
_In_ DWORD _Out_ _In_ WORD wFlags
#define IID_PPV_ARG(Itype, ppType)