NSIS/Source/BinInterop.h
anders_k 40451b29d7 Support TopDown CheckBitmap
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7084 212acab6-be3b-0410-9dea-997c60f758d6
2019-02-14 22:59:08 +00:00

52 lines
1.4 KiB
C

/*
* BinInterop.h
*
* This file is a part of NSIS.
*
* Copyright (C) 2017-2019 Anders Kjersem
*
* Licensed under the zlib/libpng license (the "License");
* you may not use this file except in compliance with the License.
*
* Licence details can be found in the file COPYING.
*
* This software is provided 'as-is', without any express or implied
* warranty.
*
*/
#ifndef NSIS_BININTEROP_H
#define NSIS_BININTEROP_H
#include "Platform.h"
#include "tchar.h"
#include <stdio.h> // FILE*
FILE* MSTLB_fopen(const TCHAR*filepath, size_t*pResId = 0);
bool GetTLBVersion(const TCHAR *filepath, DWORD &high, DWORD &low);
bool GetDLLVersion(const TCHAR *filepath, DWORD &high, DWORD &low);
typedef struct {
UINT32 Width, Height;
INT32 RawHeight;
WORD BPP, Planes;
} GENERICIMAGEINFO;
DWORD GetDIBHeaderInfo(const void*pData, size_t DataSize, GENERICIMAGEINFO&Info);
DWORD IsBMPFile(const void*pData, size_t DataSize, GENERICIMAGEINFO*pInfo = 0);
inline WORD IsICOCURFile(const void*pData)
{
WORD *p16 = (WORD*) pData, ico = 1, cur = 2, type, count;
if (p16[0] == FIX_ENDIAN_INT16(0x0000))
if ((type = FIX_ENDIAN_INT16(p16[1])) == ico || type == cur)
return count = FIX_ENDIAN_INT16(p16[2]);
return 0;
}
inline WORD IsICOCURFile(const void*pData, size_t DataSize)
{
return DataSize >= 6 ? IsICOCURFile(pData) : 0;
}
#endif //~ NSIS_BININTEROP_H