Introduced UPX_VERSION_YEAR.

committer: mfx <mfx> 1139826163 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2006-02-13 10:22:43 +00:00
parent b4e9ad031b
commit 5b2f1b6d8b
13 changed files with 45 additions and 23 deletions

View File

@ -1106,6 +1106,9 @@ void upx_sanity_check(void)
COMPILE_TIME_ASSERT(sizeof(UPX_VERSION_STRING4) == 4 + 1)
assert(strlen(UPX_VERSION_STRING4) == 4);
assert(memcmp(UPX_VERSION_STRING4, UPX_VERSION_STRING, 4) == 0);
COMPILE_TIME_ASSERT(sizeof(UPX_VERSION_YEAR) == 4 + 1)
assert(strlen(UPX_VERSION_YEAR) == 4);
assert(memcmp(UPX_VERSION_DATE + strlen(UPX_VERSION_DATE) - 4, UPX_VERSION_YEAR, 4) == 0);
#if 1
# if 1

View File

@ -547,6 +547,7 @@ void PackTos::pack(OutputFile *fo)
// patch loader
int tmp = patchPackHeader(loader, o_text);
assert(tmp + 32 == (int)o_text); UNUSED(tmp);
patchVersionYear(loader, o_text);
if (!opt->small)
patchVersion(loader, o_text);
// patch "subq.l #1,d6" or "subq.w #1,d6" - see "up41" below

View File

@ -821,6 +821,22 @@ int Packer::patchVersion(void *b, int blen)
}
// patch year into stub/ident_[ns].ash
int Packer::patchVersionYear(void *b, int blen)
{
int boff = find(b, blen, " 1996-UPXY ", 11);
checkPatch(b, blen, boff, 11);
unsigned char *p = (unsigned char *)b + boff + 6;
if (opt->fake_stub_year[0])
memcpy(p, opt->fake_stub_year, 4);
else
memcpy(p, UPX_VERSION_YEAR, 4);
return boff;
}
/*************************************************************************
// relocation util
**************************************************************************/
@ -986,12 +1002,12 @@ char const *Packer::getIdentstr(unsigned *size, int small)
"\n\0"
"$Id: UPX "
UPX_VERSION_STRING4
" Copyright (C) 1996-2006 the UPX Team. All Rights Reserved. $"
" Copyright (C) 1996-" UPX_VERSION_YEAR " the UPX Team. All Rights Reserved. $"
"\n";
static char identsmall[] =
"\n"
"$Id: UPX "
"(C) 1996-2006 the UPX Team. All Rights Reserved. http://upx.sf.net $"
"(C) 1996-" UPX_VERSION_YEAR " the UPX Team. All Rights Reserved. http://upx.sf.net $"
"\n";
static char identtiny[] = UPX_VERSION_STRING4;
@ -1011,7 +1027,7 @@ char const *Packer::getIdentstr(unsigned *size, int small)
if (opt->fake_stub_version[0])
mem_replace(iter->s, iter->size, UPX_VERSION_STRING4, 4, opt->fake_stub_version);
if (opt->fake_stub_year[0])
mem_replace(iter->s, iter->size, "2006", 4, opt->fake_stub_year);
mem_replace(iter->s, iter->size, UPX_VERSION_YEAR, 4, opt->fake_stub_year);
}
done = 1;
}

View File

@ -233,6 +233,7 @@ protected:
int patch_le32(void *b, int blen, unsigned old, unsigned new_);
int patch_le32(void *b, int blen, const void * old, unsigned new_);
int patchVersion(void *b, int blen);
int patchVersionYear(void *b, int blen);
void checkPatch(void *b, int blen, int boff, int size);
// relocation util

View File

@ -35,7 +35,7 @@
db 10,0
db '$Id: UPX '
db 'UPXV'
db ' Copyright (C) 1996-2006 the UPX Team. All Rights Reserved. $'
db ' Copyright (C) 1996-UPXY the UPX Team. All Rights Reserved. $'
db 10,0

View File

@ -29,7 +29,7 @@
; ------------- COPYRIGHT -------------
db 10
db '$Id: UPX (C) 1996-2006 the UPX Team. '
db '$Id: UPX (C) 1996-UPXY the UPX Team. '
db 'All Rights Reserved. http://upx.sf.net $'
db 10,0

View File

