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");
622 WARN(
"No Icongroupresourcedirectory!\n");
638 int iId =
abs(nIconIndex);
641 while(
n<iconDirCount && xprdeTmp)
643 if(xprdeTmp->
Id == iId)
653 WARN(
"resource id %d not found\n", iId);
660 if (nIconIndex >= iconDirCount)
662 WARN(
"nIconIndex %d is larger than iconDirCount %d\n",nIconIndex,iconDirCount);
668 if( nIcons > iconDirCount - nIconIndex )
669 nIcons = iconDirCount - nIconIndex;
674 for (
i=0;
i < nIcons;
i++,xresent++)
689 FIXME(
"no matching real address for icongroup!\n");
698 WARN(
"No Iconresourcedirectory!\n");
702 for (
i=0;
i<nIcons;
i++)
708 WARN(
"icon entry %d not found\n",
LOWORD(pIconId[
i]));
718 WARN(
"no matching real address found for icondata!\n");
760 TRACE(
"%s %d %dx%d %p %p %d 0x%08x\n",
761 debugstr_w(lpwstrFile), nIndex, sizeX, sizeY, phicon, pIconId, nIcons,
flags);
765 WARN(
"Uneven number %d of icons requested for small and large icons!\n", nIcons);
788 if (lpwstrFile ==
NULL)
811 DWORD cyicon, cysmicon, cxicon, cxsmicon;
814 TRACE(
"%s %d %p %p %d\n",
815 debugstr_w(lpwstrFile),nIndex,phIconLarge, phIconSmall, nIcons);
821 if (nIcons == 1 && phIconSmall && phIconLarge)
831 *phIconLarge =
hIcon[0];
832 *phIconSmall =
hIcon[1];
869 if (lpwstrFile ==
NULL)
873 TRACE(
"%s %d %p %p %d\n", lpstrFile, nIndex, phIconLarge, phIconSmall, nIcons);
struct taganiheader aniheader
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)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
int WINAPI LookupIconIdFromDirectoryEx(_In_reads_bytes_(sizeof(NEWHEADER)) PBYTE, _In_ BOOL, _In_ int, _In_ int, _In_ UINT)
ACPI_SIZE strlen(const char *String)
BOOL WINAPI DestroyIcon(_In_ HICON)
GLuint GLuint GLsizei count
UINT WINAPI PrivateExtractIconExW(LPCWSTR lpwstrFile, int nIndex, HICON *phIconLarge, HICON *phIconSmall, UINT nIcons)
struct _ICONIMAGE * LPICONIMAGE
#define INVALID_HANDLE_VALUE
DWORD WINAPI GetLastError(VOID)
static BYTE * ICO_LoadIcon(LPBYTE peimage, LPicoICONDIRENTRY lpiIDE, ULONG *uSize)
#define IMAGE_DOS_SIGNATURE
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
WINE_DEFAULT_DEBUG_CHANNEL(icon)
GLenum GLuint GLenum GLsizei length
_Out_opt_ int _Out_opt_ int * cy
#define IMAGE_NT_SIGNATURE
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define CreateFileMappingW(a, b, c, d, e, f)
WORD NumberOfNamedEntries
static UINT ICO_ExtractIconExW(LPCWSTR lpszExeFileName, HICON *RetPtr, INT nIconIndex, UINT nIcons, UINT cxDesired, UINT cyDesired, UINT *pIconId, UINT flags)
int WINAPI GetSystemMetrics(_In_ int)
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)
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
#define RtlImageDirectoryEntryToData
GLsizeiptr const GLvoid GLenum usage
#define NE_RSCTYPE_GROUP_ICON
#define memcpy(s1, s2, n)
#define IMAGE_OS2_SIGNATURE
static const IMAGE_RESOURCE_DIRECTORY * find_entry_default(const IMAGE_RESOURCE_DIRECTORY *dir, const void *root)
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 BYTE * ICO_GetIconDirectory(LPBYTE peimage, LPicoICONDIR *lplpiID, ULONG *uSize)
static const IMAGE_RESOURCE_DIRECTORY * find_entry_by_id(const IMAGE_RESOURCE_DIRECTORY *dir, WORD id, const void *root)
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 FIELD_OFFSET(t, f)
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
#define MultiByteToWideChar
static DWORD USER32_GetResourceTable(LPBYTE peimage, DWORD pesize, LPBYTE *retptr)
CURSORICONDIRENTRY idEntries[1]
UINT WINAPI PrivateExtractIconsA(LPCSTR lpstrFile, int nIndex, int sizeX, int sizeY, HICON *phicon, UINT *piconid, UINT nIcons, UINT flags)
#define IMAGE_DIRECTORY_ENTRY_RESOURCE
struct icoICONDIR * LPicoICONDIR
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
static BYTE * USER32_LoadResource(LPBYTE peimage, NE_NAMEINFO *pNInfo, WORD sizeShift, ULONG *uSize)
UINT WINAPI PrivateExtractIconExA(LPCSTR lpstrFile, int nIndex, HICON *phIconLarge, HICON *phIconSmall, UINT nIcons)
icoICONDIRENTRY idEntries[1]
struct icoICONDIRENTRY * LPicoICONDIRENTRY
#define HeapFree(x, y, z)