1 | /*
|
---|
2 | * shell icon cache (SIC)
|
---|
3 | *
|
---|
4 | */
|
---|
5 | #include <string.h>
|
---|
6 | #include <odin.h>
|
---|
7 |
|
---|
8 | #define ICOM_CINTERFACE 1
|
---|
9 | #define CINTERFACE 1
|
---|
10 |
|
---|
11 | #include "winbase.h"
|
---|
12 | #include "winuser.h"
|
---|
13 | #include "wingdi.h"
|
---|
14 | //#include "wine/winuser16.h"
|
---|
15 | //#include "wine/winbase16.h"
|
---|
16 | //#include "neexe.h"
|
---|
17 | #include "cursoricon.h"
|
---|
18 | #include "module.h"
|
---|
19 | #include "heap.h"
|
---|
20 | #include "debugtools.h"
|
---|
21 | #include "winversion.h"
|
---|
22 |
|
---|
23 | #include "shellapi.h"
|
---|
24 | #include "pidl.h"
|
---|
25 | #include "shell32_main.h"
|
---|
26 |
|
---|
27 | #include <heapstring.h>
|
---|
28 | #include <misc.h>
|
---|
29 |
|
---|
30 | DEFAULT_DEBUG_CHANNEL(shell)
|
---|
31 |
|
---|
32 | #include "pshpack1.h"
|
---|
33 |
|
---|
34 | typedef struct
|
---|
35 | {
|
---|
36 | BYTE bWidth; /* Width, in pixels, of the image */
|
---|
37 | BYTE bHeight; /* Height, in pixels, of the image */
|
---|
38 | BYTE bColorCount; /* Number of colors in image (0 if >=8bpp) */
|
---|
39 | BYTE bReserved; /* Reserved ( must be 0) */
|
---|
40 | WORD wPlanes; /* Color Planes */
|
---|
41 | WORD wBitCount; /* Bits per pixel */
|
---|
42 | DWORD dwBytesInRes; /* How many bytes in this resource? */
|
---|
43 | DWORD dwImageOffset; /* Where in the file is this image? */
|
---|
44 | } icoICONDIRENTRY, *LPicoICONDIRENTRY;
|
---|
45 |
|
---|
46 | typedef struct
|
---|
47 | {
|
---|
48 | WORD idReserved; /* Reserved (must be 0) */
|
---|
49 | WORD idType; /* Resource Type (RES_ICON or RES_CURSOR) */
|
---|
50 | WORD idCount; /* How many images */
|
---|
51 | icoICONDIRENTRY idEntries[1]; /* An entry for each image (idCount of 'em) */
|
---|
52 | } icoICONDIR, *LPicoICONDIR;
|
---|
53 |
|
---|
54 | #include "poppack.h"
|
---|
55 |
|
---|
56 | #if 0
|
---|
57 | static void dumpIcoDirEnty ( LPicoICONDIRENTRY entry )
|
---|
58 | {
|
---|
59 | TRACE("width = 0x%08x height = 0x%08x\n", entry->bWidth, entry->bHeight);
|
---|
60 | TRACE("colors = 0x%08x planes = 0x%08x\n", entry->bColorCount, entry->wPlanes);
|
---|
61 | TRACE("bitcount = 0x%08x bytesinres = 0x%08lx offset = 0x%08lx\n",
|
---|
62 | entry->wBitCount, entry->dwBytesInRes, entry->dwImageOffset);
|
---|
63 | }
|
---|
64 | static void dumpIcoDir ( LPicoICONDIR entry )
|
---|
65 | {
|
---|
66 | TRACE("type = 0x%08x count = 0x%08x\n", entry->idType, entry->idCount);
|
---|
67 | }
|
---|
68 | #endif
|
---|
69 |
|
---|
70 |
|
---|
71 | HDPA sic_hdpa = 0;
|
---|
72 | static CRITICAL_SECTION SHELL32_SicCS;
|
---|
73 |
|
---|
74 |
|
---|
75 |
|
---|
76 | /*************************************************************************
|
---|
77 | * SHELL_GetResourceTable
|
---|
78 | */
|
---|
79 | static DWORD SHELL_GetResourceTable(HFILE hFile, LPBYTE *retptr)
|
---|
80 | { IMAGE_DOS_HEADER mz_header;
|
---|
81 | char magic[4];
|
---|
82 | int size;
|
---|
83 |
|
---|
84 | TRACE("0x%08x %p\n", hFile, retptr);
|
---|
85 |
|
---|
86 | *retptr = NULL;
|
---|
87 | _llseek( hFile, 0, SEEK_SET );
|
---|
88 | if ((_lread(hFile,&mz_header,sizeof(mz_header)) != sizeof(mz_header)) || (mz_header.e_magic != IMAGE_DOS_SIGNATURE))
|
---|
89 | { if (mz_header.e_cblp == 1) /* .ICO file ? */
|
---|
90 | { *retptr = (LPBYTE)-1; /* ICONHEADER.idType, must be 1 */
|
---|
91 | return 1;
|
---|
92 | }
|
---|
93 | else
|
---|
94 | return 0; /* failed */
|
---|
95 | }
|
---|
96 | _llseek( hFile, mz_header.e_lfanew, SEEK_SET );
|
---|
97 |
|
---|
98 | if (_lread( hFile, magic, sizeof(magic) ) != sizeof(magic))
|
---|
99 | return 0;
|
---|
100 |
|
---|
101 | _llseek( hFile, mz_header.e_lfanew, SEEK_SET);
|
---|
102 |
|
---|
103 | if (*(DWORD*)magic == IMAGE_NT_SIGNATURE)
|
---|
104 | return IMAGE_NT_SIGNATURE;
|
---|
105 |
|
---|
106 | if (*(WORD*)magic == IMAGE_OS2_SIGNATURE)
|
---|
107 | { IMAGE_OS2_HEADER ne_header;
|
---|
108 | LPBYTE pTypeInfo = (LPBYTE)-1;
|
---|
109 |
|
---|
110 | if (_lread(hFile,&ne_header,sizeof(ne_header))!=sizeof(ne_header))
|
---|
111 | return 0;
|
---|
112 |
|
---|
113 | if (ne_header.ne_magic != IMAGE_OS2_SIGNATURE)
|
---|
114 | return 0;
|
---|
115 |
|
---|
116 | size = ne_header.rname_tab_offset - ne_header.resource_tab_offset;
|
---|
117 |
|
---|
118 | //@@@PH no NE support
|
---|
119 | #if 0
|
---|
120 | if( size > sizeof(NE_TYPEINFO) )
|
---|
121 | { pTypeInfo = (BYTE*)HeapAlloc( GetProcessHeap(), 0, size);
|
---|
122 | if( pTypeInfo )
|
---|
123 | { _llseek(hFile, mz_header.e_lfanew+ne_header.resource_tab_offset, SEEK_SET);
|
---|
124 | if( _lread( hFile, (char*)pTypeInfo, size) != size )
|
---|
125 | { HeapFree( GetProcessHeap(), 0, pTypeInfo);
|
---|
126 | pTypeInfo = NULL;
|
---|
127 | }
|
---|
128 | }
|
---|
129 | }
|
---|
130 | #endif
|
---|
131 |
|
---|
132 | *retptr = pTypeInfo;
|
---|
133 | return IMAGE_OS2_SIGNATURE;
|
---|
134 | }
|
---|
135 | return 0; /* failed */
|
---|
136 | }
|
---|
137 | /*************************************************************************
|
---|
138 | * SHELL_LoadResource
|
---|
139 | */
|
---|
140 | //@@@PH no NE support
|
---|
141 | #if 0
|
---|
142 | static BYTE * SHELL_LoadResource( HFILE hFile, NE_NAMEINFO* pNInfo, WORD sizeShift, ULONG *uSize)
|
---|
143 | { BYTE* ptr;
|
---|
144 |
|
---|
145 | TRACE("0x%08x %p 0x%08x\n", hFile, pNInfo, sizeShift);
|
---|
146 |
|
---|
147 | *uSize = (DWORD)pNInfo->length << sizeShift;
|
---|
148 | if( (ptr = (BYTE*)HeapAlloc(GetProcessHeap(),0, *uSize) ))
|
---|
149 | { _llseek( hFile, (DWORD)pNInfo->offset << sizeShift, SEEK_SET);
|
---|
150 | _lread( hFile, (char*)ptr, pNInfo->length << sizeShift);
|
---|
151 | return ptr;
|
---|
152 | }
|
---|
153 | return 0;
|
---|
154 | }
|
---|
155 | #endif
|
---|
156 |
|
---|
157 | /*************************************************************************
|
---|
158 | * ICO_LoadIcon
|
---|
159 | */
|
---|
160 | static BYTE * ICO_LoadIcon( HFILE hFile, LPicoICONDIRENTRY lpiIDE, ULONG *uSize)
|
---|
161 | { BYTE* ptr;
|
---|
162 |
|
---|
163 | TRACE("0x%08x %p\n", hFile, lpiIDE);
|
---|
164 |
|
---|
165 | *uSize = lpiIDE->dwBytesInRes;
|
---|
166 | if( (ptr = (BYTE*)HeapAlloc(GetProcessHeap(),0, *uSize)) )
|
---|
167 | { _llseek( hFile, lpiIDE->dwImageOffset, SEEK_SET);
|
---|
168 | _lread( hFile, (char*)ptr, lpiIDE->dwBytesInRes);
|
---|
169 | return ptr;
|
---|
170 | }
|
---|
171 |
|
---|
172 | return 0;
|
---|
173 | }
|
---|
174 |
|
---|
175 | /*************************************************************************
|
---|
176 | * ICO_GetIconDirectory
|
---|
177 | *
|
---|
178 | * Reads .ico file and build phony ICONDIR struct
|
---|
179 | * see http://www.microsoft.com/win32dev/ui/icons.htm
|
---|
180 | */
|
---|
181 | #define HEADER_SIZE (sizeof(CURSORICONDIR) - sizeof (CURSORICONDIRENTRY))
|
---|
182 | #define HEADER_SIZE_FILE (sizeof(icoICONDIR) - sizeof (icoICONDIRENTRY))
|
---|
183 |
|
---|
184 | static BYTE * ICO_GetIconDirectory( HFILE hFile, LPicoICONDIR* lplpiID, ULONG *uSize )
|
---|
185 | { CURSORICONDIR lpcid; /* icon resource in resource-dir format */
|
---|
186 | LPicoICONDIR lpiID; /* icon resource in file format */
|
---|
187 | int i;
|
---|
188 |
|
---|
189 | TRACE("0x%08x %p\n", hFile, lplpiID);
|
---|
190 |
|
---|
191 | _llseek( hFile, 0, SEEK_SET );
|
---|
192 | if( _lread(hFile,(char*)&lpcid, HEADER_SIZE_FILE) != HEADER_SIZE_FILE )
|
---|
193 | return 0;
|
---|
194 |
|
---|
195 | if( lpcid.idReserved || (lpcid.idType != 1) || (!lpcid.idCount) )
|
---|
196 | return 0;
|
---|
197 |
|
---|
198 | i = lpcid.idCount * sizeof(icoICONDIRENTRY);
|
---|
199 | lpiID = (LPicoICONDIR)HeapAlloc( GetProcessHeap(), 0, HEADER_SIZE_FILE + i);
|
---|
200 |
|
---|
201 | if( _lread(hFile,(char*)lpiID->idEntries,i) == i )
|
---|
202 | { CURSORICONDIR * lpID; /* icon resource in resource format */
|
---|
203 | *uSize = lpcid.idCount * sizeof(CURSORICONDIRENTRY) + HEADER_SIZE;
|
---|
204 | if( (lpID = (CURSORICONDIR*)HeapAlloc(GetProcessHeap(),0, *uSize) ))
|
---|
205 | {
|
---|
206 | /* copy the header */
|
---|
207 | lpID->idReserved = lpiID->idReserved = 0;
|
---|
208 | lpID->idType = lpiID->idType = 1;
|
---|
209 | lpID->idCount = lpiID->idCount = lpcid.idCount;
|
---|
210 |
|
---|
211 | /* copy the entrys */
|
---|
212 | for( i=0; i < lpiID->idCount; i++ )
|
---|
213 | { memcpy((void*)&(lpID->idEntries[i]),(void*)&(lpiID->idEntries[i]), sizeof(CURSORICONDIRENTRY) - 2);
|
---|
214 | lpID->idEntries[i].wResId = i;
|
---|
215 | }
|
---|
216 |
|
---|
217 | *lplpiID = lpiID;
|
---|
218 | return (BYTE *)lpID;
|
---|
219 | }
|
---|
220 | }
|
---|
221 | /* fail */
|
---|
222 |
|
---|
223 | HeapFree( GetProcessHeap(), 0, lpiID);
|
---|
224 | return 0;
|
---|
225 | }
|
---|
226 |
|
---|
227 | /*************************************************************************
|
---|
228 | * InternalExtractIcon [SHELL.39]
|
---|
229 | *
|
---|
230 | * This abortion is called directly by Progman
|
---|
231 | * fixme: the icon section is broken (don't have a handle for
|
---|
232 | * ICO_GetIconDirectory....)
|
---|
233 | *
|
---|
234 | */
|
---|
235 | #define ICO_INVALID_FILE 1
|
---|
236 | #define ICO_NO_ICONS 0
|
---|
237 |
|
---|
238 | HGLOBAL WINAPI ICO_ExtractIconEx(LPCSTR lpszExeFileName, HICON * RetPtr, UINT nIconIndex, UINT n, UINT cxDesired, UINT cyDesired )
|
---|
239 | {
|
---|
240 | dprintf (("SHELL32: ICO_ExtractIconEx not implemented.\n"));
|
---|
241 | return 0;
|
---|
242 | }
|
---|
243 |
|
---|
244 | // @@@PH turned off
|
---|
245 | #if 0
|
---|
246 | { HGLOBAL hRet = ICO_NO_ICONS;
|
---|
247 | LPBYTE pData;
|
---|
248 | OFSTRUCT ofs;
|
---|
249 | DWORD sig;
|
---|
250 | HFILE hFile = OpenFile( lpszExeFileName, &ofs, OF_READ );
|
---|
251 | UINT16 iconDirCount = 0,iconCount = 0;
|
---|
252 | LPBYTE peimage;
|
---|
253 | HANDLE fmapping;
|
---|
254 | ULONG uSize;
|
---|
255 |
|
---|
256 | TRACE("(file %s,start %d,extract %d\n", lpszExeFileName, nIconIndex, n);
|
---|
257 |
|
---|
258 | if( hFile == HFILE_ERROR || !n )
|
---|
259 | return ICO_INVALID_FILE;
|
---|
260 |
|
---|
261 | sig = SHELL_GetResourceTable(hFile,&pData);
|
---|
262 |
|
---|
263 | //@@@PH no NE support
|
---|
264 | #if 0
|
---|
265 | /* ico file */
|
---|
266 | if( sig==IMAGE_OS2_SIGNATURE || sig==1 ) /* .ICO file */
|
---|
267 | { BYTE *pCIDir = 0;
|
---|
268 | NE_TYPEINFO *pTInfo = (NE_TYPEINFO*)(pData + 2);
|
---|
269 | NE_NAMEINFO *pIconStorage = NULL;
|
---|
270 | NE_NAMEINFO *pIconDir = NULL;
|
---|
271 | LPicoICONDIR lpiID = NULL;
|
---|
272 |
|
---|
273 | TRACE("-- OS2/icon Signature (0x%08lx)\n", sig);
|
---|
274 |
|
---|
275 | if( pData == (BYTE*)-1 )
|
---|
276 | { pCIDir = ICO_GetIconDirectory(hFile, &lpiID, &uSize); /* check for .ICO file */
|
---|
277 | if( pCIDir )
|
---|
278 | { iconDirCount = 1; iconCount = lpiID->idCount;
|
---|
279 | TRACE("-- icon found %p 0x%08lx 0x%08x 0x%08x\n", pCIDir, uSize, iconDirCount, iconCount);
|
---|
280 | }
|
---|
281 | }
|
---|
282 | else while( pTInfo->type_id && !(pIconStorage && pIconDir) )
|
---|
283 | { if( pTInfo->type_id == NE_RSCTYPE_GROUP_ICON ) /* find icon directory and icon repository */
|
---|
284 | { iconDirCount = pTInfo->count;
|
---|
285 | pIconDir = ((NE_NAMEINFO*)(pTInfo + 1));
|
---|
286 | TRACE("\tfound directory - %i icon families\n", iconDirCount);
|
---|
287 | }
|
---|
288 | if( pTInfo->type_id == NE_RSCTYPE_ICON )
|
---|
289 | { iconCount = pTInfo->count;
|
---|
290 | pIconStorage = ((NE_NAMEINFO*)(pTInfo + 1));
|
---|
291 | TRACE("\ttotal icons - %i\n", iconCount);
|
---|
292 | }
|
---|
293 | pTInfo = (NE_TYPEINFO *)((char*)(pTInfo+1)+pTInfo->count*sizeof(NE_NAMEINFO));
|
---|
294 | }
|
---|
295 |
|
---|
296 | if( (pIconStorage && pIconDir) || lpiID ) /* load resources and create icons */
|
---|
297 | { if( nIconIndex == (UINT16)-1 )
|
---|
298 | { RetPtr[0] = iconDirCount;
|
---|
299 | }
|
---|
300 | else if( nIconIndex < iconDirCount )
|
---|
301 | { UINT16 i, icon;
|
---|
302 | if( n > iconDirCount - nIconIndex )
|
---|
303 | n = iconDirCount - nIconIndex;
|
---|
304 |
|
---|
305 | for( i = nIconIndex; i < nIconIndex + n; i++ )
|
---|
306 | { /* .ICO files have only one icon directory */
|
---|
307 |
|
---|
308 | if( lpiID == NULL ) /* *.ico */
|
---|
309 | pCIDir = SHELL_LoadResource( hFile, pIconDir + i, *(WORD*)pData, &uSize );
|
---|
310 | RetPtr[i-nIconIndex] = pLookupIconIdFromDirectoryEx( pCIDir, TRUE, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0);
|
---|
311 | HeapFree(GetProcessHeap(), 0, pCIDir);
|
---|
312 | }
|
---|
313 |
|
---|
314 | for( icon = nIconIndex; icon < nIconIndex + n; icon++ )
|
---|
315 | { pCIDir = NULL;
|
---|
316 | if( lpiID )
|
---|
317 | { pCIDir = ICO_LoadIcon( hFile, lpiID->idEntries + RetPtr[icon-nIconIndex], &uSize);
|
---|
318 | }
|
---|
319 | else
|
---|
320 | { for( i = 0; i < iconCount; i++ )
|
---|
321 | { if( pIconStorage[i].id == (RetPtr[icon-nIconIndex] | 0x8000) )
|
---|
322 | { pCIDir = SHELL_LoadResource( hFile, pIconStorage + i,*(WORD*)pData, &uSize );
|
---|
323 | }
|
---|
324 | }
|
---|
325 | }
|
---|
326 | if( pCIDir )
|
---|
327 | { RetPtr[icon-nIconIndex] = (HICON) pCreateIconFromResourceEx(pCIDir,uSize,TRUE,0x00030000, cxDesired, cyDesired, LR_DEFAULTCOLOR);
|
---|
328 | }
|
---|
329 | else
|
---|
330 | { RetPtr[icon-nIconIndex] = 0;
|
---|
331 | }
|
---|
332 | }
|
---|
333 | }
|
---|
334 | }
|
---|
335 | if( lpiID )
|
---|
336 | HeapFree( GetProcessHeap(), 0, lpiID);
|
---|
337 | else
|
---|
338 | HeapFree( GetProcessHeap(), 0, pData);
|
---|
339 | }
|
---|
340 | /* end ico file */
|
---|
341 | #endif
|
---|
342 |
|
---|
343 | /* exe/dll */
|
---|
344 | if( sig == IMAGE_NT_SIGNATURE)
|
---|
345 | { LPBYTE idata,igdata;
|
---|
346 | PIMAGE_DOS_HEADER dheader;
|
---|
347 | PIMAGE_NT_HEADERS pe_header;
|
---|
348 | PIMAGE_SECTION_HEADER pe_sections;
|
---|
349 | PIMAGE_RESOURCE_DIRECTORY rootresdir,iconresdir,icongroupresdir;
|
---|
350 | PIMAGE_RESOURCE_DATA_ENTRY idataent,igdataent;
|
---|
351 | PIMAGE_RESOURCE_DIRECTORY_ENTRY xresent;
|
---|
352 | int i,j;
|
---|
353 |
|
---|
354 | if ( !(fmapping = CreateFileMappingA(hFile,NULL,PAGE_READONLY|SEC_COMMIT,0,0,NULL)))
|
---|
355 | { WARN("failed to create filemap.\n"); /* FIXME, INVALID_HANDLE_VALUE? */
|
---|
356 | hRet = ICO_INVALID_FILE;
|
---|
357 | goto end_2; /* failure */
|
---|
358 | }
|
---|
359 |
|
---|
360 | if ( !(peimage = (BYTE*)MapViewOfFile(fmapping,FILE_MAP_READ,0,0,0)))
|
---|
361 | { WARN("failed to mmap filemap.\n");
|
---|
362 | hRet = ICO_INVALID_FILE;
|
---|
363 | goto end_2; /* failure */
|
---|
364 | }
|
---|
365 |
|
---|
366 | dheader = (PIMAGE_DOS_HEADER)peimage;
|
---|
367 | pe_header = (PIMAGE_NT_HEADERS)(peimage+dheader->e_lfanew); /* it is a pe header, SHELL_GetResourceTable checked that */
|
---|
368 | pe_sections = (PIMAGE_SECTION_HEADER)(((char*)pe_header)+sizeof(*pe_header)); /* probably makes problems with short PE headers...*/
|
---|
369 | rootresdir = NULL;
|
---|
370 |
|
---|
371 | for (i=0;i<pe_header->FileHeader.NumberOfSections;i++)
|
---|
372 | { if (pe_sections[i].Characteristics & IMAGE_SCN_CNT_UNINITIALIZED_DATA)
|
---|
373 | continue;
|
---|
374 | /* FIXME: doesn't work when the resources are not in a seperate section */
|
---|
375 | if (pe_sections[i].VirtualAddress == pe_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress)
|
---|
376 | { rootresdir = (PIMAGE_RESOURCE_DIRECTORY)((char*)peimage+pe_sections[i].PointerToRawData);
|
---|
377 | break;
|
---|
378 | }
|
---|
379 | }
|
---|
380 |
|
---|
381 | if (!rootresdir)
|
---|
382 | { WARN("haven't found section for resource directory.\n");
|
---|
383 | goto end_4; /* failure */
|
---|
384 | }
|
---|
385 | /* search the group icon dir*/
|
---|
386 | if (!(icongroupresdir = GetResDirEntryW(rootresdir,RT_GROUP_ICONW, (DWORD)rootresdir,FALSE)))
|
---|
387 | { WARN("No Icongroupresourcedirectory!\n");
|
---|
388 | goto end_4; /* failure */
|
---|
389 | }
|
---|
390 | iconDirCount = icongroupresdir->NumberOfNamedEntries+icongroupresdir->NumberOfIdEntries;
|
---|
391 |
|
---|
392 | /* number of icons requested */
|
---|
393 | if( nIconIndex == -1 )
|
---|
394 | { hRet = iconDirCount;
|
---|
395 | goto end_3; /* success */
|
---|
396 | }
|
---|
397 |
|
---|
398 | if (nIconIndex >= iconDirCount)
|
---|
399 | { WARN("nIconIndex %d is larger than iconDirCount %d\n",nIconIndex,iconDirCount);
|
---|
400 | goto end_4; /* failure */
|
---|
401 | }
|
---|
402 |
|
---|
403 | xresent = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)(icongroupresdir+1); /* caller just wanted the number of entries */
|
---|
404 |
|
---|
405 | if( n > iconDirCount - nIconIndex ) /* assure we don't get too much ... */
|
---|
406 | { n = iconDirCount - nIconIndex;
|
---|
407 | }
|
---|
408 |
|
---|
409 | xresent = xresent+nIconIndex; /* starting from specified index ... */
|
---|
410 |
|
---|
411 | for (i=0;i<n;i++,xresent++)
|
---|
412 | { PIMAGE_RESOURCE_DIRECTORY resdir;
|
---|
413 |
|
---|
414 | /* go down this resource entry, name */
|
---|
415 | resdir = (PIMAGE_RESOURCE_DIRECTORY)((DWORD)rootresdir+(xresent->u2.s.OffsetToDirectory));
|
---|
416 |
|
---|
417 | /* default language (0) */
|
---|
418 | resdir = GetResDirEntryW(resdir,(LPWSTR)0,(DWORD)rootresdir,TRUE);
|
---|
419 | igdataent = (PIMAGE_RESOURCE_DATA_ENTRY)resdir;
|
---|
420 |
|
---|
421 | /* lookup address in mapped image for virtual address */
|
---|
422 | igdata = NULL;
|
---|
423 |
|
---|
424 | for (j=0;j<pe_header->FileHeader.NumberOfSections;j++)
|
---|
425 | { if (igdataent->OffsetToData < pe_sections[j].VirtualAddress)
|
---|
426 | continue;
|
---|
427 | if (igdataent->OffsetToData+igdataent->Size > pe_sections[j].VirtualAddress+pe_sections[j].SizeOfRawData)
|
---|
428 | continue;
|
---|
429 | igdata = peimage+(igdataent->OffsetToData-pe_sections[j].VirtualAddress+pe_sections[j].PointerToRawData);
|
---|
430 | }
|
---|
431 |
|
---|
432 | if (!igdata)
|
---|
433 | { WARN("no matching real address for icongroup!\n");
|
---|
434 | goto end_4; /* failure */
|
---|
435 | }
|
---|
436 | RetPtr[i] = (HICON)pLookupIconIdFromDirectoryEx(igdata, TRUE, cxDesired, cyDesired, LR_DEFAULTCOLOR);
|
---|
437 | }
|
---|
438 |
|
---|
439 | if (!(iconresdir=GetResDirEntryW(rootresdir,RT_ICONW,(DWORD)rootresdir,FALSE)))
|
---|
440 | { WARN("No Iconresourcedirectory!\n");
|
---|
441 | goto end_4; /* failure */
|
---|
442 | }
|
---|
443 |
|
---|
444 | for (i=0;i<n;i++)
|
---|
445 | { PIMAGE_RESOURCE_DIRECTORY xresdir;
|
---|
446 | xresdir = GetResDirEntryW(iconresdir,(LPWSTR)(DWORD)RetPtr[i],(DWORD)rootresdir,FALSE);
|
---|
447 | xresdir = GetResDirEntryW(xresdir,(LPWSTR)0,(DWORD)rootresdir,TRUE);
|
---|
448 | idataent = (PIMAGE_RESOURCE_DATA_ENTRY)xresdir;
|
---|
449 | idata = NULL;
|
---|
450 |
|
---|
451 | /* map virtual to address in image */
|
---|
452 | for (j=0;j<pe_header->FileHeader.NumberOfSections;j++)
|
---|
453 | { if (idataent->OffsetToData < pe_sections[j].VirtualAddress)
|
---|
454 | continue;
|
---|
455 | if (idataent->OffsetToData+idataent->Size > pe_sections[j].VirtualAddress+pe_sections[j].SizeOfRawData)
|
---|
456 | continue;
|
---|
457 | idata = peimage+(idataent->OffsetToData-pe_sections[j].VirtualAddress+pe_sections[j].PointerToRawData);
|
---|
458 | }
|
---|
459 | if (!idata)
|
---|
460 | { WARN("no matching real address found for icondata!\n");
|
---|
461 | RetPtr[i]=0;
|
---|
462 | continue;
|
---|
463 | }
|
---|
464 | RetPtr[i] = (HICON) pCreateIconFromResourceEx(idata,idataent->Size,TRUE,0x00030000, cxDesired, cyDesired, LR_DEFAULTCOLOR);
|
---|
465 | }
|
---|
466 | hRet = RetPtr[0]; /* return first icon */
|
---|
467 | goto end_3; /* sucess */
|
---|
468 | }
|
---|
469 | hRet = ICO_INVALID_FILE;
|
---|
470 | goto end_1; /* unknown filetype */
|
---|
471 |
|
---|
472 | /* cleaning up (try & catch would be nicer:-) ) */
|
---|
473 | end_4: hRet = 0; /* failure */
|
---|
474 | end_3: UnmapViewOfFile(peimage); /* success */
|
---|
475 | end_2: CloseHandle(fmapping);
|
---|
476 | end_1: _lclose( hFile);
|
---|
477 | return hRet;
|
---|
478 | }
|
---|
479 | #endif
|
---|
480 |
|
---|
481 | /********************** THE ICON CACHE ********************************/
|
---|
482 |
|
---|
483 | #define INVALID_INDEX -1
|
---|
484 |
|
---|
485 | typedef struct
|
---|
486 | { LPCSTR sSourceFile; /* file (not path!) containing the icon */
|
---|
487 | DWORD dwSourceIndex; /* index within the file, if it is a resoure ID it will be negated */
|
---|
488 | DWORD dwListIndex; /* index within the iconlist */
|
---|
489 | DWORD dwFlags; /* GIL_* flags */
|
---|
490 | DWORD dwAccessTime;
|
---|
491 | } SIC_ENTRY, * LPSIC_ENTRY;
|
---|
492 |
|
---|
493 | /*****************************************************************************
|
---|
494 | * SIC_CompareEntrys [called by comctl32.dll]
|
---|
495 | *
|
---|
496 | * NOTES
|
---|
497 | * Callback for DPA_Search
|
---|
498 | */
|
---|
499 | INT CALLBACK SIC_CompareEntrys( LPVOID p1, LPVOID p2, LPARAM lparam)
|
---|
500 | { TRACE("%p %p\n", p1, p2);
|
---|
501 |
|
---|
502 | if (((LPSIC_ENTRY)p1)->dwSourceIndex != ((LPSIC_ENTRY)p2)->dwSourceIndex) /* first the faster one*/
|
---|
503 | return 1;
|
---|
504 |
|
---|
505 | if (strcmp(((LPSIC_ENTRY)p1)->sSourceFile,((LPSIC_ENTRY)p2)->sSourceFile))
|
---|
506 | return 1;
|
---|
507 |
|
---|
508 | return 0;
|
---|
509 | }
|
---|
510 | /*****************************************************************************
|
---|
511 | * SIC_IconAppend [internal]
|
---|
512 | *
|
---|
513 | * NOTES
|
---|
514 | * appends a icon pair to the end of the cache
|
---|
515 | */
|
---|
516 | static INT SIC_IconAppend (LPCSTR sSourceFile, INT dwSourceIndex, HICON hSmallIcon, HICON hBigIcon)
|
---|
517 | { LPSIC_ENTRY lpsice;
|
---|
518 | INT ret, index, index1;
|
---|
519 |
|
---|
520 | TRACE("%s %i %x %x\n", sSourceFile, dwSourceIndex, hSmallIcon ,hBigIcon);
|
---|
521 |
|
---|
522 | lpsice = (LPSIC_ENTRY) SHAlloc (sizeof (SIC_ENTRY));
|
---|
523 |
|
---|
524 | lpsice->sSourceFile = HEAP_strdupA (GetProcessHeap(), 0, PathFindFilenameA(sSourceFile));
|
---|
525 | lpsice->dwSourceIndex = dwSourceIndex;
|
---|
526 |
|
---|
527 | EnterCriticalSection(&SHELL32_SicCS);
|
---|
528 |
|
---|
529 | index = pDPA_InsertPtr(sic_hdpa, 0x7fff, lpsice);
|
---|
530 | if ( INVALID_INDEX == index )
|
---|
531 | {
|
---|
532 | SHFree(lpsice);
|
---|
533 | ret = INVALID_INDEX;
|
---|
534 | }
|
---|
535 | else
|
---|
536 | {
|
---|
537 | index = pImageList_AddIcon (ShellSmallIconList, hSmallIcon);
|
---|
538 | index1= pImageList_AddIcon (ShellBigIconList, hBigIcon);
|
---|
539 |
|
---|
540 | if (index!=index1)
|
---|
541 | {
|
---|
542 | FIXME("iconlists out of sync 0x%x 0x%x\n", index, index1);
|
---|
543 | }
|
---|
544 | lpsice->dwListIndex = index;
|
---|
545 | ret = lpsice->dwListIndex;
|
---|
546 | }
|
---|
547 |
|
---|
548 | LeaveCriticalSection(&SHELL32_SicCS);
|
---|
549 | return ret;
|
---|
550 | }
|
---|
551 | /****************************************************************************
|
---|
552 | * SIC_LoadIcon [internal]
|
---|
553 | *
|
---|
554 | * NOTES
|
---|
555 | * gets small/big icon by number from a file
|
---|
556 | */
|
---|
557 | static INT SIC_LoadIcon (LPCSTR sSourceFile, INT dwSourceIndex)
|
---|
558 | { HICON hiconLarge=0;
|
---|
559 | HICON hiconSmall=0;
|
---|
560 |
|
---|
561 | ICO_ExtractIconEx(sSourceFile, &hiconLarge, dwSourceIndex, 1, 32, 32 );
|
---|
562 | ICO_ExtractIconEx(sSourceFile, &hiconSmall, dwSourceIndex, 1, 16, 16 );
|
---|
563 |
|
---|
564 |
|
---|
565 | if ( !hiconLarge || !hiconSmall)
|
---|
566 | {
|
---|
567 | WARN("failure loading icon %i from %s (%x %x)\n", dwSourceIndex, sSourceFile, hiconLarge, hiconSmall);
|
---|
568 | return -1;
|
---|
569 | }
|
---|
570 | return SIC_IconAppend (sSourceFile, dwSourceIndex, hiconSmall, hiconLarge);
|
---|
571 | }
|
---|
572 | /*****************************************************************************
|
---|
573 | * SIC_GetIconIndex [internal]
|
---|
574 | *
|
---|
575 | * Parameters
|
---|
576 | * sSourceFile [IN] filename of file containing the icon
|
---|
577 | * index [IN] index/resID (negated) in this file
|
---|
578 | *
|
---|
579 | * NOTES
|
---|
580 | * look in the cache for a proper icon. if not available the icon is taken
|
---|
581 | * from the file and cached
|
---|
582 | */
|
---|
583 | INT SIC_GetIconIndex (LPCSTR sSourceFile, INT dwSourceIndex )
|
---|
584 | { SIC_ENTRY sice;
|
---|
585 | INT ret, index = INVALID_INDEX;
|
---|
586 |
|
---|
587 | TRACE("%s %i\n", sSourceFile, dwSourceIndex);
|
---|
588 |
|
---|
589 | sice.sSourceFile = PathFindFilenameA(sSourceFile);
|
---|
590 | sice.dwSourceIndex = dwSourceIndex;
|
---|
591 |
|
---|
592 | EnterCriticalSection(&SHELL32_SicCS);
|
---|
593 |
|
---|
594 | if (NULL != pDPA_GetPtr (sic_hdpa, 0))
|
---|
595 | {
|
---|
596 | index = pDPA_Search (sic_hdpa, &sice, -1L, (PFNDPACOMPARE)SIC_CompareEntrys, 0, 0);
|
---|
597 | }
|
---|
598 |
|
---|
599 | if ( INVALID_INDEX == index )
|
---|
600 | {
|
---|
601 | ret = SIC_LoadIcon (sSourceFile, dwSourceIndex);
|
---|
602 | }
|
---|
603 | else
|
---|
604 | {
|
---|
605 | TRACE("-- found\n");
|
---|
606 | ret = ((LPSIC_ENTRY)pDPA_GetPtr(sic_hdpa, index))->dwListIndex;
|
---|
607 | }
|
---|
608 |
|
---|
609 | LeaveCriticalSection(&SHELL32_SicCS);
|
---|
610 | return ret;
|
---|
611 | }
|
---|
612 | /****************************************************************************
|
---|
613 | * SIC_LoadIcon [internal]
|
---|
614 | *
|
---|
615 | * NOTES
|
---|
616 | * retrives the specified icon from the iconcache. if not found try's to load the icon
|
---|
617 | */
|
---|
618 | static HICON WINE_UNUSED SIC_GetIcon (LPCSTR sSourceFile, INT dwSourceIndex, BOOL bSmallIcon )
|
---|
619 | { INT index;
|
---|
620 |
|
---|
621 | TRACE("%s %i\n", sSourceFile, dwSourceIndex);
|
---|
622 |
|
---|
623 | index = SIC_GetIconIndex(sSourceFile, dwSourceIndex);
|
---|
624 |
|
---|
625 | if (INVALID_INDEX == index)
|
---|
626 | {
|
---|
627 | return INVALID_INDEX;
|
---|
628 | }
|
---|
629 |
|
---|
630 | if (bSmallIcon)
|
---|
631 | return pImageList_GetIcon(ShellSmallIconList, index, ILD_NORMAL);
|
---|
632 | return pImageList_GetIcon(ShellBigIconList, index, ILD_NORMAL);
|
---|
633 |
|
---|
634 | }
|
---|
635 | /*****************************************************************************
|
---|
636 | * SIC_Initialize [internal]
|
---|
637 | *
|
---|
638 | * NOTES
|
---|
639 | * hack to load the resources from the shell32.dll under a different dll name
|
---|
640 | * will be removed when the resource-compiler is ready
|
---|
641 | */
|
---|
642 | BOOL SIC_Initialize(void)
|
---|
643 | {
|
---|
644 | HICON hSm, hLg;
|
---|
645 | UINT index;
|
---|
646 |
|
---|
647 | TRACE("\n");
|
---|
648 |
|
---|
649 | if (sic_hdpa) /* already initialized?*/
|
---|
650 | return TRUE;
|
---|
651 |
|
---|
652 | InitializeCriticalSection(&SHELL32_SicCS);
|
---|
653 |
|
---|
654 | sic_hdpa = pDPA_Create(16);
|
---|
655 |
|
---|
656 | if (!sic_hdpa)
|
---|
657 | {
|
---|
658 | return(FALSE);
|
---|
659 | }
|
---|
660 |
|
---|
661 | ShellSmallIconList = pImageList_Create(16,16,ILC_COLORDDB | ILC_MASK,0,0x20);
|
---|
662 | ShellBigIconList = pImageList_Create(32,32,ILC_COLORDDB | ILC_MASK,0,0x20);
|
---|
663 |
|
---|
664 | pImageList_SetBkColor(ShellSmallIconList, GetSysColor(COLOR_WINDOW));
|
---|
665 | pImageList_SetBkColor(ShellBigIconList, GetSysColor(COLOR_WINDOW));
|
---|
666 |
|
---|
667 | for (index=1; index<39; index++)
|
---|
668 | {
|
---|
669 | hSm = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(index), IMAGE_ICON, 16, 16,LR_SHARED);
|
---|
670 | hLg = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(index), IMAGE_ICON, 32, 32,LR_SHARED);
|
---|
671 |
|
---|
672 | if(!hSm)
|
---|
673 | {
|
---|
674 | hSm = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(0), IMAGE_ICON, 16, 16,LR_SHARED);
|
---|
675 | hLg = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(0), IMAGE_ICON, 32, 32,LR_SHARED);
|
---|
676 | }
|
---|
677 | SIC_IconAppend ("shell32.dll", index, hSm, hLg);
|
---|
678 | }
|
---|
679 |
|
---|
680 | TRACE("hIconSmall=%p hIconBig=%p\n",ShellSmallIconList, ShellBigIconList);
|
---|
681 |
|
---|
682 | return TRUE;
|
---|
683 | }
|
---|
684 | /*************************************************************************
|
---|
685 | * SIC_Destroy
|
---|
686 | *
|
---|
687 | * frees the cache
|
---|
688 | */
|
---|
689 | void SIC_Destroy(void)
|
---|
690 | {
|
---|
691 | LPSIC_ENTRY lpsice;
|
---|
692 | int i;
|
---|
693 |
|
---|
694 | TRACE("\n");
|
---|
695 |
|
---|
696 | EnterCriticalSection(&SHELL32_SicCS);
|
---|
697 |
|
---|
698 | if (sic_hdpa && NULL != pDPA_GetPtr (sic_hdpa, 0))
|
---|
699 | {
|
---|
700 | for (i=0; i < pDPA_GetPtrCount(sic_hdpa); ++i)
|
---|
701 | {
|
---|
702 | lpsice = (LPSIC_ENTRY)pDPA_GetPtr(sic_hdpa, i);
|
---|
703 | SHFree(lpsice);
|
---|
704 | }
|
---|
705 | pDPA_Destroy(sic_hdpa);
|
---|
706 | }
|
---|
707 |
|
---|
708 | sic_hdpa = NULL;
|
---|
709 |
|
---|
710 | LeaveCriticalSection(&SHELL32_SicCS);
|
---|
711 | }
|
---|
712 | /*************************************************************************
|
---|
713 | * Shell_GetImageList [SHELL32.71]
|
---|
714 | *
|
---|
715 | * PARAMETERS
|
---|
716 | * imglist[1|2] [OUT] pointer which recive imagelist handles
|
---|
717 | *
|
---|
718 | */
|
---|
719 | BOOL WINAPI Shell_GetImageList(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList)
|
---|
720 | { TRACE("(%p,%p)\n",lpBigList,lpSmallList);
|
---|
721 | if (lpBigList)
|
---|
722 | { *lpBigList = ShellBigIconList;
|
---|
723 | }
|
---|
724 | if (lpSmallList)
|
---|
725 | { *lpSmallList = ShellSmallIconList;
|
---|
726 | }
|
---|
727 |
|
---|
728 | return TRUE;
|
---|
729 | }
|
---|
730 | /*************************************************************************
|
---|
731 | * PidlToSicIndex [INTERNAL]
|
---|
732 | *
|
---|
733 | * PARAMETERS
|
---|
734 | * sh [IN] IShellFolder
|
---|
735 | * pidl [IN]
|
---|
736 | * bBigIcon [IN]
|
---|
737 | * pIndex [OUT] index within the SIC
|
---|
738 | *
|
---|
739 | */
|
---|
740 | BOOL PidlToSicIndex (IShellFolder * sh, LPITEMIDLIST pidl, BOOL bBigIcon, UINT * pIndex)
|
---|
741 | {
|
---|
742 | IExtractIcon *ei;
|
---|
743 | char szIconFile[MAX_PATH]; /* file containing the icon */
|
---|
744 | INT iSourceIndex; /* index or resID(negated) in this file */
|
---|
745 | BOOL ret = FALSE;
|
---|
746 | UINT dwFlags = 0;
|
---|
747 |
|
---|
748 | TRACE("sf=%p pidl=%p\n", sh, pidl);
|
---|
749 |
|
---|
750 | if (SUCCEEDED (IShellFolder_GetUIObjectOf(sh, 0, 1, &pidl, &IID_IExtractIconA, 0, (void **)&ei)))
|
---|
751 | {
|
---|
752 | if (NOERROR==IExtractIconA_GetIconLocation(ei, 0, szIconFile, MAX_PATH, &iSourceIndex, &dwFlags))
|
---|
753 | { *pIndex = SIC_GetIconIndex(szIconFile, iSourceIndex);
|
---|
754 | ret = TRUE;
|
---|
755 | }
|
---|
756 | IExtractIconA_Release(ei);
|
---|
757 | }
|
---|
758 |
|
---|
759 | if (INVALID_INDEX == *pIndex) /* default icon when failed */
|
---|
760 | *pIndex = 1;
|
---|
761 |
|
---|
762 | return ret;
|
---|
763 |
|
---|
764 | }
|
---|
765 |
|
---|
766 | /*************************************************************************
|
---|
767 | * SHMapPIDLToSystemImageListIndex [SHELL32.77]
|
---|
768 | *
|
---|
769 | * PARAMETERS
|
---|
770 | * sh [IN] pointer to an instance of IShellFolder
|
---|
771 | * pidl [IN]
|
---|
772 | * pIndex [OUT][OPTIONAL] SIC index for big icon
|
---|
773 | *
|
---|
774 | */
|
---|
775 | UINT WINAPI SHMapPIDLToSystemImageListIndex(LPSHELLFOLDER sh, LPITEMIDLIST pidl, UINT * pIndex)
|
---|
776 | {
|
---|
777 | UINT Index;
|
---|
778 |
|
---|
779 | TRACE("(SF=%p,pidl=%p,%p)\n",sh,pidl,pIndex);
|
---|
780 | pdump(pidl);
|
---|
781 |
|
---|
782 | if (pIndex)
|
---|
783 | PidlToSicIndex ( sh, pidl, 1, pIndex);
|
---|
784 | PidlToSicIndex ( sh, pidl, 0, &Index);
|
---|
785 | return Index;
|
---|
786 | }
|
---|
787 |
|
---|
788 | /*************************************************************************
|
---|
789 | * Shell_GetCachedImageIndex [SHELL32.72]
|
---|
790 | *
|
---|
791 | */
|
---|
792 | INT WINAPI Shell_GetCachedImageIndexA(LPCSTR szPath, INT nIndex, BOOL bSimulateDoc)
|
---|
793 | {
|
---|
794 | WARN("(%s,%08x,%08x) semi-stub.\n",debugstr_a(szPath), nIndex, bSimulateDoc);
|
---|
795 | return SIC_GetIconIndex(szPath, nIndex);
|
---|
796 | }
|
---|
797 |
|
---|
798 | INT WINAPI Shell_GetCachedImageIndexW(LPCWSTR szPath, INT nIndex, BOOL bSimulateDoc)
|
---|
799 | { INT ret;
|
---|
800 | LPSTR sTemp = HEAP_strdupWtoA (GetProcessHeap(),0,szPath);
|
---|
801 |
|
---|
802 | WARN("(%s,%08x,%08x) semi-stub.\n",debugstr_w(szPath), nIndex, bSimulateDoc);
|
---|
803 |
|
---|
804 | ret = SIC_GetIconIndex(sTemp, nIndex);
|
---|
805 | HeapFree(GetProcessHeap(),0,sTemp);
|
---|
806 | return ret;
|
---|
807 | }
|
---|
808 |
|
---|
809 | INT WINAPI Shell_GetCachedImageIndexAW(LPCVOID szPath, INT nIndex, BOOL bSimulateDoc)
|
---|
810 | { if( VERSION_OsIsUnicode())
|
---|
811 | return Shell_GetCachedImageIndexW((LPWSTR)szPath, nIndex, bSimulateDoc);
|
---|
812 | return Shell_GetCachedImageIndexA((LPSTR)szPath, nIndex, bSimulateDoc);
|
---|
813 | }
|
---|
814 |
|
---|
815 | /*************************************************************************
|
---|
816 | * ExtracticonExAW [shell32.189]
|
---|
817 | */
|
---|
818 | HICON WINAPI ExtractIconExAW ( LPCVOID lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons )
|
---|
819 | { if (VERSION_OsIsUnicode())
|
---|
820 | return ExtractIconExW ( (LPWSTR)lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
|
---|
821 | return ExtractIconExA ( (LPSTR)lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
|
---|
822 | }
|
---|
823 | /*************************************************************************
|
---|
824 | * ExtracticonExA [shell32.190]
|
---|
825 | * RETURNS
|
---|
826 | * 0 no icon found
|
---|
827 | * 1 file is not valid
|
---|
828 | * HICON handle of a icon (phiconLarge/Small == NULL)
|
---|
829 | */
|
---|
830 | HICON WINAPI ExtractIconExA ( LPCSTR lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons )
|
---|
831 | { HICON ret=0;
|
---|
832 |
|
---|
833 | TRACE("file=%s idx=%i %p %p num=%i\n", lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons );
|
---|
834 |
|
---|
835 | if (nIconIndex==-1) /* Number of icons requested */
|
---|
836 | return ICO_ExtractIconEx(lpszFile, NULL, -1, 0, 0, 0 );
|
---|
837 |
|
---|
838 |
|
---|
839 | if (phiconLarge)
|
---|
840 | { ret = ICO_ExtractIconEx(lpszFile, phiconLarge, nIconIndex, nIcons, 32, 32 );
|
---|
841 | if ( nIcons==1)
|
---|
842 | { ret = phiconLarge[0];
|
---|
843 | }
|
---|
844 | }
|
---|
845 |
|
---|
846 | /* if no pointers given and one icon expected, return the handle directly*/
|
---|
847 | if (!phiconLarge && ! phiconSmall && nIcons==1 )
|
---|
848 | phiconSmall = &ret;
|
---|
849 |
|
---|
850 | if (phiconSmall)
|
---|
851 | { ret = ICO_ExtractIconEx(lpszFile, phiconSmall, nIconIndex, nIcons, 16, 16 );
|
---|
852 | if ( nIcons==1 )
|
---|
853 | { ret = phiconSmall[0];
|
---|
854 | }
|
---|
855 | }
|
---|
856 |
|
---|
857 | return ret;
|
---|
858 | }
|
---|
859 | /*************************************************************************
|
---|
860 | * ExtracticonExW [shell32.191]
|
---|
861 | */
|
---|
862 | HICON WINAPI ExtractIconExW ( LPCWSTR lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons )
|
---|
863 | { LPSTR sFile;
|
---|
864 | DWORD ret;
|
---|
865 |
|
---|
866 | TRACE("file=%s idx=%i %p %p num=%i\n", debugstr_w(lpszFile), nIconIndex, phiconLarge, phiconSmall, nIcons );
|
---|
867 |
|
---|
868 | sFile = HEAP_strdupWtoA (GetProcessHeap(),0,lpszFile);
|
---|
869 | ret = ExtractIconExA ( sFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
|
---|
870 | HeapFree(GetProcessHeap(),0,sFile);
|
---|
871 | return ret;
|
---|
872 | }
|
---|