⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 conf.h

📁 UPX 源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/* conf.h --   This file is part of the UPX executable compressor.   Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer   Copyright (C) 1996-2007 Laszlo Molnar   All Rights Reserved.   UPX and the UCL library are free software; you can redistribute them   and/or modify them under the terms of the GNU General Public License as   published by the Free Software Foundation; either version 2 of   the License, or (at your option) any later version.   This program is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   GNU General Public License for more details.   You should have received a copy of the GNU General Public License   along with this program; see the file COPYING.   If not, write to the Free Software Foundation, Inc.,   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.   Markus F.X.J. Oberhumer              Laszlo Molnar   <mfx@users.sourceforge.net>          <ml1050@users.sourceforge.net> */#ifndef __UPX_CONF_H#define __UPX_CONF_H#include "version.h"/*************************************************************************// ACC**************************************************************************/#include "miniacc.h"#if ((ACC_OS_WIN32 || ACC_OS_WIN64) && ACC_CC_MWERKS) && defined(__MSL__)#  undef HAVE_UTIME_H /* this pulls in <windows.h> */#endif// FIXME - quick hack for arm-wince-gcc-3.4 (Debian pocketpc-*.deb packages)#if 1 && (ACC_ARCH_ARM) && defined(__pe__) && !defined(_WIN32)#  undef HAVE_CHMOD#  undef HAVE_CHOWN#  undef HAVE_LSTAT#  undef HAVE_UTIME#endif// pragmas#if (ACC_CC_BORLANDC)#  if (__BORLANDC__ < 0x0500)#    error "need Borland C++ 5.0 or newer"#  endif#  pragma warn -aus     // 8004: 'x' is assigned a value that is never used#  pragma warn -inl     // 8026+8027: Function not expanded inline   // Borland compilers typically produce a number of bogus warnings, and   // the actual diagnostics vary from version to version...#  if (__BORLANDC__ < 0x0530)#    pragma warn -csu   // 8012: Comparing signed and unsigned values#  endif#  if (__BORLANDC__ >= 0x0530 && __BORLANDC__ < 0x0560)#    pragma warn -osh   // 8055: Possible overflow in shift operation#  endif#  if (__BORLANDC__ >= 0x0560)#    pragma warn -use   // 8080: 'x' is declared but never used#  endif#elif (ACC_CC_DMC)#  if (__DMC__ < 0x829)#    error "need Digital Mars C++ 8.29 or newer"#  endif#elif (ACC_CC_INTELC)#  if (__INTEL_COMPILER < 450)#    error "need Intel C++ 4.5 or newer"#  endif#  if (ACC_OS_WIN32 || ACC_OS_WIN64)#  elif defined(__linux__)#    pragma warning(error: 424)         // #424: extra ";" ignored#    pragma warning(disable: 193)       // #193: zero used for undefined preprocessing identifier#    pragma warning(disable: 810)       // #810: conversion from "A" to "B" may lose significant bits#    pragma warning(disable: 981)       // #981: operands are evaluated in unspecified order#    pragma warning(disable: 1418)      // #1418: external definition with no prior declaration#  else#    error "untested platform"#  endif#elif (ACC_CC_MSC)#  if (_MSC_VER < 1100)#    error "need Visual C++ 5.0 or newer"#  endif#  pragma warning(error: 4096)          // W2: '__cdecl' must be used with '...'#  pragma warning(disable: 4097)        // W3: typedef-name 'A' used as synonym for class-name 'B'#  pragma warning(disable: 4511)        // W3: 'class': copy constructor could not be generated#  pragma warning(disable: 4512)        // W4: 'class': assignment operator could not be generated#  pragma warning(disable: 4514)        // W4: 'function': unreferenced inline function has been removed#  pragma warning(disable: 4710)        // W4: 'function': function not inlined#  if (_MSC_VER >= 1300)#    pragma warning(disable: 4625)      // W4: 'class' : copy constructor could not be generated because a base class copy constructor is inaccessible#    pragma warning(disable: 4626)      // W4: 'class' : assignment operator could not be generated because a base class assignment operator is inaccessible#    pragma warning(disable: 4711)      // W4: 'function' selected for automatic inline expansion#    pragma warning(disable: 4820)      // W4: 'struct' : 'x' bytes padding added after member 'member'#  endif#  if (_MSC_VER >= 1400)#    pragma warning(disable: 4996)      // W1: 'function': was declared deprecated#  endif#elif (ACC_CC_SUNPROC)//#  pragma error_messages(off,"badargtype2w")    // FIXME#elif (ACC_CC_WATCOMC)#  if (__WATCOMC__ < 1100)#    error "need Watcom C++ 11.0c or newer"#  endif#  if defined(__cplusplus)#    pragma warning 656 9               // w5: define this function inside its class definition (may improve code quality)#  endif#endif#define ACC_WANT_ACC_INCD_H 1#define ACC_WANT_ACC_INCE_H 1#define ACC_WANT_ACC_LIB_H 1#define ACC_WANT_ACC_CXX_H 1#include "miniacc.h"#if (ACC_OS_CYGWIN || ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_EMX || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)#  if defined(INVALID_HANDLE_VALUE) || defined(MAKEWORD) || defined(RT_CURSOR)#    error "something pulled in <windows.h>"#  endif#endif/*************************************************************************//**************************************************************************/#if defined(__linux__) && !defined(__unix__)#  define __unix__ 1#endif// just in case#undef NDEBUG#undef dos#undef linux#undef small#undef tos#if defined(ACC_CC_DMC)#  undef tell#endif#if !defined(ACC_CC_PGI)#  undef unix#endif#if defined(__DJGPP__)#  undef sopen#  undef __unix__#  undef __unix#endif#if !defined(WITH_UCL)#  define WITH_UCL 1#endif#if 0 && !defined(WITH_LZMA)#  define WITH_LZMA 1#endif#if defined(UPX_OFFICIAL_BUILD)#  if !defined(WITH_LZMA) || !defined(WITH_NRV) || !defined(WITH_UCL)#    error#  endif#endif#if defined(WITH_NRV)#  include <nrv/nrvconf.h>#endif#if defined(WITH_UCL)#  define ucl_compress_config_t REAL_ucl_compress_config_t#  include <ucl/uclconf.h>#  include <ucl/ucl.h>#  if !defined(UCL_VERSION) || (UCL_VERSION < 0x010300L)#    error "please upgrade your UCL installation"#  endif#  undef ucl_compress_config_t#  undef ucl_compress_config_p#endif#if !defined(__UPX_CHECKER)#  if defined(__UCL_CHECKER) || defined(__NRV_CHECKER)#    define __UPX_CHECKER#  endif#endif#if !defined(UINT_MAX) || (UINT_MAX < 0xffffffffL)#  error "UINT_MAX"#endif#define upx_byte                    unsigned char#define upx_bytep                   upx_byte */*************************************************************************// system includes**************************************************************************/// malloc debuggers#if defined(WITH_VALGRIND)#  include <valgrind/memcheck.h>#endif#if !defined(VALGRIND_MAKE_WRITABLE)#  define VALGRIND_MAKE_WRITABLE(addr,len)      0#endif#if !defined(VALGRIND_MAKE_READABLE)#  if 0#    define VALGRIND_MAKE_READABLE(addr,len)    (memset(addr,0,len), 0)#  else#    define VALGRIND_MAKE_READABLE(addr,len)    0#  endif#endif#if !defined(VALGRIND_DISCARD)#  define VALGRIND_DISCARD(handle)              ((void)(&handle))#endif// unconditionally turn on assertions#undef NDEBUG#include <assert.h>/*************************************************************************// portab**************************************************************************/#ifndef STDIN_FILENO#  define STDIN_FILENO      (fileno(stdin))#endif#ifndef STDOUT_FILENO#  define STDOUT_FILENO     (fileno(stdout))#endif#ifndef STDERR_FILENO#  define STDERR_FILENO     (fileno(stderr))#endif#if !defined(HAVE_STRCASECMP) && defined(HAVE_STRICMP)#  define strcasecmp      stricmp#endif#if !defined(HAVE_STRNCASECMP) && defined(HAVE_STRNICMP)#  define strncasecmp     strnicmp#endif#if !defined(S_IWUSR) && defined(_S_IWUSR)#  define S_IWUSR           _S_IWUSR#elif !defined(S_IWUSR) && defined(_S_IWRITE)#  define S_IWUSR           _S_IWRITE#endif#if !defined(S_IFMT) && defined(_S_IFMT)#  define S_IFMT            _S_IFMT#endif#if !defined(S_IFREG) && defined(_S_IFREG)#  define S_IFREG           _S_IFREG#endif#if !defined(S_IFDIR) && defined(_S_IFDIR)#  define S_IFDIR           _S_IFDIR#endif#if !defined(S_IFCHR) && defined(_S_IFCHR)#  define S_IFCHR           _S_IFCHR#endif#if !defined(S_ISREG)#  if defined(S_IFMT) && defined(S_IFREG)#    define S_ISREG(m)      (((m) & S_IFMT) == S_IFREG)#  else#    error "S_ISREG"#  endif#endif#if !defined(S_ISDIR)#  if defined(S_IFMT) && defined(S_IFDIR)#    define S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)#  else#    error "S_ISDIR"#  endif#endif#if !defined(S_ISCHR)#  if defined(S_IFMT) && defined(S_IFCHR)#    define S_ISCHR(m)      (((m) & S_IFMT) == S_IFCHR)#  endif#endif// avoid warnings about shadowing global functions#undef index#define basename            upx_basename#define index               upx_index#define outp                upx_outp#undef PAGE_MASK#undef PAGE_SIZE#if !defined(O_BINARY)#  define O_BINARY  0#endif#ifndef OPTIONS_VAR#  define OPTIONS_VAR   "UPX"#endif#undef __attribute_packed#if (ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_PATHSCALE)#  if (ACC_ARCH_I386) && (ACC_CC_INTELC && (__INTEL_COMPILER < 800))#  elif (0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386))#  else#    define __attribute_packed      __attribute__((__packed__,__aligned__(1)))#  endif#endif#if !defined(__attribute_packed)#  define __attribute_packed#endif/*************************************************************************//**************************************************************************/#define UNUSED(var)              ACC_UNUSED(var)#define COMPILE_TIME_ASSERT(e)   ACC_COMPILE_TIME_ASSERT(e)#define __COMPILE_TIME_ASSERT_ALIGNOF_SIZEOF(a,b) { \     typedef a acc_tmp_a_t; typedef b acc_tmp_b_t; \     struct acc_tmp_t { acc_tmp_b_t x; acc_tmp_a_t y; acc_tmp_b_t z; } __attribute_packed; \     COMPILE_TIME_ASSERT(sizeof(struct acc_tmp_t) == 2*sizeof(b)+sizeof(a)) \   }#if defined(__acc_alignof)#  define __COMPILE_TIME_ASSERT_ALIGNOF(a,b) \     __COMPILE_TIME_ASSERT_ALIGNOF_SIZEOF(a,b) \     COMPILE_TIME_ASSERT(__acc_alignof(a) == sizeof(b))#else#  define __COMPILE_TIME_ASSERT_ALIGNOF(a,b) \     __COMPILE_TIME_ASSERT_ALIGNOF_SIZEOF(a,b)#endif#define COMPILE_TIME_ASSERT_ALIGNED1(a)     __COMPILE_TIME_ASSERT_ALIGNOF(a,char)#define TABLESIZE(table)    ((sizeof(table)/sizeof((table)[0])))#if 0#define ALIGN_DOWN(a,b)     (((a) / (b)) * (b))#define ALIGN_UP(a,b)       ALIGN_DOWN((a) + ((b) - 1), b)#define ALIGN_GAP(a,b)      (ALIGN_UP(a,b) - (a))#elif 1template <class T>inline T ALIGN_DOWN(const T& a, const T& b) { T r; r = (a / b) * b; return r; }template <class T>inline T ALIGN_UP  (const T& a, const T& b) { T r; r = ((a + b - 1) / b) * b; return r; }template <class T>inline T ALIGN_GAP (const T& a, const T& b) { T r; r = ALIGN_UP(a, b) - a; return r; }#elseinline unsigned ALIGN_DOWN(unsigned a, unsigned b) { return (a / b) * b; }inline unsigned ALIGN_UP  (unsigned a, unsigned b) { return ((a + b - 1) / b) * b; }inline unsigned ALIGN_GAP (unsigned a, unsigned b) { return ALIGN_UP(a, b) - a; }#endif#if 0#define UPX_MAX(a,b)        ((a) >= (b) ? (a) : (b))#define UPX_MIN(a,b)        ((a) <= (b) ? (a) : (b))#elif 1template <class T>inline const T& UPX_MAX(const T& a, const T& b) { if (a < b) return b; return a; }template <class T>inline const T& UPX_MIN(const T& a, const T& b) { if (a < b) return a; return b; }#elseinline unsigned UPX_MAX(unsigned a, unsigned b) { return a < b ? b : a; }inline unsigned UPX_MIN(unsigned a, unsigned b) { return a < b ? a : b; }#endif// An Array allocates memory on the heap, but automatically// gets destructed when leaving scope or on exceptions.#define Array(type, var, size) \    assert((int)(size) > 0); \    MemBuffer var ## _membuf((size)*(sizeof(type))); \    type * const var = ((type *) var ## _membuf.getVoidPtr())#define ByteArray(var, size)    Array(unsigned char, var, size)struct noncopyable{protected:    inline noncopyable() {}    inline ~noncopyable() {}private:    noncopyable(const noncopyable &); // undefined    const noncopyable& operator=(const noncopyable &); // undefined};/*************************************************************************// constants**************************************************************************//* exit codes of this program: 0 ok, 1 error, 2 warning */#define EXIT_OK         0#define EXIT_ERROR      1#define EXIT_WARN       2#define EXIT_USAGE      1#define EXIT_FILE_READ  1#define EXIT_FILE_WRITE 1#define EXIT_MEMORY     1#define EXIT_CHECKSUM   1

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -