ReactOS 0.4.16-dev-979-g79f281e
exticon.c
Go to the documentation of this file.
1/*
2 * icon extracting
3 *
4 * taken and slightly changed from shell
5 * this should replace the icon extraction code in shell32 and shell16 once
6 * it needs a serious test for compliance with the native API
7 *
8 * Copyright 2000 Juergen Schmied
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <user32.h>
26
27#ifndef ARRAY_SIZE
28#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
29#endif
30
31/* Start of Hack section */
32
34
35#include <pshpack1.h>
36
37typedef struct
38{
39 BYTE bWidth; /* Width, in pixels, of the image */
40 BYTE bHeight; /* Height, in pixels, of the image */
41 BYTE bColorCount; /* Number of colors in image (0 if >=8bpp) */
42 BYTE bReserved; /* Reserved ( must be 0) */
43 WORD wPlanes; /* Color Planes */
44 WORD wBitCount; /* Bits per pixel */
45 DWORD dwBytesInRes; /* How many bytes in this resource? */
46 DWORD dwImageOffset; /* Where in the file is this image? */
48
49typedef struct
50{
51 WORD idReserved; /* Reserved (must be 0) */
52 WORD idType; /* Resource Type (RES_ICON or RES_CURSOR) */
53 WORD idCount; /* How many images */
54 icoICONDIRENTRY idEntries[1]; /* An entry for each image (idCount of 'em) */
56
57typedef struct
58{
61 WORD flags;
62 WORD id;
64 WORD usage;
66
67typedef struct
68{
70 WORD count;
71 DWORD resloader;
73
74#ifdef __REACTOS__
75// From: James Houghtaling
76// https://www.moon-soft.com/program/FORMAT/windows/ani.htm
77typedef struct taganiheader
78{
79 DWORD cbsizeof; // num bytes in aniheader (36 bytes)
80 DWORD cframes; // number of unique icons in this cursor
81 DWORD csteps; // number of blits before the animation cycles
82 DWORD cx; // reserved, must be zero.
83 DWORD cy; // reserved, must be zero.
84 DWORD cbitcount; // reserved, must be zero.
85 DWORD cplanes; // reserved, must be zero.
86 DWORD jifrate; // default jiffies (1/60th sec) if rate chunk not present.
87 DWORD flags; // animation flag
88} aniheader;
89#endif
90
91#define NE_RSCTYPE_ICON 0x8003
92#define NE_RSCTYPE_GROUP_ICON 0x800e
93
94#include <poppack.h>
95
96#if 0
97static void dumpIcoDirEnty ( LPicoICONDIRENTRY entry )
98{
99 TRACE("width = 0x%08x height = 0x%08x\n", entry->bWidth, entry->bHeight);
100 TRACE("colors = 0x%08x planes = 0x%08x\n", entry->bColorCount, entry->wPlanes);
101 TRACE("bitcount = 0x%08x bytesinres = 0x%08lx offset = 0x%08lx\n",
102 entry->wBitCount, entry->dwBytesInRes, entry->dwImageOffset);
103}
104static void dumpIcoDir ( LPicoICONDIR entry )
105{
106 TRACE("type = 0x%08x count = 0x%08x\n", entry->idType, entry->idCount);
107}
108#endif
109
110#ifndef WINE
113 int cxDesired,
114 int cyDesired,
115 BOOL bIcon,
116 DWORD fuLoad,
117 POINT *ptHotSpot);
118#endif
119
120/**********************************************************************
121 * find_entry_by_id
122 *
123 * Find an entry by id in a resource directory
124 * Copied from loader/pe_resource.c (FIXME: should use exported resource functions)
125 */
127 WORD id, const void *root )
128{
130 int min, max, pos;
131
133 min = dir->NumberOfNamedEntries;
134 max = min + dir->NumberOfIdEntries - 1;
135 while (min <= max)
136 {
137 pos = (min + max) / 2;
138 if (entry[pos].Id == id)
139 return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].OffsetToDirectory);
140 if (entry[pos].Id > id) max = pos - 1;
141 else min = pos + 1;
142 }
143 return NULL;
144}
145
146/**********************************************************************
147 * find_entry_default
148 *
149 * Find a default entry in a resource directory
150 * Copied from loader/pe_resource.c (FIXME: should use exported resource functions)
151 */
153 const void *root )
154{
157 return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry->OffsetToDirectory);
158}
159
160/*************************************************************************
161 * USER32_GetResourceTable
162 */
163static DWORD USER32_GetResourceTable(LPBYTE peimage,DWORD pesize,LPBYTE *retptr)
164{
165 IMAGE_DOS_HEADER * mz_header;
166
167 TRACE("%p %p\n", peimage, retptr);
168
169 *retptr = NULL;
170
171 mz_header = (IMAGE_DOS_HEADER*) peimage;
172
173 if (mz_header->e_magic != IMAGE_DOS_SIGNATURE)
174 {
175 if (mz_header->e_cblp == 1 || mz_header->e_cblp == 2) /* .ICO or .CUR file ? */
176 {
177 *retptr = (LPBYTE)-1; /* ICONHEADER.idType, must be 1 */
178 return mz_header->e_cblp;
179 }
180 else
181 return 0; /* failed */
182 }
183 if (mz_header->e_lfanew >= pesize) {
184 return 0; /* failed, happens with PKZIP DOS Exes for instance. */
185 }
186 if (*((DWORD*)(peimage + mz_header->e_lfanew)) == IMAGE_NT_SIGNATURE )
187 return IMAGE_NT_SIGNATURE;
188
189 if (*((WORD*)(peimage + mz_header->e_lfanew)) == IMAGE_OS2_SIGNATURE )
190 {
191 IMAGE_OS2_HEADER * ne_header;
192
193 ne_header = (IMAGE_OS2_HEADER*)(peimage + mz_header->e_lfanew);
194
195 if (ne_header->ne_magic != IMAGE_OS2_SIGNATURE)
196 return 0;
197
198 if( (ne_header->ne_restab - ne_header->ne_rsrctab) <= sizeof(NE_TYPEINFO) )
199 *retptr = (LPBYTE)-1;
200 else
201 *retptr = peimage + mz_header->e_lfanew + ne_header->ne_rsrctab;
202
203 return IMAGE_OS2_SIGNATURE;
204 }
205 return 0; /* failed */
206}
207/*************************************************************************
208 * USER32_LoadResource
209 */
210static BYTE * USER32_LoadResource( LPBYTE peimage, NE_NAMEINFO* pNInfo, WORD sizeShift, ULONG *uSize)
211{
212 TRACE("%p %p 0x%08x\n", peimage, pNInfo, sizeShift);
213
214 *uSize = (DWORD)pNInfo->length << sizeShift;
215 return peimage + ((DWORD)pNInfo->offset << sizeShift);
216}
217
218/*************************************************************************
219 * ICO_LoadIcon
220 */
221static BYTE * ICO_LoadIcon( LPBYTE peimage, LPicoICONDIRENTRY lpiIDE, ULONG *uSize)
222{
223 TRACE("%p %p\n", peimage, lpiIDE);
224
225 *uSize = lpiIDE->dwBytesInRes;
226 return peimage + lpiIDE->dwImageOffset;
227}
228
229/*************************************************************************
230 * ICO_GetIconDirectory
231 *
232 * Reads .ico file and build phony ICONDIR struct
233 */
234static BYTE * ICO_GetIconDirectory( LPBYTE peimage, LPicoICONDIR* lplpiID, ULONG *uSize )
235{
236 CURSORICONDIR * lpcid; /* icon resource in resource-dir format */
237 CURSORICONDIR * lpID; /* icon resource in resource format */
238 int i;
239
240 TRACE("%p %p\n", peimage, lplpiID);
241
242 lpcid = (CURSORICONDIR*)peimage;
243
244 if( lpcid->idReserved || (lpcid->idType != 1) || (!lpcid->idCount) )
245 return 0;
246
247 /* allocate the phony ICONDIR structure */
248 *uSize = FIELD_OFFSET(CURSORICONDIR, idEntries[lpcid->idCount]);
249 if( (lpID = HeapAlloc(GetProcessHeap(),0, *uSize) ))
250 {
251 /* copy the header */
252 lpID->idReserved = lpcid->idReserved;
253 lpID->idType = lpcid->idType;
254 lpID->idCount = lpcid->idCount;
255
256 /* copy the entries */
257 for( i=0; i < lpcid->idCount; i++ )
258 {
259 memcpy(&lpID->idEntries[i], &lpcid->idEntries[i], sizeof(CURSORICONDIRENTRY) - 2);
260 lpID->idEntries[i].wResId = i;
261 }
262
263 *lplpiID = (LPicoICONDIR)peimage;
264 return (BYTE *)lpID;
265 }
266 return 0;
267}
268
269/*************************************************************************
270 * ICO_ExtractIconExW [internal]
271 *
272 * NOTES
273 * nIcons = 0: returns number of Icons in file
274 *
275 * returns
276 * invalid file: -1
277 * failure:0;
278 * success: number of icons in file (nIcons = 0) or nr of icons retrieved
279 */
281 LPCWSTR lpszExeFileName,
282 HICON * RetPtr,
283 INT nIconIndex,
284 UINT nIcons,
285 UINT cxDesired,
286 UINT cyDesired,
287 UINT *pIconId,
288#ifdef __REACTOS__
289 UINT flags,
290 /* This function is called from two different code paths.
291 * One is from Shell32 using the ExtractIconEx function.
292 * The other is from User32 using PrivateExtractIcons.
293 * Based on W2K3SP2 testing, the count of icons returned
294 * is zero (0) for PNG ones using ExtractIconEx and
295 * one (1) for PNG icons using PrivateExtractIcons.
296 * We can handle the difference using the fIconEx flag.*/
297 BOOL fIconEx)
298#else
299 UINT flags)
300#endif
301{
302 UINT ret = 0;
303 UINT cx1, cx2, cy1, cy2;
305 DWORD sig;
307 UINT16 iconDirCount = 0,iconCount = 0;
308 LPBYTE peimage;
309 HANDLE fmapping;
310 DWORD fsizeh,fsizel;
311#ifdef __REACTOS__
312 WCHAR szExpandedExePath[MAX_PATH];
313#endif
314 WCHAR szExePath[MAX_PATH];
315 DWORD dwSearchReturn;
316
317#ifdef __REACTOS__
318 TRACE("%s, %d, %d, %p, 0x%08x, %d\n", debugstr_w(lpszExeFileName), nIconIndex, nIcons, pIconId, flags, fIconEx);
319#else
320 TRACE("%s, %d, %d %p 0x%08x\n", debugstr_w(lpszExeFileName), nIconIndex, nIcons, pIconId, flags);
321#endif
322
323#ifdef __REACTOS__
324 if (RetPtr)
325 *RetPtr = NULL;
326
327 if (ExpandEnvironmentStringsW(lpszExeFileName, szExpandedExePath, ARRAY_SIZE(szExpandedExePath)))
328 lpszExeFileName = szExpandedExePath;
329#endif
330
331 dwSearchReturn = SearchPathW(NULL, lpszExeFileName, NULL, ARRAY_SIZE(szExePath), szExePath, NULL);
332 if ((dwSearchReturn == 0) || (dwSearchReturn > ARRAY_SIZE(szExePath)))
333 {
334#ifdef __REACTOS__
335 WARN("File %s not found or path too long and fIconEx is '%d'\n",
336 debugstr_w(lpszExeFileName), fIconEx);
337 if (fIconEx && !RetPtr && !pIconId)
338 return 0;
339 else
340 return -1;
341#else
342 WARN("File %s not found or path too long\n", debugstr_w(lpszExeFileName));
343 return -1;
344#endif
345 }
346
348 if (hFile == INVALID_HANDLE_VALUE) return ret;
349 fsizel = GetFileSize(hFile,&fsizeh);
350#ifdef __REACTOS__
351 if (!(fsizel | fsizeh))
352 {
353 /* Cannot map empty file */
355 return 0; /* No icons */
356 }
357#endif
358
359 /* Map the file */
362 if (!fmapping)
363 {
364 WARN("CreateFileMapping error %ld\n", GetLastError() );
365 return 0xFFFFFFFF;
366 }
367
368 if (!(peimage = MapViewOfFile(fmapping, FILE_MAP_READ, 0, 0, 0)))
369 {
370 WARN("MapViewOfFile error %ld\n", GetLastError() );
371 CloseHandle(fmapping);
372 return 0xFFFFFFFF;
373 }
374 CloseHandle(fmapping);
375
376#ifdef __REACTOS__
377 /* Check if we have a min size of 2 headers RIFF & 'icon'
378 * at 8 chars each plus an anih header of 36 byptes.
379 * Also, is this resource an animjated icon/cursor (RIFF) */
380 if ((fsizel >= 52) && !memcmp(peimage, "RIFF", 4))
381 {
382 UINT anihOffset;
383 UINT anihMax;
384 /* Get size of the animation data */
385 ULONG uSize = MAKEWORD(peimage[4], peimage[5]);
386
387 /* Check if uSize is reasonable with respect to fsizel */
388 if ((uSize < strlen("anih")) || (uSize > fsizel))
389 goto end;
390
391 /* Look though the reported size less search string length */
392 anihMax = uSize - strlen("anih");
393 /* Search for 'anih' indicating animation header */
394 for (anihOffset = 0; anihOffset < anihMax; anihOffset++)
395 {
396 if (memcmp(&peimage[anihOffset], "anih", 4) == 0)
397 break;
398 }
399
400 if (anihOffset + sizeof(aniheader) > fsizel)
401 goto end;
402
403 /* Get count of images for return value */
404 ret = MAKEWORD(peimage[anihOffset + 12], peimage[anihOffset + 13]);
405
406 TRACE("RIFF File with '%u' images at Offset '%u'.\n", ret, anihOffset);
407
408 cx1 = LOWORD(cxDesired);
409 cy1 = LOWORD(cyDesired);
410
411 if (RetPtr)
412 {
413 RetPtr[0] = CreateIconFromResourceEx(peimage, uSize, TRUE, 0x00030000, cx1, cy1, flags);
414 }
415 goto end;
416 }
417#endif
418
419 cx1 = LOWORD(cxDesired);
420 cx2 = HIWORD(cxDesired);
421 cy1 = LOWORD(cyDesired);
422 cy2 = HIWORD(cyDesired);
423
424 if (pIconId) /* Invalidate first icon identifier */
425 *pIconId = 0xFFFFFFFF;
426
427 if (!pIconId) /* if no icon identifier array present use the icon handle array as intermediate storage */
428 pIconId = (UINT*)RetPtr;
429
430 sig = USER32_GetResourceTable(peimage, fsizel, &pData);
431
432/* NE exe/dll */
433 if (sig==IMAGE_OS2_SIGNATURE)
434 {
435 BYTE *pCIDir = 0;
436 NE_TYPEINFO *pTInfo = (NE_TYPEINFO*)(pData + 2);
437 NE_NAMEINFO *pIconStorage = NULL;
438 NE_NAMEINFO *pIconDir = NULL;
439 LPicoICONDIR lpiID = NULL;
440 ULONG uSize = 0;
441
442 TRACE("-- OS2/icon Signature (0x%08x)\n", sig);
443
444 if (pData == (BYTE*)-1)
445 {
446 pCIDir = ICO_GetIconDirectory(peimage, &lpiID, &uSize); /* check for .ICO file */
447 if (pCIDir)
448 {
449 iconDirCount = 1; iconCount = lpiID->idCount;
450 TRACE("-- icon found %p 0x%08x 0x%08x 0x%08x\n", pCIDir, uSize, iconDirCount, iconCount);
451 }
452 }
453 else while (pTInfo->type_id && !(pIconStorage && pIconDir))
454 {
455 if (pTInfo->type_id == NE_RSCTYPE_GROUP_ICON) /* find icon directory and icon repository */
456 {
457 iconDirCount = pTInfo->count;
458 pIconDir = ((NE_NAMEINFO*)(pTInfo + 1));
459 TRACE("\tfound directory - %i icon families\n", iconDirCount);
460 }
461 if (pTInfo->type_id == NE_RSCTYPE_ICON)
462 {
463 iconCount = pTInfo->count;
464 pIconStorage = ((NE_NAMEINFO*)(pTInfo + 1));
465 TRACE("\ttotal icons - %i\n", iconCount);
466 }
467 pTInfo = (NE_TYPEINFO *)((char*)(pTInfo+1)+pTInfo->count*sizeof(NE_NAMEINFO));
468 }
469
470 if ((pIconStorage && pIconDir) || lpiID) /* load resources and create icons */
471 {
472 if (nIcons == 0)
473 {
474 ret = iconDirCount;
475 if (lpiID) /* *.ico file, deallocate heap pointer*/
476 HeapFree(GetProcessHeap(), 0, pCIDir);
477 }
478 else if (nIconIndex < iconDirCount)
479 {
480 UINT16 i, icon;
481 if (nIcons > iconDirCount - nIconIndex)
482 nIcons = iconDirCount - nIconIndex;
483
484 for (i = 0; i < nIcons; i++)
485 {
486 /* .ICO files have only one icon directory */
487 if (lpiID == NULL) /* not *.ico */
488 pCIDir = USER32_LoadResource(peimage, pIconDir + i + nIconIndex, *(WORD*)pData, &uSize);
489 pIconId[i] = LookupIconIdFromDirectoryEx(pCIDir, TRUE, cx1, cy1, flags);
490 if (cx2 && cy2) pIconId[++i] = LookupIconIdFromDirectoryEx(pCIDir, TRUE, cx2, cy2, flags);
491 }
492 if (lpiID) /* *.ico file, deallocate heap pointer*/
493 HeapFree(GetProcessHeap(), 0, pCIDir);
494
495 for (icon = 0; icon < nIcons; icon++)
496 {
497 pCIDir = NULL;
498 if (lpiID)
499 pCIDir = ICO_LoadIcon(peimage, lpiID->idEntries + (int)pIconId[icon], &uSize);
500 else
501 for (i = 0; i < iconCount; i++)
502 if (pIconStorage[i].id == ((int)pIconId[icon] | 0x8000) )
503 pCIDir = USER32_LoadResource(peimage, pIconStorage + i, *(WORD*)pData, &uSize);
504
505 if (pCIDir)
506 {
507 RetPtr[icon] = CreateIconFromResourceEx(pCIDir, uSize, TRUE, 0x00030000,
508 cx1, cy1, flags);
509 if (cx2 && cy2)
510 RetPtr[++icon] = CreateIconFromResourceEx(pCIDir, uSize, TRUE, 0x00030000,
511 cx2, cy2, flags);
512 }
513 else
514 RetPtr[icon] = 0;
515 }
516 ret = icon; /* return number of retrieved icons */
517 }
518 }
519 }
520 else
521 if (sig == 1 || sig == 2) /* .ICO or .CUR file */
522 {
523 TRACE("-- icon Signature (0x%08x)\n", sig);
524
525 if (pData == (BYTE*)-1)
526 {
527 INT cx[2] = {cx1, cx2}, cy[2] = {cy1, cy2};
528 INT index;
529
530 for(index = 0; index < (cx2 || cy2 ? 2 : 1); index++)
531 {
532 DWORD dataOffset;
533 LPBYTE imageData;
534 POINT hotSpot;
535#ifndef __REACTOS__
537#endif
538
539 dataOffset = get_best_icon_file_offset(peimage, fsizel, cx[index], cy[index], sig == 1, flags, sig == 1 ? NULL : &hotSpot);
540
541 if (dataOffset)
542 {
543 HICON icon;
544 WORD *cursorData = NULL;
545#ifdef __REACTOS__
547 DWORD cbColorTable = 0, cbTotal;
548#endif
549
550 imageData = peimage + dataOffset;
551#ifdef __REACTOS__
552 /* Calculate the size of color table */
553 ZeroMemory(&bi, sizeof(bi));
554 CopyMemory(&bi, imageData, sizeof(BITMAPCOREHEADER));
555 if (bi.biBitCount <= 8)
556 {
557 if (bi.biSize >= sizeof(BITMAPINFOHEADER))
558 {
559 CopyMemory(&bi, imageData, sizeof(BITMAPINFOHEADER));
560 if (bi.biClrUsed)
561 cbColorTable = bi.biClrUsed * sizeof(RGBQUAD);
562 else
563 cbColorTable = (1 << bi.biBitCount) * sizeof(RGBQUAD);
564 }
565 else if (bi.biSize == sizeof(BITMAPCOREHEADER))
566 {
567 cbColorTable = (1 << bi.biBitCount) * sizeof(RGBTRIPLE);
568 }
569 }
570
571 /* biSizeImage is the size of the raw bitmap data.
572 * https://en.wikipedia.org/wiki/BMP_file_format */
573 if (bi.biSizeImage == 0)
574 {
575 /* Calculate image size */
576#define WIDTHBYTES(width, bits) (((width) * (bits) + 31) / 32 * 4)
577 bi.biSizeImage = WIDTHBYTES(bi.biWidth, bi.biBitCount) * (bi.biHeight / 2);
578 bi.biSizeImage += WIDTHBYTES(bi.biWidth, 1) * (bi.biHeight / 2);
579#undef WIDTHBYTES
580 }
581
582 /* Calculate total size */
583 cbTotal = bi.biSize + cbColorTable + bi.biSizeImage;
584#else
585 entry = (LPICONIMAGE)(imageData);
586#endif
587
588 if(sig == 2)
589 {
590 /* we need to prepend the bitmap data with hot spots for CreateIconFromResourceEx */
591#ifdef __REACTOS__
592 cursorData = HeapAlloc(GetProcessHeap(), 0, 2 * sizeof(WORD) + cbTotal);
593#else
594 cursorData = HeapAlloc(GetProcessHeap(), 0, entry->icHeader.biSizeImage + 2 * sizeof(WORD));
595#endif
596
597 if(!cursorData)
598 continue;
599
600 cursorData[0] = hotSpot.x;
601 cursorData[1] = hotSpot.y;
602
603#ifdef __REACTOS__
604 CopyMemory(cursorData + 2, imageData, cbTotal);
605#else
606 memcpy(cursorData + 2, imageData, entry->icHeader.biSizeImage);
607#endif
608
609 imageData = (LPBYTE)cursorData;
610 }
611
612#ifdef __REACTOS__
613 icon = CreateIconFromResourceEx(imageData, cbTotal, sig == 1, 0x00030000, cx[index], cy[index], flags);
614 if (fIconEx && sig == 1)
615 iconCount = 1;
616#else
617 icon = CreateIconFromResourceEx(imageData, entry->icHeader.biSizeImage, sig == 1, 0x00030000, cx[index], cy[index], flags);
618#endif
619
620 HeapFree(GetProcessHeap(), 0, cursorData);
621
622 if (icon)
623 {
624 if (RetPtr)
625 RetPtr[index] = icon;
626 else
627 DestroyIcon(icon);
628
629 iconCount = 1;
630 break;
631 }
632 }
633 }
634 }
635 ret = iconCount; /* return number of retrieved icons */
636 }
637/* end ico file */
638
639/* exe/dll */
640 else if( sig == IMAGE_NT_SIGNATURE )
641 {
642 BYTE *idata, *igdata;
643 const IMAGE_RESOURCE_DIRECTORY *rootresdir, *iconresdir, *icongroupresdir;
644 const IMAGE_RESOURCE_DATA_ENTRY *idataent, *igdataent;
645 const IMAGE_RESOURCE_DIRECTORY_ENTRY *xresent;
646 ULONG size;
647 UINT i;
648
650 if (!rootresdir)
651 {
652 WARN("haven't found section for resource directory.\n");
653 goto end;
654 }
655
656#ifdef __REACTOS__
657 /* Check for boundary limit (and overflow) */
658 if (((ULONG_PTR)(rootresdir + 1) < (ULONG_PTR)rootresdir) ||
659 ((ULONG_PTR)(rootresdir + 1) > (ULONG_PTR)peimage + fsizel))
660 {
661 goto end;
662 }
663#endif
664
665 /* search for the group icon directory */
666 if (!(icongroupresdir = find_entry_by_id(rootresdir, LOWORD(RT_GROUP_ICON), rootresdir)))
667 {
668 WARN("No Icongroupresourcedirectory!\n");
669 goto end; /* failure */
670 }
671 iconDirCount = icongroupresdir->NumberOfNamedEntries + icongroupresdir->NumberOfIdEntries;
672
673 /* only number of icons requested */
674 if( !pIconId )
675 {
676 ret = iconDirCount;
677 goto end; /* success */
678 }
679
680 if( nIconIndex < 0 )
681 {
682 /* search resource id */
683 int n = 0;
684 int iId = abs(nIconIndex);
685 const IMAGE_RESOURCE_DIRECTORY_ENTRY* xprdeTmp = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)(icongroupresdir+1);
686
687 while(n<iconDirCount && xprdeTmp)
688 {
689 if(xprdeTmp->Id == iId)
690 {
691 nIconIndex = n;
692 break;
693 }
694 n++;
695 xprdeTmp++;
696 }
697 if (nIconIndex < 0)
698 {
699 WARN("resource id %d not found\n", iId);
700 goto end; /* failure */
701 }
702 }
703 else
704 {
705 /* check nIconIndex to be in range */
706 if (nIconIndex >= iconDirCount)
707 {
708 WARN("nIconIndex %d is larger than iconDirCount %d\n",nIconIndex,iconDirCount);
709 goto end; /* failure */
710 }
711 }
712
713 /* assure we don't get too much */
714 if( nIcons > iconDirCount - nIconIndex )
715 nIcons = iconDirCount - nIconIndex;
716
717 /* starting from specified index */
718 xresent = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)(icongroupresdir+1) + nIconIndex;
719
720 for (i=0; i < nIcons; i++,xresent++)
721 {
722 const IMAGE_RESOURCE_DIRECTORY *resdir;
723
724 /* go down this resource entry, name */
725 resdir = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)rootresdir + xresent->OffsetToDirectory);
726
727 /* default language (0) */
728 resdir = find_entry_default(resdir,rootresdir);
729 igdataent = (const IMAGE_RESOURCE_DATA_ENTRY*)resdir;
730
731 /* lookup address in mapped image for virtual address */
732 igdata = RtlImageRvaToVa(RtlImageNtHeader((HMODULE)peimage), (HMODULE)peimage, igdataent->OffsetToData, NULL);
733 if (!igdata)
734 {
735 FIXME("no matching real address for icongroup!\n");
736 goto end; /* failure */
737 }
738 pIconId[i] = LookupIconIdFromDirectoryEx(igdata, TRUE, cx1, cy1, flags);
739 if (cx2 && cy2) pIconId[++i] = LookupIconIdFromDirectoryEx(igdata, TRUE, cx2, cy2, flags);
740 }
741
742 if (!(iconresdir=find_entry_by_id(rootresdir,LOWORD(RT_ICON),rootresdir)))
743 {
744 WARN("No Iconresourcedirectory!\n");
745 goto end; /* failure */
746 }
747
748 for (i=0; i<nIcons; i++)
749 {
750 const IMAGE_RESOURCE_DIRECTORY *xresdir;
751 xresdir = find_entry_by_id(iconresdir, LOWORD(pIconId[i]), rootresdir);
752 if( !xresdir )
753 {
754#ifdef __REACTOS__
755 /* XP/2K3 can decode icons this way. Vista/7 cannot. This handles
756 * damaged Resources in 'Icon Group' by falling back to 'Icon' resources.
757 * Older Watcom C/C++ compilers can generate such a case */
758 const IMAGE_RESOURCE_DIRECTORY *resdir;
759 WARN("icon entry %d not found\n", LOWORD(pIconId[i]));
760
761 /* Try to get an icon by walking the files Resource Section */
762 if (iconresdir->NumberOfIdEntries > 0)
763 {
764 xresent = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)
765 (ULONG_PTR)(iconresdir + 1);
766 }
767 else
768 {
769 RetPtr[i] = 0;
770 continue;
771 }
772
773 /* Get the Resource Directory */
774 resdir = (const IMAGE_RESOURCE_DIRECTORY *)
775 ((const char *)rootresdir + xresent->OffsetToDirectory);
776
777 if (resdir->NumberOfIdEntries > 0) // Do we have entries
778 {
779 xresent = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)
780 (ULONG_PTR)(resdir + 1);
781 }
782 else
783 {
784 RetPtr[i] = 0;
785 continue;
786 }
787
788 /* Retrieve the data entry and find its address */
789 igdataent = (const IMAGE_RESOURCE_DATA_ENTRY*)
790 ((const char *)rootresdir + xresent->OffsetToData);
791 idata = RtlImageRvaToVa(RtlImageNtHeader((HMODULE)peimage),
792 (HMODULE)peimage, igdataent->OffsetToData, NULL);
793 if (!idata)
794 {
795 RetPtr[i] = 0;
796 continue;
797 }
798
799 /* Check to see if this looks like an icon bitmap */
800 if (idata[0] == sizeof(BITMAPINFOHEADER))
801 {
802 BITMAPINFOHEADER bmih;
803 RtlCopyMemory(&bmih, idata, sizeof(BITMAPINFOHEADER));
804 /* Do the Width and Height look correct for an icon */
805 if ((bmih.biWidth * 2) == bmih.biHeight)
806 {
807 RetPtr[0] = CreateIconFromResourceEx(idata, igdataent->Size,
808 TRUE, 0x00030000, cx1, cy1, flags);
809 if (cx2 && cy2)
810 RetPtr[1] = CreateIconFromResourceEx(idata, idataent->Size,
811 TRUE, 0x00030000, cx2, cy2, flags);
812 ret = 1; // Set number of icons found
813 goto end; // Success so Exit
814 }
815 }
816 else
817 {
818 RetPtr[i] = 0;
819 continue;
820 }
821#else
822 WARN("icon entry %d not found\n", LOWORD(pIconId[i]));
823 RetPtr[i]=0;
824 continue;
825#endif
826 }
827 xresdir = find_entry_default(xresdir, rootresdir);
828 idataent = (const IMAGE_RESOURCE_DATA_ENTRY*)xresdir;
829
830 idata = RtlImageRvaToVa(RtlImageNtHeader((HMODULE)peimage), (HMODULE)peimage, idataent->OffsetToData, NULL);
831 if (!idata)
832 {
833 WARN("no matching real address found for icondata!\n");
834 RetPtr[i]=0;
835 continue;
836 }
837 RetPtr[i] = CreateIconFromResourceEx(idata, idataent->Size, TRUE, 0x00030000, cx1, cy1, flags);
838 if (cx2 && cy2)
839 RetPtr[++i] = CreateIconFromResourceEx(idata, idataent->Size, TRUE, 0x00030000, cx2, cy2, flags);
840 }
841 ret = i; /* return number of retrieved icons */
842 } /* if(sig == IMAGE_NT_SIGNATURE) */
843
844end:
845 UnmapViewOfFile(peimage); /* success */
846 return ret;
847}
848
849/***********************************************************************
850 * PrivateExtractIconsW [USER32.@]
851 *
852 * NOTES
853 * If HIWORD(sizeX) && HIWORD(sizeY) 2 * ((nIcons + 1) MOD 2) icons are
854 * returned, with the LOWORD size icon first and the HIWORD size icon
855 * second.
856 * Also the Windows equivalent does extract icons in a strange way if
857 * nIndex is negative. Our implementation treats a negative nIndex as
858 * looking for that resource identifier for the first icon to retrieve.
859 *
860 * FIXME:
861 * should also support 16 bit EXE + DLLs, cursor and animated cursor as
862 * well as bitmap files.
863 */
864
866 LPCWSTR lpwstrFile,
867 int nIndex,
868 int sizeX,
869 int sizeY,
870 HICON * phicon, /* [out] pointer to array of nIcons HICON handles */
871 UINT* pIconId, /* [out] pointer to array of nIcons icon identifiers or NULL */
872 UINT nIcons, /* [in] number of icons to retrieve */
873 UINT flags ) /* [in] LR_* flags used by LoadImage */
874{
875 TRACE("%s %d %dx%d %p %p %d 0x%08x\n",
876 debugstr_w(lpwstrFile), nIndex, sizeX, sizeY, phicon, pIconId, nIcons, flags);
877
878 if ((nIcons & 1) && HIWORD(sizeX) && HIWORD(sizeY))
879 {
880 WARN("Uneven number %d of icons requested for small and large icons!\n", nIcons);
881 }
882#ifdef __REACTOS__
883 return ICO_ExtractIconExW(lpwstrFile, phicon, nIndex, nIcons, sizeX, sizeY,
884 pIconId, flags, TRUE);
885#else
886 return ICO_ExtractIconExW(lpwstrFile, phicon, nIndex, nIcons, sizeX, sizeY, pIconId, flags);
887#endif
888}
889
890/***********************************************************************
891 * PrivateExtractIconsA [USER32.@]
892 */
893
895 LPCSTR lpstrFile,
896 int nIndex,
897 int sizeX,
898 int sizeY,
899 HICON * phicon, /* [out] pointer to array of nIcons HICON handles */
900 UINT* piconid, /* [out] pointer to array of nIcons icon identifiers or NULL */
901 UINT nIcons, /* [in] number of icons to retrieve */
902 UINT flags ) /* [in] LR_* flags used by LoadImage */
903{
904 UINT ret;
905 INT len = MultiByteToWideChar(CP_ACP, 0, lpstrFile, -1, NULL, 0);
906 LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
907#ifdef __REACTOS__
908 if (lpwstrFile == NULL)
909 return 0;
910#endif
911
912 MultiByteToWideChar(CP_ACP, 0, lpstrFile, -1, lpwstrFile, len);
913 ret = PrivateExtractIconsW(lpwstrFile, nIndex, sizeX, sizeY, phicon, piconid, nIcons, flags);
914
915 HeapFree(GetProcessHeap(), 0, lpwstrFile);
916 return ret;
917}
918
919/***********************************************************************
920 * PrivateExtractIconExW [USER32.@]
921 * NOTES
922 * if nIndex == -1 it returns the number of icons in any case !!!
923 */
925 LPCWSTR lpwstrFile,
926 int nIndex,
927 HICON * phIconLarge,
928 HICON * phIconSmall,
929 UINT nIcons )
930{
931 DWORD cyicon, cysmicon, cxicon, cxsmicon;
932 UINT ret = 0;
933
934 TRACE("%s %d %p %p %d\n",
935 debugstr_w(lpwstrFile),nIndex,phIconLarge, phIconSmall, nIcons);
936
937#ifdef __REACTOS__
938 if (nIndex == -1 || (!phIconSmall && !phIconLarge))
939 /* get the number of icons */
940 return ICO_ExtractIconExW(lpwstrFile, NULL, 0, 0, 0, 0, NULL,
942#else
943 if (nIndex == -1)
944 /* get the number of icons */
945 return ICO_ExtractIconExW(lpwstrFile, NULL, 0, 0, 0, 0, NULL, LR_DEFAULTCOLOR);
946#endif
947
948 if (nIcons == 1 && phIconSmall && phIconLarge)
949 {
950 HICON hIcon[2];
951 cxicon = GetSystemMetrics(SM_CXICON);
952 cyicon = GetSystemMetrics(SM_CYICON);
953 cxsmicon = GetSystemMetrics(SM_CXSMICON);
954 cysmicon = GetSystemMetrics(SM_CYSMICON);
955
956#ifdef __REACTOS__
957 ret = ICO_ExtractIconExW(lpwstrFile, hIcon, nIndex, 2,
958 cxicon | (cxsmicon<<16),
959 cyicon | (cysmicon<<16), NULL,
961#else
962 ret = ICO_ExtractIconExW(lpwstrFile, hIcon, nIndex, 2, cxicon | (cxsmicon<<16),
963 cyicon | (cysmicon<<16), NULL, LR_DEFAULTCOLOR);
964#endif
965 *phIconLarge = hIcon[0];
966 *phIconSmall = hIcon[1];
967 return ret;
968 }
969
970 if (phIconSmall)
971 {
972 /* extract n small icons */
973 cxsmicon = GetSystemMetrics(SM_CXSMICON);
974 cysmicon = GetSystemMetrics(SM_CYSMICON);
975#ifdef __REACTOS__
976 ret = ICO_ExtractIconExW(lpwstrFile, phIconSmall, nIndex, nIcons, cxsmicon,
977 cysmicon, NULL, LR_DEFAULTCOLOR, FALSE);
978#else
979 ret = ICO_ExtractIconExW(lpwstrFile, phIconSmall, nIndex, nIcons, cxsmicon,
980 cysmicon, NULL, LR_DEFAULTCOLOR);
981#endif
982 }
983 if (phIconLarge)
984 {
985 /* extract n large icons */
986 cxicon = GetSystemMetrics(SM_CXICON);
987 cyicon = GetSystemMetrics(SM_CYICON);
988#ifdef __REACTOS__
989 ret = ICO_ExtractIconExW(lpwstrFile, phIconLarge, nIndex, nIcons, cxicon,
990 cyicon, NULL, LR_DEFAULTCOLOR, FALSE);
991#else
992 ret = ICO_ExtractIconExW(lpwstrFile, phIconLarge, nIndex, nIcons, cxicon,
993 cyicon, NULL, LR_DEFAULTCOLOR);
994#endif
995 }
996 return ret;
997}
998
999/***********************************************************************
1000 * PrivateExtractIconExA [USER32.@]
1001 */
1003 LPCSTR lpstrFile,
1004 int nIndex,
1005 HICON * phIconLarge,
1006 HICON * phIconSmall,
1007 UINT nIcons )
1008{
1009 UINT ret;
1010 INT len = MultiByteToWideChar(CP_ACP, 0, lpstrFile, -1, NULL, 0);
1011 LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1012#ifdef __REACTOS__
1013 if (lpwstrFile == NULL)
1014 return 0;
1015#endif
1016
1017 TRACE("%s %d %p %p %d\n", lpstrFile, nIndex, phIconLarge, phIconSmall, nIcons);
1018
1019 MultiByteToWideChar(CP_ACP, 0, lpstrFile, -1, lpwstrFile, len);
1020 ret = PrivateExtractIconExW(lpwstrFile, nIndex, phIconLarge, phIconSmall, nIcons);
1021 HeapFree(GetProcessHeap(), 0, lpwstrFile);
1022 return ret;
1023}
DWORD Id
unsigned short UINT16
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
unsigned int dir
Definition: maze.c:112
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define index(s, c)
Definition: various.h:29
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define WIDTHBYTES(i)
Definition: dib.cpp:15
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define PAGE_READONLY
Definition: compat.h:138
#define UnmapViewOfFile
Definition: compat.h:746
#define CP_ACP
Definition: compat.h:109
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:744
#define RtlImageDirectoryEntryToData
Definition: compat.h:809
#define GENERIC_READ
Definition: compat.h:135
#define RtlImageRvaToVa
Definition: compat.h:807
#define RtlImageNtHeader
Definition: compat.h:806
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CreateFileW
Definition: compat.h:741
#define FILE_MAP_READ
Definition: compat.h:776
#define MapViewOfFile
Definition: compat.h:745
#define MultiByteToWideChar
Definition: compat.h:110
#define FILE_SHARE_READ
Definition: compat.h:136
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
DWORD WINAPI SearchPathW(IN LPCWSTR lpPath OPTIONAL, IN LPCWSTR lpFileName, IN LPCWSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart OPTIONAL)
Definition: path.c:1298
ULONG RGBQUAD
Definition: precomp.h:59
static const IMAGE_RESOURCE_DIRECTORY * find_entry_default(const IMAGE_RESOURCE_DIRECTORY *dir, const void *root)
Definition: exticon.c:152
struct icoICONDIRENTRY * LPicoICONDIRENTRY
UINT WINAPI PrivateExtractIconExW(LPCWSTR lpwstrFile, int nIndex, HICON *phIconLarge, HICON *phIconSmall, UINT nIcons)
Definition: exticon.c:924
#define ARRAY_SIZE(x)
Definition: exticon.c:28
static BYTE * USER32_LoadResource(LPBYTE peimage, NE_NAMEINFO *pNInfo, WORD sizeShift, ULONG *uSize)
Definition: exticon.c:210
UINT WINAPI PrivateExtractIconsA(LPCSTR lpstrFile, int nIndex, int sizeX, int sizeY, HICON *phicon, UINT *piconid, UINT nIcons, UINT flags)
Definition: exticon.c:894
static BYTE * ICO_GetIconDirectory(LPBYTE peimage, LPicoICONDIR *lplpiID, ULONG *uSize)
Definition: exticon.c:234
static UINT ICO_ExtractIconExW(LPCWSTR lpszExeFileName, HICON *RetPtr, INT nIconIndex, UINT nIcons, UINT cxDesired, UINT cyDesired, UINT *pIconId, UINT flags)
Definition: exticon.c:280
#define NE_RSCTYPE_ICON
Definition: exticon.c:91
static DWORD USER32_GetResourceTable(LPBYTE peimage, DWORD pesize, LPBYTE *retptr)
Definition: exticon.c:163
DWORD get_best_icon_file_offset(const LPBYTE dir, DWORD dwFileSize, int cxDesired, int cyDesired, BOOL bIcon, DWORD fuLoad, POINT *ptHotSpot)
UINT WINAPI PrivateExtractIconsW(LPCWSTR lpwstrFile, int nIndex, int sizeX, int sizeY, HICON *phicon, UINT *pIconId, UINT nIcons, UINT flags)
Definition: exticon.c:865
static const IMAGE_RESOURCE_DIRECTORY * find_entry_by_id(const IMAGE_RESOURCE_DIRECTORY *dir, WORD id, const void *root)
Definition: exticon.c:126
struct icoICONDIR * LPicoICONDIR
#define NE_RSCTYPE_GROUP_ICON
Definition: exticon.c:92
static BYTE * ICO_LoadIcon(LPBYTE peimage, LPicoICONDIRENTRY lpiIDE, ULONG *uSize)
Definition: exticon.c:221
UINT WINAPI PrivateExtractIconExA(LPCSTR lpstrFile, int nIndex, HICON *phIconLarge, HICON *phIconSmall, UINT nIcons)
Definition: exticon.c:1002
#define abs(i)
Definition: fconv.c:206
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLdouble n
Definition: glext.h:7729
GLsizeiptr size
Definition: glext.h:5919
GLintptr offset
Definition: glext.h:5920
GLuint index
Definition: glext.h:6031
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLenum GLsizei len
Definition: glext.h:6722
GLuint id
Definition: glext.h:5910
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
type_id
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_w
Definition: kernel32.h:32
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static HICON
Definition: imagelist.c:80
#define min(a, b)
Definition: monoChain.cc:55
DWORD dwFileSize
Definition: more.c:40
HICON hIcon
Definition: msconfig.c:44
_In_ HANDLE hFile
Definition: mswsock.h:90
unsigned int UINT
Definition: ndis.h:50
#define SEC_COMMIT
Definition: mmtypes.h:100
#define DWORD
Definition: nt_native.h:44
struct _ICONIMAGE * LPICONIMAGE
#define LOWORD(l)
Definition: pedump.c:82
#define IMAGE_NT_SIGNATURE
Definition: pedump.c:93
#define RT_ICON
Definition: pedump.c:365
#define IMAGE_OS2_SIGNATURE
Definition: pedump.c:90
#define IMAGE_DOS_SIGNATURE
Definition: pedump.c:89
#define RT_GROUP_ICON
Definition: pedump.c:375
#define IMAGE_DIRECTORY_ENTRY_RESOURCE
Definition: pedump.c:261
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
#define TRACE(s)
Definition: solgame.cpp:4
DWORD biSizeImage
Definition: amvideo.idl:36
WORD idReserved
Definition: ntusrtyp.h:99
CURSORICONDIRENTRY idEntries[1]
Definition: ntusrtyp.h:102
WORD idCount
Definition: ntusrtyp.h:101
WORD offset
Definition: typelib.c:81
WORD length
Definition: typelib.c:82
WORD type_id
Definition: typelib.c:91
WORD count
Definition: typelib.c:92
Definition: pedump.c:458
DWORD OffsetToData
Definition: pedump.c:459
DWORD Size
Definition: pedump.c:460
Definition: pedump.c:414
DWORD OffsetToData
Definition: pedump.c:416
ULONG OffsetToDirectory
Definition: ntimage.h:194
USHORT Id
Definition: ntimage.h:189
WORD wBitCount
Definition: exticon.c:44
DWORD dwImageOffset
Definition: exticon.c:46
BYTE bColorCount
Definition: exticon.c:41
WORD wPlanes
Definition: exticon.c:43
DWORD dwBytesInRes
Definition: exticon.c:45
BYTE bReserved
Definition: exticon.c:42
BYTE bHeight
Definition: exticon.c:40
WORD idCount
Definition: exticon.c:53
WORD idReserved
Definition: exticon.c:51
icoICONDIRENTRY idEntries[1]
Definition: exticon.c:54
WORD idType
Definition: exticon.c:52
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define max(a, b)
Definition: svc.c:63
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
#define MAKEWORD(a, b)
Definition: typedefs.h:248
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned char * LPBYTE
Definition: typedefs.h:53
int32_t INT
Definition: typedefs.h:58
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
int ret
#define ZeroMemory
Definition: winbase.h:1743
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CopyMemory
Definition: winbase.h:1741
#define WINAPI
Definition: msvc.h:6
#define SM_CYSMICON
Definition: winuser.h:1024
HICON WINAPI CreateIconFromResourceEx(_In_reads_bytes_(dwResSize) PBYTE presbits, _In_ DWORD dwResSize, _In_ BOOL fIcon, _In_ DWORD dwVer, _In_ int cxDesired, _In_ int cyDesired, _In_ UINT Flags)
#define SM_CXSMICON
Definition: winuser.h:1023
#define SM_CYICON
Definition: winuser.h:984
int WINAPI LookupIconIdFromDirectoryEx(_In_reads_bytes_(sizeof(NEWHEADER)) PBYTE, _In_ BOOL, _In_ int, _In_ int, _In_ UINT)
#define LR_DEFAULTCOLOR
Definition: winuser.h:1098
#define SM_CXICON
Definition: winuser.h:983
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2390
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193