Added a framework for the win16/ne format, so that it's easier for someone
to actually contribute that. committer: mfx <mfx> 978183080 +0000
This commit is contained in:
+1
-1
@@ -64,7 +64,7 @@ OBJECTS1 = \
|
|||||||
p_com$o p_djgpp2$o p_elks$o p_exe$o \
|
p_com$o p_djgpp2$o p_elks$o p_exe$o \
|
||||||
p_lx_elf$o p_lx_exc$o p_lx_sep$o p_lx_sh$o \
|
p_lx_elf$o p_lx_exc$o p_lx_sep$o p_lx_sh$o \
|
||||||
p_sys$o p_tmt$o p_tos$o \
|
p_sys$o p_tmt$o p_tos$o \
|
||||||
p_unix$o p_vmlinz$o p_w32pe$o p_wcle$o
|
p_unix$o p_vmlinz$o p_w16ne$o p_w32pe$o p_wcle$o
|
||||||
|
|
||||||
# no exceptions or RTTI
|
# no exceptions or RTTI
|
||||||
OBJECTS2 = \
|
OBJECTS2 = \
|
||||||
|
|||||||
+133
@@ -0,0 +1,133 @@
|
|||||||
|
/* p_w16ne.cpp --
|
||||||
|
|
||||||
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
|
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1996-2000 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
|
||||||
|
markus.oberhumer@jk.uni-linz.ac.at ml1050@cdata.tvnet.hu
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "conf.h"
|
||||||
|
#include "file.h"
|
||||||
|
#include "filter.h"
|
||||||
|
#include "packer.h"
|
||||||
|
#include "p_w16ne.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
PackW16Ne::PackW16Ne(InputFile *f) :
|
||||||
|
super(f)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int PackW16Ne::getCompressionMethod() const
|
||||||
|
{
|
||||||
|
if (M_IS_NRV2B(opt->method))
|
||||||
|
return M_NRV2B_8;
|
||||||
|
if (M_IS_NRV2D(opt->method))
|
||||||
|
return M_NRV2D_8;
|
||||||
|
return opt->level > 1 && file_size >= 512*1024 ? M_NRV2D_8 : M_NRV2B_8;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const int *PackW16Ne::getFilters() const
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int PackW16Ne::buildLoader(const Filter *ft)
|
||||||
|
{
|
||||||
|
// prepare loader
|
||||||
|
// initLoader(nrv_loader,sizeof(nrv_loader));
|
||||||
|
// addLoader("...");
|
||||||
|
if (ft->id)
|
||||||
|
{
|
||||||
|
assert(ft->calls > 0);
|
||||||
|
// addLoader("...");
|
||||||
|
}
|
||||||
|
//
|
||||||
|
return getLoaderSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
bool PackW16Ne::readFileHeader()
|
||||||
|
{
|
||||||
|
// FIXME: identify a win16/ne executable, so that the call
|
||||||
|
// for contribution below will get thrown
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool PackW16Ne::canPack()
|
||||||
|
{
|
||||||
|
if (!readFileHeader())
|
||||||
|
return false;
|
||||||
|
throwCantPack("win16/ne is not supported yet; your contribution is welcome");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
void PackW16Ne::pack(OutputFile *)
|
||||||
|
{
|
||||||
|
throwCantPack("not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
int PackW16Ne::canUnpack()
|
||||||
|
{
|
||||||
|
if (!readFileHeader())
|
||||||
|
return false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
//
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
void PackW16Ne::unpack(OutputFile *)
|
||||||
|
{
|
||||||
|
throwCantUnpack("not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
vi:ts=4:et
|
||||||
|
*/
|
||||||
|
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
/* p_w16ne.h --
|
||||||
|
|
||||||
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
|
Copyright (C) 1996-2000 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 1996-2000 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
|
||||||
|
markus.oberhumer@jk.uni-linz.ac.at ml1050@cdata.tvnet.hu
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __UPX_P_W16NE_H
|
||||||
|
#define __UPX_P_W16NE_H
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
// win16/ne
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
class PackW16Ne : public Packer
|
||||||
|
{
|
||||||
|
typedef Packer super;
|
||||||
|
public:
|
||||||
|
PackW16Ne(InputFile *f);
|
||||||
|
virtual int getVersion() const { return 11; }
|
||||||
|
virtual int getFormat() const { return UPX_F_WIN16_NE; }
|
||||||
|
virtual const char *getName() const { return "win16/ne"; }
|
||||||
|
virtual int getCompressionMethod() const;
|
||||||
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
|
virtual void pack(OutputFile *fo);
|
||||||
|
virtual void unpack(OutputFile *fo);
|
||||||
|
|
||||||
|
virtual bool canPack();
|
||||||
|
virtual int canUnpack();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual bool readFileHeader(void);
|
||||||
|
virtual int buildLoader(const Filter *ft);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* already included */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
vi:ts=4:et
|
||||||
|
*/
|
||||||
|
|
||||||
+1
-1
@@ -48,7 +48,7 @@ public:
|
|||||||
PackW32Pe(InputFile *f);
|
PackW32Pe(InputFile *f);
|
||||||
~PackW32Pe();
|
~PackW32Pe();
|
||||||
virtual int getVersion() const { return 12; }
|
virtual int getVersion() const { return 12; }
|
||||||
virtual int getFormat() const { return UPX_F_W32_PE; }
|
virtual int getFormat() const { return UPX_F_WIN32_PE; }
|
||||||
virtual const char *getName() const { return isrtm ? "rtm32/pe" : "win32/pe"; }
|
virtual const char *getName() const { return isrtm ? "rtm32/pe" : "win32/pe"; }
|
||||||
virtual int getCompressionMethod() const;
|
virtual int getCompressionMethod() const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|||||||
@@ -46,6 +46,7 @@
|
|||||||
#include "p_wcle.h"
|
#include "p_wcle.h"
|
||||||
#include "p_tmt.h"
|
#include "p_tmt.h"
|
||||||
#include "p_vxd.h"
|
#include "p_vxd.h"
|
||||||
|
#include "p_w16ne.h"
|
||||||
#include "p_w32pe.h"
|
#include "p_w32pe.h"
|
||||||
#include "p_vmlinz.h"
|
#include "p_vmlinz.h"
|
||||||
|
|
||||||
@@ -162,6 +163,8 @@ static Packer* try_packers(InputFile *f, try_function func)
|
|||||||
if ((p = func(new PackVxd(f),f)) != NULL)
|
if ((p = func(new PackVxd(f),f)) != NULL)
|
||||||
return p;
|
return p;
|
||||||
#endif
|
#endif
|
||||||
|
if ((p = func(new PackW16Ne(f),f)) != NULL)
|
||||||
|
return p;
|
||||||
if ((p = func(new PackW32Pe(f),f)) != NULL)
|
if ((p = func(new PackW32Pe(f),f)) != NULL)
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -74,9 +74,9 @@ typedef unsigned upx_uint32;
|
|||||||
#define UPX_F_VXD_LE 6
|
#define UPX_F_VXD_LE 6
|
||||||
#define UPX_F_DOS_EXEH 7 /* OBSOLETE */
|
#define UPX_F_DOS_EXEH 7 /* OBSOLETE */
|
||||||
#define UPX_F_TMT_ADAM 8
|
#define UPX_F_TMT_ADAM 8
|
||||||
#define UPX_F_W32_PE 9
|
#define UPX_F_WIN32_PE 9
|
||||||
#define UPX_F_LINUX_i386 10
|
#define UPX_F_LINUX_i386 10
|
||||||
/* UNUSED */
|
#define UPX_F_WIN16_NE 11
|
||||||
#define UPX_F_LINUX_ELF_i386 12
|
#define UPX_F_LINUX_ELF_i386 12
|
||||||
#define UPX_F_LINUX_SEP_i386 13
|
#define UPX_F_LINUX_SEP_i386 13
|
||||||
#define UPX_F_LINUX_SH_i386 14
|
#define UPX_F_LINUX_SH_i386 14
|
||||||
|
|||||||
Reference in New Issue
Block a user