home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 7 / POWERCD7.ISO / prgmming / exeval_c / exedemod.c next >
C/C++ Source or Header  |  1994-07-16  |  1KB  |  43 lines

  1. /* DOS VERSION */
  2.  
  3. /* This sample program demonstrates the use of the .EXE file validation */
  4. /* system. This program simply checks whether its .EXE file is valid,   */
  5. /* and displays a message accordingly. To rebuild this file, create a   */
  6. /* "makefile" / "project file" that includes exedemo.c and exevalid.c.  */
  7. /* After compiling the .EXE file, use the exestamp program to create a  */
  8. /* valid hash stamp in the .EXE file.                                   */
  9.  
  10. /* Include the EXEValid header file. */
  11. #include "exevalid.h"
  12.  
  13.     
  14. /* Program execution begins here. */
  15. int main(int argc, char *argv[])
  16. {
  17.    if(argc < 1)
  18.    {
  19.       /* Check that EXE filename has been provided. */
  20.       printf("EXE file name is unknown.\n");
  21.       return(0);
  22.    }
  23.  
  24.    /* Validate EXE and act accordingly. */
  25.    switch(ValidateEXE(argv[0]))
  26.    {
  27.       case kInvalid:
  28.          printf("EXE file does not have a valid hash stamp; aborting.\n");
  29.          return(1);
  30.       case kGeneralFailure:
  31.          printf("Internal error - not enough system resources available.\n");
  32.          return(1);
  33.    }
  34.    
  35.    /* Program execution will only get to this point if .EXE is valid. */
  36.    printf("EXE file is valid, proceeding normally.\n");
  37.  
  38.    /* Exit program. */   
  39.    return(0);
  40. }
  41.  
  42.  
  43.