1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

fixed CUTPOINT related stuff

committer: ml1050 <ml1050> 977333745 +0000
This commit is contained in:
László Molnár 2000-12-20 17:35:45 +00:00
parent 97ff8042b4
commit a42e72094a
5 changed files with 7 additions and 6 deletions

View File

@ -97,7 +97,7 @@ void PackCom::patchLoader(OutputFile *fo,
unsigned calls, unsigned overlapoh)
{
const int filter_id = ph.filter;
const int e_len = getLoaderSection("COMCUTPO");
const int e_len = getLoaderSectionStart("COMCUTPO");
const int d_len = lsize - e_len;
assert(e_len > 0 && e_len < 256);
assert(d_len > 0 && d_len < 256);

View File

@ -264,7 +264,7 @@ void PackExe::pack(OutputFile *fo)
fi->seek(ih.headsize16*16,SEEK_SET);
fi->readx(ibuf,imagesize);
if (find_le32(ibuf, UPX_MAX(imagesize, 127u), UPX_MAGIC_LE32) >= 0)
if (find_le32(ibuf, UPX_MIN(imagesize, 127u), UPX_MAGIC_LE32) >= 0)
throwAlreadyPacked();
// relocations
@ -413,7 +413,7 @@ void PackExe::pack(OutputFile *fo)
//OutputFile::dump("xxloader.dat", loader, lsize);
// patch loader
const unsigned e_len = getLoaderSection("EXECUTPO");
const unsigned e_len = getLoaderSectionStart("EXECUTPO");
const unsigned d_len = lsize - e_len;
assert((e_len&15) == 0);

View File

@ -69,7 +69,7 @@ void PackSys::patchLoader(OutputFile *fo,
unsigned calls, unsigned overlapoh)
{
const int filter_id = ph.filter;
const int e_len = getLoaderSection("SYSCUTPO");
const int e_len = getLoaderSectionStart("SYSCUTPO");
const int d_len = lsize - e_len;
assert(e_len > 0 && e_len < 256);
assert(d_len > 0 && d_len < 256);
@ -88,6 +88,7 @@ void PackSys::patchLoader(OutputFile *fo,
assert(calls > 0);
patch_le16(loader,lsize,"CT",calls);
}
patchPackHeader(loader,e_len);
const unsigned jmp_pos = find_le16(loader,e_len,get_le16("JM"));
patch_le16(loader,e_len,"JM",ph.u_len+overlapoh+2-jmp_pos-2);

View File

@ -217,7 +217,7 @@ void PackTmt::pack(OutputFile *fo)
memcpy(loader,getLoader(),lsize);
const unsigned s_point = getLoaderSection("TMTMAIN1");
int e_len = getLoaderSection("TMTCUTPO");
int e_len = getLoaderSectionStart("TMTCUTPO");
const unsigned d_len = lsize - e_len;
assert(e_len > 0 && s_point > 0);

View File

@ -481,7 +481,7 @@ void PackWcle::pack(OutputFile *fo)
const unsigned lsize = getLoaderSize();
neweip = getLoaderSection("WCLEMAIN");
int e_len = getLoaderSection("WCLECUTP");
int e_len = getLoaderSectionStart("WCLECUTP");
const unsigned d_len = lsize - e_len;
assert(e_len > 0);