1
0
mirror of https://github.com/upx/upx synced 2025-10-12 20:59:43 +08:00

Re-synced both files a little bit.

committer: mfx <mfx> 1142301586 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2006-03-14 01:59:46 +00:00
parent 0608c35669
commit c43c484a62
2 changed files with 24 additions and 12 deletions

View File

@ -158,6 +158,7 @@ PackArmPe::PackArmPe(InputFile *f) : super(f)
kernel32ordinal = false; kernel32ordinal = false;
tlsindex = 0; tlsindex = 0;
big_relocs = 0; big_relocs = 0;
sorelocs = 0;
soxrelocs = 0; soxrelocs = 0;
} }
@ -583,6 +584,7 @@ unsigned PackArmPe::processImports() // pass 1
} }
} }
__attribute_packed; __attribute_packed;
COMPILE_TIME_ASSERT(sizeof(udll) == 32);
// +1 for dllnum=0 // +1 for dllnum=0
Array(struct udll, dlls, dllnum+1); Array(struct udll, dlls, dllnum+1);
@ -611,7 +613,6 @@ unsigned PackArmPe::processImports() // pass 1
importbyordinal = true; importbyordinal = true;
soimport += 2; // ordinal num: 2 bytes soimport += 2; // ordinal num: 2 bytes
dlls[ic].ordinal = *tarr & 0xffff; dlls[ic].ordinal = *tarr & 0xffff;
//if (dlls[ic].isk32) //if (dlls[ic].isk32)
// kernel32ordinal = true,k32o++; // kernel32ordinal = true,k32o++;
} }
@ -658,8 +659,8 @@ unsigned PackArmPe::processImports() // pass 1
strcpy(dllnames,kernel32dll); strcpy(dllnames,kernel32dll);
im->dllname = k32namepos; im->dllname = k32namepos;
im->iat = ptr_diff(ordinals,oimpdlls); im->iat = ptr_diff(ordinals,oimpdlls);
*ordinals++ = ptr_diff(importednames,oimpdlls); *ordinals++ = ptr_diff(importednames,oimpdlls); // LoadLibraryW
*ordinals++ = ptr_diff(importednames,oimpdlls) + 14; *ordinals++ = ptr_diff(importednames,oimpdlls) + 14; // GetProcAddressA
dllnames += sizeof(kernel32dll); dllnames += sizeof(kernel32dll);
importednames += sizeof(llgpa); importednames += sizeof(llgpa);
@ -702,6 +703,7 @@ unsigned PackArmPe::processImports() // pass 1
Interval names(ibuf),iats(ibuf),lookups(ibuf); Interval names(ibuf),iats(ibuf),lookups(ibuf);
// create the preprocessed data // create the preprocessed data
//ordinals -= k32o;
upx_byte *ppi = oimport; // preprocessed imports upx_byte *ppi = oimport; // preprocessed imports
for (ic = 0; ic < dllnum; ic++) for (ic = 0; ic < dllnum; ic++)
{ {
@ -1567,9 +1569,9 @@ void PackArmPe::pack(OutputFile *fo)
|| ih.subsystem != 9 || ih.subsystem != 9
|| (ih.entry == 0 && !isdll) || (ih.entry == 0 && !isdll)
|| ih.ddirsentries != 16 || ih.ddirsentries != 16
/*|| IDSIZE(PEDIR_EXCEPTION*/) // is this used on i386? // || IDSIZE(PEDIR_EXCEPTION) // is this used on arm?
// || IDSIZE(PEDIR_COPYRIGHT) // || IDSIZE(PEDIR_COPYRIGHT)
) ))
throwCantPack("unexpected value in PE header (try --force)"); throwCantPack("unexpected value in PE header (try --force)");
if (IDSIZE(PEDIR_SEC)) if (IDSIZE(PEDIR_SEC))
@ -1891,10 +1893,12 @@ void PackArmPe::pack(OutputFile *fo)
ODADDR(PEDIR_RESOURCE) = soresources ? ic : 0; ODADDR(PEDIR_RESOURCE) = soresources ? ic : 0;
ODSIZE(PEDIR_RESOURCE) = soresources; ODSIZE(PEDIR_RESOURCE) = soresources;
ic += soresources; ic += soresources;
processImports(ic); processImports(ic);
ODADDR(PEDIR_IMPORT) = ic; ODADDR(PEDIR_IMPORT) = ic;
ODSIZE(PEDIR_IMPORT) = soimpdlls; ODSIZE(PEDIR_IMPORT) = soimpdlls;
ic += soimpdlls; ic += soimpdlls;
//processExports(&xport,ic); //processExports(&xport,ic);
ODADDR(PEDIR_EXPORT) = soexport ? ic : 0; ODADDR(PEDIR_EXPORT) = soexport ? ic : 0;
ODSIZE(PEDIR_EXPORT) = soexport; ODSIZE(PEDIR_EXPORT) = soexport;
@ -1904,6 +1908,7 @@ void PackArmPe::pack(OutputFile *fo)
ODSIZE(PEDIR_EXPORT) = IDSIZE(PEDIR_EXPORT); ODSIZE(PEDIR_EXPORT) = IDSIZE(PEDIR_EXPORT);
} }
ic += soexport; ic += soexport;
//processRelocs(&rel); //processRelocs(&rel);
ODADDR(PEDIR_RELOC) = soxrelocs ? ic : 0; ODADDR(PEDIR_RELOC) = soxrelocs ? ic : 0;
ODSIZE(PEDIR_RELOC) = soxrelocs; ODSIZE(PEDIR_RELOC) = soxrelocs;
@ -1986,6 +1991,8 @@ void PackArmPe::pack(OutputFile *fo)
fo->write(obuf,clen); fo->write(obuf,clen);
infoWriting("compressed data", clen); infoWriting("compressed data", clen);
fo->write(loader,codesize); fo->write(loader,codesize);
if (opt->debug.dump_stub_loader)
OutputFile::dump(opt->debug.dump_stub_loader, loader, codesize);
if ((ic = fo->getBytesWritten() & 3) != 0) if ((ic = fo->getBytesWritten() & 3) != 0)
fo->write(ibuf,4 - ic); fo->write(ibuf,4 - ic);
fo->write(otls,sotls); fo->write(otls,sotls);
@ -2037,6 +2044,8 @@ void PackArmPe::unpack(OutputFile *)
{ {
} }
/* /*
vi:ts=4:et vi:ts=4:et
*/ */

View File

@ -159,6 +159,8 @@ PackW32Pe::PackW32Pe(InputFile *f) : super(f)
kernel32ordinal = false; kernel32ordinal = false;
tlsindex = 0; tlsindex = 0;
big_relocs = 0; big_relocs = 0;
sorelocs = 0;
soxrelocs = 0;
soloadconf = 0; soloadconf = 0;
use_dep_hack = true; use_dep_hack = true;
use_clear_dirty_stack = true; use_clear_dirty_stack = true;
@ -591,6 +593,7 @@ unsigned PackW32Pe::processImports() // pass 1
} }
} }
__attribute_packed; __attribute_packed;
COMPILE_TIME_ASSERT(sizeof(udll) == 32);
// +1 for dllnum=0 // +1 for dllnum=0
Array(struct udll, dlls, dllnum+1); Array(struct udll, dlls, dllnum+1);