From 4a19b9964071b059f2a6139e92732361e4a51148 Mon Sep 17 00:00:00 2001 From: Sup Yut Sum Date: Wed, 9 Sep 2015 22:09:58 +0800 Subject: [PATCH] ico file format width,height=0 means 256px Signed-off-by: Sup Yut Sum --- src/Utils/MiscUI/Picture.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Utils/MiscUI/Picture.cpp b/src/Utils/MiscUI/Picture.cpp index 0b17ccce1..ab2b3373e 100644 --- a/src/Utils/MiscUI/Picture.cpp +++ b/src/Utils/MiscUI/Picture.cpp @@ -215,14 +215,14 @@ bool CPicture::Load(tstring sFilePathName) if (((BYTE*)lpIconDir->idEntries > (BYTE*)lpIconDir) && (((BYTE*)lpIconDir->idEntries) + (lpIconDir->idCount * sizeof(ICONDIRENTRY)) < ((BYTE*)lpIconDir) + fileinfo.nFileSizeLow)) { - m_Width = lpIconDir->idEntries[0].bWidth; - m_Height = lpIconDir->idEntries[0].bHeight; + m_Width = lpIconDir->idEntries[0].bWidth == 0 ? 256 : lpIconDir->idEntries[0].bWidth; + m_Height = lpIconDir->idEntries[0].bHeight == 0 ? 256 : lpIconDir->idEntries[0].bHeight; bResult = true; for (int i=0; iidCount; ++i) { hIcons[i] = (HICON)LoadImage(NULL, sFilePathName.c_str(), IMAGE_ICON, - lpIconDir->idEntries[i].bWidth, - lpIconDir->idEntries[i].bHeight, + lpIconDir->idEntries[i].bWidth == 0 ? 256 : lpIconDir->idEntries[i].bWidth, + lpIconDir->idEntries[i].bHeight == 0 ? 256 : lpIconDir->idEntries[i].bHeight, LR_LOADFROMFILE); if (hIcons[i] == NULL) { -- 2.11.4.GIT