mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Use consistent syntax for boolean preprocessor expressions.
This commit is contained in:
parent
30c3f8c1ac
commit
0aff9d8df4
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_BELE_H
|
#ifndef __UPX_BELE_H
|
||||||
#define __UPX_BELE_H
|
#define __UPX_BELE_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -543,7 +543,7 @@ int __acc_cdecl_qsort le64_compare_signed(const void *, const void *);
|
||||||
|
|
||||||
|
|
||||||
// just for testing...
|
// just for testing...
|
||||||
#if !defined(ACC_CFG_NO_UNALIGNED)
|
#if !(ACC_CFG_NO_UNALIGNED)
|
||||||
#if 0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386) && (ACC_CC_GNUC >= 0x030200)
|
#if 0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386) && (ACC_CC_GNUC >= 0x030200)
|
||||||
typedef acc_uint16e_t LE16_unaligned __attribute__((__aligned__(1)));
|
typedef acc_uint16e_t LE16_unaligned __attribute__((__aligned__(1)));
|
||||||
typedef acc_uint32e_t LE32_unaligned __attribute__((__aligned__(1)));
|
typedef acc_uint32e_t LE32_unaligned __attribute__((__aligned__(1)));
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
// CTP - Compile-Time Polymorphism (templates)
|
// CTP - Compile-Time Polymorphism (templates)
|
||||||
# define V static inline
|
# define V static inline
|
||||||
# define S static int __acc_cdecl_qsort
|
# define S static int __acc_cdecl_qsort
|
||||||
# define C
|
# define C /*empty*/
|
||||||
#elif defined(BELE_RTP)
|
#elif defined(BELE_RTP)
|
||||||
// RTP - Run-Time Polymorphism (virtual functions)
|
// RTP - Run-Time Polymorphism (virtual functions)
|
||||||
# define V virtual
|
# define V virtual
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_BPTR_H
|
#ifndef __UPX_BPTR_H
|
||||||
#define __UPX_BPTR_H
|
#define __UPX_BPTR_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
#if defined(USE_CONSOLE)
|
#if (USE_CONSOLE)
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
FILE *con_term = NULL;
|
FILE *con_term = NULL;
|
||||||
|
|
||||||
#if defined(USE_CONSOLE)
|
#if (USE_CONSOLE)
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
|
@ -84,14 +84,14 @@ static int do_init(FILE *f)
|
||||||
if (!acc_isatty(STDIN_FILENO) || !acc_isatty(STDOUT_FILENO) || !acc_isatty(STDERR_FILENO))
|
if (!acc_isatty(STDIN_FILENO) || !acc_isatty(STDOUT_FILENO) || !acc_isatty(STDERR_FILENO))
|
||||||
return con_mode;
|
return con_mode;
|
||||||
|
|
||||||
#if defined(USE_ANSI)
|
#if (USE_ANSI)
|
||||||
try_init(&console_ansi_mono,f);
|
try_init(&console_ansi_mono,f);
|
||||||
try_init(&console_ansi_color,f);
|
try_init(&console_ansi_color,f);
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_SCREEN)
|
#if (USE_SCREEN)
|
||||||
try_init(&console_screen,f);
|
try_init(&console_screen,f);
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_AALIB)
|
#if (USE_AALIB)
|
||||||
try_init(&console_aalib,f);
|
try_init(&console_aalib,f);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
#if defined(USE_CONSOLE)
|
#if (USE_CONSOLE)
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
#if defined(USE_SCREEN)
|
#if (USE_SCREEN)
|
||||||
|
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
|
@ -130,15 +130,15 @@ static int init(FILE *f, int o, int now)
|
||||||
if (!screen)
|
if (!screen)
|
||||||
screen = do_construct(screen_djgpp2_construct(),fd);
|
screen = do_construct(screen_djgpp2_construct(),fd);
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_SCREEN_WIN32)
|
#if (USE_SCREEN_WIN32)
|
||||||
if (!screen)
|
if (!screen)
|
||||||
screen = do_construct(screen_win32_construct(),fd);
|
screen = do_construct(screen_win32_construct(),fd);
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_SCREEN_VCSA)
|
#if (USE_SCREEN_VCSA)
|
||||||
if (!screen)
|
if (!screen)
|
||||||
screen = do_construct(screen_vcsa_construct(),fd);
|
screen = do_construct(screen_vcsa_construct(),fd);
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_SCREEN_CURSES)
|
#if (USE_SCREEN_CURSES)
|
||||||
if (!screen && o == CON_SCREEN)
|
if (!screen && o == CON_SCREEN)
|
||||||
screen = do_construct(screen_curses_construct(),fd);
|
screen = do_construct(screen_curses_construct(),fd);
|
||||||
#endif
|
#endif
|
||||||
|
@ -298,7 +298,7 @@ static void print0(FILE *f, const char *ss)
|
||||||
static bool intro(FILE *f)
|
static bool intro(FILE *f)
|
||||||
{
|
{
|
||||||
UNUSED(f);
|
UNUSED(f);
|
||||||
#if defined(USE_FRAMES)
|
#if (USE_FRAMES)
|
||||||
if (screen->intro)
|
if (screen->intro)
|
||||||
return screen->intro(screen,screen_show_frames);
|
return screen->intro(screen,screen_show_frames);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -43,7 +43,7 @@ unsigned upx_adler32(const void *buf, unsigned len, unsigned adler)
|
||||||
assert(buf != NULL);
|
assert(buf != NULL);
|
||||||
#if 0
|
#if 0
|
||||||
return adler32(adler, (const Bytef *) buf, len); // zlib
|
return adler32(adler, (const Bytef *) buf, len); // zlib
|
||||||
#elif defined(WITH_UCL)
|
#elif (WITH_UCL)
|
||||||
return ucl_adler32(adler, (const ucl_bytep) buf, len);
|
return ucl_adler32(adler, (const ucl_bytep) buf, len);
|
||||||
#else
|
#else
|
||||||
# error
|
# error
|
||||||
|
@ -59,7 +59,7 @@ unsigned upx_crc32(const void *buf, unsigned len, unsigned crc)
|
||||||
assert(buf != NULL);
|
assert(buf != NULL);
|
||||||
#if 0
|
#if 0
|
||||||
return crc32(crc, (const Bytef *) buf, len); // zlib
|
return crc32(crc, (const Bytef *) buf, len); // zlib
|
||||||
#elif defined(WITH_UCL)
|
#elif (WITH_UCL)
|
||||||
return ucl_crc32(crc, (const ucl_bytep) buf, len);
|
return ucl_crc32(crc, (const ucl_bytep) buf, len);
|
||||||
#else
|
#else
|
||||||
# error
|
# error
|
||||||
|
@ -108,17 +108,17 @@ int upx_compress ( const upx_bytep src, unsigned src_len,
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
}
|
}
|
||||||
#if defined(WITH_LZMA)
|
#if (WITH_LZMA)
|
||||||
else if (M_IS_LZMA(method))
|
else if (M_IS_LZMA(method))
|
||||||
r = upx_lzma_compress(src, src_len, dst, dst_len,
|
r = upx_lzma_compress(src, src_len, dst, dst_len,
|
||||||
cb, method, level, cconf, cresult);
|
cb, method, level, cconf, cresult);
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_NRV)
|
#if (WITH_NRV)
|
||||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
||||||
r = upx_nrv_compress(src, src_len, dst, dst_len,
|
r = upx_nrv_compress(src, src_len, dst, dst_len,
|
||||||
cb, method, level, cconf, cresult);
|
cb, method, level, cconf, cresult);
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_UCL)
|
#if (WITH_UCL)
|
||||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
||||||
r = upx_ucl_compress(src, src_len, dst, dst_len,
|
r = upx_ucl_compress(src, src_len, dst, dst_len,
|
||||||
cb, method, level, cconf, cresult);
|
cb, method, level, cconf, cresult);
|
||||||
|
@ -154,19 +154,19 @@ int upx_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
}
|
}
|
||||||
#if defined(WITH_LZMA)
|
#if (WITH_LZMA)
|
||||||
else if (M_IS_LZMA(method))
|
else if (M_IS_LZMA(method))
|
||||||
r = upx_lzma_decompress(src, src_len, dst, dst_len, method, cresult);
|
r = upx_lzma_decompress(src, src_len, dst, dst_len, method, cresult);
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_NRV)
|
#if (WITH_NRV)
|
||||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
||||||
r = upx_nrv_decompress(src, src_len, dst, dst_len, method, cresult);
|
r = upx_nrv_decompress(src, src_len, dst, dst_len, method, cresult);
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_UCL)
|
#if (WITH_UCL)
|
||||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
||||||
r = upx_ucl_decompress(src, src_len, dst, dst_len, method, cresult);
|
r = upx_ucl_decompress(src, src_len, dst, dst_len, method, cresult);
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_ZLIB)
|
#if (WITH_ZLIB)
|
||||||
else if (M_IS_DEFLATE(method))
|
else if (M_IS_DEFLATE(method))
|
||||||
r = upx_zlib_decompress(src, src_len, dst, dst_len, method, cresult);
|
r = upx_zlib_decompress(src, src_len, dst, dst_len, method, cresult);
|
||||||
#endif
|
#endif
|
||||||
|
@ -201,15 +201,15 @@ int upx_test_overlap ( const upx_bytep buf,
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
}
|
}
|
||||||
#if defined(WITH_LZMA)
|
#if (WITH_LZMA)
|
||||||
else if (M_IS_LZMA(method))
|
else if (M_IS_LZMA(method))
|
||||||
r = upx_lzma_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
|
r = upx_lzma_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_NRV)
|
#if (WITH_NRV)
|
||||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
||||||
r = upx_nrv_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
|
r = upx_nrv_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_UCL)
|
#if (WITH_UCL)
|
||||||
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
|
||||||
r = upx_ucl_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
|
r = upx_ucl_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,14 +27,14 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_COMPRESS_H
|
#ifndef __UPX_COMPRESS_H
|
||||||
#define __UPX_COMPRESS_H
|
#define __UPX_COMPRESS_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#if defined(WITH_LZMA)
|
#if (WITH_LZMA)
|
||||||
const char *upx_lzma_version_string(void);
|
const char *upx_lzma_version_string(void);
|
||||||
int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, unsigned* dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
@ -55,7 +55,7 @@ int upx_lzma_test_overlap ( const upx_bytep buf,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(WITH_NRV)
|
#if (WITH_NRV)
|
||||||
const char *upx_nrv_version_string(void);
|
const char *upx_nrv_version_string(void);
|
||||||
int upx_nrv_compress ( const upx_bytep src, unsigned src_len,
|
int upx_nrv_compress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, unsigned* dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
@ -76,7 +76,7 @@ int upx_nrv_test_overlap ( const upx_bytep buf,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(WITH_UCL)
|
#if (WITH_UCL)
|
||||||
const char *upx_ucl_version_string(void);
|
const char *upx_ucl_version_string(void);
|
||||||
int upx_ucl_compress ( const upx_bytep src, unsigned src_len,
|
int upx_ucl_compress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, unsigned* dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
@ -96,7 +96,8 @@ int upx_ucl_test_overlap ( const upx_bytep buf,
|
||||||
const upx_compress_result_t *cresult );
|
const upx_compress_result_t *cresult );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WITH_ZLIB)
|
|
||||||
|
#if (WITH_ZLIB)
|
||||||
const char *upx_zlib_version_string(void);
|
const char *upx_zlib_version_string(void);
|
||||||
int upx_zlib_compress ( const upx_bytep src, unsigned src_len,
|
int upx_zlib_compress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, unsigned* dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
|
|
|
@ -47,7 +47,7 @@ void lzma_compress_config_t::reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !defined(WITH_LZMA)
|
#if !(WITH_LZMA)
|
||||||
extern int compress_lzma_dummy;
|
extern int compress_lzma_dummy;
|
||||||
int compress_lzma_dummy = 0;
|
int compress_lzma_dummy = 0;
|
||||||
#else
|
#else
|
||||||
|
@ -291,7 +291,7 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
||||||
unsigned char props_buf[LZMA_PROPS_SIZE];
|
unsigned char props_buf[LZMA_PROPS_SIZE];
|
||||||
SizeT props_buf_size; props_buf_size = LZMA_PROPS_SIZE;
|
SizeT props_buf_size; props_buf_size = LZMA_PROPS_SIZE;
|
||||||
|
|
||||||
#if defined(USE_LZMA_PROPERTIES)
|
#if (USE_LZMA_PROPERTIES)
|
||||||
if (dst_avail < 1)
|
if (dst_avail < 1)
|
||||||
goto error;
|
goto error;
|
||||||
dst[0] = 0; // filled below
|
dst[0] = 0; // filled below
|
||||||
|
@ -312,7 +312,7 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
||||||
assert(x_len <= dst_avail);
|
assert(x_len <= dst_avail);
|
||||||
*dst_len += x_len;
|
*dst_len += x_len;
|
||||||
if (rh == SZ_OK) {
|
if (rh == SZ_OK) {
|
||||||
#if defined(USE_LZMA_PROPERTIES)
|
#if (USE_LZMA_PROPERTIES)
|
||||||
dst[-1] = props_buf[0];
|
dst[-1] = props_buf[0];
|
||||||
#endif
|
#endif
|
||||||
r = UPX_E_OK;
|
r = UPX_E_OK;
|
||||||
|
@ -513,7 +513,7 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
assert(os.b_pos == 5);
|
assert(os.b_pos == 5);
|
||||||
#if defined(USE_LZMA_PROPERTIES)
|
#if (USE_LZMA_PROPERTIES)
|
||||||
os.b_pos = 1;
|
os.b_pos = 1;
|
||||||
#else
|
#else
|
||||||
os.b_pos = 0;
|
os.b_pos = 0;
|
||||||
|
@ -586,7 +586,7 @@ int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
SRes rh;
|
SRes rh;
|
||||||
ELzmaStatus status;
|
ELzmaStatus status;
|
||||||
|
|
||||||
#if defined(USE_LZMA_PROPERTIES)
|
#if (USE_LZMA_PROPERTIES)
|
||||||
rh = LzmaProps_Decode(&s.Properties, src, src_len);
|
rh = LzmaProps_Decode(&s.Properties, src, src_len);
|
||||||
if (rh != 0)
|
if (rh != 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -684,7 +684,7 @@ int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
int r = UPX_E_ERROR;
|
int r = UPX_E_ERROR;
|
||||||
int rh;
|
int rh;
|
||||||
|
|
||||||
#if defined(USE_LZMA_PROPERTIES)
|
#if (USE_LZMA_PROPERTIES)
|
||||||
if (src_len < 2)
|
if (src_len < 2)
|
||||||
goto error;
|
goto error;
|
||||||
rh = LzmaDecodeProperties(&s.Properties, src, src_len);
|
rh = LzmaDecodeProperties(&s.Properties, src, src_len);
|
||||||
|
|
|
@ -28,23 +28,23 @@
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "compress.h"
|
#include "compress.h"
|
||||||
#if !defined(WITH_UCL)
|
#if !(WITH_UCL)
|
||||||
extern int compress_ucl_dummy;
|
extern int compress_ucl_dummy;
|
||||||
int compress_ucl_dummy = 0;
|
int compress_ucl_dummy = 0;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if 1 && !defined(UCL_USE_ASM) && (ACC_ARCH_I386)
|
#if 1 && !(UCL_USE_ASM) && (ACC_ARCH_I386)
|
||||||
# if (ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_WATCOMC)
|
# if (ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_WATCOMC)
|
||||||
# define UCL_USE_ASM
|
# define UCL_USE_ASM 1
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(UCL_NO_ASM)
|
#if (UCL_NO_ASM)
|
||||||
# undef UCL_USE_ASM
|
# undef UCL_USE_ASM
|
||||||
#endif
|
#endif
|
||||||
#if defined(ACC_CFG_NO_UNALIGNED)
|
#if (ACC_CFG_NO_UNALIGNED)
|
||||||
# undef UCL_USE_ASM
|
# undef UCL_USE_ASM
|
||||||
#endif
|
#endif
|
||||||
#if 1 && defined(UCL_USE_ASM)
|
#if 1 && (UCL_USE_ASM)
|
||||||
# include <ucl/ucl_asm.h>
|
# include <ucl/ucl_asm.h>
|
||||||
# define ucl_nrv2b_decompress_safe_8 ucl_nrv2b_decompress_asm_safe_8
|
# define ucl_nrv2b_decompress_safe_8 ucl_nrv2b_decompress_asm_safe_8
|
||||||
# define ucl_nrv2b_decompress_safe_le16 ucl_nrv2b_decompress_asm_safe_le16
|
# define ucl_nrv2b_decompress_safe_le16 ucl_nrv2b_decompress_asm_safe_le16
|
||||||
|
|
|
@ -41,7 +41,7 @@ void zlib_compress_config_t::reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !defined(WITH_ZLIB)
|
#if !(WITH_ZLIB)
|
||||||
extern int compress_zlib_dummy;
|
extern int compress_zlib_dummy;
|
||||||
int compress_zlib_dummy = 0;
|
int compress_zlib_dummy = 0;
|
||||||
#else
|
#else
|
||||||
|
|
23
src/conf.h
23
src/conf.h
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_CONF_H
|
#ifndef __UPX_CONF_H
|
||||||
#define __UPX_CONF_H
|
#define __UPX_CONF_H 1
|
||||||
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
@ -167,10 +167,10 @@
|
||||||
#undef linux
|
#undef linux
|
||||||
#undef small
|
#undef small
|
||||||
#undef tos
|
#undef tos
|
||||||
#if defined(ACC_CC_DMC)
|
#if (ACC_CC_DMC)
|
||||||
# undef tell
|
# undef tell
|
||||||
#endif
|
#endif
|
||||||
#if !defined(ACC_CC_PGI)
|
#if !(ACC_CC_PGI)
|
||||||
# undef unix
|
# undef unix
|
||||||
#endif
|
#endif
|
||||||
#if defined(__DJGPP__)
|
#if defined(__DJGPP__)
|
||||||
|
@ -189,14 +189,14 @@
|
||||||
# undef WITH_LZMA
|
# undef WITH_LZMA
|
||||||
#endif
|
#endif
|
||||||
#if defined(UPX_OFFICIAL_BUILD)
|
#if defined(UPX_OFFICIAL_BUILD)
|
||||||
# if !defined(WITH_LZMA) || !defined(WITH_NRV) || !defined(WITH_UCL)
|
# if !(WITH_LZMA) || !(WITH_NRV) || !(WITH_UCL)
|
||||||
# error
|
# error
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_NRV)
|
#if (WITH_NRV)
|
||||||
# include <nrv/nrvconf.h>
|
# include <nrv/nrvconf.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_UCL)
|
#if (WITH_UCL)
|
||||||
# define ucl_compress_config_t REAL_ucl_compress_config_t
|
# define ucl_compress_config_t REAL_ucl_compress_config_t
|
||||||
# include <ucl/uclconf.h>
|
# include <ucl/uclconf.h>
|
||||||
# include <ucl/ucl.h>
|
# include <ucl/ucl.h>
|
||||||
|
@ -206,11 +206,6 @@
|
||||||
# undef ucl_compress_config_t
|
# undef ucl_compress_config_t
|
||||||
# undef ucl_compress_config_p
|
# undef ucl_compress_config_p
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__UPX_CHECKER)
|
|
||||||
# if defined(__UCL_CHECKER) || defined(__NRV_CHECKER)
|
|
||||||
# define __UPX_CHECKER
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#if !defined(UINT_MAX) || (UINT_MAX < 0xffffffffL)
|
#if !defined(UINT_MAX) || (UINT_MAX < 0xffffffffL)
|
||||||
# error "UINT_MAX"
|
# error "UINT_MAX"
|
||||||
#endif
|
#endif
|
||||||
|
@ -224,7 +219,7 @@
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
// malloc debuggers
|
// malloc debuggers
|
||||||
#if defined(WITH_VALGRIND)
|
#if (WITH_VALGRIND)
|
||||||
# include <valgrind/memcheck.h>
|
# include <valgrind/memcheck.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -263,10 +258,10 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if !defined(HAVE_STRCASECMP) && defined(HAVE_STRICMP)
|
#if !(HAVE_STRCASECMP) && (HAVE_STRICMP)
|
||||||
# define strcasecmp stricmp
|
# define strcasecmp stricmp
|
||||||
#endif
|
#endif
|
||||||
#if !defined(HAVE_STRNCASECMP) && defined(HAVE_STRNICMP)
|
#if !(HAVE_STRNCASECMP) && (HAVE_STRNICMP)
|
||||||
# define strncasecmp strnicmp
|
# define strncasecmp strnicmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -39,41 +39,41 @@
|
||||||
#undef USE_SCREEN_WIN32
|
#undef USE_SCREEN_WIN32
|
||||||
#undef USE_FRAMES
|
#undef USE_FRAMES
|
||||||
|
|
||||||
#if defined(WITH_GUI) && !defined(NO_CONSOLE)
|
#if 1 && (WITH_GUI) && !defined(NO_CONSOLE)
|
||||||
# define NO_CONSOLE
|
# define NO_CONSOLE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1 && defined(__linux__)
|
#if 1 && defined(__linux__)
|
||||||
# define USE_SCREEN
|
# define USE_SCREEN 1
|
||||||
# define USE_SCREEN_VCSA
|
# define USE_SCREEN_VCSA 1
|
||||||
# if !defined(HAVE_LINUX_KD_H)
|
# if !(HAVE_LINUX_KD_H)
|
||||||
# undef USE_SCREEN
|
# undef USE_SCREEN
|
||||||
# undef USE_SCREEN_VCSA
|
# undef USE_SCREEN_VCSA
|
||||||
# endif
|
# endif
|
||||||
# if !defined(HAVE_LINUX_KDEV_T_H) || !defined(HAVE_LINUX_MAJOR_H)
|
# if !(HAVE_LINUX_KDEV_T_H) || !(HAVE_LINUX_MAJOR_H)
|
||||||
# undef USE_SCREEN
|
# undef USE_SCREEN
|
||||||
# undef USE_SCREEN_VCSA
|
# undef USE_SCREEN_VCSA
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1 && defined(__DJGPP__)
|
#if 1 && defined(__DJGPP__)
|
||||||
# define USE_SCREEN
|
# define USE_SCREEN 1
|
||||||
#elif 1 && (ACC_OS_CYGWIN || ACC_OS_WIN32 || ACC_OS_WIN64)
|
#elif 1 && (ACC_OS_CYGWIN || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||||
# define USE_SCREEN
|
# define USE_SCREEN 1
|
||||||
# define USE_SCREEN_WIN32
|
# define USE_SCREEN_WIN32 1
|
||||||
#elif 1 && (ACC_OS_EMX && defined(__RSXNT__))
|
#elif 1 && (ACC_OS_EMX && defined(__RSXNT__))
|
||||||
# define USE_SCREEN
|
# define USE_SCREEN 1
|
||||||
# define USE_SCREEN_WIN32
|
# define USE_SCREEN_WIN32 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if 0 || defined(NO_ANSI)
|
#if 0 || (NO_ANSI)
|
||||||
# undef USE_ANSI
|
# undef USE_ANSI
|
||||||
#endif
|
#endif
|
||||||
#if 0 || defined(NO_SCREEN)
|
#if 0 || (NO_SCREEN)
|
||||||
# undef USE_SCREEN
|
# undef USE_SCREEN
|
||||||
#endif
|
#endif
|
||||||
#if 0 || defined(NO_FRAMES) || !defined(USE_SCREEN)
|
#if 0 || (NO_FRAMES) || !(USE_SCREEN)
|
||||||
# undef USE_FRAMES
|
# undef USE_FRAMES
|
||||||
#endif
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
|
@ -81,11 +81,11 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if 0 || defined(USE_ANSI) || defined(USE_SCREEN)
|
#if 0 || (USE_ANSI) || (USE_SCREEN)
|
||||||
# define USE_CONSOLE
|
# define USE_CONSOLE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0 || defined(NO_CONSOLE) || !defined(USE_CONSOLE)
|
#if 0 || (NO_CONSOLE) || !(USE_CONSOLE)
|
||||||
# undef USE_CONSOLE
|
# undef USE_CONSOLE
|
||||||
# undef USE_ANSI
|
# undef USE_ANSI
|
||||||
# undef USE_SCREEN
|
# undef USE_SCREEN
|
||||||
|
@ -110,7 +110,7 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#if defined(USE_CONSOLE)
|
#if (USE_CONSOLE)
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -165,7 +165,7 @@ void __acc_cdecl_va con_fprintf(FILE *f, const char *format, ...);
|
||||||
|
|
||||||
extern FILE *con_term;
|
extern FILE *con_term;
|
||||||
|
|
||||||
#if defined(USE_CONSOLE)
|
#if (USE_CONSOLE)
|
||||||
|
|
||||||
extern int con_mode;
|
extern int con_mode;
|
||||||
extern console_t *con;
|
extern console_t *con;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_EXCEPT_H
|
#ifndef __UPX_EXCEPT_H
|
||||||
#define __UPX_EXCEPT_H
|
#define __UPX_EXCEPT_H 1
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ public:
|
||||||
// (noreturn) is probably not the correct semantics for throwing exceptions
|
// (noreturn) is probably not the correct semantics for throwing exceptions
|
||||||
#define NORET __attribute__((__noreturn__))
|
#define NORET __attribute__((__noreturn__))
|
||||||
#else
|
#else
|
||||||
#define NORET
|
#define NORET /*empty*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void throwCantPack(const char *msg) NORET;
|
void throwCantPack(const char *msg) NORET;
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
void File::chmod(const char *name, int mode)
|
void File::chmod(const char *name, int mode)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_CHMOD)
|
#if (HAVE_CHMOD)
|
||||||
if (::chmod(name,mode) != 0)
|
if (::chmod(name,mode) != 0)
|
||||||
throwIOException(name,errno);
|
throwIOException(name,errno);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_FILE_H
|
#ifndef __UPX_FILE_H
|
||||||
#define __UPX_FILE_H
|
#define __UPX_FILE_H 1
|
||||||
|
|
||||||
class MemBuffer;
|
class MemBuffer;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_FILTER_H
|
#ifndef __UPX_FILTER_H
|
||||||
#define __UPX_FILTER_H
|
#define __UPX_FILTER_H 1
|
||||||
|
|
||||||
class Filter;
|
class Filter;
|
||||||
class FilterImp;
|
class FilterImp;
|
||||||
|
|
18
src/help.cpp
18
src/help.cpp
|
@ -310,13 +310,13 @@ void show_help(int verbose)
|
||||||
// "\nUPX comes with ABSOLUTELY NO WARRANTY; for details type 'upx -L'.\n"
|
// "\nUPX comes with ABSOLUTELY NO WARRANTY; for details type 'upx -L'.\n"
|
||||||
"");
|
"");
|
||||||
|
|
||||||
#if defined(DEBUG) || defined(TESTING)
|
#if (DEBUG) || (TESTING)
|
||||||
fg = con_fg(f,FG_RED);
|
fg = con_fg(f,FG_RED);
|
||||||
con_fprintf(f,"\nWARNING: this version is compiled with"
|
con_fprintf(f,"\nWARNING: this version is compiled with"
|
||||||
#if defined(DEBUG)
|
#if (DEBUG)
|
||||||
" -DDEBUG"
|
" -DDEBUG"
|
||||||
#endif
|
#endif
|
||||||
#if defined(TESTING)
|
#if (TESTING)
|
||||||
" -DTESTING"
|
" -DTESTING"
|
||||||
#endif
|
#endif
|
||||||
"\n");
|
"\n");
|
||||||
|
@ -380,22 +380,22 @@ void show_version(int x)
|
||||||
UNUSED(v);
|
UNUSED(v);
|
||||||
|
|
||||||
fprintf(fp, "upx %s\n", UPX_VERSION_STRING);
|
fprintf(fp, "upx %s\n", UPX_VERSION_STRING);
|
||||||
#if defined(WITH_NRV)
|
#if (WITH_NRV)
|
||||||
v = upx_nrv_version_string();
|
v = upx_nrv_version_string();
|
||||||
if (v != NULL && v[0])
|
if (v != NULL && v[0])
|
||||||
fprintf(fp, "NRV data compression library %s\n", v);
|
fprintf(fp, "NRV data compression library %s\n", v);
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_UCL)
|
#if (WITH_UCL)
|
||||||
v = upx_ucl_version_string();
|
v = upx_ucl_version_string();
|
||||||
if (v != NULL && v[0])
|
if (v != NULL && v[0])
|
||||||
fprintf(fp, "UCL data compression library %s\n", v);
|
fprintf(fp, "UCL data compression library %s\n", v);
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_ZLIB)
|
#if (WITH_ZLIB)
|
||||||
v = upx_zlib_version_string();
|
v = upx_zlib_version_string();
|
||||||
if (v != NULL && v[0])
|
if (v != NULL && v[0])
|
||||||
fprintf(fp, "zlib data compression library %s\n", v);
|
fprintf(fp, "zlib data compression library %s\n", v);
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_LZMA)
|
#if (WITH_LZMA)
|
||||||
v = upx_lzma_version_string();
|
v = upx_lzma_version_string();
|
||||||
if (v != NULL && v[0])
|
if (v != NULL && v[0])
|
||||||
fprintf(fp, "LZMA SDK version %s\n", v);
|
fprintf(fp, "LZMA SDK version %s\n", v);
|
||||||
|
@ -404,10 +404,10 @@ void show_version(int x)
|
||||||
fprintf(fp, "Copyright (C) 1996-2010 Laszlo Molnar\n");
|
fprintf(fp, "Copyright (C) 1996-2010 Laszlo Molnar\n");
|
||||||
fprintf(fp, "Copyright (C) 2000-2010 John F. Reiser\n");
|
fprintf(fp, "Copyright (C) 2000-2010 John F. Reiser\n");
|
||||||
fprintf(fp, "Copyright (C) 2002-2010 Jens Medoch\n");
|
fprintf(fp, "Copyright (C) 2002-2010 Jens Medoch\n");
|
||||||
#if defined(WITH_ZLIB)
|
#if (WITH_ZLIB)
|
||||||
fprintf(fp, "Copyright (C) 1995" "-2005 Jean-loup Gailly and Mark Adler\n");
|
fprintf(fp, "Copyright (C) 1995" "-2005 Jean-loup Gailly and Mark Adler\n");
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_LZMA)
|
#if (WITH_LZMA)
|
||||||
fprintf(fp, "Copyright (C) 1999" "-2006 Igor Pavlov\n");
|
fprintf(fp, "Copyright (C) 1999" "-2006 Igor Pavlov\n");
|
||||||
#endif
|
#endif
|
||||||
fprintf(fp, "UPX comes with ABSOLUTELY NO WARRANTY; for details type '%s -L'.\n", progname);
|
fprintf(fp, "UPX comes with ABSOLUTELY NO WARRANTY; for details type '%s -L'.\n", progname);
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_LEFILE_H
|
#ifndef __UPX_LEFILE_H
|
||||||
#define __UPX_LEFILE_H
|
#define __UPX_LEFILE_H 1
|
||||||
|
|
||||||
class InputFile;
|
class InputFile;
|
||||||
class OutputFile;
|
class OutputFile;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_LINKER_H
|
#ifndef __UPX_LINKER_H
|
||||||
#define __UPX_LINKER_H
|
#define __UPX_LINKER_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
10
src/main.cpp
10
src/main.cpp
|
@ -62,7 +62,7 @@ void options_t::reset()
|
||||||
o->console = CON_FILE;
|
o->console = CON_FILE;
|
||||||
#if defined(__DJGPP__)
|
#if defined(__DJGPP__)
|
||||||
o->console = CON_INIT;
|
o->console = CON_INIT;
|
||||||
#elif defined(USE_SCREEN_WIN32)
|
#elif (USE_SCREEN_WIN32)
|
||||||
o->console = CON_INIT;
|
o->console = CON_INIT;
|
||||||
#elif 1 && defined(__linux__)
|
#elif 1 && defined(__linux__)
|
||||||
o->console = CON_INIT;
|
o->console = CON_INIT;
|
||||||
|
@ -1419,7 +1419,7 @@ void upx_sanity_check(void)
|
||||||
// main entry point
|
// main entry point
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#if !defined(WITH_GUI)
|
#if !(WITH_GUI)
|
||||||
|
|
||||||
#if (ACC_ARCH_M68K && ACC_OS_TOS && ACC_CC_GNUC) && defined(__MINT__)
|
#if (ACC_ARCH_M68K && ACC_OS_TOS && ACC_CC_GNUC) && defined(__MINT__)
|
||||||
extern "C" { extern long _stksize; long _stksize = 256 * 1024L; }
|
extern "C" { extern long _stksize; long _stksize = 256 * 1024L; }
|
||||||
|
@ -1469,7 +1469,7 @@ int __acc_cdecl_main main(int argc, char *argv[])
|
||||||
|
|
||||||
set_term(stderr);
|
set_term(stderr);
|
||||||
|
|
||||||
#if defined(WITH_UCL)
|
#if (WITH_UCL)
|
||||||
if (ucl_init() != UCL_E_OK)
|
if (ucl_init() != UCL_E_OK)
|
||||||
{
|
{
|
||||||
show_head();
|
show_head();
|
||||||
|
@ -1480,7 +1480,7 @@ int __acc_cdecl_main main(int argc, char *argv[])
|
||||||
e_exit(EXIT_INIT);
|
e_exit(EXIT_INIT);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(WITH_NRV)
|
#if (WITH_NRV)
|
||||||
if (nrv_init() != NRV_E_OK || NRV_VERSION != nrv_version())
|
if (nrv_init() != NRV_E_OK || NRV_VERSION != nrv_version())
|
||||||
{
|
{
|
||||||
show_head();
|
show_head();
|
||||||
|
@ -1573,7 +1573,7 @@ int __acc_cdecl_main main(int argc, char *argv[])
|
||||||
return exit_code;
|
return exit_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !defined(WITH_GUI) */
|
#endif /* !(WITH_GUI) */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -41,7 +41,7 @@ static int mcheck_init()
|
||||||
if (use_mcheck < 0)
|
if (use_mcheck < 0)
|
||||||
{
|
{
|
||||||
use_mcheck = 1;
|
use_mcheck = 1;
|
||||||
#if defined(WITH_VALGRIND) && defined(RUNNING_ON_VALGRIND)
|
#if (WITH_VALGRIND) && defined(RUNNING_ON_VALGRIND)
|
||||||
if (RUNNING_ON_VALGRIND)
|
if (RUNNING_ON_VALGRIND)
|
||||||
{
|
{
|
||||||
//fprintf(stderr, "upx: detected RUNNING_ON_VALGRIND\n");
|
//fprintf(stderr, "upx: detected RUNNING_ON_VALGRIND\n");
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_MEM_H
|
#ifndef __UPX_MEM_H
|
||||||
#define __UPX_MEM_H
|
#define __UPX_MEM_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_OPTIONS_H
|
#ifndef __UPX_OPTIONS_H
|
||||||
#define __UPX_OPTIONS_H
|
#define __UPX_OPTIONS_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_ARMPE_H
|
#ifndef __UPX_P_ARMPE_H
|
||||||
#define __UPX_P_ARMPE_H
|
#define __UPX_P_ARMPE_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// arm/pe
|
// arm/pe
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
static const
|
static const
|
||||||
#include "stub/i086-dos16.com.h"
|
#include "stub/i086-dos16.com.h"
|
||||||
|
|
||||||
//#define TESTING
|
//#define TESTING 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_COM_H
|
#ifndef __UPX_P_COM_H
|
||||||
#define __UPX_P_COM_H
|
#define __UPX_P_COM_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_DJGPP2_H
|
#ifndef __UPX_P_DJGPP2_H
|
||||||
#define __UPX_P_DJGPP2_H
|
#define __UPX_P_DJGPP2_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_ELF_H
|
#ifndef __UPX_P_ELF_H
|
||||||
#define __UPX_P_ELF_H
|
#define __UPX_P_ELF_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -514,7 +514,7 @@ void PackExe::pack(OutputFile *fo)
|
||||||
if (ph.max_run_found + ph.max_match_found > 0x8000)
|
if (ph.max_run_found + ph.max_match_found > 0x8000)
|
||||||
throwCantPack("decompressor limit exceeded, send a bugreport");
|
throwCantPack("decompressor limit exceeded, send a bugreport");
|
||||||
|
|
||||||
#ifdef TESTING
|
#if TESTING
|
||||||
if (opt->debug.debug_level)
|
if (opt->debug.debug_level)
|
||||||
{
|
{
|
||||||
printf("image+relocs %d -> %d\n",ih_imagesize+relocsize,ph.c_len);
|
printf("image+relocs %d -> %d\n",ih_imagesize+relocsize,ph.c_len);
|
||||||
|
@ -631,7 +631,7 @@ void PackExe::pack(OutputFile *fo)
|
||||||
//fprintf(stderr,"\ne_len=%x d_len=%x c_len=%x oo=%x ulen=%x destp=%x copys=%x images=%x",e_len,d_len,packedsize,ph.overlap_overhead,ph.u_len,destpara,copysize,ih_imagesize);
|
//fprintf(stderr,"\ne_len=%x d_len=%x c_len=%x oo=%x ulen=%x destp=%x copys=%x images=%x",e_len,d_len,packedsize,ph.overlap_overhead,ph.u_len,destpara,copysize,ih_imagesize);
|
||||||
|
|
||||||
// write header + write loader + compressed file
|
// write header + write loader + compressed file
|
||||||
#ifdef TESTING
|
#if TESTING
|
||||||
if (opt->debug.debug_level)
|
if (opt->debug.debug_level)
|
||||||
printf("\n%d %d %d %d\n",(int)sizeof(oh),e_len,packedsize,d_len);
|
printf("\n%d %d %d %d\n",(int)sizeof(oh),e_len,packedsize,d_len);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_EXE_H
|
#ifndef __UPX_P_EXE_H
|
||||||
#define __UPX_P_EXE_H
|
#define __UPX_P_EXE_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_LX_ELF_H //{
|
#ifndef __UPX_P_LX_ELF_H //{
|
||||||
#define __UPX_P_LX_ELF_H
|
#define __UPX_P_LX_ELF_H 1
|
||||||
|
|
||||||
|
|
||||||
class PackLinuxElf : public PackUnix
|
class PackLinuxElf : public PackUnix
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_LX_EXC_H
|
#ifndef __UPX_P_LX_EXC_H
|
||||||
#define __UPX_P_LX_EXC_H
|
#define __UPX_P_LX_EXC_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_LX_INTERP_H //{
|
#ifndef __UPX_P_LX_INTERP_H //{
|
||||||
#define __UPX_P_LX_INTERP_H
|
#define __UPX_P_LX_INTERP_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_LX_SH_H //{
|
#ifndef __UPX_P_LX_SH_H //{
|
||||||
#define __UPX_P_LX_SH_H
|
#define __UPX_P_LX_SH_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
12
src/p_mach.h
12
src/p_mach.h
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_MACHO_H
|
#ifndef __UPX_P_MACHO_H
|
||||||
#define __UPX_P_MACHO_H
|
#define __UPX_P_MACHO_H 1
|
||||||
|
|
||||||
|
|
||||||
__packed_struct(Mach_fat_header)
|
__packed_struct(Mach_fat_header)
|
||||||
|
@ -640,7 +640,7 @@ protected:
|
||||||
BE32 flavor;
|
BE32 flavor;
|
||||||
BE32 count; /* sizeof(following_thread_state)/4 */
|
BE32 count; /* sizeof(following_thread_state)/4 */
|
||||||
Mach_ppc_thread_state state;
|
Mach_ppc_thread_state state;
|
||||||
#define WANT_MACH_THREAD_ENUM
|
#define WANT_MACH_THREAD_ENUM 1
|
||||||
#include "p_mach_enum.h"
|
#include "p_mach_enum.h"
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
|
@ -689,7 +689,7 @@ protected:
|
||||||
LE32 flavor;
|
LE32 flavor;
|
||||||
LE32 count; /* sizeof(following_thread_state)/4 */
|
LE32 count; /* sizeof(following_thread_state)/4 */
|
||||||
Mach_i386_thread_state state;
|
Mach_i386_thread_state state;
|
||||||
#define WANT_MACH_THREAD_ENUM
|
#define WANT_MACH_THREAD_ENUM 1
|
||||||
#include "p_mach_enum.h"
|
#include "p_mach_enum.h"
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
|
@ -738,7 +738,7 @@ protected:
|
||||||
LE32 flavor;
|
LE32 flavor;
|
||||||
LE32 count; /* sizeof(following_thread_state)/4 */
|
LE32 count; /* sizeof(following_thread_state)/4 */
|
||||||
Mach_AMD64_thread_state state;
|
Mach_AMD64_thread_state state;
|
||||||
#define WANT_MACH_THREAD_ENUM
|
#define WANT_MACH_THREAD_ENUM 1
|
||||||
#include "p_mach_enum.h"
|
#include "p_mach_enum.h"
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
|
@ -788,7 +788,7 @@ protected:
|
||||||
LE32 flavor;
|
LE32 flavor;
|
||||||
LE32 count; /* sizeof(following_thread_state)/4 */
|
LE32 count; /* sizeof(following_thread_state)/4 */
|
||||||
Mach_ARM_thread_state state;
|
Mach_ARM_thread_state state;
|
||||||
#define WANT_MACH_THREAD_ENUM
|
#define WANT_MACH_THREAD_ENUM 1
|
||||||
#include "p_mach_enum.h"
|
#include "p_mach_enum.h"
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
|
@ -841,7 +841,7 @@ protected:
|
||||||
|
|
||||||
// linker
|
// linker
|
||||||
Linker *linker;
|
Linker *linker;
|
||||||
#define WANT_MACH_HEADER_ENUM
|
#define WANT_MACH_HEADER_ENUM 1
|
||||||
#include "p_mach_enum.h"
|
#include "p_mach_enum.h"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_PS1_H
|
#ifndef __UPX_P_PS1_H
|
||||||
#define __UPX_P_PS1_H
|
#define __UPX_P_PS1_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_SYS_H
|
#ifndef __UPX_P_SYS_H
|
||||||
#define __UPX_P_SYS_H
|
#define __UPX_P_SYS_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_TMT_H
|
#ifndef __UPX_P_TMT_H
|
||||||
#define __UPX_P_TMT_H
|
#define __UPX_P_TMT_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -446,7 +446,7 @@ void PackTos::pack(OutputFile *fo)
|
||||||
overlay = file_size - (FH_SIZE + i_text + i_data + i_sym);
|
overlay = file_size - (FH_SIZE + i_text + i_data + i_sym);
|
||||||
fi->readx(ibuf+t,overlay);
|
fi->readx(ibuf+t,overlay);
|
||||||
|
|
||||||
#if 0 || defined(TESTING)
|
#if 0 || (TESTING)
|
||||||
printf("text: %d, data: %d, sym: %d, bss: %d, flags=0x%x\n",
|
printf("text: %d, data: %d, sym: %d, bss: %d, flags=0x%x\n",
|
||||||
i_text, i_data, i_sym, i_bss, (int)ih.fh_flag);
|
i_text, i_data, i_sym, i_bss, (int)ih.fh_flag);
|
||||||
printf("xx1 reloc: %d, overlay: %d, fixup: %d\n", relocsize, overlay, overlay >= 4 ? (int)get_be32(ibuf+t) : -1);
|
printf("xx1 reloc: %d, overlay: %d, fixup: %d\n", relocsize, overlay, overlay >= 4 ? (int)get_be32(ibuf+t) : -1);
|
||||||
|
@ -476,7 +476,7 @@ void PackTos::pack(OutputFile *fo)
|
||||||
symbols.need_reloc = true;
|
symbols.need_reloc = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 || defined(TESTING)
|
#if 0 || (TESTING)
|
||||||
printf("xx2: %d relocs: %d, overlay: %d, t: %d\n", nrelocs, relocsize, overlay, t);
|
printf("xx2: %d relocs: %d, overlay: %d, t: %d\n", nrelocs, relocsize, overlay, t);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ void PackTos::pack(OutputFile *fo)
|
||||||
ih.fh_sym = 0; // we stripped all symbols
|
ih.fh_sym = 0; // we stripped all symbols
|
||||||
memcpy(ibuf+t, &ih, FH_SIZE);
|
memcpy(ibuf+t, &ih, FH_SIZE);
|
||||||
t += FH_SIZE;
|
t += FH_SIZE;
|
||||||
#if 0 || defined(TESTING)
|
#if 0 || (TESTING)
|
||||||
printf("xx3 reloc: %d, overlay: %d, t: %d\n", relocsize, overlay, t);
|
printf("xx3 reloc: %d, overlay: %d, t: %d\n", relocsize, overlay, t);
|
||||||
#endif
|
#endif
|
||||||
assert(t <= isize);
|
assert(t <= isize);
|
||||||
|
@ -686,7 +686,7 @@ void PackTos::pack(OutputFile *fo)
|
||||||
// add an empty relocation fixup to workaround a bug in some TOS versions
|
// add an empty relocation fixup to workaround a bug in some TOS versions
|
||||||
oh.fh_reloc = 0;
|
oh.fh_reloc = 0;
|
||||||
|
|
||||||
#if 0 || defined(TESTING)
|
#if 0 || (TESTING)
|
||||||
printf("old text: %6d, data: %6d, bss: %6d, reloc: %d, overlay: %d\n",
|
printf("old text: %6d, data: %6d, bss: %6d, reloc: %d, overlay: %d\n",
|
||||||
i_text, i_data, i_bss, relocsize, overlay);
|
i_text, i_data, i_bss, relocsize, overlay);
|
||||||
printf("new text: %6d, data: %6d, bss: %6d, flag=0x%x\n",
|
printf("new text: %6d, data: %6d, bss: %6d, flag=0x%x\n",
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_TOS_H
|
#ifndef __UPX_P_TOS_H
|
||||||
#define __UPX_P_TOS_H
|
#define __UPX_P_TOS_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_UNIX_H
|
#ifndef __UPX_P_UNIX_H
|
||||||
#define __UPX_P_UNIX_H
|
#define __UPX_P_UNIX_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_VMLINX_H
|
#ifndef __UPX_P_VMLINX_H
|
||||||
#define __UPX_P_VMLINX_H
|
#define __UPX_P_VMLINX_H 1
|
||||||
|
|
||||||
#include "p_elf.h"
|
#include "p_elf.h"
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_VMLINZ_H
|
#ifndef __UPX_P_VMLINZ_H
|
||||||
#define __UPX_P_VMLINZ_H
|
#define __UPX_P_VMLINZ_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_VXD_H
|
#ifndef __UPX_P_VXD_H
|
||||||
#define __UPX_P_VXD_H
|
#define __UPX_P_VXD_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_W16NE_H
|
#ifndef __UPX_P_W16NE_H
|
||||||
#define __UPX_P_W16NE_H
|
#define __UPX_P_W16NE_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_W32PE_H
|
#ifndef __UPX_P_W32PE_H
|
||||||
#define __UPX_P_W32PE_H
|
#define __UPX_P_W32PE_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// w32/pe
|
// w32/pe
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_P_WCLE_H
|
#ifndef __UPX_P_WCLE_H
|
||||||
#define __UPX_P_WCLE_H
|
#define __UPX_P_WCLE_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//#define WANT_STL
|
//#define WANT_STL 1
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "packer.h"
|
#include "packer.h"
|
||||||
|
@ -211,7 +211,7 @@ bool Packer::compress(upx_bytep i_ptr, unsigned i_len, upx_bytep o_ptr,
|
||||||
cconf.conf_ucl.max_offset = opt->crp.crp_ucl.max_offset;
|
cconf.conf_ucl.max_offset = opt->crp.crp_ucl.max_offset;
|
||||||
if (opt->crp.crp_ucl.max_match != UINT_MAX && opt->crp.crp_ucl.max_match < cconf.conf_ucl.max_match)
|
if (opt->crp.crp_ucl.max_match != UINT_MAX && opt->crp.crp_ucl.max_match < cconf.conf_ucl.max_match)
|
||||||
cconf.conf_ucl.max_match = opt->crp.crp_ucl.max_match;
|
cconf.conf_ucl.max_match = opt->crp.crp_ucl.max_match;
|
||||||
#if defined(WITH_NRV)
|
#if (WITH_NRV)
|
||||||
if (ph.level >= 7 || (ph.level >= 4 && ph.u_len >= 512*1024))
|
if (ph.level >= 7 || (ph.level >= 4 && ph.u_len >= 512*1024))
|
||||||
step = 0;
|
step = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -625,7 +625,7 @@ unsigned Packer::getRandomId() const
|
||||||
#endif
|
#endif
|
||||||
while (id == 0)
|
while (id == 0)
|
||||||
{
|
{
|
||||||
#if !defined(HAVE_GETTIMEOFDAY) || defined(__DJGPP__)
|
#if !(HAVE_GETTIMEOFDAY) || defined(__DJGPP__)
|
||||||
id ^= (unsigned) time(NULL);
|
id ^= (unsigned) time(NULL);
|
||||||
id ^= ((unsigned) clock()) << 12;
|
id ^= ((unsigned) clock()) << 12;
|
||||||
#else
|
#else
|
||||||
|
@ -634,7 +634,7 @@ unsigned Packer::getRandomId() const
|
||||||
id ^= (unsigned) tv.tv_sec;
|
id ^= (unsigned) tv.tv_sec;
|
||||||
id ^= ((unsigned) tv.tv_usec) << 12; // shift into high-bits
|
id ^= ((unsigned) tv.tv_usec) << 12; // shift into high-bits
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_GETPID)
|
#if (HAVE_GETPID)
|
||||||
id ^= (unsigned) getpid();
|
id ^= (unsigned) getpid();
|
||||||
#endif
|
#endif
|
||||||
id ^= (unsigned) fi->st.st_ino;
|
id ^= (unsigned) fi->st.st_ino;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_PACKER_H
|
#ifndef __UPX_PACKER_H
|
||||||
#define __UPX_PACKER_H
|
#define __UPX_PACKER_H 1
|
||||||
|
|
||||||
#include "mem.h"
|
#include "mem.h"
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
bool Packer::isValidCompressionMethod(int method)
|
bool Packer::isValidCompressionMethod(int method)
|
||||||
{
|
{
|
||||||
if (M_IS_LZMA(method)) {
|
if (M_IS_LZMA(method)) {
|
||||||
#if !defined(WITH_LZMA)
|
#if !(WITH_LZMA)
|
||||||
assert(0 && "Internal error - LZMA not compiled in");
|
assert(0 && "Internal error - LZMA not compiled in");
|
||||||
#else
|
#else
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_PACKMASTER_H
|
#ifndef __UPX_PACKMASTER_H
|
||||||
#define __UPX_PACKMASTER_H
|
#define __UPX_PACKMASTER_H 1
|
||||||
|
|
||||||
class Packer;
|
class Packer;
|
||||||
class InputFile;
|
class InputFile;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_PEFILE_H
|
#ifndef __UPX_PEFILE_H
|
||||||
#define __UPX_PEFILE_H
|
#define __UPX_PEFILE_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
#if defined(USE_SCREEN) && defined(__DJGPP__)
|
#if (USE_SCREEN) && defined(__DJGPP__)
|
||||||
|
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
#define mask_fg 0x0f
|
#define mask_fg 0x0f
|
||||||
#define mask_bg 0xf0
|
#define mask_bg 0xf0
|
||||||
|
|
||||||
/* #define USE_SCROLLBACK */
|
/* #define USE_SCROLLBACK 1 */
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -70,7 +70,7 @@ struct screen_data_t
|
||||||
unsigned char init_attr;
|
unsigned char init_attr;
|
||||||
unsigned char empty_attr;
|
unsigned char empty_attr;
|
||||||
unsigned short empty_cell;
|
unsigned short empty_cell;
|
||||||
#ifdef USE_SCROLLBACK
|
#if USE_SCROLLBACK
|
||||||
/* scrollback buffer */
|
/* scrollback buffer */
|
||||||
unsigned short sb_buf[32][256];
|
unsigned short sb_buf[32][256];
|
||||||
int sb_size;
|
int sb_size;
|
||||||
|
@ -89,7 +89,7 @@ static struct
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_SCROLLBACK
|
#if USE_SCROLLBACK
|
||||||
static __inline__ void sb_add(screen_t *this, int *val, int inc)
|
static __inline__ void sb_add(screen_t *this, int *val, int inc)
|
||||||
{
|
{
|
||||||
*val = (*val + inc) & (this->data->sb_size - 1);
|
*val = (*val + inc) & (this->data->sb_size - 1);
|
||||||
|
@ -304,7 +304,7 @@ static int init(screen_t *this, int fd)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
this->data->mode = -1;
|
this->data->mode = -1;
|
||||||
#ifdef USE_SCROLLBACK
|
#if USE_SCROLLBACK
|
||||||
this->data->sb_size = 32;
|
this->data->sb_size = 32;
|
||||||
this->data->sb_base = 0;
|
this->data->sb_base = 0;
|
||||||
this->data->sb_sp = 0;
|
this->data->sb_sp = 0;
|
||||||
|
@ -404,7 +404,7 @@ static int scrollUp(screen_t *this, int lines)
|
||||||
if (lines <= 0 || lines > sr)
|
if (lines <= 0 || lines > sr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#ifdef USE_SCROLLBACK
|
#if USE_SCROLLBACK
|
||||||
/* copy to scrollback buffer */
|
/* copy to scrollback buffer */
|
||||||
for (y = 0; y < lines; y++)
|
for (y = 0; y < lines; y++)
|
||||||
{
|
{
|
||||||
|
@ -449,7 +449,7 @@ static int scrollDown(screen_t *this, int lines)
|
||||||
/* copy top lines from scrollback buffer */
|
/* copy top lines from scrollback buffer */
|
||||||
for (y = lines; --y >= 0; )
|
for (y = lines; --y >= 0; )
|
||||||
{
|
{
|
||||||
#ifdef USE_SCROLLBACK
|
#if USE_SCROLLBACK
|
||||||
const unsigned short *buf = sb_pop(this);
|
const unsigned short *buf = sb_pop(this);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
clearLine(this,y);
|
clearLine(this,y);
|
||||||
|
@ -556,7 +556,7 @@ screen_t *screen_djgpp2_construct(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* defined(USE_SCREEN) && defined(__DJGPP__) */
|
#endif /* (USE_SCREEN) && defined(__DJGPP__) */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
#if defined(USE_SCREEN)
|
#if (USE_SCREEN)
|
||||||
|
|
||||||
#define this local_this
|
#define this local_this
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ screen_t *sobject_construct(const screen_t *c, size_t data_size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* defined(USE_SCREEN) */
|
#endif /* (USE_SCREEN) */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
#if defined(USE_SCREEN) && defined(USE_SCREEN_VCSA)
|
#if (USE_SCREEN) && (USE_SCREEN_VCSA)
|
||||||
|
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
#define mask_fg 0x0f
|
#define mask_fg 0x0f
|
||||||
#define mask_bg 0xf0
|
#define mask_bg 0xf0
|
||||||
|
|
||||||
/* #define USE_SCROLLBACK */
|
/* #define USE_SCROLLBACK 1 */
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -68,7 +68,7 @@ struct screen_data_t
|
||||||
unsigned char init_attr;
|
unsigned char init_attr;
|
||||||
unsigned char map[256];
|
unsigned char map[256];
|
||||||
unsigned short empty_line[256];
|
unsigned short empty_line[256];
|
||||||
#ifdef USE_SCROLLBACK
|
#if USE_SCROLLBACK
|
||||||
/* scrollback buffer */
|
/* scrollback buffer */
|
||||||
unsigned short sb_buf[32][256];
|
unsigned short sb_buf[32][256];
|
||||||
int sb_size;
|
int sb_size;
|
||||||
|
@ -78,7 +78,7 @@ struct screen_data_t
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_SCROLLBACK
|
#if USE_SCROLLBACK
|
||||||
static __inline__ void sb_add(screen_t *this, int *val, int inc)
|
static __inline__ void sb_add(screen_t *this, int *val, int inc)
|
||||||
{
|
{
|
||||||
*val = (*val + inc) & (this->data->sb_size - 1);
|
*val = (*val + inc) & (this->data->sb_size - 1);
|
||||||
|
@ -311,7 +311,7 @@ static int init(screen_t *this, int fd)
|
||||||
this->data->fd = -1;
|
this->data->fd = -1;
|
||||||
this->data->mode = -1;
|
this->data->mode = -1;
|
||||||
this->data->page = 0;
|
this->data->page = 0;
|
||||||
#ifdef USE_SCROLLBACK
|
#if USE_SCROLLBACK
|
||||||
this->data->sb_size = 32;
|
this->data->sb_size = 32;
|
||||||
this->data->sb_base = 0;
|
this->data->sb_base = 0;
|
||||||
this->data->sb_sp = 0;
|
this->data->sb_sp = 0;
|
||||||
|
@ -427,7 +427,7 @@ static int scrollUp(screen_t *this, int lines)
|
||||||
if (lines <= 0 || lines > sr)
|
if (lines <= 0 || lines > sr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#ifdef USE_SCROLLBACK
|
#if USE_SCROLLBACK
|
||||||
/* copy to scrollback buffer */
|
/* copy to scrollback buffer */
|
||||||
for (y = 0; y < lines; y++)
|
for (y = 0; y < lines; y++)
|
||||||
{
|
{
|
||||||
|
@ -479,7 +479,7 @@ static int scrollDown(screen_t *this, int lines)
|
||||||
/* copy top lines from scrollback buffer */
|
/* copy top lines from scrollback buffer */
|
||||||
for (y = lines; --y >= 0; )
|
for (y = lines; --y >= 0; )
|
||||||
{
|
{
|
||||||
#ifdef USE_SCROLLBACK
|
#if USE_SCROLLBACK
|
||||||
const unsigned short *buf = sb_pop(this);
|
const unsigned short *buf = sb_pop(this);
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
clearLine(this,y);
|
clearLine(this,y);
|
||||||
|
@ -608,7 +608,7 @@ screen_t *screen_vcsa_construct(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* defined(USE_SCREEN) && defined(USE_SCREEN_VCSA) */
|
#endif /* (USE_SCREEN) && (USE_SCREEN_VCSA) */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
#if defined(USE_SCREEN_WIN32)
|
#if (USE_SCREEN_WIN32)
|
||||||
|
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
# define timeval win32_timeval /* struct timeval already in <sys/time.h> */
|
# define timeval win32_timeval /* struct timeval already in <sys/time.h> */
|
||||||
#endif
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#if defined(HAVE_CONIO_H)
|
#if (HAVE_CONIO_H)
|
||||||
# include <conio.h>
|
# include <conio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -449,7 +449,7 @@ static int getScrollCounter(const screen_t *this)
|
||||||
static int s_kbhit(screen_t *this)
|
static int s_kbhit(screen_t *this)
|
||||||
{
|
{
|
||||||
UNUSED(this);
|
UNUSED(this);
|
||||||
#if defined(HAVE_CONIO_H)
|
#if (HAVE_CONIO_H)
|
||||||
# if defined(__RSXNT__)
|
# if defined(__RSXNT__)
|
||||||
return 0;
|
return 0;
|
||||||
# elif defined(__BORLANDC__) || defined(__WATCOMC__)
|
# elif defined(__BORLANDC__) || defined(__WATCOMC__)
|
||||||
|
@ -526,7 +526,7 @@ screen_t *screen_win32_construct(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* defined(USE_SCREEN) && (ACC_OS_WIN32 || ACC_OS_WIN64) */
|
#endif /* (USE_SCREEN_WIN32) */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
12
src/screen.h
12
src/screen.h
|
@ -27,9 +27,9 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_SCREEN_H
|
#ifndef __UPX_SCREEN_H
|
||||||
#define __UPX_SCREEN_H
|
#define __UPX_SCREEN_H 1
|
||||||
|
|
||||||
#if defined(USE_SCREEN)
|
#if (USE_SCREEN)
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -113,7 +113,7 @@ void screen_show_frames(screen_t *);
|
||||||
#undef LOGU
|
#undef LOGU
|
||||||
#undef LOGS
|
#undef LOGS
|
||||||
|
|
||||||
#if defined(SCREEN_DEBUG)
|
#if (SCREEN_DEBUG)
|
||||||
static void LOG(const char *format, ...)
|
static void LOG(const char *format, ...)
|
||||||
{
|
{
|
||||||
static FILE *logfile = NULL;
|
static FILE *logfile = NULL;
|
||||||
|
@ -133,9 +133,9 @@ static void LOG(const char *format, ...)
|
||||||
# define LOGU(x) LOG(#x " %lu\n", (long)(x))
|
# define LOGU(x) LOG(#x " %lu\n", (long)(x))
|
||||||
# define LOGS(x) LOG(#x " %s\n", x)
|
# define LOGS(x) LOG(#x " %s\n", x)
|
||||||
#else
|
#else
|
||||||
# define LOGI(x)
|
# define LOGI(x) /*empty*/
|
||||||
# define LOGU(x)
|
# define LOGU(x) /*empty*/
|
||||||
# define LOGS(x)
|
# define LOGS(x) /*empty*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* if #0 */
|
#endif /* if #0 */
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
# define float error no_float
|
# define float error no_float
|
||||||
# define double error no_float
|
# define double error no_float
|
||||||
# endif
|
# endif
|
||||||
#elif 0 || defined(HAVE_LONG_DOUBLE)
|
#elif 0 || (HAVE_LONG_DOUBLE)
|
||||||
# define LDOUBLE long double
|
# define LDOUBLE long double
|
||||||
#else
|
#else
|
||||||
# define LDOUBLE double
|
# define LDOUBLE double
|
||||||
|
@ -263,7 +263,7 @@ static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
||||||
// floating format support
|
// floating format support
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#if !defined(NO_FLOAT)
|
#if !(NO_FLOAT)
|
||||||
|
|
||||||
static LDOUBLE abs_val(LDOUBLE value)
|
static LDOUBLE abs_val(LDOUBLE value)
|
||||||
{
|
{
|
||||||
|
@ -490,7 +490,7 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* !defined(NO_FLOAT) */
|
#endif /* !(NO_FLOAT) */
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -501,7 +501,7 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args
|
||||||
{
|
{
|
||||||
char ch;
|
char ch;
|
||||||
LLONG value;
|
LLONG value;
|
||||||
#if !defined(NO_FLOAT)
|
#if !(NO_FLOAT)
|
||||||
LDOUBLE fvalue;
|
LDOUBLE fvalue;
|
||||||
#endif
|
#endif
|
||||||
const char *strvalue;
|
const char *strvalue;
|
||||||
|
@ -665,7 +665,7 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args
|
||||||
value = (long)va_arg (args, unsigned int);
|
value = (long)va_arg (args, unsigned int);
|
||||||
fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags);
|
fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags);
|
||||||
break;
|
break;
|
||||||
#if !defined(NO_FLOAT)
|
#if !(NO_FLOAT)
|
||||||
case 'f':
|
case 'f':
|
||||||
if (cflags == DP_C_LDOUBLE)
|
if (cflags == DP_C_LDOUBLE)
|
||||||
fvalue = va_arg (args, LDOUBLE);
|
fvalue = va_arg (args, LDOUBLE);
|
||||||
|
@ -698,7 +698,7 @@ static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args
|
||||||
case 'g':
|
case 'g':
|
||||||
assert(0);
|
assert(0);
|
||||||
exit(255);
|
exit(255);
|
||||||
#endif /* !defined(NO_FLOAT) */
|
#endif /* !(NO_FLOAT) */
|
||||||
case 'c':
|
case 'c':
|
||||||
dopr_outch (buffer, &currlen, maxlen, va_arg (args, int));
|
dopr_outch (buffer, &currlen, maxlen, va_arg (args, int));
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_SNPRINTF_H
|
#ifndef __UPX_SNPRINTF_H
|
||||||
#define __UPX_SNPRINTF_H
|
#define __UPX_SNPRINTF_H 1
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//#define WANT_STL
|
//#define WANT_STL 1
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "stdcxx.h"
|
#include "stdcxx.h"
|
||||||
|
|
||||||
|
|
10
src/stdcxx.h
10
src/stdcxx.h
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_STDCXX_H
|
#ifndef __UPX_STDCXX_H
|
||||||
#define __UPX_STDCXX_H
|
#define __UPX_STDCXX_H 1
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
@ -93,9 +93,9 @@ using namespace std;
|
||||||
#elif (ACC_CC_DMC)
|
#elif (ACC_CC_DMC)
|
||||||
namespace std { class bad_alloc { }; }
|
namespace std { class bad_alloc { }; }
|
||||||
#elif (ACC_CC_GNUC && ACC_OS_EMX)
|
#elif (ACC_CC_GNUC && ACC_OS_EMX)
|
||||||
#define std
|
#define std /*empty*/
|
||||||
#elif (ACC_CC_SYMANTECC)
|
#elif (ACC_CC_SYMANTECC)
|
||||||
#define std
|
#define std /*empty*/
|
||||||
class bad_alloc { };
|
class bad_alloc { };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -107,11 +107,11 @@ class bad_alloc { };
|
||||||
#ifdef WANT_STL
|
#ifdef WANT_STL
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
# define _NOTHREADS
|
# define _NOTHREADS 1
|
||||||
#endif
|
#endif
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
# define __THROW_BAD_ALLOC throw bad_alloc()
|
# define __THROW_BAD_ALLOC throw bad_alloc()
|
||||||
# define __USE_MALLOC
|
# define __USE_MALLOC 1
|
||||||
# define enable upx_stl_enable
|
# define enable upx_stl_enable
|
||||||
#endif
|
#endif
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
|
|
@ -48,7 +48,7 @@ binmode(INFILE);
|
||||||
# check file size
|
# check file size
|
||||||
@st = stat($ifile);
|
@st = stat($ifile);
|
||||||
if (1 && $st[7] <= 0) {
|
if (1 && $st[7] <= 0) {
|
||||||
print STDERR "$ifile: ERROR: emtpy file\n";
|
print STDERR "$ifile: ERROR: empty file\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (1 && $st[7] > 64*1024) {
|
if (1 && $st[7] > 64*1024) {
|
||||||
|
|
|
@ -284,7 +284,7 @@ def main(argv):
|
||||||
# check file size
|
# check file size
|
||||||
st = os.stat(ifile)
|
st = os.stat(ifile)
|
||||||
if 1 and st.st_size <= 0:
|
if 1 and st.st_size <= 0:
|
||||||
print >> sys.stderr, "%s: ERROR: emtpy file" % (ifile)
|
print >> sys.stderr, "%s: ERROR: empty file" % (ifile)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if 1 and st.st_size > 128*1024:
|
if 1 and st.st_size > 128*1024:
|
||||||
print >> sys.stderr, "%s: ERROR: file is too big (%d bytes)" % (ifile, st.st_size)
|
print >> sys.stderr, "%s: ERROR: file is too big (%d bytes)" % (ifile, st.st_size)
|
||||||
|
|
|
@ -76,7 +76,7 @@ xread(Extent *x, void *buf, size_t count)
|
||||||
#define ERR_LAB error: exit(127);
|
#define ERR_LAB error: exit(127);
|
||||||
#define err_exit(a) goto error
|
#define err_exit(a) goto error
|
||||||
#else //}{ save debugging time
|
#else //}{ save debugging time
|
||||||
#define ERR_LAB
|
#define ERR_LAB /*empty*/
|
||||||
static void
|
static void
|
||||||
err_exit(int a)
|
err_exit(int a)
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,7 +78,7 @@ xread(Extent *x, char *buf, size_t count)
|
||||||
#define ERR_LAB error: exit(127);
|
#define ERR_LAB error: exit(127);
|
||||||
#define err_exit(a) goto error
|
#define err_exit(a) goto error
|
||||||
#else //}{ save debugging time
|
#else //}{ save debugging time
|
||||||
#define ERR_LAB
|
#define ERR_LAB /*empty*/
|
||||||
static void
|
static void
|
||||||
err_exit(int a)
|
err_exit(int a)
|
||||||
{
|
{
|
||||||
|
|
|
@ -102,7 +102,7 @@ section LZMA_DEC00
|
||||||
ignore_reloc_overflow lzma_properties
|
ignore_reloc_overflow lzma_properties
|
||||||
|
|
||||||
|
|
||||||
#define ret
|
#define ret /*empty*/
|
||||||
section LZMA_DEC10
|
section LZMA_DEC10
|
||||||
.arch i8086, nojumps
|
.arch i8086, nojumps
|
||||||
#define SMALL 1
|
#define SMALL 1
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef _MR3K_STD_CONF_
|
#ifndef _MR3K_STD_CONF_
|
||||||
#define _MR3K_STD_CONF_
|
#define _MR3K_STD_CONF_ 1
|
||||||
|
|
||||||
#define JOHN 1
|
#define JOHN 1
|
||||||
#define ALT_SMALL 1
|
#define ALT_SMALL 1
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
# define PRINT(str)
|
# define PRINT(str) /*empty*/
|
||||||
#else
|
#else
|
||||||
# define PRINT(str) .print str
|
# define PRINT(str) .print str
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef __PPC_REGS__ /*{*/
|
#ifndef __PPC_REGS__ /*{*/
|
||||||
#define __PPC_REGS__
|
#define __PPC_REGS__ 1
|
||||||
|
|
||||||
#define r0 0
|
#define r0 0
|
||||||
#define r1 1
|
#define r1 1
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef __PPC_REGS__ /*{*/
|
#ifndef __PPC_REGS__ /*{*/
|
||||||
#define __PPC_REGS__
|
#define __PPC_REGS__ 1
|
||||||
|
|
||||||
#define r0 0
|
#define r0 0
|
||||||
#define r1 1
|
#define r1 1
|
||||||
|
|
|
@ -79,7 +79,7 @@ xread(Extent *x, void *buf, size_t count)
|
||||||
#define ERR_LAB error: exit(127);
|
#define ERR_LAB error: exit(127);
|
||||||
#define err_exit(a) goto error
|
#define err_exit(a) goto error
|
||||||
#else //}{ save debugging time
|
#else //}{ save debugging time
|
||||||
#define ERR_LAB
|
#define ERR_LAB /*empty*/
|
||||||
static void
|
static void
|
||||||
err_exit(int a)
|
err_exit(int a)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,9 +38,9 @@
|
||||||
|
|
||||||
#define DEBUG 0
|
#define DEBUG 0
|
||||||
#if DEBUG == 0
|
#if DEBUG == 0
|
||||||
# define DINIT
|
# define DINIT /*empty*/
|
||||||
# define DDUMP(x)
|
# define DDUMP(x) /*empty*/
|
||||||
# define DDONE
|
# define DDONE /*empty*/
|
||||||
#else
|
#else
|
||||||
#define DDUMP(x) stmfd sp!, {r0 - r3}; mov r0, x; mov lr, pc; mov pc, r8; ldmia sp!, {r0 - r3}
|
#define DDUMP(x) stmfd sp!, {r0 - r3}; mov r0, x; mov lr, pc; mov pc, r8; ldmia sp!, {r0 - r3}
|
||||||
#if DEBUG == 1
|
#if DEBUG == 1
|
||||||
|
@ -48,10 +48,10 @@
|
||||||
#define DDONE mov pc, lr
|
#define DDONE mov pc, lr
|
||||||
#elif DEBUG == 2
|
#elif DEBUG == 2
|
||||||
#define DINIT adr r8, writefile
|
#define DINIT adr r8, writefile
|
||||||
#define DDONE
|
#define DDONE /*empty*/
|
||||||
#elif DEBUG == 3
|
#elif DEBUG == 3
|
||||||
#define DINIT adr r8, DelFile
|
#define DINIT adr r8, DelFile
|
||||||
#define DDONE
|
#define DDONE /*empty*/
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ xread(struct Extent *x, char *buf, size_t count)
|
||||||
#define ERR_LAB error: exit(127);
|
#define ERR_LAB error: exit(127);
|
||||||
#define err_exit(a) goto error
|
#define err_exit(a) goto error
|
||||||
#else //}{ save debugging time
|
#else //}{ save debugging time
|
||||||
#define ERR_LAB
|
#define ERR_LAB /*empty*/
|
||||||
static void
|
static void
|
||||||
err_exit(int a) __attribute__ ((__noreturn__));
|
err_exit(int a) __attribute__ ((__noreturn__));
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
// mmap() the temporary output file
|
// mmap() the temporary output file
|
||||||
#define USE_MMAP_FO
|
#define USE_MMAP_FO 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -50,7 +50,7 @@ struct Extent {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#if !defined(USE_MMAP_FO)
|
#if !(USE_MMAP_FO)
|
||||||
#if 1
|
#if 1
|
||||||
static __inline__ int xwrite(int fd, const void *buf, int count)
|
static __inline__ int xwrite(int fd, const void *buf, int count)
|
||||||
{
|
{
|
||||||
|
@ -322,7 +322,7 @@ void upx_main(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the temporary output file.
|
// Create the temporary output file.
|
||||||
#if defined(USE_MMAP_FO)
|
#if (USE_MMAP_FO)
|
||||||
fdo = open(tmpname, O_RDWR | O_CREAT | O_EXCL, 0700);
|
fdo = open(tmpname, O_RDWR | O_CREAT | O_EXCL, 0700);
|
||||||
#else
|
#else
|
||||||
fdo = open(tmpname, O_WRONLY | O_CREAT | O_EXCL, 0700);
|
fdo = open(tmpname, O_WRONLY | O_CREAT | O_EXCL, 0700);
|
||||||
|
@ -342,7 +342,7 @@ void upx_main(
|
||||||
// ----- Step 3: setup memory -----
|
// ----- Step 3: setup memory -----
|
||||||
//
|
//
|
||||||
|
|
||||||
#if defined(USE_MMAP_FO)
|
#if (USE_MMAP_FO)
|
||||||
// FIXME: packer could set length
|
// FIXME: packer could set length
|
||||||
buf = (unsigned char *)mmap(0, header.p_filesize,
|
buf = (unsigned char *)mmap(0, header.p_filesize,
|
||||||
PROT_READ | PROT_WRITE, MAP_SHARED, fdo, 0);
|
PROT_READ | PROT_WRITE, MAP_SHARED, fdo, 0);
|
||||||
|
@ -413,7 +413,7 @@ void upx_main(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Incompressible block
|
// Incompressible block
|
||||||
#if defined(USE_MMAP_FO)
|
#if (USE_MMAP_FO)
|
||||||
//memcpy(buf, xi.buf, h.sz_unc);
|
//memcpy(buf, xi.buf, h.sz_unc);
|
||||||
register unsigned long int __d0, __d1, __d2;
|
register unsigned long int __d0, __d1, __d2;
|
||||||
__asm__ __volatile__( "rep; movsb"
|
__asm__ __volatile__( "rep; movsb"
|
||||||
|
@ -423,7 +423,7 @@ void upx_main(
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USE_MMAP_FO)
|
#if (USE_MMAP_FO)
|
||||||
// unmap part of the output
|
// unmap part of the output
|
||||||
munmap(buf, h.sz_unc);
|
munmap(buf, h.sz_unc);
|
||||||
buf += h.sz_unc;
|
buf += h.sz_unc;
|
||||||
|
@ -455,7 +455,7 @@ void upx_main(
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#if !defined(USE_MMAP_FO)
|
#if !(USE_MMAP_FO)
|
||||||
// Free our temporary decompression buffer.
|
// Free our temporary decompression buffer.
|
||||||
munmap(buf, malloc_args.ma_length);
|
munmap(buf, malloc_args.ma_length);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -76,7 +76,7 @@ xread(Extent *x, char *buf, size_t count)
|
||||||
#define ERR_LAB error: exit(127);
|
#define ERR_LAB error: exit(127);
|
||||||
#define err_exit(a) goto error
|
#define err_exit(a) goto error
|
||||||
#else //}{ save debugging time
|
#else //}{ save debugging time
|
||||||
#define ERR_LAB
|
#define ERR_LAB /*empty*/
|
||||||
static void
|
static void
|
||||||
err_exit(int a)
|
err_exit(int a)
|
||||||
{
|
{
|
||||||
|
|
|
@ -177,7 +177,7 @@ xread(Extent *x, char *buf, size_t count)
|
||||||
#define ERR_LAB error: exit(127);
|
#define ERR_LAB error: exit(127);
|
||||||
#define err_exit(a) goto error
|
#define err_exit(a) goto error
|
||||||
#else //}{ save debugging time
|
#else //}{ save debugging time
|
||||||
#define ERR_LAB
|
#define ERR_LAB /*empty*/
|
||||||
static void __attribute__ ((__noreturn__))
|
static void __attribute__ ((__noreturn__))
|
||||||
err_exit(int a)
|
err_exit(int a)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
// mmap() the temporary output file
|
// mmap() the temporary output file
|
||||||
#define USE_MMAP_FO
|
#define USE_MMAP_FO 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -50,7 +50,7 @@ struct Extent {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#if !defined(USE_MMAP_FO)
|
#if !(USE_MMAP_FO)
|
||||||
#if 1
|
#if 1
|
||||||
static __inline__ int xwrite(int fd, const void *buf, int count)
|
static __inline__ int xwrite(int fd, const void *buf, int count)
|
||||||
{
|
{
|
||||||
|
@ -345,7 +345,7 @@ void upx_main(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the temporary output file.
|
// Create the temporary output file.
|
||||||
#if defined(USE_MMAP_FO)
|
#if (USE_MMAP_FO)
|
||||||
fdo = open(tmpname, O_RDWR | O_CREAT | O_EXCL, 0700);
|
fdo = open(tmpname, O_RDWR | O_CREAT | O_EXCL, 0700);
|
||||||
#else
|
#else
|
||||||
fdo = open(tmpname, O_WRONLY | O_CREAT | O_EXCL, 0700);
|
fdo = open(tmpname, O_WRONLY | O_CREAT | O_EXCL, 0700);
|
||||||
|
@ -365,7 +365,7 @@ void upx_main(
|
||||||
// ----- Step 3: setup memory -----
|
// ----- Step 3: setup memory -----
|
||||||
//
|
//
|
||||||
|
|
||||||
#if defined(USE_MMAP_FO)
|
#if (USE_MMAP_FO)
|
||||||
// FIXME: packer could set length
|
// FIXME: packer could set length
|
||||||
buf = (unsigned char *)mmap(0, header.p_filesize,
|
buf = (unsigned char *)mmap(0, header.p_filesize,
|
||||||
PROT_READ | PROT_WRITE, MAP_SHARED, fdo, 0);
|
PROT_READ | PROT_WRITE, MAP_SHARED, fdo, 0);
|
||||||
|
@ -436,7 +436,7 @@ void upx_main(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Incompressible block
|
// Incompressible block
|
||||||
#if defined(USE_MMAP_FO)
|
#if (USE_MMAP_FO)
|
||||||
//memcpy(buf, xi.buf, h.sz_unc);
|
//memcpy(buf, xi.buf, h.sz_unc);
|
||||||
register unsigned long int __d0, __d1, __d2;
|
register unsigned long int __d0, __d1, __d2;
|
||||||
__asm__ __volatile__( "rep; movsb"
|
__asm__ __volatile__( "rep; movsb"
|
||||||
|
@ -446,7 +446,7 @@ void upx_main(
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USE_MMAP_FO)
|
#if (USE_MMAP_FO)
|
||||||
// unmap part of the output
|
// unmap part of the output
|
||||||
munmap(buf, h.sz_unc);
|
munmap(buf, h.sz_unc);
|
||||||
buf += h.sz_unc;
|
buf += h.sz_unc;
|
||||||
|
@ -478,7 +478,7 @@ void upx_main(
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#if !defined(USE_MMAP_FO)
|
#if !(USE_MMAP_FO)
|
||||||
// Free our temporary decompression buffer.
|
// Free our temporary decompression buffer.
|
||||||
munmap(buf, malloc_args.ma_length);
|
munmap(buf, malloc_args.ma_length);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -81,7 +81,7 @@ xread(struct Extent *x, char *buf, size_t count)
|
||||||
#define ERR_LAB error: exit(127);
|
#define ERR_LAB error: exit(127);
|
||||||
#define err_exit(a) goto error
|
#define err_exit(a) goto error
|
||||||
#else //}{ save debugging time
|
#else //}{ save debugging time
|
||||||
#define ERR_LAB
|
#define ERR_LAB /*empty*/
|
||||||
static void
|
static void
|
||||||
err_exit(int a)
|
err_exit(int a)
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,7 +78,7 @@ xread(struct Extent *x, char *buf, size_t count)
|
||||||
#define ERR_LAB error: exit(127);
|
#define ERR_LAB error: exit(127);
|
||||||
#define err_exit(a) goto error
|
#define err_exit(a) goto error
|
||||||
#else //}{ save debugging time
|
#else //}{ save debugging time
|
||||||
#define ERR_LAB
|
#define ERR_LAB /*empty*/
|
||||||
static void
|
static void
|
||||||
err_exit(int a)
|
err_exit(int a)
|
||||||
{
|
{
|
||||||
|
|
|
@ -167,7 +167,7 @@ xread(struct Extent *x, char *buf, size_t count)
|
||||||
#define ERR_LAB error: exit(127);
|
#define ERR_LAB error: exit(127);
|
||||||
#define err_exit(a) goto error
|
#define err_exit(a) goto error
|
||||||
#else //}{ save debugging time
|
#else //}{ save debugging time
|
||||||
#define ERR_LAB
|
#define ERR_LAB /*empty*/
|
||||||
static void
|
static void
|
||||||
err_exit(int a) __attribute__ ((__noreturn__));
|
err_exit(int a) __attribute__ ((__noreturn__));
|
||||||
{
|
{
|
||||||
|
|
|
@ -359,7 +359,7 @@ struct p_info // 12-byte packed program header follows stub loader
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__attribute_cdecl)
|
#if !defined(__attribute_cdecl)
|
||||||
# define __attribute_cdecl
|
# define __attribute_cdecl /*empty*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ typedef unsigned int nrv_uint;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__attribute_cdecl)
|
#if !defined(__attribute_cdecl)
|
||||||
# define __attribute_cdecl
|
# define __attribute_cdecl /*empty*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -745,7 +745,7 @@ struct p_info // 12-byte packed program header follows stub loader
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__attribute_cdecl)
|
#if !defined(__attribute_cdecl)
|
||||||
# define __attribute_cdecl
|
# define __attribute_cdecl /*empty*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ xread(Extent *x, char *buf, size_t count)
|
||||||
#define ERR_LAB error: exit(127);
|
#define ERR_LAB error: exit(127);
|
||||||
#define err_exit(a) goto error
|
#define err_exit(a) goto error
|
||||||
#else //}{ save debugging time
|
#else //}{ save debugging time
|
||||||
#define ERR_LAB
|
#define ERR_LAB /*empty*/
|
||||||
static void
|
static void
|
||||||
err_exit(int a)
|
err_exit(int a)
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,7 +78,7 @@ xread(Extent *x, char *buf, size_t count)
|
||||||
#define ERR_LAB error: exit(127);
|
#define ERR_LAB error: exit(127);
|
||||||
#define err_exit(a) goto error
|
#define err_exit(a) goto error
|
||||||
#else //}{ save debugging time
|
#else //}{ save debugging time
|
||||||
#define ERR_LAB
|
#define ERR_LAB /*empty*/
|
||||||
static void
|
static void
|
||||||
err_exit(int a)
|
err_exit(int a)
|
||||||
{
|
{
|
||||||
|
|
12
src/ui.cpp
12
src/ui.cpp
|
@ -33,8 +33,8 @@
|
||||||
#include "packer.h"
|
#include "packer.h"
|
||||||
|
|
||||||
|
|
||||||
#if 1 && defined(USE_SCREEN)
|
#if 1 && (USE_SCREEN)
|
||||||
#define UI_USE_SCREEN
|
#define UI_USE_SCREEN 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ struct UiPacker::State
|
||||||
int bar_len;
|
int bar_len;
|
||||||
int pass_digits; // number of digits needed to print total_passes
|
int pass_digits; // number of digits needed to print total_passes
|
||||||
|
|
||||||
#if defined(UI_USE_SCREEN)
|
#if (UI_USE_SCREEN)
|
||||||
screen_t *screen;
|
screen_t *screen;
|
||||||
int screen_init_done;
|
int screen_init_done;
|
||||||
int b_cx, b_cy;
|
int b_cx, b_cy;
|
||||||
|
@ -304,7 +304,7 @@ void UiPacker::startCallback(unsigned u_len, unsigned step,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(UI_USE_SCREEN)
|
#if (UI_USE_SCREEN)
|
||||||
if (s->mode == M_CB_SCREEN)
|
if (s->mode == M_CB_SCREEN)
|
||||||
{
|
{
|
||||||
if (!s->screen_init_done)
|
if (!s->screen_init_done)
|
||||||
|
@ -365,7 +365,7 @@ void UiPacker::endCallback(bool done)
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore screen
|
// restore screen
|
||||||
#if defined(UI_USE_SCREEN)
|
#if (UI_USE_SCREEN)
|
||||||
if (s->mode == M_CB_SCREEN)
|
if (s->mode == M_CB_SCREEN)
|
||||||
{
|
{
|
||||||
if (done)
|
if (done)
|
||||||
|
@ -484,7 +484,7 @@ void UiPacker::doCallback(unsigned isize, unsigned osize)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(UI_USE_SCREEN)
|
#if (UI_USE_SCREEN)
|
||||||
if (s->mode == M_CB_SCREEN)
|
if (s->mode == M_CB_SCREEN)
|
||||||
{
|
{
|
||||||
const char *msg = &s->msg_buf[1];
|
const char *msg = &s->msg_buf[1];
|
||||||
|
|
2
src/ui.h
2
src/ui.h
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_UI_H
|
#ifndef __UPX_UI_H
|
||||||
#define __UPX_UI_H
|
#define __UPX_UI_H 1
|
||||||
|
|
||||||
class InputFile;
|
class InputFile;
|
||||||
class OutputFile;
|
class OutputFile;
|
||||||
|
|
|
@ -377,7 +377,7 @@ bool fn_is_same_file(const char *n1, const char *n2)
|
||||||
|
|
||||||
#if 0 // not used
|
#if 0 // not used
|
||||||
|
|
||||||
#if defined(HAVE_LOCALTIME)
|
#if (HAVE_LOCALTIME)
|
||||||
void tm2str(char *s, size_t size, const struct tm *tmp)
|
void tm2str(char *s, size_t size, const struct tm *tmp)
|
||||||
{
|
{
|
||||||
upx_snprintf(s, size, "%04d-%02d-%02d %02d:%02d:%02d",
|
upx_snprintf(s, size, "%04d-%02d-%02d %02d:%02d:%02d",
|
||||||
|
@ -391,9 +391,9 @@ void tm2str(char *s, size_t size, const struct tm *tmp)
|
||||||
void time2str(char *s, size_t size, const time_t *t)
|
void time2str(char *s, size_t size, const time_t *t)
|
||||||
{
|
{
|
||||||
assert(size >= 18);
|
assert(size >= 18);
|
||||||
#if defined(HAVE_LOCALTIME)
|
#if (HAVE_LOCALTIME)
|
||||||
tm2str(s, size, localtime(t));
|
tm2str(s, size, localtime(t));
|
||||||
#elif defined(HAVE_CTIME)
|
#elif (HAVE_CTIME)
|
||||||
const char *p = ctime(t);
|
const char *p = ctime(t);
|
||||||
memset(s, ' ', 16);
|
memset(s, ' ', 16);
|
||||||
memcpy(s + 2, p + 4, 6);
|
memcpy(s + 2, p + 4, 6);
|
||||||
|
@ -468,7 +468,7 @@ bool file_exists(const char *name)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* return true if we can lstat it */
|
/* return true if we can lstat it */
|
||||||
#if defined(HAVE_LSTAT)
|
#if (HAVE_LSTAT)
|
||||||
//memset(&st, 0, sizeof(st));
|
//memset(&st, 0, sizeof(st));
|
||||||
r = lstat(name, &st);
|
r = lstat(name, &st);
|
||||||
if (r != -1)
|
if (r != -1)
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifndef __UPX_UTIL_H
|
#ifndef __UPX_UTIL_H
|
||||||
#define __UPX_UTIL_H
|
#define __UPX_UTIL_H 1
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
|
22
src/work.cpp
22
src/work.cpp
|
@ -40,7 +40,7 @@
|
||||||
# define USE_UTIME 1
|
# define USE_UTIME 1
|
||||||
#elif ((ACC_OS_WIN32 || ACC_OS_WIN64) && (ACC_CC_INTELC || ACC_CC_MSC))
|
#elif ((ACC_OS_WIN32 || ACC_OS_WIN64) && (ACC_CC_INTELC || ACC_CC_MSC))
|
||||||
# define USE__FUTIME 1
|
# define USE__FUTIME 1
|
||||||
#elif defined(HAVE_UTIME)
|
#elif (HAVE_UTIME)
|
||||||
# define USE_UTIME 1
|
# define USE_UTIME 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ void do_one_file(const char *iname, char *oname)
|
||||||
int r;
|
int r;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
memset(&st, 0, sizeof(st));
|
memset(&st, 0, sizeof(st));
|
||||||
#if defined(HAVE_LSTAT)
|
#if (HAVE_LSTAT)
|
||||||
r = lstat(iname,&st);
|
r = lstat(iname,&st);
|
||||||
#else
|
#else
|
||||||
r = stat(iname,&st);
|
r = stat(iname,&st);
|
||||||
|
@ -100,7 +100,7 @@ void do_one_file(const char *iname, char *oname)
|
||||||
fi.st = st;
|
fi.st = st;
|
||||||
fi.sopen(iname, O_RDONLY | O_BINARY, SH_DENYWR);
|
fi.sopen(iname, O_RDONLY | O_BINARY, SH_DENYWR);
|
||||||
|
|
||||||
#if defined(USE_FTIME)
|
#if (USE_FTIME)
|
||||||
struct ftime fi_ftime;
|
struct ftime fi_ftime;
|
||||||
memset(&fi_ftime, 0, sizeof(fi_ftime));
|
memset(&fi_ftime, 0, sizeof(fi_ftime));
|
||||||
if (opt->preserve_timestamp)
|
if (opt->preserve_timestamp)
|
||||||
|
@ -131,7 +131,7 @@ void do_one_file(const char *iname, char *oname)
|
||||||
}
|
}
|
||||||
if (opt->force >= 2)
|
if (opt->force >= 2)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_CHMOD)
|
#if (HAVE_CHMOD)
|
||||||
r = chmod(tname, 0777);
|
r = chmod(tname, 0777);
|
||||||
IGNORE_ERROR(r);
|
IGNORE_ERROR(r);
|
||||||
#endif
|
#endif
|
||||||
|
@ -177,10 +177,10 @@ void do_one_file(const char *iname, char *oname)
|
||||||
// copy time stamp
|
// copy time stamp
|
||||||
if (opt->preserve_timestamp && oname[0] && fo.isOpen())
|
if (opt->preserve_timestamp && oname[0] && fo.isOpen())
|
||||||
{
|
{
|
||||||
#if defined(USE_FTIME)
|
#if (USE_FTIME)
|
||||||
r = setftime(fo.getFd(), &fi_ftime);
|
r = setftime(fo.getFd(), &fi_ftime);
|
||||||
IGNORE_ERROR(r);
|
IGNORE_ERROR(r);
|
||||||
#elif defined(USE__FUTIME)
|
#elif (USE__FUTIME)
|
||||||
struct _utimbuf u;
|
struct _utimbuf u;
|
||||||
u.actime = st.st_atime;
|
u.actime = st.st_atime;
|
||||||
u.modtime = st.st_mtime;
|
u.modtime = st.st_mtime;
|
||||||
|
@ -199,7 +199,7 @@ void do_one_file(const char *iname, char *oname)
|
||||||
// FIXME: .exe or .cof etc.
|
// FIXME: .exe or .cof etc.
|
||||||
if (!opt->backup)
|
if (!opt->backup)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_CHMOD)
|
#if (HAVE_CHMOD)
|
||||||
r = chmod(iname, 0777);
|
r = chmod(iname, 0777);
|
||||||
IGNORE_ERROR(r);
|
IGNORE_ERROR(r);
|
||||||
#endif
|
#endif
|
||||||
|
@ -222,7 +222,7 @@ void do_one_file(const char *iname, char *oname)
|
||||||
oname[0] = 0;
|
oname[0] = 0;
|
||||||
const char *name = opt->output_name ? opt->output_name : iname;
|
const char *name = opt->output_name ? opt->output_name : iname;
|
||||||
UNUSED(name);
|
UNUSED(name);
|
||||||
#if defined(USE_UTIME)
|
#if (USE_UTIME)
|
||||||
// copy time stamp
|
// copy time stamp
|
||||||
if (opt->preserve_timestamp)
|
if (opt->preserve_timestamp)
|
||||||
{
|
{
|
||||||
|
@ -233,7 +233,7 @@ void do_one_file(const char *iname, char *oname)
|
||||||
IGNORE_ERROR(r);
|
IGNORE_ERROR(r);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_CHMOD)
|
#if (HAVE_CHMOD)
|
||||||
// copy permissions
|
// copy permissions
|
||||||
if (opt->preserve_mode)
|
if (opt->preserve_mode)
|
||||||
{
|
{
|
||||||
|
@ -241,7 +241,7 @@ void do_one_file(const char *iname, char *oname)
|
||||||
IGNORE_ERROR(r);
|
IGNORE_ERROR(r);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_CHOWN)
|
#if (HAVE_CHOWN)
|
||||||
// copy the ownership
|
// copy the ownership
|
||||||
if (opt->preserve_ownership)
|
if (opt->preserve_ownership)
|
||||||
{
|
{
|
||||||
|
@ -263,7 +263,7 @@ static void unlink_ofile(char *oname)
|
||||||
{
|
{
|
||||||
if (oname && oname[0])
|
if (oname && oname[0])
|
||||||
{
|
{
|
||||||
#if defined(HAVE_CHMOD)
|
#if (HAVE_CHMOD)
|
||||||
int r;
|
int r;
|
||||||
r = chmod(oname, 0777);
|
r = chmod(oname, 0777);
|
||||||
IGNORE_ERROR(r);
|
IGNORE_ERROR(r);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user