| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Encrypted changes to runn |
KD> EXEs are a bit harder. Information can be appended to the
KD> end of an EXE file. Working out how to find the end of an
KD> EXE requires fiddling with the EXE header.
This program finds the size of DOS .EXE files.
NOTE: if there is debug info, it is ignored, and only the
size of the actual .EXE file, to which the debug info
has been appended, is given.
/*_|_| EXESIZE.C PUBLIC DOMAIN Kurt Kuzba 1/7/1999
_|_|*/
typedef struct { short mz, bytes, blocks;} EXE_HEADER;
#include
int main(int argc, char **argv)
{
FILE *Getsize;
long filesize;
EXE_HEADER sizedata;
if(argc < 2)
{
puts("usage: exesize file.ext");
return 1;
}
Getsize = fopen(argv[1], "rb");
if(!Getsize)
{
printf("Could not open %s.\nusage: exesize file.ext\n", argv[1]);
return 2;
}
fread(&sizedata, sizeof(EXE_HEADER), 1, Getsize);
if(*((char*)&sizedata.mz) == 'M' ||
*((char*)&sizedata.mz + 1) == 'Z')
{
filesize = (long)(sizedata.blocks) * 512L +
(long)sizedata.bytes - 512L;
printf("sizedata.blocks = %d :: sizedata.bytes = %d\n",
sizedata.blocks, sizedata.bytes);
printf("%s is %ld bytes long.\n", argv[1], filesize);
}
else
printf("%s is not an .EXE file.\n", argv[1]);
fclose(Getsize);
return 0;
}
> ] * Origin: *YOPS ]I[* 8.4 GIG * RA/FD/FE * Milwaukee, WI (1:154/750)SEEN-BY: 396/1 632/0 371 633/260 262 267 270 371 634/397 635/506 728 639/252 SEEN-BY: 670/218 @PATH: 154/750 222 396/1 633/260 635/506 728 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.