* block_header::offset is now pointer sized in exehead

* Wininet.h -> wininet.h for POSIX


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6608 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2015-09-18 15:55:56 +00:00
parent 286edd20c4
commit 940277d9d8
10 changed files with 83 additions and 41 deletions

View file

@ -175,6 +175,11 @@ const TCHAR * NSISCALL loadHeaders(int cl_flags)
HANDLE db_hFile;
#ifdef C_ASSERT
{C_ASSERT(sizeof(firstheader) == sizeof(int) * 7);}
{C_ASSERT(sizeof(struct block_header) == sizeof(UINT_PTR) + sizeof(int));}
#endif
#ifdef NSIS_CONFIG_CRC_SUPPORT
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
verify_time = GetTickCount() + 1000;
@ -336,7 +341,7 @@ const TCHAR * NSISCALL loadHeaders(int cl_flags)
if (h.length_of_header < header->blocks[left].offset)
return _LANG_GENERIC_ERROR; // Should never happen
#endif
header->blocks[left].offset += BUGBUG64TRUNCATE(UINT, (UINT_PTR) data);
header->blocks[left].offset += (UINT_PTR) data;
}
#ifdef NSIS_COMPRESS_WHOLE
@ -370,7 +375,12 @@ int NSISCALL _dodecomp(int offset, HANDLE hFileOut, unsigned char *outbuf, int o
if (offset>=0)
{
SetSelfFilePointer(g_blocks[NB_DATA].offset+offset);
UINT_PTR datofs=g_blocks[NB_DATA].offset+offset;
#if (NSIS_MAX_EXESIZE+0) > 0x7fffffff
#error "SetFilePointer is documented to only support signed 32-bit offsets in lDistanceToMove"
#endif
const int pos=(int)datofs;
SetSelfFilePointer(pos);
}
if (!ReadSelfFile((LPVOID)&input_len,sizeof(int))) return -3;
@ -542,7 +552,11 @@ int NSISCALL _dodecomp(int offset, HANDLE hFileOut, unsigned char *outbuf, int o
int retval;
if (offset>=0)
{
dbd_pos=g_blocks[NB_DATA].offset+offset;
UINT_PTR datofs=g_blocks[NB_DATA].offset+offset;
#if (NSIS_MAX_EXESIZE+0) > 0x7fffffff
#error "SetFilePointer is documented to only support signed 32-bit offsets in lDistanceToMove"
#endif
dbd_pos=(int)datofs;
SetFilePointer(dbd_hFile,dbd_pos,NULL,FILE_BEGIN);
}
retval=__ensuredata(sizeof(int));

View file

@ -209,6 +209,8 @@ enum
#endif
};
#pragma pack(push, 1) // fileform.cpp assumes no padding/alignment
#define FH_FLAGS_MASK 15
#define FH_FLAGS_UNINSTALL 1
#ifdef NSIS_CONFIG_SILENT_SUPPORT
@ -258,7 +260,11 @@ typedef struct
// nsis blocks
struct block_header {
/*UINT_PTR*/ int offset; // BUGBUG: This should probably be UINT_PTR but that currently crashes :(
#ifdef MAKENSIS
int offset;
#else
UINT_PTR offset; // exehead stores a memory location here so it needs to be pointer sized
#endif
int num;
};
@ -286,7 +292,7 @@ typedef TCHAR NSIS_STRING[NSIS_MAX_STRLEN];
typedef struct
{
int flags; // CH_FLAGS_*
struct block_header blocks[BLOCKS_NUM];
struct block_header blocks[BLOCKS_NUM]; // CEXEBuild::get_header_size needs to adjust the size of this based on the targets pointer size
// InstallDirRegKey stuff
int install_reg_rootkey;
@ -468,7 +474,6 @@ typedef struct
#define CC_BK_SYS 8
#define CC_BKB 16
#pragma pack(push, 4)
typedef struct {
COLORREF text;
COLORREF bkc;
@ -498,7 +503,6 @@ typedef struct {
#else
# define ctlcolors ctlcolors32
#endif
#pragma pack(pop)
// constants for myDelete (util.c)
#define DEL_DIR 1
@ -525,6 +529,8 @@ typedef struct {
#define FIELDN(x, y) (((int *)&x)[y])
#pragma pack(pop)
#ifdef EXEHEAD
// the following are only used/implemented in exehead, not makensis.