28#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
89#define NE_RSCTYPE_ICON 0x8003
90#define NE_RSCTYPE_GROUP_ICON 0x800e
97 TRACE(
"width = 0x%08x height = 0x%08x\n",
entry->bWidth,
entry->bHeight);
98 TRACE(
"colors = 0x%08x planes = 0x%08x\n",
entry->bColorCount,
entry->wPlanes);
99 TRACE(
"bitcount = 0x%08x bytesinres = 0x%08lx offset = 0x%08lx\n",
104 TRACE(
"type = 0x%08x count = 0x%08x\n",
entry->idType,
entry->idCount);
131 min =
dir->NumberOfNamedEntries;
165 TRACE(
"%p %p\n", peimage, retptr);
181 if (mz_header->
e_lfanew >= pesize) {
210 TRACE(
"%p %p 0x%08x\n", peimage, pNInfo, sizeShift);
213 return peimage + ((
DWORD)pNInfo->
offset << sizeShift);
221 TRACE(
"%p %p\n", peimage, lpiIDE);
238 TRACE(
"%p %p\n", peimage, lplpiID);
289 UINT cx1, cx2, cy1, cy2;
293 UINT16 iconDirCount = 0,iconCount = 0;
301 DWORD dwSearchReturn;
303 TRACE(
"%s, %d, %d %p 0x%08x\n",
debugstr_w(lpszExeFileName), nIconIndex, nIcons, pIconId,
flags);
310 lpszExeFileName = szExpandedExePath;
314 if ((dwSearchReturn == 0) || (dwSearchReturn >
ARRAY_SIZE(szExePath)))
316 WARN(
"File %s not found or path too long\n",
debugstr_w(lpszExeFileName));
345 if ((fsizel >= 52) && !
memcmp(peimage,
"RIFF", 4))
353 if ((uSize <
strlen(
"anih")) || (uSize > fsizel))
357 anihMax = uSize -
strlen(
"anih");
359 for (anihOffset = 0; anihOffset < anihMax; anihOffset++)
361 if (
memcmp(&peimage[anihOffset],
"anih", 4) == 0)
365 if (anihOffset +
sizeof(
aniheader) > fsizel)
369 ret =
MAKEWORD(peimage[anihOffset + 12], peimage[anihOffset + 13]);
371 TRACE(
"RIFF File with '%u' images at Offset '%u'.\n",
ret, anihOffset);
390 *pIconId = 0xFFFFFFFF;
393 pIconId = (
UINT*)RetPtr;
407 TRACE(
"-- OS2/icon Signature (0x%08x)\n", sig);
414 iconDirCount = 1; iconCount = lpiID->
idCount;
415 TRACE(
"-- icon found %p 0x%08x 0x%08x 0x%08x\n", pCIDir, uSize, iconDirCount, iconCount);
418 else while (pTInfo->
type_id && !(pIconStorage && pIconDir))
422 iconDirCount = pTInfo->
count;
424 TRACE(
"\tfound directory - %i icon families\n", iconDirCount);
428 iconCount = pTInfo->
count;
430 TRACE(
"\ttotal icons - %i\n", iconCount);
435 if ((pIconStorage && pIconDir) || lpiID)
443 else if (nIconIndex < iconDirCount)
446 if (nIcons > iconDirCount - nIconIndex)
447 nIcons = iconDirCount - nIconIndex;
449 for (
i = 0;
i < nIcons;
i++)
460 for (icon = 0; icon < nIcons; icon++)
466 for (
i = 0;
i < iconCount;
i++)
467 if (pIconStorage[
i].
id == ((
int)pIconId[icon] | 0x8000) )
486 if (sig == 1 || sig == 2)
488 TRACE(
"-- icon Signature (0x%08x)\n", sig);
492 INT cx[2] = {cx1, cx2},
cy[2] = {cy1, cy2};
512 DWORD cbColorTable = 0, cbTotal;
515 imageData = peimage + dataOffset;
541#define WIDTHBYTES(width, bits) (((width) * (bits) + 31) / 32 * 4)
565 cursorData[0] = hotSpot.
x;
566 cursorData[1] = hotSpot.
y;
569 CopyMemory(cursorData + 2, imageData, cbTotal);
571 memcpy(cursorData + 2, imageData,
entry->icHeader.biSizeImage);
574 imageData = (
LPBYTE)cursorData;
588 RetPtr[
index] = icon;
605 BYTE *idata, *igdata;
615 WARN(
"haven't found section for resource directory.\n");
631 WARN(
"No Icongroupresourcedirectory!\n");
647 int iId =
abs(nIconIndex);
650 while(
n<iconDirCount && xprdeTmp)
652 if(xprdeTmp->
Id == iId)
662 WARN(
"resource id %d not found\n", iId);
669 if (nIconIndex >= iconDirCount)
671 WARN(
"nIconIndex %d is larger than iconDirCount %d\n",nIconIndex,iconDirCount);
677 if( nIcons > iconDirCount - nIconIndex )
678 nIcons = iconDirCount - nIconIndex;
683 for (
i=0;
i < nIcons;
i++,xresent++)
698 FIXME(
"no matching real address for icongroup!\n");
707 WARN(
"No Iconresourcedirectory!\n");
711 for (
i=0;
i<nIcons;
i++)
717 WARN(
"icon entry %d not found\n",
LOWORD(pIconId[
i]));
727 WARN(
"no matching real address found for icondata!\n");
769 TRACE(
"%s %d %dx%d %p %p %d 0x%08x\n",
770 debugstr_w(lpwstrFile), nIndex, sizeX, sizeY, phicon, pIconId, nIcons,
flags);
774 WARN(
"Uneven number %d of icons requested for small and large icons!\n", nIcons);
797 if (lpwstrFile ==
NULL)
820 DWORD cyicon, cysmicon, cxicon, cxsmicon;
823 TRACE(
"%s %d %p %p %d\n",
824 debugstr_w(lpwstrFile),nIndex,phIconLarge, phIconSmall, nIcons);
830 if (nIcons == 1 && phIconSmall && phIconLarge)
840 *phIconLarge =
hIcon[0];
841 *phIconSmall =
hIcon[1];
878 if (lpwstrFile ==
NULL)
882 TRACE(
"%s %d %p %p %d\n", lpstrFile, nIndex, phIconLarge, phIconSmall, nIcons);
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
#define INVALID_HANDLE_VALUE
#define CreateFileMappingW(a, b, c, d, e, f)
#define RtlImageDirectoryEntryToData
#define HeapFree(x, y, z)
#define MultiByteToWideChar
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
DWORD WINAPI SearchPathW(IN LPCWSTR lpPath OPTIONAL, IN LPCWSTR lpFileName, IN LPCWSTR lpExtension OPTIONAL, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart OPTIONAL)
static const IMAGE_RESOURCE_DIRECTORY * find_entry_default(const IMAGE_RESOURCE_DIRECTORY *dir, const void *root)
struct taganiheader aniheader
struct icoICONDIRENTRY * LPicoICONDIRENTRY
UINT WINAPI PrivateExtractIconExW(LPCWSTR lpwstrFile, int nIndex, HICON *phIconLarge, HICON *phIconSmall, UINT nIcons)
static BYTE * USER32_LoadResource(LPBYTE peimage, NE_NAMEINFO *pNInfo, WORD sizeShift, ULONG *uSize)
UINT WINAPI PrivateExtractIconsA(LPCSTR lpstrFile, int nIndex, int sizeX, int sizeY, HICON *phicon, UINT *piconid, UINT nIcons, UINT flags)
static BYTE * ICO_GetIconDirectory(LPBYTE peimage, LPicoICONDIR *lplpiID, ULONG *uSize)
static UINT ICO_ExtractIconExW(LPCWSTR lpszExeFileName, HICON *RetPtr, INT nIconIndex, UINT nIcons, UINT cxDesired, UINT cyDesired, UINT *pIconId, UINT flags)
static DWORD USER32_GetResourceTable(LPBYTE peimage, DWORD pesize, LPBYTE *retptr)
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)
static const IMAGE_RESOURCE_DIRECTORY * find_entry_by_id(const IMAGE_RESOURCE_DIRECTORY *dir, WORD id, const void *root)
struct icoICONDIR * LPicoICONDIR
#define NE_RSCTYPE_GROUP_ICON
static BYTE * ICO_LoadIcon(LPBYTE peimage, LPicoICONDIRENTRY lpiIDE, ULONG *uSize)
UINT WINAPI PrivateExtractIconExA(LPCSTR lpstrFile, int nIndex, HICON *phIconLarge, HICON *phIconSmall, UINT nIcons)
GLuint GLuint GLsizei count
GLuint GLsizei GLsizei * length
GLsizeiptr const GLvoid GLenum usage
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
#define memcpy(s1, s2, n)
struct _ICONIMAGE * LPICONIMAGE
#define IMAGE_NT_SIGNATURE
#define IMAGE_OS2_SIGNATURE
#define IMAGE_DOS_SIGNATURE
#define IMAGE_DIRECTORY_ENTRY_RESOURCE
_Out_opt_ int _Out_opt_ int * cy
CURSORICONDIRENTRY idEntries[1]
WORD NumberOfNamedEntries
icoICONDIRENTRY idEntries[1]
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
#define FIELD_OFFSET(t, f)
DWORD WINAPI GetLastError(void)
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)
int WINAPI LookupIconIdFromDirectoryEx(_In_reads_bytes_(sizeof(NEWHEADER)) PBYTE, _In_ BOOL, _In_ int, _In_ int, _In_ UINT)
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI DestroyIcon(_In_ HICON)