@ -28,8 +28,8 @@
#define NRV2B_LOADER_SIZE 668
#define NRV2B_LOADER_ADLER32 0xb149ee81
#define NRV2B_LOADER_CRC32 0x8c9f9acd
#define NRV2B_LOADER_ADLER32 0x36bbef0f
#define NRV2B_LOADER_CRC32 0x4f682ad4
unsigned char nrv2b_loader[668] = {
32, 8,103, 6, 46,104, 0, 4, 96, 4, 32, 47, 0, 4, 72,231, /* 0x 0 */
@ -58,7 +58,7 @@ unsigned char nrv2b_loader[668] = {
107,101,114, 32,104,116,116,112, 58, 47, 47,117,112,120, 46,115, /* 0x 170 */
102, 46,110,101,116, 32, 36, 10, 0, 36, 73,100, 58, 32, 85, 80, /* 0x 180 */
88, 32, 85, 80, 88, 86, 32, 67,111,112,121,114,105,103,104,116, /* 0x 190 */
32, 40, 67, 41, 32, 49, 57, 57, 54, 45, 50, 48, 48, 54, 32,116, /* 0x 1a0 */
32, 40, 67, 41, 32, 49, 57, 57, 54, 45, 85, 80, 88, 89, 32,116, /* 0x 1a0 */
104,101, 32, 85, 80, 88, 32, 84,101, 97,109, 46, 32, 65,108,108, /* 0x 1b0 */
32, 82,105,103,104,116,115, 32, 82,101,115,101,114,118,101,100, /* 0x 1c0 */
46, 32, 36, 10, 0, 0, 0, 0, 85, 80, 88, 33,161,216,208,213, /* 0x 1d0 */

View File

@ -28,8 +28,8 @@
#define NRV2B_LOADER_SMALL_SIZE 530
#define NRV2B_LOADER_SMALL_ADLER32 0xdcb7b310
#define NRV2B_LOADER_SMALL_CRC32 0x35164d24
#define NRV2B_LOADER_SMALL_ADLER32 0x6843b39e
#define NRV2B_LOADER_SMALL_CRC32 0x68e5d2d4
unsigned char nrv2b_loader_small[530] = {
32, 8,103, 6, 46,104, 0, 4, 96, 4, 32, 47, 0, 4, 72,231, /* 0x 0 */
@ -49,7 +49,7 @@ unsigned char nrv2b_loader_small[530] = {
33,223, 0,244, 33,223, 0, 44, 33,223, 0, 16, 78,113, 78,117, /* 0x e0 */
78,117, 79,239, 0,146, 76,223,127,254, 32, 8,103, 2,159,207, /* 0x f0 */
78,249, 10, 36, 73,100, 58, 32, 85, 80, 88, 32, 40, 67, 41, 32, /* 0x 100 */
49, 57, 57, 54, 45, 50, 48, 48, 54, 32,116,104,101, 32, 85, 80, /* 0x 110 */
49, 57, 57, 54, 45, 85, 80, 88, 89, 32,116,104,101, 32, 85, 80, /* 0x 110 */
88, 32, 84,101, 97,109, 46, 32, 65,108,108, 32, 82,105,103,104, /* 0x 120 */
116,115, 32, 82,101,115,101,114,118,101,100, 46, 32,104,116,116, /* 0x 130 */
112, 58, 47, 47,117,112,120, 46,115,102, 46,110,101,116, 32, 36, /* 0x 140 */

View File

@ -28,8 +28,8 @@
#define NRV2D_LOADER_SIZE 688
#define NRV2D_LOADER_ADLER32 0x86fbf45f
#define NRV2D_LOADER_CRC32 0x6902d666
#define NRV2D_LOADER_ADLER32 0x1785f4ed
#define NRV2D_LOADER_CRC32 0xecd288cc
unsigned char nrv2d_loader[688] = {
32, 8,103, 6, 46,104, 0, 4, 96, 4, 32, 47, 0, 4, 72,231, /* 0x 0 */
@ -58,7 +58,7 @@ unsigned char nrv2d_loader[688] = {
107,101,114, 32,104,116,116,112, 58, 47, 47,117,112,120, 46,115, /* 0x 170 */
102, 46,110,101,116, 32, 36, 10, 0, 36, 73,100, 58, 32, 85, 80, /* 0x 180 */
88, 32, 85, 80, 88, 86, 32, 67,111,112,121,114,105,103,104,116, /* 0x 190 */
32, 40, 67, 41, 32, 49, 57, 57, 54, 45, 50, 48, 48, 54, 32,116, /* 0x 1a0 */
32, 40, 67, 41, 32, 49, 57, 57, 54, 45, 85, 80, 88, 89, 32,116, /* 0x 1a0 */
104,101, 32, 85, 80, 88, 32, 84,101, 97,109, 46, 32, 65,108,108, /* 0x 1b0 */
32, 82,105,103,104,116,115, 32, 82,101,115,101,114,118,101,100, /* 0x 1c0 */
46, 32, 36, 10, 0, 0, 0, 0, 85, 80, 88, 33,161,216,208,213, /* 0x 1d0 */

View File

@ -28,8 +28,8 @@
#define NRV2D_LOADER_SMALL_SIZE 550
#define NRV2D_LOADER_SMALL_ADLER32 0x9fb1b9c8
#define NRV2D_LOADER_SMALL_CRC32 0xc069fa07
#define NRV2D_LOADER_SMALL_ADLER32 0x3655ba56
#define NRV2D_LOADER_SMALL_CRC32 0x7bba64b7
unsigned char nrv2d_loader_small[550] = {
32, 8,103, 6, 46,104, 0, 4, 96, 4, 32, 47, 0, 4, 72,231, /* 0x 0 */
@ -49,7 +49,7 @@ unsigned char nrv2d_loader_small[550] = {
33,223, 0,244, 33,223, 0, 44, 33,223, 0, 16, 78,113, 78,117, /* 0x e0 */
78,117, 79,239, 0,146, 76,223,127,254, 32, 8,103, 2,159,207, /* 0x f0 */
78,249, 10, 36, 73,100, 58, 32, 85, 80, 88, 32, 40, 67, 41, 32, /* 0x 100 */
49, 57, 57, 54, 45, 50, 48, 48, 54, 32,116,104,101, 32, 85, 80, /* 0x 110 */
49, 57, 57, 54, 45, 85, 80, 88, 89, 32,116,104,101, 32, 85, 80, /* 0x 110 */
88, 32, 84,101, 97,109, 46, 32, 65,108,108, 32, 82,105,103,104, /* 0x 120 */
116,115, 32, 82,101,115,101,114,118,101,100, 46, 32,104,116,116, /* 0x 130 */
112, 58, 47, 47,117,112,120, 46,115,102, 46,110,101,116, 32, 36, /* 0x 140 */

View File

@ -28,8 +28,8 @@
#define NRV2E_LOADER_SIZE 696
#define NRV2E_LOADER_ADLER32 0x0bfbf673
#define NRV2E_LOADER_CRC32 0x3e79ea40
#define NRV2E_LOADER_ADLER32 0xa0e6f701
#define NRV2E_LOADER_CRC32 0x1d26a023
unsigned char nrv2e_loader[696] = {
32, 8,103, 6, 46,104, 0, 4, 96, 4, 32, 47, 0, 4, 72,231, /* 0x 0 */
@ -58,7 +58,7 @@ unsigned char nrv2e_loader[696] = {
107,101,114, 32,104,116,116,112, 58, 47, 47,117,112,120, 46,115, /* 0x 170 */
102, 46,110,101,116, 32, 36, 10, 0, 36, 73,100, 58, 32, 85, 80, /* 0x 180 */
88, 32, 85, 80, 88, 86, 32, 67,111,112,121,114,105,103,104,116, /* 0x 190 */
32, 40, 67, 41, 32, 49, 57, 57, 54, 45, 50, 48, 48, 54, 32,116, /* 0x 1a0 */
32, 40, 67, 41, 32, 49, 57, 57, 54, 45, 85, 80, 88, 89, 32,116, /* 0x 1a0 */
104,101, 32, 85, 80, 88, 32, 84,101, 97,109, 46, 32, 65,108,108, /* 0x 1b0 */
32, 82,105,103,104,116,115, 32, 82,101,115,101,114,118,101,100, /* 0x 1c0 */
46, 32, 36, 10, 0, 0, 0, 0, 85, 80, 88, 33,161,216,208,213, /* 0x 1d0 */

View File

@ -28,8 +28,8 @@
#define NRV2E_LOADER_SMALL_SIZE 558
#define NRV2E_LOADER_SMALL_ADLER32 0xb197bbdc
#define NRV2E_LOADER_SMALL_CRC32 0x4082eb7b
#define NRV2E_LOADER_SMALL_ADLER32 0x4cabbc6a
#define NRV2E_LOADER_SMALL_CRC32 0xda3e6739
unsigned char nrv2e_loader_small[558] = {
32, 8,103, 6, 46,104, 0, 4, 96, 4, 32, 47, 0, 4, 72,231, /* 0x 0 */
@ -49,7 +49,7 @@ unsigned char nrv2e_loader_small[558] = {
33,223, 0,244, 33,223, 0, 44, 33,223, 0, 16, 78,113, 78,117, /* 0x e0 */
78,117, 79,239, 0,146, 76,223,127,254, 32, 8,103, 2,159,207, /* 0x f0 */
78,249, 10, 36, 73,100, 58, 32, 85, 80, 88, 32, 40, 67, 41, 32, /* 0x 100 */
49, 57, 57, 54, 45, 50, 48, 48, 54, 32,116,104,101, 32, 85, 80, /* 0x 110 */
49, 57, 57, 54, 45, 85, 80, 88, 89, 32,116,104,101, 32, 85, 80, /* 0x 110 */
88, 32, 84,101, 97,109, 46, 32, 65,108,108, 32, 82,105,103,104, /* 0x 120 */
116,115, 32, 82,101,115,101,114,118,101,100, 46, 32,104,116,116, /* 0x 130 */
112, 58, 47, 47,117,112,120, 46,115,102, 46,110,101,116, 32, 36, /* 0x 140 */

View File

@ -2,3 +2,4 @@
#define UPX_VERSION_STRING "1.94 beta"
#define UPX_VERSION_STRING4 "1.94"
#define UPX_VERSION_DATE "Feb 13th 2006"
#define UPX_VERSION_YEAR "2006"