BITMAPCOREHEADER bitmaps cannot be top-down bitmaps

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7116 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2019-08-18 22:54:26 +00:00
parent 79056544b0
commit 7100afa549
2 changed files with 6 additions and 4 deletions

View file

@ -455,7 +455,8 @@ DWORD GetDIBHeaderInfo(const void*pData, size_t DataSize, GENERICIMAGEINFO&Info)
DWORD size = LE2HE32(p32[0]);
if (size == 12) // BITMAPCOREHEADER
{
Info.Width = LE2HE16(p16[2]), Info.Height = (INT32) (SHORT) LE2HE16(p16[3]);
Info.Width = LE2HE16(p16[2]), Info.RawHeight = (INT32) (SHORT) LE2HE16(p16[3]);
Info.Height = Info.RawHeight; // BITMAPCOREHEADER bitmaps cannot be top-down bitmaps (docs.microsoft.com/en-us/windows/win32/gdi/bitmap-header-types)
Info.Planes = LE2HE16(p16[4]), Info.BPP = LE2HE16(p16[5]);
return size;
}

View file

@ -27,11 +27,12 @@ bool GetTLBVersion(const TCHAR *filepath, DWORD &high, DWORD &low);
bool GetDLLVersion(const TCHAR *filepath, DWORD &high, DWORD &low);
typedef struct {
typedef struct GENERICIMAGEINFO {
UINT32 Width, Height;
INT32 RawHeight;
WORD BPP, Planes;
bool IsTopDownBitmap() const { return Height != (UINT32) RawHeight; }
GENERICIMAGEINFO() : RawHeight(0) {}
bool IsTopDownBitmap() const { return Height != (UINT32) RawHeight && RawHeight; }
} GENERICIMAGEINFO;
DWORD GetDIBHeaderInfo(const void*pData, size_t DataSize, GENERICIMAGEINFO&Info);
@ -47,7 +48,7 @@ inline WORD IsICOCURFile(const void*pData)
}
inline WORD IsICOCURFile(const void*pData, size_t DataSize)
{
return DataSize >= 6 ? IsICOCURFile(pData) : 0;
return DataSize > 6 ? IsICOCURFile(pData) : 0;
}
#endif //~ NSIS_BININTEROP_H