refuse compressing files which have tls callbacks

committer: ml1050 <ml1050> 980113870 +0000
This commit is contained in:
László Molnár
2001-01-21 21:51:10 +00:00
parent b7f0187e9c
commit d5dd445a06
+7 -5
View File
@@ -909,7 +909,7 @@ struct tls
LE32 dataend; // VA tls init data end LE32 dataend; // VA tls init data end
LE32 tlsindex; // VA tls index LE32 tlsindex; // VA tls index
LE32 callbacks; // VA tls callbacks LE32 callbacks; // VA tls callbacks
char _[8]; // zero init, characteristics char _[8]; // zero init, characteristics
}; };
void PackW32Pe::processTls(Interval *iv) // pass 1 void PackW32Pe::processTls(Interval *iv) // pass 1
@@ -918,6 +918,8 @@ void PackW32Pe::processTls(Interval *iv) // pass 1
return; return;
const tls * const tlsp = (const tls*) (ibuf + IDADDR(PEDIR_TLS)); const tls * const tlsp = (const tls*) (ibuf + IDADDR(PEDIR_TLS));
if (tlsp->callbacks) // note: callbacks are not implemented on windoze 9x
throwCantPack("tls callbacks are not supported");
unsigned tlsdatastart = tlsp->datastart - ih.imagebase; unsigned tlsdatastart = tlsp->datastart - ih.imagebase;
unsigned tlsdataend = tlsp->dataend - ih.imagebase; unsigned tlsdataend = tlsp->dataend - ih.imagebase;
@@ -967,7 +969,7 @@ void PackW32Pe::processTls(Reloc *rel,const Interval *iv,unsigned newaddr) // pa
tlsp->datastart = newaddr + sizeof(tls) + ih.imagebase; tlsp->datastart = newaddr + sizeof(tls) + ih.imagebase;
tlsp->dataend = newaddr + sotls + ih.imagebase; tlsp->dataend = newaddr + sotls + ih.imagebase;
tlsp->callbacks = 0; // note: callbacks are not implemented in windoze tlsp->callbacks = 0; // note: callbacks are not implemented on windoze 9x
} }
@@ -1179,7 +1181,7 @@ void Resource::destroy(upx_rnode *node,unsigned level)
delete [] branch->children; delete [] branch->children;
} }
static void lame_print_unicode (const upx_byte *p) static void lame_print_unicode(const upx_byte *p)
{ {
for (unsigned ic = 0; ic < get_le16(p); ic++) for (unsigned ic = 0; ic < get_le16(p); ic++)
printf("%c",(char)p[ic * 2 + 2]); printf("%c",(char)p[ic * 2 + 2]);
@@ -1231,7 +1233,7 @@ bool Resource::clear()
return iv.ivnum == 1; return iv.ivnum == 1;
} }
void PackW32Pe::processResources(Resource* res,unsigned newaddr) void PackW32Pe::processResources(Resource *res,unsigned newaddr)
{ {
if (IDSIZE(PEDIR_RESOURCE) == 0) if (IDSIZE(PEDIR_RESOURCE) == 0)
return; return;
@@ -1243,7 +1245,7 @@ void PackW32Pe::processResources(Resource* res,unsigned newaddr)
delete [] p; delete [] p;
} }
void PackW32Pe::processResources(Resource* res) void PackW32Pe::processResources(Resource *res)
{ {
const unsigned vaddr = IDADDR(PEDIR_RESOURCE); const unsigned vaddr = IDADDR(PEDIR_RESOURCE);
if ((soresources = IDSIZE(PEDIR_RESOURCE)) == 0) if ((soresources = IDSIZE(PEDIR_RESOURCE)) == 0)