Category : C Source Code
Archive   : CAWARE.ZIP
Filename : EXAMPLE.C

 
Output of file : EXAMPLE.C contained in archive : CAWARE.ZIP
/*****************************************************************************/
/* */
/* Example source code to check if this executable's logged CRC or filesize */
/* has changed. */
/* */
/* Written by Chuck Gilmore - (C)Copyright 1988, Gilmore Systems */
/* P.O. Box 3831 */
/* Beverly Hills, CA 90212 USA */
/* */
/* Voice (213) 275-8006 */
/* Data (213) 276-5263 */
/* */
/* Designed for Turbo C version 1.5 */
/* */
/* Instructions: */
/* */
/* Small model: tcc -ms example exeawars.obj */
/* makaware example.exe */
/* example */
/* */
/* Medium model: tcc -mm example exeawarm.obj */
/* makaware example.exe */
/* example */
/* */
/* Large model: tcc -ml example exeawarl.obj */
/* makaware example.exe */
/* example */
/* */
/* Huge model: tcc -mh example exeawarh.obj */
/* makaware example.exe */
/* example */
/* */
/* Compact model: tcc -mc example exeawarc.obj */
/* makaware example.exe */
/* example */
/* */
/* */
/* NOTE THE EXTRA STEPS FOR THE TINY MODEL: */
/* */
/* Tiny model: tcc -mt example exeawart.obj */
/* exe2bin example.exe example.com */
/* del example.exe */
/* makaware example.com */
/* example */
/* */
/*****************************************************************************/

#include

main(argc,argv)
int argc;
unsigned char **argv;
{
int result;
FILE *f;

extern int exeaware();

printf("\nAbout to check stored values ...\n\n");

result=exeaware(argv[0]); /* call with name of THIS program (argv[0]) */
switch(result)
{
case 1:
printf("Stored CRC doesn't match - program altered!\n");
break;
case 2:
printf("Stored filesize doesn't match - program altered!\n");
break;
case 3:
printf("Stored CRC and filesize don't match - program altered!\n");
break;
case 0:
default:
printf("No changes to CRC or filesize detected - program unaltered\n");
break;
}

/*****************************************************************************/
/** NOW, Let's change the size of the file by adding a byte to the filesize **/
/** This will change both the filesize and the CRC of the file. **/
/*****************************************************************************/

printf("about to change filesize\n");
if(!(f=fopen(argv[0],"ab"))) /* open for "append, binary mode" */
{
printf("Error - Can't open \"%s\"\n",argv[0]);
exit(1);
}
putc(0,f); /* write out 1 byte */
fclose(f); /* close the file */

/***************************************************************************/
/* The following is duplicated code from above (for example purposes only) */
/***************************************************************************/

result=exeaware(argv[0]); /* call with name of THIS program (argv[0]) */
switch(result)
{
case 1:
printf("Stored CRC doesn't match - program altered!\n");
break;
case 2:
printf("Stored filesize doesn't match - program altered!\n");
break;
case 3:
printf("Stored CRC and filesize don't match - program altered!\n");
break;
case 0:
default:
printf("No changes to CRC or filesize detected - program unaltered\n");
break;
}

exit(0);
}



  3 Responses to “Category : C Source Code
Archive   : CAWARE.ZIP
Filename : EXAMPLE.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/