added filter (id: 0x50) support to the stub

the data cache is written back before the stub jumps to the uncompressed code

committer: ml1050 <ml1050> 1144931349 +0000
This commit is contained in:
László Molnár 2006-04-13 12:29:09 +00:00
parent 3e31560e7d
commit 779033d0bc
4 changed files with 412 additions and 261 deletions

View File

@ -199,7 +199,8 @@ const int *PackArmPe::getCompressionMethods(int method, int level) const
const int *PackArmPe::getFilters() const
{
return 0;
static const int filters[] = { 0x50, -1 };
return filters;
}
@ -556,7 +557,9 @@ void PackArmPe::processImports(unsigned myimport) // pass 2
unsigned PackArmPe::processImports() // pass 1
{
static const unsigned char kernel32dll[] = "COREDLL.dll";
static const char llgpa[] = "\x0\x0""LoadLibraryW\x0\x0""GetProcAddressA";
static const char llgpa[] = "\x0\x0""LoadLibraryW\x0\x0"
"GetProcAddressA\x0\x0\x0"
"CacheSync";
//static const char exitp[] = "ExitProcess\x0\x0\x0";
unsigned dllnum = 0;
@ -658,7 +661,7 @@ unsigned PackArmPe::processImports() // pass 1
im = (import_desc*) oimpdlls;
LE32 *ordinals = (LE32*) (oimpdlls + (dllnum2 + 1) * sizeof(import_desc));
LE32 *lookuptable = ordinals + 3;// + k32o + (isdll ? 0 : 1);
LE32 *lookuptable = ordinals + 4;// + k32o + (isdll ? 0 : 1);
upx_byte *dllnames = ((upx_byte*) lookuptable) + (dllnum2 - 1) * 8;
upx_byte *importednames = dllnames + (dllnamelen &~ 1);
@ -670,6 +673,7 @@ unsigned PackArmPe::processImports() // pass 1
im->iat = ptr_diff(ordinals,oimpdlls);
*ordinals++ = ptr_diff(importednames,oimpdlls); // LoadLibraryW
*ordinals++ = ptr_diff(importednames,oimpdlls) + 14; // GetProcAddressA
*ordinals++ = ptr_diff(importednames,oimpdlls) + 14 + 18; // CacheSync
dllnames += sizeof(kernel32dll);
importednames += sizeof(llgpa);
@ -1806,12 +1810,15 @@ void PackArmPe::pack(OutputFile *fo)
const unsigned upxsection = s1addr + ic + clen;
// FIXME
const unsigned assumed_soxrelocs = isdll ? 0x18 : 0;
const unsigned assumed_soxrelocs = isdll ? 0x20 : 0;
const unsigned myimport = ncsection + assumed_soxrelocs + soresources - rvamin;
const int src0_offset = find(loader, lsize, "SRC0", 4);
// patch loader
patch_le32(loader, codesize, "CSYN", ih.imagebase + rvamin + myimport + get_le32(oimpdlls + 16) + 8);
patch_le32(loader, codesize, "FIBE", ih.imagebase + ih.codebase + (ft.id ? ih.codesize : 0));
patch_le32(loader, codesize, "FIBS", ih.imagebase + ih.codebase);
patch_le32(loader, codesize, "BREL", crelocs + rvamin + ih.imagebase);
patch_le32(loader, codesize, "ENTR", ih.entry + ih.imagebase);
patch_le32(loader, codesize, "LOAD", ih.imagebase + rvamin + myimport + get_le32(oimpdlls + 16));
@ -1882,6 +1889,9 @@ void PackArmPe::pack(OutputFile *fo)
rel.add(upxsection + src0_offset + 28, 3);
rel.add(upxsection + src0_offset + 32, 3);
rel.add(upxsection + src0_offset + 36, 3);
rel.add(upxsection + src0_offset + 40, 3);
rel.add(upxsection + src0_offset + 44, 3);
rel.add(upxsection + src0_offset + 48, 3);
// new PE header
memcpy(&oh,&ih,sizeof(oh));

View File

@ -1,4 +1,4 @@
/* l_armpe.h -- created from l_armpe.bin, 3592 (0xe08) bytes
/* l_armpe.h -- created from l_armpe.bin, 4112 (0x1010) bytes
This file is part of the UPX executable compressor.
@ -27,234 +27,266 @@
*/
#define NRV_LOADER_SIZE 3592
#define NRV_LOADER_ADLER32 0x7cf0b17d
#define NRV_LOADER_CRC32 0x03faeff7
#define NRV_LOADER_SIZE 4112
#define NRV_LOADER_ADLER32 0x78258e9b
#define NRV_LOADER_CRC32 0xa3de7215
unsigned char nrv_loader[3592] = {
15, 64, 45,233, 52, 0,143,226, 22, 0, 0,235, 15, 64,189,232, /* 0x 0 */
72,240,159,229, 64, 48,159,229, 0,240,147,229, 52, 48,159,229, /* 0x 10 */
0,240,147,229, 3, 32,160,227, 2, 48,208,231, 1, 32, 82,226, /* 0x 20 */
1, 20,131,224,251,255,255, 90, 1, 0,160,225, 14,240,160,225, /* 0x 30 */
83, 82, 67, 48, 83, 82, 67, 76, 68, 83, 84, 48, 68, 83, 84, 76, /* 0x 40 */
66, 73, 77, 80, 79, 78, 65, 77, 71, 69, 84, 80, 76, 79, 65, 68, /* 0x 50 */
69, 78, 84, 82, 66, 82, 69, 76,240, 65, 45,233, 0,224,160,227, /* 0x 60 */
8,112,144,229,132,208, 77,226, 0,192,160,225, 3, 0,144,232, /* 0x 70 */
0,224,141,229, 7, 32,160,225, 13, 48,160,225, 16, 64,140,226, /* 0x 80 */
16, 1,148,232, 52, 0, 0,235, 4, 0,160,225,224,255,255,235, /* 0x 90 */
0, 80, 80,226, 46, 0, 0, 10, 4, 0,132,226,220,255,255,235, /* 0x a0 */
8, 80,133,224, 0, 48,213,229, 4, 16,141,226, 0, 0, 83,227, /* 0x b0 */
7, 96,128,224, 1, 32,160,225, 3, 0, 0, 10,178, 48,194,224, /* 0x c0 */
1, 48,245,229, 0, 0, 83,227,250,255,255,234, 0, 48,160,227, /* 0x d0 */
176, 48,194,225, 1, 0,160,225,201,255,255,235, 8, 48,244,229, /* 0x e0 */
0, 80,160,225, 0, 0, 83,227, 23, 0, 0, 10,255, 48, 3,226, /* 0x f0 */
1, 0, 83,227, 1, 64,132,226, 2, 0, 0, 10,255, 0, 83,227, /* 0x 100 */
8, 0, 0, 10, 14, 0, 0,234, 5, 0,160,225, 4, 16,160,225, /* 0x 110 */
189,255,255,235, 4, 0,134,228, 1, 48,212,228, 0, 0, 83,227, /* 0x 120 */
252,255,255, 26, 6, 0, 0,234, 0, 48,212,229, 1, 16,212,229, /* 0x 130 */
5, 0,160,225, 1, 20,131,224,179,255,255,235, 2, 64,132,226, /* 0x 140 */
4, 0,134,228, 0, 48,212,229,229,255,255,234, 1, 64,132,226, /* 0x 150 */
204,255,255,234,132,208,141,226,240,129,189,232,252, 64, 45,233, /* 0x 160 */
0,112,129,224, 0, 80,224,227, 2, 65,160,227, 10, 0, 0,234, /* 0x 170 */
24, 0,189,232, 7, 0, 64,224, 3, 32, 66,224, 0, 32,132,229, /* 0x 180 */
240,128,189,232, 1, 64,208,228, 4, 64,164,224, 4, 76,176,225, /* 0x 190 */
14,240,160,225, 1, 48,208,228, 1, 48,194,228, 4, 64,148,224, /* 0x 1a0 */
247,255,255, 11,250,255,255, 42, 1, 16,160,227, 3, 0, 0,234, /* 0x 1b0 */
1, 16, 65,226, 4, 64,148,224,241,255,255, 11, 1, 16,161,224, /* 0x 1c0 */
4, 64,148,224,238,255,255, 11, 1, 16,161,224, 4, 64,148,224, /* 0x 1d0 */
235,255,255, 11,245,255,255, 58, 3, 48, 81,226, 0, 16,160,227, /* 0x 1e0 */
6, 0, 0, 58, 1, 80,208,228, 3, 84,133,225, 5, 80,240,225, /* 0x 1f0 */
222,255,255, 10,197, 80,176,225, 15, 0, 0, 42, 2, 0, 0,234, /* 0x 200 */
4, 64,148,224,222,255,255, 11, 11, 0, 0, 42, 1, 16,160,227, /* 0x 210 */
4, 64,148,224,218,255,255, 11, 7, 0, 0, 42, 4, 64,148,224, /* 0x 220 */
215,255,255, 11, 1, 16,161,224, 4, 64,148,224,212,255,255, 11, /* 0x 230 */
249,255,255, 58, 4, 16,129,226, 3, 0, 0,234, 4, 64,148,224, /* 0x 240 */
207,255,255, 11, 1, 16,161,224, 2, 16,129,226, 5, 12,117,227, /* 0x 250 */
0, 0, 0, 42, 1, 16,129,226, 0, 48,210,229, 5, 48,210,231, /* 0x 260 */
1, 48,194,228, 1, 16, 81,226,251,255,255, 26,202,255,255,234, /* 0x 270 */
1, 0, 81,227, 3, 0, 0, 26, 15, 64, 45,233,148, 0,143,226, /* 0x 280 */
46, 0, 0,235, 15, 64,189,232,168,240,159,229,160, 48,159,229, /* 0x 290 */
0,240,147,229,148, 48,159,229, 0,240,147,229, 3, 32,160,227, /* 0x 2a0 */
2, 48,208,231, 1, 32, 82,226, 1, 20,131,224,251,255,255, 90, /* 0x 2b0 */
1, 0,160,225, 14,240,160,225,124, 0,159,229, 92, 32,159,229, /* 0x 2c0 */
4, 16, 66,226, 1, 48,208,228, 0, 0, 83,227,248,255,255, 10, /* 0x 2d0 */
240, 0, 83,227,240,192,195, 35, 1, 48,208, 37, 12,196,131, 32, /* 0x 2e0 */
2, 48,208, 36, 12, 52,131, 32, 3, 16,129,224, 0, 48,209,229, /* 0x 2f0 */
12,196,131,224, 1, 48,209,229, 12,196,131,224, 2, 48,209,229, /* 0x 300 */
12,196,131,224, 3, 48,209,229, 12,196,131,224, 2,192,140,224, /* 0x 310 */
0,192,129,229,234,255,255,234, 83, 82, 67, 48, 83, 82, 67, 76, /* 0x 320 */
68, 83, 84, 48, 68, 83, 84, 76, 66, 73, 77, 80, 79, 78, 65, 77, /* 0x 330 */
71, 69, 84, 80, 76, 79, 65, 68, 69, 78, 84, 82, 66, 82, 69, 76, /* 0x 340 */
240, 65, 45,233, 0,224,160,227, 8,112,144,229,132,208, 77,226, /* 0x 350 */
0,192,160,225, 3, 0,144,232, 0,224,141,229, 7, 32,160,225, /* 0x 360 */
13, 48,160,225, 16, 64,140,226, 16, 1,148,232, 53, 0, 0,235, /* 0x 370 */
4, 0,160,225,200,255,255,235, 0, 80, 80,226, 46, 0, 0, 10, /* 0x 380 */
4, 0,132,226,196,255,255,235, 8, 80,133,224, 0, 48,213,229, /* 0x 390 */
4, 16,141,226, 0, 0, 83,227, 7, 96,128,224, 1, 32,160,225, /* 0x 3a0 */
3, 0, 0, 10,178, 48,194,224, 1, 48,245,229, 0, 0, 83,227, /* 0x 3b0 */
250,255,255,234, 0, 48,160,227,176, 48,194,225, 1, 0,160,225, /* 0x 3c0 */
177,255,255,235, 8, 48,244,229, 0, 80,160,225, 0, 0, 83,227, /* 0x 3d0 */
23, 0, 0, 10,255, 48, 3,226, 1, 0, 83,227, 1, 64,132,226, /* 0x 3e0 */
2, 0, 0, 10,255, 0, 83,227, 8, 0, 0, 10, 14, 0, 0,234, /* 0x 3f0 */
5, 0,160,225, 4, 16,160,225,165,255,255,235, 4, 0,134,228, /* 0x 400 */
1, 48,212,228, 0, 0, 83,227,252,255,255, 26, 6, 0, 0,234, /* 0x 410 */
0, 48,212,229, 1, 16,212,229, 5, 0,160,225, 1, 20,131,224, /* 0x 420 */
155,255,255,235, 2, 64,132,226, 4, 0,134,228, 0, 48,212,229, /* 0x 430 */
229,255,255,234, 1, 64,132,226,204,255,255,234,157,255,255,235, /* 0x 440 */
132,208,141,226,240,129,189,232,252, 64, 45,233, 0,112,129,224, /* 0x 450 */
0, 80,224,227, 2, 65,160,227, 10, 0, 0,234, 24, 0,189,232, /* 0x 460 */
7, 0, 64,224, 3, 32, 66,224, 0, 32,132,229,240,128,189,232, /* 0x 470 */
1, 64,208,228, 4, 64,164,224, 4, 76,176,225, 14,240,160,225, /* 0x 480 */
1, 48,208,228, 1, 48,194,228, 4, 64,148,224,247,255,255, 11, /* 0x 490 */
250,255,255, 42, 1, 16,160,227, 3, 0, 0,234, 1, 16, 65,226, /* 0x 4a0 */
4, 64,148,224,241,255,255, 11, 1, 16,161,224, 4, 64,148,224, /* 0x 4b0 */
238,255,255, 11, 1, 16,161,224, 4, 64,148,224,235,255,255, 11, /* 0x 4c0 */
245,255,255, 58, 3, 48, 81,226, 0, 16,160,227, 6, 0, 0, 58, /* 0x 4d0 */
1, 80,208,228, 3, 84,133,225, 5, 80,240,225,222,255,255, 10, /* 0x 4e0 */
197, 80,176,225, 15, 0, 0, 42, 2, 0, 0,234, 4, 64,148,224, /* 0x 4f0 */
222,255,255, 11, 11, 0, 0, 42, 1, 16,160,227, 4, 64,148,224, /* 0x 500 */
218,255,255, 11, 7, 0, 0, 42, 4, 64,148,224,215,255,255, 11, /* 0x 510 */
1, 16,161,224, 4, 64,148,224,212,255,255, 11,249,255,255, 58, /* 0x 520 */
4, 16,129,226, 3, 0, 0,234, 4, 64,148,224,207,255,255, 11, /* 0x 530 */
1, 16,161,224, 2, 16,129,226, 5, 12,117,227, 0, 0, 0, 42, /* 0x 540 */
1, 16,129,226, 0, 48,210,229, 5, 48,210,231, 1, 48,194,228, /* 0x 550 */
1, 16, 81,226,251,255,255, 26,202,255,255,234, 15, 64, 45,233, /* 0x 560 */
72, 0,143,226, 14, 0,144,232, 2, 16,129,224, 0, 32,147,229, /* 0x 570 */
1, 58,131,226, 1, 0, 83,225,251,255,255,154, 4,224,143,226, /* 0x 580 */
23,192,143,226, 28,255, 47,225, 15, 64,189,232, 60,192,159,229, /* 0x 590 */
28,255, 47,225, 12, 75, 27,104, 24, 71, 12, 75,251,231, 27,224, /* 0x 5a0 */
3, 33, 67, 92, 18, 2,210, 24, 1, 57,250,213, 16, 28,112, 71, /* 0x 5b0 */
83, 82, 67, 48, 83, 82, 67, 76, 68, 83, 84, 48, 68, 83, 84, 76, /* 0x 5c0 */
66, 73, 77, 80, 79, 78, 65, 77, 71, 69, 84, 80, 76, 79, 65, 68, /* 0x 5d0 */
69, 78, 84, 82, 66, 82, 69, 76,240,181,163,176, 0, 34, 2,146, /* 0x 5e0 */
130,104, 1,146, 66,105, 3, 28, 4,105, 0,146, 89,104, 0,104, /* 0x 5f0 */
1,154, 2,171, 0,240, 76,248, 37, 28, 40, 28,255,247,208,255, /* 0x 600 */
4, 30, 61,208, 0,155, 40, 29,228, 24,255,247,201,255, 1,154, /* 0x 610 */
134, 24, 3,168, 2, 28, 35,120, 27, 6, 0, 43, 4,208, 27, 14, /* 0x 620 */
19,128, 1, 52, 2, 50,246,231, 0, 35, 19,128,255,247,181,255, /* 0x 630 */
8, 53, 7, 28, 43,120, 27, 6, 0, 43, 31,208, 27, 14, 1, 53, /* 0x 640 */
1, 43, 2,208,255, 43, 13,208,244,231, 56, 28, 41, 28,255,247, /* 0x 650 */
161,255, 52, 28, 32, 96, 4, 54, 43,120, 27, 6, 1, 53, 0, 43, /* 0x 660 */
250,209,231,231,105,120, 43,120, 9, 2, 56, 28, 89, 24,255,247, /* 0x 670 */
145,255, 52, 28, 2, 53, 4, 54, 32, 96,219,231, 1, 53,188,231, /* 0x 680 */
35,176,240,188, 1,188, 0, 71, 1,192,143,226, 28,255, 47,225, /* 0x 690 */
252,181, 15, 24, 1, 36,101, 66,228, 7, 5, 38, 54, 2, 15,224, /* 0x 6a0 */
24,188,192, 27,210, 26, 34, 96,240,188, 2,188, 8, 71, 4,120, /* 0x 6b0 */
100, 65, 1, 48, 36, 6,247, 70, 3,120, 1, 48, 19,112, 1, 50, /* 0x 6c0 */
36, 25,254, 70,243,208,247,210, 1, 33, 4,224, 1, 57, 36, 25, /* 0x 6d0 */
254, 70,236,208, 73, 65, 36, 25,254, 70,232,208, 73, 65, 36, 25, /* 0x 6e0 */
254, 70,228,208,242,211,203, 30, 0, 33, 8,211, 27, 2, 5,120, /* 0x 6f0 */
1, 48, 29, 67,237, 67,211,208,109, 16, 19,210, 3,224, 36, 25, /* 0x 700 */
254, 70,212,208, 14,210, 1, 33, 36, 25,254, 70,207,208, 9,210, /* 0x 710 */
36, 25,254, 70,203,208, 73, 65, 36, 25,254, 70,199,208,247,211, /* 0x 720 */
4, 49, 4,224, 36, 25,254, 70,193,208, 73, 65, 2, 49,238, 66, /* 0x 730 */
0,210, 1, 49, 19,120, 83, 93, 19,112, 1, 50, 1, 57,250,209, /* 0x 740 */
190,231, 0, 0, 1, 0, 81,227, 11, 0, 0, 26, 15, 64, 45,233, /* 0x 750 */
136, 0,143,226, 14, 0,144,232, 2, 16,129,224, 0, 32,147,229, /* 0x 760 */
1, 58,131,226, 1, 0, 83,225,251,255,255,154, 4,224,143,226, /* 0x 770 */
23,192,143,226, 28,255, 47,225, 15, 64,189,232,124,192,159,229, /* 0x 780 */
28,255, 47,225, 28, 75, 27,104, 24, 71, 28, 75,251,231, 59,224, /* 0x 790 */
3, 33, 67, 92, 18, 2,210, 24, 1, 57,250,213, 16, 28,112, 71, /* 0x 7a0 */
48,180, 24, 72, 16, 74, 17, 31, 3,120, 1, 48, 0, 43, 21,208, /* 0x 7b0 */
240, 43, 8,211, 15, 36, 28, 64, 67,120, 36, 2,228, 24, 3,120, /* 0x 7c0 */
2, 48, 36, 2, 27, 25,201, 24, 0, 37, 75, 93, 36, 2,228, 24, /* 0x 7d0 */
1, 53, 4, 45,249,209,164, 24, 12, 96,229,231, 48,188,112, 71, /* 0x 7e0 */
83, 82, 67, 48, 83, 82, 67, 76, 68, 83, 84, 48, 68, 83, 84, 76, /* 0x 7f0 */
66, 73, 77, 80, 79, 78, 65, 77, 71, 69, 84, 80, 76, 79, 65, 68, /* 0x 800 */
69, 78, 84, 82, 66, 82, 69, 76,240,181,163,176, 0, 34, 2,146, /* 0x 810 */
130,104, 1,146, 66,105, 3, 28, 4,105, 0,146, 89,104, 0,104, /* 0x 820 */
1,154, 2,171, 0,240, 78,248, 37, 28, 40, 28,255,247,176,255, /* 0x 830 */
4, 30, 61,208, 0,155, 40, 29,228, 24,255,247,169,255, 1,154, /* 0x 840 */
134, 24, 3,168, 2, 28, 35,120, 27, 6, 0, 43, 4,208, 27, 14, /* 0x 850 */
19,128, 1, 52, 2, 50,246,231, 0, 35, 19,128,255,247,149,255, /* 0x 860 */
8, 53, 7, 28, 43,120, 27, 6, 0, 43, 31,208, 27, 14, 1, 53, /* 0x 870 */
1, 43, 2,208,255, 43, 13,208,244,231, 56, 28, 41, 28,255,247, /* 0x 880 */
129,255, 52, 28, 32, 96, 4, 54, 43,120, 27, 6, 1, 53, 0, 43, /* 0x 890 */
250,209,231,231,105,120, 43,120, 9, 2, 56, 28, 89, 24,255,247, /* 0x 8a0 */
113,255, 52, 28, 2, 53, 4, 54, 32, 96,219,231, 1, 53,188,231, /* 0x 8b0 */
255,247,118,255, 35,176,240,188, 1,188, 0, 71, 1,192,143,226, /* 0x 8c0 */
28,255, 47,225,252,181, 15, 24, 1, 36,101, 66,228, 7, 5, 38, /* 0x 8d0 */
54, 2, 15,224, 24,188,192, 27,210, 26, 34, 96,240,188, 2,188, /* 0x 8e0 */
8, 71, 4,120,100, 65, 1, 48, 36, 6,247, 70, 3,120, 1, 48, /* 0x 8f0 */
19,112, 1, 50, 36, 25,254, 70,243,208,247,210, 1, 33, 4,224, /* 0x 900 */
1, 57, 36, 25,254, 70,236,208, 73, 65, 36, 25,254, 70,232,208, /* 0x 910 */
73, 65, 36, 25,254, 70,228,208,242,211,203, 30, 0, 33, 8,211, /* 0x 920 */
27, 2, 5,120, 1, 48, 29, 67,237, 67,211,208,109, 16, 19,210, /* 0x 930 */
3,224, 36, 25,254, 70,212,208, 14,210, 1, 33, 36, 25,254, 70, /* 0x 940 */
207,208, 9,210, 36, 25,254, 70,203,208, 73, 65, 36, 25,254, 70, /* 0x 950 */
199,208,247,211, 4, 49, 4,224, 36, 25,254, 70,193,208, 73, 65, /* 0x 960 */
2, 49,238, 66, 0,210, 1, 49, 19,120, 83, 93, 19,112, 1, 50, /* 0x 970 */
1, 57,250,209,190,231, 0, 0, 15, 64, 45,233, 72, 0,143,226, /* 0x 980 */
14, 0,144,232, 2, 16,129,224, 0, 32,147,229, 1, 58,131,226, /* 0x 990 */
1, 0, 83,225,251,255,255,154, 4,224,143,226, 23,192,143,226, /* 0x 9a0 */
28,255, 47,225, 15, 64,189,232, 60,192,159,229, 28,255, 47,225, /* 0x 9b0 */
12, 75, 27,104, 24, 71, 12, 75,251,231, 27,224, 3, 33, 67, 92, /* 0x 9c0 */
18, 2,210, 24, 1, 57,250,213, 16, 28,112, 71, 83, 82, 67, 48, /* 0x 9d0 */
83, 82, 67, 76, 68, 83, 84, 48, 68, 83, 84, 76, 66, 73, 77, 80, /* 0x 9e0 */
79, 78, 65, 77, 71, 69, 84, 80, 76, 79, 65, 68, 69, 78, 84, 82, /* 0x 9f0 */
66, 82, 69, 76,240,181,163,176, 0, 34, 2,146,130,104, 1,146, /* 0x a00 */
66,105, 3, 28, 4,105, 0,146, 89,104, 0,104, 1,154, 2,171, /* 0x a10 */
0,240, 76,248, 37, 28, 40, 28,255,247,208,255, 4, 30, 61,208, /* 0x a20 */
0,155, 40, 29,228, 24,255,247,201,255, 1,154,134, 24, 3,168, /* 0x a30 */
2, 28, 35,120, 27, 6, 0, 43, 4,208, 27, 14, 19,128, 1, 52, /* 0x a40 */
2, 50,246,231, 0, 35, 19,128,255,247,181,255, 8, 53, 7, 28, /* 0x a50 */
43,120, 27, 6, 0, 43, 31,208, 27, 14, 1, 53, 1, 43, 2,208, /* 0x a60 */
255, 43, 13,208,244,231, 56, 28, 41, 28,255,247,161,255, 52, 28, /* 0x a70 */
32, 96, 4, 54, 43,120, 27, 6, 1, 53, 0, 43,250,209,231,231, /* 0x a80 */
105,120, 43,120, 9, 2, 56, 28, 89, 24,255,247,145,255, 52, 28, /* 0x a90 */
2, 53, 4, 54, 32, 96,219,231, 1, 53,188,231, 35,176,240,188, /* 0x aa0 */
1,188, 0, 71, 1,192,143,226, 28,255, 47,225, 9, 24,254,181, /* 0x ab0 */
1, 36,101, 66,228, 7, 13, 39, 63, 2, 15,224, 26,188, 64, 26, /* 0x ac0 */
210, 26, 34, 96,240,188, 2,188, 8, 71, 4,120,100, 65, 1, 48, /* 0x ad0 */
36, 6,247, 70, 3,120, 1, 48, 19,112, 1, 50, 36, 25,254, 70, /* 0x ae0 */
243,208,247,210, 1, 33, 36, 25,254, 70,238,208, 73, 65, 36, 25, /* 0x af0 */
254, 70,234,208,247,211,203, 30, 0, 33, 5,211, 27, 2, 5,120, /* 0x b00 */
1, 48, 29, 67,237, 67,217,208, 36, 25,254, 70,221,208, 73, 65, /* 0x b10 */
36, 25,254, 70,217,208, 73, 65, 9,209, 1, 33, 36, 25,254, 70, /* 0x b20 */
211,208, 73, 65, 36, 25,254, 70,207,208,247,211, 2, 49, 1, 49, /* 0x b30 */
253, 66, 0,210, 1, 49, 19,120, 83, 93, 19,112, 1, 50, 1, 57, /* 0x b40 */
250,209,203,231, 1, 0, 81,227, 11, 0, 0, 26, 15, 64, 45,233, /* 0x b50 */
136, 0,143,226, 14, 0,144,232, 2, 16,129,224, 0, 32,147,229, /* 0x b60 */
1, 58,131,226, 1, 0, 83,225,251,255,255,154, 4,224,143,226, /* 0x b70 */
23,192,143,226, 28,255, 47,225, 15, 64,189,232,124,192,159,229, /* 0x b80 */
28,255, 47,225, 28, 75, 27,104, 24, 71, 28, 75,251,231, 59,224, /* 0x b90 */
3, 33, 67, 92, 18, 2,210, 24, 1, 57,250,213, 16, 28,112, 71, /* 0x ba0 */
48,180, 24, 72, 16, 74, 17, 31, 3,120, 1, 48, 0, 43, 21,208, /* 0x bb0 */
240, 43, 8,211, 15, 36, 28, 64, 67,120, 36, 2,228, 24, 3,120, /* 0x bc0 */
2, 48, 36, 2, 27, 25,201, 24, 0, 37, 75, 93, 36, 2,228, 24, /* 0x bd0 */
1, 53, 4, 45,249,209,164, 24, 12, 96,229,231, 48,188,112, 71, /* 0x be0 */
83, 82, 67, 48, 83, 82, 67, 76, 68, 83, 84, 48, 68, 83, 84, 76, /* 0x bf0 */
66, 73, 77, 80, 79, 78, 65, 77, 71, 69, 84, 80, 76, 79, 65, 68, /* 0x c00 */
69, 78, 84, 82, 66, 82, 69, 76,240,181,163,176, 0, 34, 2,146, /* 0x c10 */
130,104, 1,146, 66,105, 3, 28, 4,105, 0,146, 89,104, 0,104, /* 0x c20 */
1,154, 2,171, 0,240, 78,248, 37, 28, 40, 28,255,247,176,255, /* 0x c30 */
4, 30, 61,208, 0,155, 40, 29,228, 24,255,247,169,255, 1,154, /* 0x c40 */
134, 24, 3,168, 2, 28, 35,120, 27, 6, 0, 43, 4,208, 27, 14, /* 0x c50 */
19,128, 1, 52, 2, 50,246,231, 0, 35, 19,128,255,247,149,255, /* 0x c60 */
8, 53, 7, 28, 43,120, 27, 6, 0, 43, 31,208, 27, 14, 1, 53, /* 0x c70 */
1, 43, 2,208,255, 43, 13,208,244,231, 56, 28, 41, 28,255,247, /* 0x c80 */
129,255, 52, 28, 32, 96, 4, 54, 43,120, 27, 6, 1, 53, 0, 43, /* 0x c90 */
250,209,231,231,105,120, 43,120, 9, 2, 56, 28, 89, 24,255,247, /* 0x ca0 */
113,255, 52, 28, 2, 53, 4, 54, 32, 96,219,231, 1, 53,188,231, /* 0x cb0 */
255,247,118,255, 35,176,240,188, 1,188, 0, 71, 1,192,143,226, /* 0x cc0 */
28,255, 47,225, 9, 24,254,181, 1, 36,101, 66,228, 7, 13, 39, /* 0x cd0 */
63, 2, 15,224, 26,188, 64, 26,210, 26, 34, 96,240,188, 2,188, /* 0x ce0 */
8, 71, 4,120,100, 65, 1, 48, 36, 6,247, 70, 3,120, 1, 48, /* 0x cf0 */
19,112, 1, 50, 36, 25,254, 70,243,208,247,210, 1, 33, 36, 25, /* 0x d00 */
254, 70,238,208, 73, 65, 36, 25,254, 70,234,208,247,211,203, 30, /* 0x d10 */
0, 33, 5,211, 27, 2, 5,120, 1, 48, 29, 67,237, 67,217,208, /* 0x d20 */
36, 25,254, 70,221,208, 73, 65, 36, 25,254, 70,217,208, 73, 65, /* 0x d30 */
9,209, 1, 33, 36, 25,254, 70,211,208, 73, 65, 36, 25,254, 70, /* 0x d40 */
207,208,247,211, 2, 49, 1, 49,253, 66, 0,210, 1, 49, 19,120, /* 0x d50 */
83, 93, 19,112, 1, 50, 1, 57,250,209,203,231, 85, 80, 88, 33, /* 0x d60 */
161,216,208,213, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x d70 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 45, 65, 82, 77, 80, /* 0x d80 */
69, 65, 88, 69, 0, 0, 0, 0, 0, 65, 82, 77, 80, 69, 65, 68, /* 0x d90 */
69, 0,128, 2, 0, 0, 65, 82, 77, 80, 69, 84, 88, 69, 0,108, /* 0x da0 */
5, 0, 0, 65, 82, 77, 80, 69, 84, 68, 69, 0, 84, 7, 0, 0, /* 0x db0 */
65, 82, 77, 80, 69, 84, 88, 66, 0,136, 9, 0, 0, 65, 82, 77, /* 0x dc0 */
80, 69, 84, 68, 66, 0, 84, 11, 0, 0, 65, 82, 77, 80, 69, 72, /* 0x dd0 */
69, 65, 68, 0,108, 13, 0, 0, 85, 80, 88, 49, 72, 69, 65, 68, /* 0x de0 */
0,108, 13, 0, 0, 65, 82, 77, 80, 69, 69, 79, 70, 0,140, 13, /* 0x df0 */
0, 0,255,255,255,255,140, 13 /* 0x e00 */
unsigned char nrv_loader[4112] = {
15, 64, 45,233,132, 0,143,226, 45, 0, 0,235, 15, 64,189,232, /* 0x 0 */
152,240,159,229,144, 48,159,229, 0,240,147,229,132, 48,159,229, /* 0x 10 */
0,240,147,229,148, 48,159,229, 0,240,147,229,132, 0,159,229, /* 0x 20 */
0, 32,160,227,128,192,159,229, 12, 0, 80,225, 14,240,160, 1, /* 0x 30 */
3, 48,208,229, 15, 48, 3,226, 11, 0, 83,227, 5, 0, 0, 26, /* 0x 40 */
0, 48,144,229,255, 20, 3,226, 2, 48, 67,224,255, 52,195,227, /* 0x 50 */
1, 48,131,225, 0, 48,128,229, 4, 0,128,226, 1, 32,130,226, /* 0x 60 */
240,255,255,234, 3, 32,160,227, 2, 48,208,231, 1, 32, 82,226, /* 0x 70 */
1, 20,131,224,251,255,255, 90, 1, 0,160,225, 14,240,160,225, /* 0x 80 */
83, 82, 67, 48, 83, 82, 67, 76, 68, 83, 84, 48, 68, 83, 84, 76, /* 0x 90 */
66, 73, 77, 80, 79, 78, 65, 77, 71, 69, 84, 80, 76, 79, 65, 68, /* 0x a0 */
69, 78, 84, 82, 66, 82, 69, 76, 70, 73, 66, 83, 70, 73, 66, 69, /* 0x b0 */
67, 83, 89, 78,240, 65, 45,233, 0,224,160,227,132,208, 77,226, /* 0x c0 */
8,112,144,229, 0,192,160,225, 3, 0,144,232, 0,224,141,229, /* 0x d0 */
7, 32,160,225, 13, 48,160,225, 16, 64,140,226, 16, 1,148,232, /* 0x e0 */
55, 0, 0,235,204,255,255,235, 4, 0,160,225,220,255,255,235, /* 0x f0 */
0, 80, 80,226, 46, 0, 0, 10, 4, 0,132,226,216,255,255,235, /* 0x 100 */
8, 80,133,224, 0, 48,213,229, 4, 16,141,226, 0, 0, 83,227, /* 0x 110 */
7, 96,128,224, 1, 32,160,225, 3, 0, 0, 10,178, 48,194,224, /* 0x 120 */
1, 48,245,229, 0, 0, 83,227,250,255,255,234, 0, 48,160,227, /* 0x 130 */
176, 48,194,225, 1, 0,160,225,177,255,255,235, 8, 48,244,229, /* 0x 140 */
0, 80,160,225, 0, 0, 83,227, 23, 0, 0, 10,255, 48, 3,226, /* 0x 150 */
1, 0, 83,227, 1, 64,132,226, 2, 0, 0, 10,255, 0, 83,227, /* 0x 160 */
8, 0, 0, 10, 14, 0, 0,234, 5, 0,160,225, 4, 16,160,225, /* 0x 170 */
165,255,255,235, 4, 0,134,228, 1, 48,212,228, 0, 0, 83,227, /* 0x 180 */
252,255,255, 26, 6, 0, 0,234, 0, 48,212,229, 1, 16,212,229, /* 0x 190 */
5, 0,160,225, 1, 20,131,224,155,255,255,235, 2, 64,132,226, /* 0x 1a0 */
4, 0,134,228, 0, 48,212,229,229,255,255,234, 1, 64,132,226, /* 0x 1b0 */
204,255,255,234, 4, 0,160,227,149,255,255,235,132,208,141,226, /* 0x 1c0 */
240,129,189,232,252, 64, 45,233, 0,112,129,224, 0, 80,224,227, /* 0x 1d0 */
2, 65,160,227, 10, 0, 0,234, 24, 0,189,232, 7, 0, 64,224, /* 0x 1e0 */
3, 32, 66,224, 0, 32,132,229,240,128,189,232, 1, 64,208,228, /* 0x 1f0 */
4, 64,164,224, 4, 76,176,225, 14,240,160,225, 1, 48,208,228, /* 0x 200 */
1, 48,194,228, 4, 64,148,224,247,255,255, 11,250,255,255, 42, /* 0x 210 */
1, 16,160,227, 3, 0, 0,234, 1, 16, 65,226, 4, 64,148,224, /* 0x 220 */
241,255,255, 11, 1, 16,161,224, 4, 64,148,224,238,255,255, 11, /* 0x 230 */
1, 16,161,224, 4, 64,148,224,235,255,255, 11,245,255,255, 58, /* 0x 240 */
3, 48, 81,226, 0, 16,160,227, 6, 0, 0, 58, 1, 80,208,228, /* 0x 250 */
3, 84,133,225, 5, 80,240,225,222,255,255, 10,197, 80,176,225, /* 0x 260 */
15, 0, 0, 42, 2, 0, 0,234, 4, 64,148,224,222,255,255, 11, /* 0x 270 */
11, 0, 0, 42, 1, 16,160,227, 4, 64,148,224,218,255,255, 11, /* 0x 280 */
7, 0, 0, 42, 4, 64,148,224,215,255,255, 11, 1, 16,161,224, /* 0x 290 */
4, 64,148,224,212,255,255, 11,249,255,255, 58, 4, 16,129,226, /* 0x 2a0 */
3, 0, 0,234, 4, 64,148,224,207,255,255, 11, 1, 16,161,224, /* 0x 2b0 */
2, 16,129,226, 5, 12,117,227, 0, 0, 0, 42, 1, 16,129,226, /* 0x 2c0 */
0, 48,210,229, 5, 48,210,231, 1, 48,194,228, 1, 16, 81,226, /* 0x 2d0 */
251,255,255, 26,202,255,255,234, 1, 0, 81,227, 3, 0, 0, 26, /* 0x 2e0 */
15, 64, 45,233,228, 0,143,226, 69, 0, 0,235, 15, 64,189,232, /* 0x 2f0 */
248,240,159,229,240, 48,159,229, 0,240,147,229,228, 48,159,229, /* 0x 300 */
0,240,147,229,244, 48,159,229, 0,240,147,229,228, 0,159,229, /* 0x 310 */
0, 32,160,227,224,192,159,229, 12, 0, 80,225, 14,240,160, 1, /* 0x 320 */
3, 48,208,229, 15, 48, 3,226, 11, 0, 83,227, 5, 0, 0, 26, /* 0x 330 */
0, 48,144,229,255, 20, 3,226, 2, 48, 67,224,255, 52,195,227, /* 0x 340 */
1, 48,131,225, 0, 48,128,229, 4, 0,128,226, 1, 32,130,226, /* 0x 350 */
240,255,255,234, 3, 32,160,227, 2, 48,208,231, 1, 32, 82,226, /* 0x 360 */
1, 20,131,224,251,255,255, 90, 1, 0,160,225, 14,240,160,225, /* 0x 370 */
124, 0,159,229, 92, 32,159,229, 4, 16, 66,226, 1, 48,208,228, /* 0x 380 */
0, 0, 83,227, 14,240,160, 1,240, 0, 83,227,240,192,195, 35, /* 0x 390 */
1, 48,208, 37, 12,196,131, 32, 2, 48,208, 36, 12, 52,131, 32, /* 0x 3a0 */
3, 16,129,224, 0, 48,209,229, 12,196,131,224, 1, 48,209,229, /* 0x 3b0 */
12,196,131,224, 2, 48,209,229, 12,196,131,224, 3, 48,209,229, /* 0x 3c0 */
12,196,131,224, 2,192,140,224, 0,192,129,229,234,255,255,234, /* 0x 3d0 */
83, 82, 67, 48, 83, 82, 67, 76, 68, 83, 84, 48, 68, 83, 84, 76, /* 0x 3e0 */
66, 73, 77, 80, 79, 78, 65, 77, 71, 69, 84, 80, 76, 79, 65, 68, /* 0x 3f0 */
69, 78, 84, 82, 66, 82, 69, 76, 70, 73, 66, 83, 70, 73, 66, 69, /* 0x 400 */
67, 83, 89, 78,240, 65, 45,233, 0,224,160,227,132,208, 77,226, /* 0x 410 */
8,112,144,229, 0,192,160,225, 3, 0,144,232, 0,224,141,229, /* 0x 420 */
7, 32,160,225, 13, 48,160,225, 16, 64,140,226, 16, 1,148,232, /* 0x 430 */
56, 0, 0,235,180,255,255,235, 4, 0,160,225,196,255,255,235, /* 0x 440 */
0, 80, 80,226, 46, 0, 0, 10, 4, 0,132,226,192,255,255,235, /* 0x 450 */
8, 80,133,224, 0, 48,213,229, 4, 16,141,226, 0, 0, 83,227, /* 0x 460 */
7, 96,128,224, 1, 32,160,225, 3, 0, 0, 10,178, 48,194,224, /* 0x 470 */
1, 48,245,229, 0, 0, 83,227,250,255,255,234, 0, 48,160,227, /* 0x 480 */
176, 48,194,225, 1, 0,160,225,153,255,255,235, 8, 48,244,229, /* 0x 490 */
0, 80,160,225, 0, 0, 83,227, 23, 0, 0, 10,255, 48, 3,226, /* 0x 4a0 */
1, 0, 83,227, 1, 64,132,226, 2, 0, 0, 10,255, 0, 83,227, /* 0x 4b0 */
8, 0, 0, 10, 14, 0, 0,234, 5, 0,160,225, 4, 16,160,225, /* 0x 4c0 */
141,255,255,235, 4, 0,134,228, 1, 48,212,228, 0, 0, 83,227, /* 0x 4d0 */
252,255,255, 26, 6, 0, 0,234, 0, 48,212,229, 1, 16,212,229, /* 0x 4e0 */
5, 0,160,225, 1, 20,131,224,131,255,255,235, 2, 64,132,226, /* 0x 4f0 */
4, 0,134,228, 0, 48,212,229,229,255,255,234, 1, 64,132,226, /* 0x 500 */
204,255,255,234,153,255,255,235, 4, 0,160,227,124,255,255,235, /* 0x 510 */
132,208,141,226,240,129,189,232,252, 64, 45,233, 0,112,129,224, /* 0x 520 */
0, 80,224,227, 2, 65,160,227, 10, 0, 0,234, 24, 0,189,232, /* 0x 530 */
7, 0, 64,224, 3, 32, 66,224, 0, 32,132,229,240,128,189,232, /* 0x 540 */
1, 64,208,228, 4, 64,164,224, 4, 76,176,225, 14,240,160,225, /* 0x 550 */
1, 48,208,228, 1, 48,194,228, 4, 64,148,224,247,255,255, 11, /* 0x 560 */
250,255,255, 42, 1, 16,160,227, 3, 0, 0,234, 1, 16, 65,226, /* 0x 570 */
4, 64,148,224,241,255,255, 11, 1, 16,161,224, 4, 64,148,224, /* 0x 580 */
238,255,255, 11, 1, 16,161,224, 4, 64,148,224,235,255,255, 11, /* 0x 590 */
245,255,255, 58, 3, 48, 81,226, 0, 16,160,227, 6, 0, 0, 58, /* 0x 5a0 */
1, 80,208,228, 3, 84,133,225, 5, 80,240,225,222,255,255, 10, /* 0x 5b0 */
197, 80,176,225, 15, 0, 0, 42, 2, 0, 0,234, 4, 64,148,224, /* 0x 5c0 */
222,255,255, 11, 11, 0, 0, 42, 1, 16,160,227, 4, 64,148,224, /* 0x 5d0 */
218,255,255, 11, 7, 0, 0, 42, 4, 64,148,224,215,255,255, 11, /* 0x 5e0 */
1, 16,161,224, 4, 64,148,224,212,255,255, 11,249,255,255, 58, /* 0x 5f0 */
4, 16,129,226, 3, 0, 0,234, 4, 64,148,224,207,255,255, 11, /* 0x 600 */
1, 16,161,224, 2, 16,129,226, 5, 12,117,227, 0, 0, 0, 42, /* 0x 610 */
1, 16,129,226, 0, 48,210,229, 5, 48,210,231, 1, 48,194,228, /* 0x 620 */
1, 16, 81,226,251,255,255, 26,202,255,255,234, 15, 64, 45,233, /* 0x 630 */
128, 0,143,226, 14, 0,144,232, 2, 16,129,224, 0, 32,147,229, /* 0x 640 */
1, 58,131,226, 1, 0, 83,225,251,255,255,154, 31,192,143,226, /* 0x 650 */
15,224,160,225, 28,255, 47,225, 15, 64,189,232,116,192,159,229, /* 0x 660 */
28,255, 47,225, 26, 75, 27,104, 24, 71, 26, 75,251,231, 30, 75, /* 0x 670 */
249,231, 59,224,240,181, 26, 72, 0, 34, 26, 76, 15, 37,255, 38, /* 0x 680 */
54, 6,247, 67,160, 66, 13,208,195,120, 43, 64, 11, 43, 6,209, /* 0x 690 */
3,104, 25, 28, 49, 64,155, 26, 59, 64, 11, 67, 3, 96, 4, 48, /* 0x 6a0 */
1, 50,239,231,240,189, 3, 33, 67, 92, 18, 2,210, 24, 1, 57, /* 0x 6b0 */
250,213, 16, 28,112, 71, 0, 0, 83, 82, 67, 48, 83, 82, 67, 76, /* 0x 6c0 */
68, 83, 84, 48, 68, 83, 84, 76, 66, 73, 77, 80, 79, 78, 65, 77, /* 0x 6d0 */
71, 69, 84, 80, 76, 79, 65, 68, 69, 78, 84, 82, 66, 82, 69, 76, /* 0x 6e0 */
70, 73, 66, 83, 70, 73, 66, 69, 67, 83, 89, 78,240,181,163,176, /* 0x 6f0 */
0, 34, 2,146,130,104, 1,146, 66,105, 3, 28, 4,105, 89,104, /* 0x 700 */
0,146, 2,171, 1,154, 0,104, 0,240, 82,248,255,247,178,255, /* 0x 710 */
37, 28, 40, 28,255,247,199,255, 4, 30, 61,208, 0,155, 40, 29, /* 0x 720 */
228, 24,255,247,192,255, 1,154,134, 24, 3,168, 2, 28, 35,120, /* 0x 730 */
27, 6, 0, 43, 4,208, 27, 14, 19,128, 1, 52, 2, 50,246,231, /* 0x 740 */
0, 35, 19,128,255,247,145,255, 8, 53, 7, 28, 43,120, 27, 6, /* 0x 750 */
0, 43, 31,208, 27, 14, 1, 53, 1, 43, 2,208,255, 43, 13,208, /* 0x 760 */
244,231, 56, 28, 41, 28,255,247,125,255, 52, 28, 32, 96, 4, 54, /* 0x 770 */
43,120, 27, 6, 1, 53, 0, 43,250,209,231,231,105,120, 43,120, /* 0x 780 */
9, 2, 56, 28, 89, 24,255,247,109,255, 52, 28, 2, 53, 4, 54, /* 0x 790 */
32, 96,219,231, 1, 53,188,231, 4, 32,255,247,104,255, 35,176, /* 0x 7a0 */
240,188, 1,188, 0, 71,192, 70, 1,192,143,226, 28,255, 47,225, /* 0x 7b0 */
252,181, 15, 24, 1, 36,101, 66,228, 7, 5, 38, 54, 2, 15,224, /* 0x 7c0 */
24,188,192, 27,210, 26, 34, 96,240,188, 2,188, 8, 71, 4,120, /* 0x 7d0 */
100, 65, 1, 48, 36, 6,247, 70, 3,120, 1, 48, 19,112, 1, 50, /* 0x 7e0 */
36, 25,254, 70,243,208,247,210, 1, 33, 4,224, 1, 57, 36, 25, /* 0x 7f0 */
254, 70,236,208, 73, 65, 36, 25,254, 70,232,208, 73, 65, 36, 25, /* 0x 800 */
254, 70,228,208,242,211,203, 30, 0, 33, 8,211, 27, 2, 5,120, /* 0x 810 */
1, 48, 29, 67,237, 67,211,208,109, 16, 19,210, 3,224, 36, 25, /* 0x 820 */
254, 70,212,208, 14,210, 1, 33, 36, 25,254, 70,207,208, 9,210, /* 0x 830 */
36, 25,254, 70,203,208, 73, 65, 36, 25,254, 70,199,208,247,211, /* 0x 840 */
4, 49, 4,224, 36, 25,254, 70,193,208, 73, 65, 2, 49,238, 66, /* 0x 850 */
0,210, 1, 49, 19,120, 83, 93, 19,112, 1, 50, 1, 57,250,209, /* 0x 860 */
190,231, 0, 0, 1, 0, 81,227, 11, 0, 0, 26, 15, 64, 45,233, /* 0x 870 */
188, 0,143,226, 14, 0,144,232, 2, 16,129,224, 0, 32,147,229, /* 0x 880 */
1, 58,131,226, 1, 0, 83,225,251,255,255,154, 31,192,143,226, /* 0x 890 */
15,224,160,225, 28,255, 47,225, 15, 64,189,232,176,192,159,229, /* 0x 8a0 */
28,255, 47,225, 41, 75, 27,104, 24, 71, 41, 75,251,231, 45, 75, /* 0x 8b0 */
249,231, 89,224,240,181, 41, 72, 0, 34, 41, 76, 15, 37,255, 38, /* 0x 8c0 */
54, 6,247, 67,160, 66, 13,208,195,120, 43, 64, 11, 43, 6,209, /* 0x 8d0 */
3,104, 25, 28, 49, 64,155, 26, 59, 64, 11, 67, 3, 96, 4, 48, /* 0x 8e0 */
1, 50,239,231,240,189, 3, 33, 67, 92, 18, 2,210, 24, 1, 57, /* 0x 8f0 */
250,213, 16, 28,112, 71, 48,181, 23, 72, 16, 74, 17, 31, 3,120, /* 0x 900 */
1, 48, 0, 43, 21,208,240, 43, 8,211, 15, 36, 28, 64, 67,120, /* 0x 910 */
36, 2,228, 24, 3,120, 2, 48, 36, 2, 27, 25,201, 24, 0, 37, /* 0x 920 */
75, 93, 36, 2,228, 24, 1, 53, 4, 45,249,209,164, 24, 12, 96, /* 0x 930 */
229,231, 48,189, 83, 82, 67, 48, 83, 82, 67, 76, 68, 83, 84, 48, /* 0x 940 */
68, 83, 84, 76, 66, 73, 77, 80, 79, 78, 65, 77, 71, 69, 84, 80, /* 0x 950 */
76, 79, 65, 68, 69, 78, 84, 82, 66, 82, 69, 76, 70, 73, 66, 83, /* 0x 960 */
70, 73, 66, 69, 67, 83, 89, 78,240,181,163,176, 0, 34, 2,146, /* 0x 970 */
130,104, 1,146, 66,105, 3, 28, 4,105, 89,104, 0,146, 2,171, /* 0x 980 */
1,154, 0,104, 0,240, 84,248,255,247,148,255, 37, 28, 40, 28, /* 0x 990 */
255,247,169,255, 4, 30, 61,208, 0,155, 40, 29,228, 24,255,247, /* 0x 9a0 */
162,255, 1,154,134, 24, 3,168, 2, 28, 35,120, 27, 6, 0, 43, /* 0x 9b0 */
4,208, 27, 14, 19,128, 1, 52, 2, 50,246,231, 0, 35, 19,128, /* 0x 9c0 */
255,247,115,255, 8, 53, 7, 28, 43,120, 27, 6, 0, 43, 31,208, /* 0x 9d0 */
27, 14, 1, 53, 1, 43, 2,208,255, 43, 13,208,244,231, 56, 28, /* 0x 9e0 */
41, 28,255,247, 95,255, 52, 28, 32, 96, 4, 54, 43,120, 27, 6, /* 0x 9f0 */
1, 53, 0, 43,250,209,231,231,105,120, 43,120, 9, 2, 56, 28, /* 0x a00 */
89, 24,255,247, 79,255, 52, 28, 2, 53, 4, 54, 32, 96,219,231, /* 0x a10 */
1, 53,188,231,255,247,111,255, 4, 32,255,247, 72,255, 35,176, /* 0x a20 */
240,188, 1,188, 0, 71,192, 70, 1,192,143,226, 28,255, 47,225, /* 0x a30 */
252,181, 15, 24, 1, 36,101, 66,228, 7, 5, 38, 54, 2, 15,224, /* 0x a40 */
24,188,192, 27,210, 26, 34, 96,240,188, 2,188, 8, 71, 4,120, /* 0x a50 */
100, 65, 1, 48, 36, 6,247, 70, 3,120, 1, 48, 19,112, 1, 50, /* 0x a60 */
36, 25,254, 70,243,208,247,210, 1, 33, 4,224, 1, 57, 36, 25, /* 0x a70 */
254, 70,236,208, 73, 65, 36, 25,254, 70,232,208, 73, 65, 36, 25, /* 0x a80 */
254, 70,228,208,242,211,203, 30, 0, 33, 8,211, 27, 2, 5,120, /* 0x a90 */
1, 48, 29, 67,237, 67,211,208,109, 16, 19,210, 3,224, 36, 25, /* 0x aa0 */
254, 70,212,208, 14,210, 1, 33, 36, 25,254, 70,207,208, 9,210, /* 0x ab0 */
36, 25,254, 70,203,208, 73, 65, 36, 25,254, 70,199,208,247,211, /* 0x ac0 */
4, 49, 4,224, 36, 25,254, 70,193,208, 73, 65, 2, 49,238, 66, /* 0x ad0 */
0,210, 1, 49, 19,120, 83, 93, 19,112, 1, 50, 1, 57,250,209, /* 0x ae0 */
190,231, 0, 0, 15, 64, 45,233,128, 0,143,226, 14, 0,144,232, /* 0x af0 */
2, 16,129,224, 0, 32,147,229, 1, 58,131,226, 1, 0, 83,225, /* 0x b00 */
251,255,255,154, 31,192,143,226, 15,224,160,225, 28,255, 47,225, /* 0x b10 */
15, 64,189,232,116,192,159,229, 28,255, 47,225, 26, 75, 27,104, /* 0x b20 */
24, 71, 26, 75,251,231, 30, 75,249,231, 59,224,240,181, 26, 72, /* 0x b30 */
0, 34, 26, 76, 15, 37,255, 38, 54, 6,247, 67,160, 66, 13,208, /* 0x b40 */
195,120, 43, 64, 11, 43, 6,209, 3,104, 25, 28, 49, 64,155, 26, /* 0x b50 */
59, 64, 11, 67, 3, 96, 4, 48, 1, 50,239,231,240,189, 3, 33, /* 0x b60 */
67, 92, 18, 2,210, 24, 1, 57,250,213, 16, 28,112, 71, 0, 0, /* 0x b70 */
83, 82, 67, 48, 83, 82, 67, 76, 68, 83, 84, 48, 68, 83, 84, 76, /* 0x b80 */
66, 73, 77, 80, 79, 78, 65, 77, 71, 69, 84, 80, 76, 79, 65, 68, /* 0x b90 */
69, 78, 84, 82, 66, 82, 69, 76, 70, 73, 66, 83, 70, 73, 66, 69, /* 0x ba0 */
67, 83, 89, 78,240,181,163,176, 0, 34, 2,146,130,104, 1,146, /* 0x bb0 */
66,105, 3, 28, 4,105, 89,104, 0,146, 2,171, 1,154, 0,104, /* 0x bc0 */
0,240, 82,248,255,247,178,255, 37, 28, 40, 28,255,247,199,255, /* 0x bd0 */
4, 30, 61,208, 0,155, 40, 29,228, 24,255,247,192,255, 1,154, /* 0x be0 */
134, 24, 3,168, 2, 28, 35,120, 27, 6, 0, 43, 4,208, 27, 14, /* 0x bf0 */
19,128, 1, 52, 2, 50,246,231, 0, 35, 19,128,255,247,145,255, /* 0x c00 */
8, 53, 7, 28, 43,120, 27, 6, 0, 43, 31,208, 27, 14, 1, 53, /* 0x c10 */
1, 43, 2,208,255, 43, 13,208,244,231, 56, 28, 41, 28,255,247, /* 0x c20 */
125,255, 52, 28, 32, 96, 4, 54, 43,120, 27, 6, 1, 53, 0, 43, /* 0x c30 */
250,209,231,231,105,120, 43,120, 9, 2, 56, 28, 89, 24,255,247, /* 0x c40 */
109,255, 52, 28, 2, 53, 4, 54, 32, 96,219,231, 1, 53,188,231, /* 0x c50 */
4, 32,255,247,104,255, 35,176,240,188, 1,188, 0, 71,192, 70, /* 0x c60 */
1,192,143,226, 28,255, 47,225, 9, 24,254,181, 1, 36,101, 66, /* 0x c70 */
228, 7, 13, 39, 63, 2, 15,224, 26,188, 64, 26,210, 26, 34, 96, /* 0x c80 */
240,188, 2,188, 8, 71, 4,120,100, 65, 1, 48, 36, 6,247, 70, /* 0x c90 */
3,120, 1, 48, 19,112, 1, 50, 36, 25,254, 70,243,208,247,210, /* 0x ca0 */
1, 33, 36, 25,254, 70,238,208, 73, 65, 36, 25,254, 70,234,208, /* 0x cb0 */
247,211,203, 30, 0, 33, 5,211, 27, 2, 5,120, 1, 48, 29, 67, /* 0x cc0 */
237, 67,217,208, 36, 25,254, 70,221,208, 73, 65, 36, 25,254, 70, /* 0x cd0 */
217,208, 73, 65, 9,209, 1, 33, 36, 25,254, 70,211,208, 73, 65, /* 0x ce0 */
36, 25,254, 70,207,208,247,211, 2, 49, 1, 49,253, 66, 0,210, /* 0x cf0 */
1, 49, 19,120, 83, 93, 19,112, 1, 50, 1, 57,250,209,203,231, /* 0x d00 */
1, 0, 81,227, 11, 0, 0, 26, 15, 64, 45,233,188, 0,143,226, /* 0x d10 */
14, 0,144,232, 2, 16,129,224, 0, 32,147,229, 1, 58,131,226, /* 0x d20 */
1, 0, 83,225,251,255,255,154, 31,192,143,226, 15,224,160,225, /* 0x d30 */
28,255, 47,225, 15, 64,189,232,176,192,159,229, 28,255, 47,225, /* 0x d40 */
41, 75, 27,104, 24, 71, 41, 75,251,231, 45, 75,249,231, 89,224, /* 0x d50 */
240,181, 41, 72, 0, 34, 41, 76, 15, 37,255, 38, 54, 6,247, 67, /* 0x d60 */
160, 66, 13,208,195,120, 43, 64, 11, 43, 6,209, 3,104, 25, 28, /* 0x d70 */
49, 64,155, 26, 59, 64, 11, 67, 3, 96, 4, 48, 1, 50,239,231, /* 0x d80 */
240,189, 3, 33, 67, 92, 18, 2,210, 24, 1, 57,250,213, 16, 28, /* 0x d90 */
112, 71, 48,181, 23, 72, 16, 74, 17, 31, 3,120, 1, 48, 0, 43, /* 0x da0 */
21,208,240, 43, 8,211, 15, 36, 28, 64, 67,120, 36, 2,228, 24, /* 0x db0 */
3,120, 2, 48, 36, 2, 27, 25,201, 24, 0, 37, 75, 93, 36, 2, /* 0x dc0 */
228, 24, 1, 53, 4, 45,249,209,164, 24, 12, 96,229,231, 48,189, /* 0x dd0 */
83, 82, 67, 48, 83, 82, 67, 76, 68, 83, 84, 48, 68, 83, 84, 76, /* 0x de0 */
66, 73, 77, 80, 79, 78, 65, 77, 71, 69, 84, 80, 76, 79, 65, 68, /* 0x df0 */
69, 78, 84, 82, 66, 82, 69, 76, 70, 73, 66, 83, 70, 73, 66, 69, /* 0x e00 */
67, 83, 89, 78,240,181,163,176, 0, 34, 2,146,130,104, 1,146, /* 0x e10 */
66,105, 3, 28, 4,105, 89,104, 0,146, 2,171, 1,154, 0,104, /* 0x e20 */
0,240, 84,248,255,247,148,255, 37, 28, 40, 28,255,247,169,255, /* 0x e30 */
4, 30, 61,208, 0,155, 40, 29,228, 24,255,247,162,255, 1,154, /* 0x e40 */
134, 24, 3,168, 2, 28, 35,120, 27, 6, 0, 43, 4,208, 27, 14, /* 0x e50 */
19,128, 1, 52, 2, 50,246,231, 0, 35, 19,128,255,247,115,255, /* 0x e60 */
8, 53, 7, 28, 43,120, 27, 6, 0, 43, 31,208, 27, 14, 1, 53, /* 0x e70 */
1, 43, 2,208,255, 43, 13,208,244,231, 56, 28, 41, 28,255,247, /* 0x e80 */
95,255, 52, 28, 32, 96, 4, 54, 43,120, 27, 6, 1, 53, 0, 43, /* 0x e90 */
250,209,231,231,105,120, 43,120, 9, 2, 56, 28, 89, 24,255,247, /* 0x ea0 */
79,255, 52, 28, 2, 53, 4, 54, 32, 96,219,231, 1, 53,188,231, /* 0x eb0 */
255,247,111,255, 4, 32,255,247, 72,255, 35,176,240,188, 1,188, /* 0x ec0 */
0, 71,192, 70, 1,192,143,226, 28,255, 47,225, 9, 24,254,181, /* 0x ed0 */
1, 36,101, 66,228, 7, 13, 39, 63, 2, 15,224, 26,188, 64, 26, /* 0x ee0 */
210, 26, 34, 96,240,188, 2,188, 8, 71, 4,120,100, 65, 1, 48, /* 0x ef0 */
36, 6,247, 70, 3,120, 1, 48, 19,112, 1, 50, 36, 25,254, 70, /* 0x f00 */
243,208,247,210, 1, 33, 36, 25,254, 70,238,208, 73, 65, 36, 25, /* 0x f10 */
254, 70,234,208,247,211,203, 30, 0, 33, 5,211, 27, 2, 5,120, /* 0x f20 */
1, 48, 29, 67,237, 67,217,208, 36, 25,254, 70,221,208, 73, 65, /* 0x f30 */
36, 25,254, 70,217,208, 73, 65, 9,209, 1, 33, 36, 25,254, 70, /* 0x f40 */
211,208, 73, 65, 36, 25,254, 70,207,208,247,211, 2, 49, 1, 49, /* 0x f50 */
253, 66, 0,210, 1, 49, 19,120, 83, 93, 19,112, 1, 50, 1, 57, /* 0x f60 */
250,209,203,231, 85, 80, 88, 33,161,216,208,213, 0, 0, 0, 0, /* 0x f70 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x f80 */
0, 0, 0, 45, 65, 82, 77, 80, 69, 65, 88, 69, 0, 0, 0, 0, /* 0x f90 */
0, 65, 82, 77, 80, 69, 65, 68, 69, 0,232, 2, 0, 0, 65, 82, /* 0x fa0 */
77, 80, 69, 84, 88, 69, 0, 60, 6, 0, 0, 65, 82, 77, 80, 69, /* 0x fb0 */
84, 68, 69, 0,116, 8, 0, 0, 65, 82, 77, 80, 69, 84, 88, 66, /* 0x fc0 */
0,244, 10, 0, 0, 65, 82, 77, 80, 69, 84, 68, 66, 0, 16, 13, /* 0x fd0 */
0, 0, 65, 82, 77, 80, 69, 72, 69, 65, 68, 0,116, 15, 0, 0, /* 0x fe0 */
85, 80, 88, 49, 72, 69, 65, 68, 0,116, 15, 0, 0, 65, 82, 77, /* 0x ff0 */
80, 69, 69, 79, 70, 0,148, 15, 0, 0,255,255,255,255,148, 15 /* 0x1000 */
};

View File

@ -40,6 +40,8 @@ void *LoadLibraryW(const unsigned short *);
void *GetProcAddressA(const void *, const void *);
void *get_le32(const void *);
void reloc_main();
void Unfilter_0x50();
void CacheSync(unsigned);
static void handle_imports(const unsigned char *imp, unsigned name_offset,
unsigned iat_offset)
@ -127,13 +129,16 @@ void upx_main(const unsigned *info)
#ifdef SAFE
dlen = info[3];
#endif
//WRITEFILE2('0', (void*) dst0, info[7] + 256 - dst0);
//WRITEFILE2('l', (void*) dst0, info[7] + 256 - dst0);
UCL_DECOMPRESS((void *) src0, srcl, (void *) dst0, &dlen);
//WRITEFILE2('1', (void*) dst0, info[7] + 256 - dst0);
// WRITEFILE2('c', (void*) dst0, info[7] + 256 - dst0);
Unfilter_0x50();
//WRITEFILE2('f', (void*) dst0, info[7] + 256 - dst0);
handle_imports((void *) bimp, onam, dst0);
//WRITEFILE2('2', (void*) dst0, info[7] + 256 - dst0);
//WRITEFILE2('i', (void*) dst0, info[7] + 256 - dst0);
#ifdef STUB_FOR_DLL
reloc_main();
//WRITEFILE2('3', (void*) dst0, info[7] + 256 - dst0);
//WRITEFILE2('r', (void*) dst0, info[7] + 256 - dst0);
#endif
CacheSync(4); // CACHE_SYNC_WRITEBACK
}

View File

@ -29,6 +29,7 @@
<jreiser@users.sourceforge.net>
*/
#define DEBUG 0
#undef STUB_IN_THUMB_MODE
#if defined(__ARM_ARCH_4T__) || defined(__ARM_ARCH_5T__)
@ -66,10 +67,9 @@
bls .L01
# ifdef __ARM_ARCH_4T__
adr lr, .Larmret
adr ip, call_upxmain + 1
mov lr, pc
bx ip
.Larmret:
ldmfd sp!, {r0 - r3, lr}
.Lstart_orig:
ldr ip, ENTR
@ -81,7 +81,7 @@
ldr pc, ENTR @ original entry
# endif
@@@@@@@@@@@@@@@@
.code 16
.global GetProcAddressA
@ -93,8 +93,6 @@ GetProcAddressA:
ldr r3, [r3]
bx r3
@@@@@@@@@@@@@@@@
.global LoadLibraryW
.thumb_func
@ -102,12 +100,63 @@ LoadLibraryW:
ldr r3, LLIB
b .Lcallr3
.global CacheSync
.thumb_func
CacheSync:
ldr r3, CSYN
b .Lcallr3
# ifdef __ARM_ARCH_4T__
call_upxmain:
b upx_main
# endif
@@@@@@@@@@@@@@@@
.global Unfilter_0x50
.thumb_func
buffer .req r0
addval .req r2
bufend .req r4
Unfilter_0x50:
push {r4 - r7, lr}
ldr buffer, FIBS
mov addval, #0
ldr bufend, FIBE
mov r5, #0x0f
mov r6, #0xff
lsl r6, #24
mvn r7, r6
.Luf50_0:
cmp buffer, bufend
beq .Luf50_ret
ldrb r3, [buffer, #3]
and r3, r5
cmp r3, #0x0b
bne .Luf50_1
ldr r3, [buffer]
mov r1, r3
and r1, r6
sub r3, addval
and r3, r7
orr r3, r1
str r3, [buffer]
.Luf50_1:
add buffer, #4
add addval, #1
b .Luf50_0
.Luf50_ret:
pop {r4 - r7, pc}
.unreq buffer
.unreq addval
.unreq bufend
.global get_le32
.thumb_func
@ -122,6 +171,8 @@ get_le32: @ optimized for size
mov r0, r2
bx lr
# ifdef STUB_FOR_DLL
.global reloc_main
.thumb_func
@ -130,7 +181,7 @@ get_le32: @ optimized for size
addval .req r2
reloc_main:
push {r4, r5}
push {r4, r5, lr}
ldr buffer, BREL
ldr addval, DST0
sub dest, addval, #4
@ -170,12 +221,11 @@ reloc_main:
b .Lreloc_loop
.Lreloc_end:
pop {r4, r5}
bx lr
pop {r4, r5, pc}
# endif
# if 0
# if DEBUG
// debugging stuff - helpers for dumping memory to a file or deleting a file
@ -241,7 +291,9 @@ filename:
bl upx_main
ldmfd sp!, {r0 - r3, lr}
.Lstart_orig:
ldr pc, ENTR
ldr pc, ENTR
.global LoadLibraryW
LoadLibraryW:
@ -253,6 +305,49 @@ GetProcAddressA:
ldr r3, GETP
ldr pc, [r3]
.global CacheSync
CacheSync:
ldr r3, CSYN
ldr pc, [r3]
.global Unfilter_0x50
buffer .req r0
addval .req r2
bufend .req ip
Unfilter_0x50:
ldr buffer, FIBS
mov addval, #0
ldr bufend, FIBE
.Luf50_0:
cmp buffer, bufend
moveq pc, lr
ldrb r3, [buffer, #3]
and r3, r3, #0x0f
cmp r3, #0x0b
bne .Luf50_1
ldr r3, [buffer]
and r1, r3, #0xff000000
sub r3, r3, addval
and r3, r3, #0x00ffffff
orr r3, r3, r1
str r3, [buffer]
.Luf50_1:
add buffer, buffer, #4
add addval, addval, #1
b .Luf50_0
.unreq buffer
.unreq addval
.unreq bufend
.global get_le32
get_le32: @ optimized for size
mov r2, #3
@ -262,9 +357,10 @@ get_le32: @ optimized for size
add r1, r3, r1, asl #8
bpl .Lg0
mov r0, r1
gret:
mov pc, lr
# ifdef STUB_FOR_DLL
.global reloc_main
buffer .req r0
@ -279,7 +375,7 @@ reloc_main:
.Lreloc_loop:
ldrb r3, [buffer], #1
cmp r3, #0
beq gret
moveq pc, lr
cmp r3, #0xf0
bichs ip, r3, #0xf0
@ -300,9 +396,13 @@ reloc_main:
add ip, ip, addval
str ip, [dest]
b .Lreloc_loop
.unreq buffer
.unreq addval
.unreq dest
# endif
# if 0
# if DEBUG
// debugging stuff - helpers for dumping memory to a file or deleting a file
@ -348,12 +448,16 @@ filename:
.code 32
.align 2
SRC0: .ascii "SRC0"
SRCL: .ascii "SRCL"
DST0: .ascii "DST0"
.ascii "DSTL"
.ascii "BIMPONAM"
GETP: .ascii "GETP"
LLIB: .ascii "LOAD"
ENTR: .ascii "ENTR"
BREL: .ascii "BREL"
SRC0: .ascii "SRC0" @ start of compressed data
SRCL: .ascii "SRCL" @ compressed length
DST0: .ascii "DST0" @ start of uncompressed data
.ascii "DSTL" @ uncompressed length
.ascii "BIMPONAM" @ start of import data & dll names
GETP: .ascii "GETP" @ pointer to GetProcAddressA
LLIB: .ascii "LOAD" @ pointer to LoadLibraryW
ENTR: .ascii "ENTR" @ original entry point
BREL: .ascii "BREL" @ start of reloc info
FIBS: .ascii "FIBS" @ buffer start for filter
FIBE: .ascii "FIBE" @ buffer end for filter
CSYN: .ascii "CSYN" @ pointer to CacheSync