mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Prepared for first GUI version.
committer: mfx <mfx> 968541447 +0000
This commit is contained in:
parent
679fabef25
commit
4e6fc92d8a
|
@ -0,0 +1,3 @@
|
||||||
|
.cvsignore
|
||||||
|
.mfxcvsup
|
||||||
|
maint
|
6
THANKS
6
THANKS
|
@ -23,6 +23,8 @@ Adam Ierymenko <api@one.net>
|
||||||
for severals ideas for the Linux version
|
for severals ideas for the Linux version
|
||||||
Andi Kleen <ak@muc.de> and Jamie Lokier <nospam@cern.ch>
|
Andi Kleen <ak@muc.de> and Jamie Lokier <nospam@cern.ch>
|
||||||
for the /proc/self/fd/X and other Linux suggestions
|
for the /proc/self/fd/X and other Linux suggestions
|
||||||
|
Andreas Muegge <andreas.muegge@gmx.de>
|
||||||
|
for the Win32 GUI
|
||||||
Atli Mar Gudmundsson <amg@complex.is>
|
Atli Mar Gudmundsson <amg@complex.is>
|
||||||
for several comments on the win32/pe stub
|
for several comments on the win32/pe stub
|
||||||
Charles W. Sandmann <sandmann@clio.rice.edu>
|
Charles W. Sandmann <sandmann@clio.rice.edu>
|
||||||
|
@ -31,6 +33,8 @@ Ice
|
||||||
for debugging the PE headersize problem down
|
for debugging the PE headersize problem down
|
||||||
Joergen Ibsen <jibz@hotmail.com> and d'b
|
Joergen Ibsen <jibz@hotmail.com> and d'b
|
||||||
for the relocation & address optimization ideas
|
for the relocation & address optimization ideas
|
||||||
|
John F. Reiser <jreiser@BitWagon.com>
|
||||||
|
for the new Linux executable formats
|
||||||
John S. Fine <johnfine@erols.com>
|
John S. Fine <johnfine@erols.com>
|
||||||
for the new version of the dos/exe decompressor
|
for the new version of the dos/exe decompressor
|
||||||
Lukundoo <Lukundoo@softhome.net>
|
Lukundoo <Lukundoo@softhome.net>
|
||||||
|
@ -45,8 +49,6 @@ Salvador Eduardo Tropea
|
||||||
for beta testing
|
for beta testing
|
||||||
The WINE project (http://www.winehq.com/)
|
The WINE project (http://www.winehq.com/)
|
||||||
for lots of useful information found in their PE loader sources
|
for lots of useful information found in their PE loader sources
|
||||||
DJ Delorie <dj@delorie.com> for djgpp
|
|
||||||
Linus for Linux
|
|
||||||
Natascha
|
Natascha
|
||||||
|
|
||||||
Everybody else who was kind enough to spend time testing UPX, use it in
|
Everybody else who was kind enough to spend time testing UPX, use it in
|
||||||
|
|
|
@ -3,7 +3,7 @@ SHELL = /bin/sh
|
||||||
top_srcdir = ..
|
top_srcdir = ..
|
||||||
|
|
||||||
PACKAGE = upx
|
PACKAGE = upx
|
||||||
VERSION_DATE = 10 May 2000
|
VERSION_DATE = 10 Sep 2000
|
||||||
VERSION := $(shell sed -n 's/^.*UPX_VERSION_STRING.*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h)
|
VERSION := $(shell sed -n 's/^.*UPX_VERSION_STRING.*"\(.*\)".*/\1/p' $(top_srcdir)/src/version.h)
|
||||||
|
|
||||||
TRIMSPACE = cat
|
TRIMSPACE = cat
|
||||||
|
|
|
@ -15,7 +15,6 @@ B<upx> S<[ I<command> ]> S<[ I<options> ]> I<filename>...
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2000 Markus Oberhumer & Laszlo Molnar
|
Copyright (c) 1996-2000 Markus Oberhumer & Laszlo Molnar
|
||||||
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
|
http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
|
||||||
http://www.nexus.hu/upx
|
|
||||||
http://upx.tsx.org
|
http://upx.tsx.org
|
||||||
|
|
||||||
|
|
||||||
|
@ -222,7 +221,7 @@ For example:
|
||||||
for csh/tcsh: setenv UPX "-9 --compress-icons=1"
|
for csh/tcsh: setenv UPX "-9 --compress-icons=1"
|
||||||
|
|
||||||
Under DOS/Windows you must use '#' instead of '=' when setting the
|
Under DOS/Windows you must use '#' instead of '=' when setting the
|
||||||
environment variable because of a command.com limitation.
|
environment variable because of a COMMAND.COM limitation.
|
||||||
|
|
||||||
On Vax/VMS, the name of the environment variable is
|
On Vax/VMS, the name of the environment variable is
|
||||||
UPX_OPT, to avoid a conflict with the symbol set for
|
UPX_OPT, to avoid a conflict with the symbol set for
|
||||||
|
@ -345,7 +344,7 @@ How it works:
|
||||||
May 2000), and transfers control to the program interpreter or
|
May 2000), and transfers control to the program interpreter or
|
||||||
the e_entry address of the original executable.
|
the e_entry address of the original executable.
|
||||||
|
|
||||||
For shell script executables (files beginning with "#!/" or "#! /")
|
For shell script executables (files beginning with "#!/" or "#! /")
|
||||||
where the shell is known to accept "-c <command>", UPX decompresses
|
where the shell is known to accept "-c <command>", UPX decompresses
|
||||||
the file into low memory, then maps the shell (and its PT_INTERP),
|
the file into low memory, then maps the shell (and its PT_INTERP),
|
||||||
and passes control to the shell with the entire decompressed file
|
and passes control to the shell with the entire decompressed file
|
||||||
|
|
|
@ -50,8 +50,10 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// just in case
|
// just in case
|
||||||
|
#undef NDEBUG
|
||||||
#undef dos
|
#undef dos
|
||||||
#undef linux
|
#undef linux
|
||||||
|
#undef small
|
||||||
#undef tos
|
#undef tos
|
||||||
#undef unix
|
#undef unix
|
||||||
|
|
||||||
|
@ -503,7 +505,7 @@ struct options_t {
|
||||||
bool le;
|
bool le;
|
||||||
} wcle;
|
} wcle;
|
||||||
struct {
|
struct {
|
||||||
bool compress_exports;
|
int compress_exports;
|
||||||
int compress_icons;
|
int compress_icons;
|
||||||
bool compress_resources;
|
bool compress_resources;
|
||||||
int strip_relocs;
|
int strip_relocs;
|
||||||
|
@ -515,6 +517,7 @@ extern struct options_t * volatile opt;
|
||||||
|
|
||||||
// main.cpp
|
// main.cpp
|
||||||
extern const char *progname;
|
extern const char *progname;
|
||||||
|
void init_options(struct options_t *o);
|
||||||
bool set_ec(int ec);
|
bool set_ec(int ec);
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
void e_exit(int ec) __attribute__((noreturn));
|
void e_exit(int ec) __attribute__((noreturn));
|
||||||
|
@ -527,6 +530,7 @@ void e_exit(int ec);
|
||||||
void printSetNl(int need_nl);
|
void printSetNl(int need_nl);
|
||||||
void printClearLine(FILE *f = NULL);
|
void printClearLine(FILE *f = NULL);
|
||||||
void printErr(const char *iname, const Throwable *e);
|
void printErr(const char *iname, const Throwable *e);
|
||||||
|
void printUnhandledException(const char *iname, const exception *e);
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
void printErr(const char *iname, const char *format, ...)
|
void printErr(const char *iname, const char *format, ...)
|
||||||
__attribute__((format(printf,2,3)));
|
__attribute__((format(printf,2,3)));
|
||||||
|
|
|
@ -37,6 +37,10 @@
|
||||||
#undef USE_SCREEN_CURSES
|
#undef USE_SCREEN_CURSES
|
||||||
#undef USE_FRAMES
|
#undef USE_FRAMES
|
||||||
|
|
||||||
|
#if defined(WITH_GUI) && !defined(NO_CONSOLE)
|
||||||
|
# define NO_CONSOLE
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 1 && defined(__linux__)
|
#if 1 && defined(__linux__)
|
||||||
# define USE_SCREEN
|
# define USE_SCREEN
|
||||||
# define USE_SCREEN_VCSA
|
# define USE_SCREEN_VCSA
|
||||||
|
|
|
@ -238,7 +238,6 @@ con_fprintf(f,
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" http://upx.tsx.org\n"
|
" http://upx.tsx.org\n"
|
||||||
" http://wildsau.idv.uni-linz.ac.at/mfx/upx.html\n"
|
" http://wildsau.idv.uni-linz.ac.at/mfx/upx.html\n"
|
||||||
" http://www.nexus.hu/upx\n"
|
|
||||||
);
|
);
|
||||||
(void)con_fg(f,FG_ORANGE);
|
(void)con_fg(f,FG_ORANGE);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
|
@ -260,10 +259,10 @@ void show_version(int x)
|
||||||
UNUSED(x);
|
UNUSED(x);
|
||||||
|
|
||||||
fprintf(f,"upx %s\n",UPX_VERSION_STRING);
|
fprintf(f,"upx %s\n",UPX_VERSION_STRING);
|
||||||
#if defined(WITH_UCL)
|
#if defined(WITH_NRV)
|
||||||
fprintf(f,"UCL data compression library %s\n", ucl_version_string());
|
|
||||||
#elif defined(WITH_NRV)
|
|
||||||
fprintf(f,"NRV data compression library %s\n", nrv_version_string());
|
fprintf(f,"NRV data compression library %s\n", nrv_version_string());
|
||||||
|
#elif defined(WITH_UCL)
|
||||||
|
fprintf(f,"UCL data compression library %s\n", ucl_version_string());
|
||||||
#endif
|
#endif
|
||||||
fprintf(f,"Copyright (C) 1996,1997,1998,1999,2000 Markus Franz Xaver Johannes Oberhumer\n");
|
fprintf(f,"Copyright (C) 1996,1997,1998,1999,2000 Markus Franz Xaver Johannes Oberhumer\n");
|
||||||
fprintf(f,"Copyright (C) 1996,1997,1998,1999,2000 Laszlo Molnar\n");
|
fprintf(f,"Copyright (C) 1996,1997,1998,1999,2000 Laszlo Molnar\n");
|
||||||
|
|
13
src/main.cpp
13
src/main.cpp
|
@ -34,7 +34,7 @@
|
||||||
// options
|
// options
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
static void init_options(struct options_t *o)
|
void init_options(struct options_t *o)
|
||||||
{
|
{
|
||||||
memset(o, 0, sizeof(*o));
|
memset(o, 0, sizeof(*o));
|
||||||
memset(&o->crp, 0xff, sizeof(o->crp));
|
memset(&o->crp, 0xff, sizeof(o->crp));
|
||||||
|
@ -51,7 +51,7 @@ static void init_options(struct options_t *o)
|
||||||
o->console = CON_INIT;
|
o->console = CON_INIT;
|
||||||
o->verbose = 2;
|
o->verbose = 2;
|
||||||
|
|
||||||
o->w32pe.compress_exports = true;
|
o->w32pe.compress_exports = 1;
|
||||||
o->w32pe.compress_icons = 2;
|
o->w32pe.compress_icons = 2;
|
||||||
o->w32pe.compress_resources = true;
|
o->w32pe.compress_resources = true;
|
||||||
o->w32pe.strip_relocs = -1;
|
o->w32pe.strip_relocs = -1;
|
||||||
|
@ -608,9 +608,8 @@ static int do_option(int optc, const char *arg)
|
||||||
opt->wcle.le = true;
|
opt->wcle.le = true;
|
||||||
break;
|
break;
|
||||||
case 630:
|
case 630:
|
||||||
opt->w32pe.compress_exports = true;
|
opt->w32pe.compress_exports = 1;
|
||||||
if (mfx_optarg && strcmp(mfx_optarg,"0") == 0)
|
getoptvar(&opt->w32pe.compress_exports, 0, 1);
|
||||||
opt->w32pe.compress_exports = false;
|
|
||||||
//printf("compress_exports: %d\n", opt->w32pe.compress_exports);
|
//printf("compress_exports: %d\n", opt->w32pe.compress_exports);
|
||||||
break;
|
break;
|
||||||
case 631:
|
case 631:
|
||||||
|
@ -977,6 +976,8 @@ void upx_sanity_check(void)
|
||||||
// main entry point
|
// main entry point
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
#if !defined(WITH_GUI)
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -1127,6 +1128,8 @@ int main(int argc, char *argv[])
|
||||||
return exit_code;
|
return exit_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* !defined(WITH_GUI) */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
vi:ts=4:et:nowrap
|
vi:ts=4:et:nowrap
|
||||||
|
|
16
src/msg.cpp
16
src/msg.cpp
|
@ -145,6 +145,19 @@ void printWarn(const char *iname, const char *format, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void printUnhandledException(const char *iname, const exception *e)
|
||||||
|
{
|
||||||
|
if (e)
|
||||||
|
printErr(iname,"unhandled exception: %s\n", prettyName(e->what()));
|
||||||
|
else
|
||||||
|
printErr(iname,"internal error: unhandled exception!\n");
|
||||||
|
if (opt->cmd != CMD_COMPRESS)
|
||||||
|
{
|
||||||
|
printErr(iname," this file has possibly been modified/hacked; take care!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// FIXME: should use colors and a consistent layout here
|
// FIXME: should use colors and a consistent layout here
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
@ -208,7 +221,10 @@ void info(const char *format, ...)
|
||||||
void infoWarning(const char *format, ...)
|
void infoWarning(const char *format, ...)
|
||||||
{
|
{
|
||||||
if (opt->info_mode <= 0)
|
if (opt->info_mode <= 0)
|
||||||
|
{
|
||||||
|
// FIXME - should still print something here
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
va_list args;
|
va_list args;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
va_start(args,format);
|
va_start(args,format);
|
||||||
|
|
8
src/ui.h
8
src/ui.h
|
@ -33,6 +33,10 @@ class OutputFile;
|
||||||
class Packer;
|
class Packer;
|
||||||
class UiPacker;
|
class UiPacker;
|
||||||
|
|
||||||
|
#if defined(WITH_GUI)
|
||||||
|
class CMainDlg;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
//
|
//
|
||||||
|
@ -104,6 +108,10 @@ protected:
|
||||||
static long update_u_len;
|
static long update_u_len;
|
||||||
static long update_fc_len;
|
static long update_fc_len;
|
||||||
static long update_fu_len;
|
static long update_fu_len;
|
||||||
|
|
||||||
|
#if defined(WITH_GUI)
|
||||||
|
CMainDlg* pMain;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#define UPX_VERSION_STRING "1.09.2"
|
#define UPX_VERSION_STRING "1.09.3"
|
||||||
#define UPX_VERSION_DATE "May 13th 2000"
|
#define UPX_VERSION_DATE "Sep 10th 2000"
|
||||||
|
|
16
src/work.cpp
16
src/work.cpp
|
@ -65,7 +65,7 @@ void do_one_file(const char *iname, char *oname)
|
||||||
|
|
||||||
if (r == -1)
|
if (r == -1)
|
||||||
throw FileNotFoundException(iname);
|
throw FileNotFoundException(iname);
|
||||||
if (!S_ISREG(st.st_mode))
|
if (!(S_ISREG(st.st_mode)))
|
||||||
throwIOException("not a regular file -- skipped");
|
throwIOException("not a regular file -- skipped");
|
||||||
#if defined(__unix__)
|
#if defined(__unix__)
|
||||||
// no special bits may be set
|
// no special bits may be set
|
||||||
|
@ -124,7 +124,7 @@ void do_one_file(const char *iname, char *oname)
|
||||||
int omode = 0600;
|
int omode = 0600;
|
||||||
fo.sopen(tname,flags,shmode,omode);
|
fo.sopen(tname,flags,shmode,omode);
|
||||||
#endif
|
#endif
|
||||||
// open succeeded - set oname
|
// open succeeded - now set oname[]
|
||||||
strcpy(oname,tname);
|
strcpy(oname,tname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,6 +177,8 @@ void do_one_file(const char *iname, char *oname)
|
||||||
// make backup
|
// make backup
|
||||||
char bakname[PATH_MAX+1];
|
char bakname[PATH_MAX+1];
|
||||||
makebakname(bakname,iname);
|
makebakname(bakname,iname);
|
||||||
|
if (file_exists(bakname))
|
||||||
|
maketempname(bakname,iname,".000",1);
|
||||||
File::rename(iname,bakname);
|
File::rename(iname,bakname);
|
||||||
}
|
}
|
||||||
File::rename(oname,iname);
|
File::rename(oname,iname);
|
||||||
|
@ -213,6 +215,8 @@ void do_one_file(const char *iname, char *oname)
|
||||||
// process all files from the commandline
|
// process all files from the commandline
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
#if !defined(WITH_GUI)
|
||||||
|
|
||||||
void do_files(int i, int argc, char *argv[])
|
void do_files(int i, int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (opt->verbose >= 1)
|
if (opt->verbose >= 1)
|
||||||
|
@ -247,19 +251,19 @@ void do_files(int i, int argc, char *argv[])
|
||||||
e_exit(EXIT_ERROR);
|
e_exit(EXIT_ERROR);
|
||||||
//throw;
|
//throw;
|
||||||
} catch (const exception &e) {
|
} catch (const exception &e) {
|
||||||
printErr(iname,"unhandled exception: %s\n", prettyName(e.what()));
|
printUnhandledException(iname,&e);
|
||||||
if (oname[0])
|
if (oname[0])
|
||||||
(void) ::unlink(oname);
|
(void) ::unlink(oname);
|
||||||
e_exit(EXIT_ERROR);
|
e_exit(EXIT_ERROR);
|
||||||
//throw;
|
//throw;
|
||||||
} catch (const exception *e) {
|
} catch (const exception *e) {
|
||||||
printErr(iname,"unhandled exception: %s\n", prettyName(e->what()));
|
printUnhandledException(iname,e);
|
||||||
if (oname[0])
|
if (oname[0])
|
||||||
(void) ::unlink(oname);
|
(void) ::unlink(oname);
|
||||||
e_exit(EXIT_ERROR);
|
e_exit(EXIT_ERROR);
|
||||||
//throw;
|
//throw;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
printErr(iname,"internal error: unhandled exception !\n");
|
printUnhandledException(iname,NULL);
|
||||||
if (oname[0])
|
if (oname[0])
|
||||||
(void) ::unlink(oname);
|
(void) ::unlink(oname);
|
||||||
e_exit(EXIT_ERROR);
|
e_exit(EXIT_ERROR);
|
||||||
|
@ -284,6 +288,8 @@ void do_files(int i, int argc, char *argv[])
|
||||||
UiPacker::uiFileInfoTotal();
|
UiPacker::uiFileInfoTotal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* !defined(WITH_GUI) */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
vi:ts=4:et
|
vi:ts=4:et
|
||||||
|
|
Loading…
Reference in New Issue
Block a user