home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TROJAN_P / CRCSET13.ZIP / TESTCRC.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1991-07-13  |  1.1 KB  |  62 lines

  1. {
  2. TESTCRC.PAS
  3.  
  4. Kevin Dean
  5. Fairview Mall P.O. Box 55074
  6. 1800 Sheppard Avenue East
  7. Willowdale, Ontario
  8. CANADA    M2J 5B9
  9. CompuServe ID: 76336,3114
  10.  
  11. March 24, 1991
  12.  
  13.     This program demonstrates the anti-virus CRC algorithm in VALIDCRC.PAS.
  14. The response to an invalid CRC is entirely up to the programmer.
  15.  
  16.     This code is public domain.
  17. }
  18.  
  19.  
  20. program TestCRC;
  21.  
  22.  
  23. uses
  24.   ValidCRC;
  25.  
  26.  
  27. var
  28.   Buffer : pointer;
  29.  
  30.  
  31. {$F+}
  32. {***}
  33. { Override default handling of memory allocation errors (see chapter 15 - Inside Turbo Pascal). }
  34. function HeapFunc(Size : word) : integer;
  35.  
  36. begin
  37. HeapFunc := 1
  38. end;
  39. {$F-}
  40.  
  41.  
  42. begin
  43. HeapError := @HeapFunc;
  44.  
  45. case ValidateCRC('TESTCRC.EXE') of
  46.   crcValid:
  47.     WriteLn('CRC is valid.');
  48.  
  49.   crcInvalid, crcIsZero:
  50.     begin
  51.     WriteLn('*** WARNING *** Program''s CRC is invalid.');
  52.     WriteLn('This program may have been infected by a virus.')
  53.     end;
  54.  
  55.   crcNoMem:
  56.     WriteLn('Insufficient memory to run CRC calculation.');
  57.  
  58.   crcFileErr:
  59.     WriteLn('Program file not found; cannot calculate CRC.')
  60.   end
  61. end.
  62.