Go to most recent revision |
Blame |
Last modification |
View Log
| Download
| RSS feed
#define OFF 20
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(int argc,char * argv[])
{
FILE * f;
char * buf;
unsigned long sz,newsz;
if(argc<3)
{
printf("%s filename memsize_hex\n",argv
[0]);
printf("Example:\n\t%s test.app 100000\n",argv
[0]);
return -1;
}
if(newsz<0x10000 || newsz>0x2000000) /* Min 64kB max 32MB */
{
printf("Impossibly large memory size %x\n",newsz
);
return -1;
}
if(!f)
{
printf("Unable to open file\n");
return -1;
}
if(!buf)
{
printf("Unable to allocate temporary buffer\n");
return -1;
}
*((unsigned long *)(buf+OFF))=newsz;
return 0;
}