![]() |
exepack by Shelwien
exepack As part of adding sfx support for my archive format, I made a standalone x64flt3/delta/plzma archiver.
Then I thought that it can be used to bundle multifile apps into a single exe file, just as well. Loader stub unpacks app archive to a temp folder, then runs first executable there with current commandline. Temp folder is deleted on exit. Code:
Exepack version 1 [12.08.2018 10:04].It is also a valuable tool for ISDONE:D |
The decompression for the program is as follows:
int srcPos; /* start at the end of the packed exe, because the unpacker works downwards */ int dstPos; int commandByte, lengthWord, fillByte; /* skip all 0xff bytes (they're just padding to make the packed exe's size a multiple of 16 */ while (*srcPos == 0xff) { srcPos--; } /* unpack */ do { commandByte = *(srcPos--); switch (commandByte & 0xFE) { /* (byte)value (word)length (byte)0xb0 */ /* writes a run of <length> bytes with a value of <value> */ case 0xb0: lengthWord = (*(srcPos--))*0x100; lengthWord += *(srcPos--); fillByte = *(srcPos--); for (i = 0; i < lengthWord; i++) { *(dstPos--) = fillByte; } break; /* (word)length (byte)0xb2 */ /* copies the next <length> bytes */ case 0xb2: lengthWord = (*(srcPos--))*0x100; lengthWord += *(srcPos--); for (i = 0; i < lengthWord; i++) { *(dstPos--) = *(srcPos--); } break; /* unknown command */ default: printf("Unknown command %x at position %x\n", commandByte, srcPos); exit(1); break; } } while ((commandByte & 1) != 1); /* lowest bit set => last block */ |
| All times are GMT -7. The time now is 20:11. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com