diff --git a/src/conf.h b/src/conf.h index 4af97666..0726382e 100644 --- a/src/conf.h +++ b/src/conf.h @@ -328,7 +328,7 @@ typedef RETSIGTYPE (SIGTYPEENTRY *sig_type)(int); #undef UNUSED #if 1 -# define UNUSED(var) { typedef int __upx_unused[sizeof(var) ? 2 : 1]; } +# define UNUSED(var) { typedef int __upx_unused[sizeof(var) ? 1 : -1]; } #elif 1 # define UNUSED(var) do { } while (!sizeof(var)) #elif defined(__BORLANDC__) @@ -432,6 +432,22 @@ inline void operator delete[](void *p) #include "unupx.h" +// options - command +enum { + CMD_NONE, + CMD_COMPRESS, CMD_DECOMPRESS, CMD_TEST, CMD_LIST, CMD_FILEINFO, + CMD_HELP, CMD_LICENSE, CMD_VERSION +}; + +// win32/pe resource types +enum { + RT_CURSOR = 1, RT_BITMAP, RT_ICON, RT_MENU, RT_DIALOG, RT_STRING, + RT_FONTDIR, RT_FONT, RT_ACCELERATOR, RT_RCDATA, RT_MESSAGE_TABLE, + RT_GROUP_CURSOR, RT_GROUP_ICON = 14, RT_VERSION = 16, RT_DLGINCLUDE, + RT_PLUGPLAY = 19, RT_VXD, RT_ANICURSOR, RT_ANIICON, RT_HTML, + RT_LAST +}; + #if defined(__cplusplus) @@ -441,13 +457,6 @@ inline void operator delete[](void *p) #include "util.h" #include "console.h" -// options -enum { - CMD_NONE, - CMD_COMPRESS, CMD_DECOMPRESS, CMD_TEST, CMD_LIST, CMD_FILEINFO, - CMD_HELP, CMD_LICENSE, CMD_VERSION -}; - struct options_t { int cmd; @@ -526,7 +535,8 @@ struct options_t { struct { int compress_exports; int compress_icons; - bool compress_resources; + int compress_resources; + signed char compress_rt[RT_LAST]; int strip_relocs; } w32pe; }; diff --git a/src/main.cpp b/src/main.cpp index e7a12594..4416d47f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,6 +33,12 @@ #include "packer.h" +#if 1 && defined(__DJGPP__) +#include +int _crt0_startup_flags = _CRT0_FLAG_UNIX_SBRK; +#endif + + /************************************************************************* // options **************************************************************************/ @@ -60,7 +66,9 @@ void init_options(struct options_t *o) o->w32pe.compress_exports = 1; o->w32pe.compress_icons = 2; - o->w32pe.compress_resources = true; + o->w32pe.compress_resources = -1; + for (int i = 0; i < RT_LAST; i++) + opt->w32pe.compress_rt[i] = -1; o->w32pe.strip_relocs = -1; }