Re-synced `identtiny' from 1.2 branch.

committer: mfx <mfx> 1034741770 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2002-10-16 04:16:10 +00:00
parent cecfaaf63e
commit ac245b39d5
4 changed files with 22 additions and 14 deletions

View File

@ -93,7 +93,7 @@ PackLinuxI386::generateElfHdr(
#if 0 //{ #if 0 //{
unsigned identsize; unsigned identsize;
char const *const ident = identstr(identsize); char const *const ident = getIdentstr(&identsize);
#endif //} #endif //}
h2->phdr[0].p_filesz = sizeof(*h2); // + identsize; h2->phdr[0].p_filesz = sizeof(*h2); // + identsize;
h2->phdr[0].p_memsz = h2->phdr[0].p_filesz; h2->phdr[0].p_memsz = h2->phdr[0].p_filesz;

View File

@ -1483,7 +1483,7 @@ bool PackW32Pe::canPack()
int PackW32Pe::buildLoader(const Filter *ft) int PackW32Pe::buildLoader(const Filter *ft)
{ {
// prepare loader // prepare loader
initLoader(nrv_loader,sizeof(nrv_loader)); initLoader(nrv_loader, sizeof(nrv_loader), -1, 2);
addLoader(isdll ? "PEISDLL1" : "", addLoader(isdll ? "PEISDLL1" : "",
"PEMAIN01", "PEMAIN01",
icondir_count > 1 ? (icondir_count == 2 ? "PEICONS1" : "PEICONS2") : "", icondir_count > 1 ? (icondir_count == 2 ? "PEICONS1" : "PEICONS2") : "",

View File

@ -965,7 +965,7 @@ const int *Packer::getDefaultCompressionMethods_LE32(int method, int level, int
// loader util // loader util
**************************************************************************/ **************************************************************************/
char const *Packer::identstr(unsigned &size) char const *Packer::getIdentstr(unsigned *size, int small)
{ {
static const char identbig[] = static const char identbig[] =
"\n\0" "\n\0"
@ -981,20 +981,28 @@ char const *Packer::identstr(unsigned &size)
"$Id: UPX " "$Id: UPX "
"(C) 1996-2002 the UPX Team. All Rights Reserved. http://upx.sf.net $" "(C) 1996-2002 the UPX Team. All Rights Reserved. http://upx.sf.net $"
"\n"; "\n";
// static const char identtiny[] = UPX_VERSION_STRING4; static const char identtiny[] = UPX_VERSION_STRING4;
// FIXME
if (opt->small) { if (small < 0)
size = sizeof(identsmall); small = opt->small;
if (small >= 2)
{
*size = sizeof(identtiny);
return identtiny;
}
else if (small >= 1)
{
*size = sizeof(identsmall);
return identsmall; return identsmall;
} }
else { else
size = sizeof(identbig); {
*size = sizeof(identbig);
return identbig; return identbig;
} }
} }
void Packer::initLoader(const void *pdata, int plen, int pinfo) void Packer::initLoader(const void *pdata, int plen, int pinfo, int small)
{ {
if (pinfo < 0) if (pinfo < 0)
{ {
@ -1009,8 +1017,8 @@ void Packer::initLoader(const void *pdata, int plen, int pinfo)
linker = new BeLinker(pdata, plen, pinfo); // big endian linker = new BeLinker(pdata, plen, pinfo); // big endian
unsigned size; unsigned size;
char const *const ident = identstr(size); char const * const ident = getIdentstr(&size, small);
linker->addSection("IDENTSTR",ident,size); linker->addSection("IDENTSTR", ident, size);
} }

View File

@ -207,12 +207,12 @@ protected:
virtual int buildLoader(const Filter *) { return getLoaderSize(); } virtual int buildLoader(const Filter *) { return getLoaderSize(); }
virtual const upx_byte *getLoader() const; virtual const upx_byte *getLoader() const;
virtual int getLoaderSize() const; virtual int getLoaderSize() const;
virtual void initLoader(const void *pdata, int plen, int pinfo=-1); virtual void initLoader(const void *pdata, int plen, int pinfo=-1, int small=-1);
virtual void addLoader(const char *s, ...); virtual void addLoader(const char *s, ...);
virtual int getLoaderSection(const char *name, int *slen=NULL) const; virtual int getLoaderSection(const char *name, int *slen=NULL) const;
virtual int getLoaderSectionStart(const char *name, int *slen=NULL) const; virtual int getLoaderSectionStart(const char *name, int *slen=NULL) const;
virtual const char *getDecompressor() const; virtual const char *getDecompressor() const;
char const *identstr(unsigned &size); virtual const char *getIdentstr(unsigned *size, int small=-1);
// stub and overlay util // stub and overlay util
static void handleStub(InputFile *fi, OutputFile *fo, long size); static void handleStub(InputFile *fi, OutputFile *fo, long size);