home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / ECO30603.ZIP / ECO30603.LZH / ECOLIBII / DEMOS / NOVELL / REPVIRUS.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-12-21  |  4.5 KB  |  155 lines

  1. {$A-,B-,D-,E-,F+,I-,L-,N-,O-,R-,S-,V-}
  2. {$M 65520, 0, 655360}
  3. uses
  4.   eco_lib,
  5.   crt, dos
  6.  
  7.   ;
  8.  
  9.  
  10.  
  11. var
  12.   user, station,
  13.   boot,
  14.   netdrive,
  15.   dag, dagn : string;
  16.   error     :   word;
  17.   oldexitproc : pointer;
  18.  
  19.  
  20. const
  21.   kbint = $09;  (* keyboard interrupt number *)
  22.  
  23. var
  24.   oldkbisr : procedure; (* address of old kb isr *)
  25.  
  26.  
  27.  
  28.  
  29.  
  30.   procedure newkbisr; interrupt;
  31.   const
  32.     keyport = $60; (* base port address for keyboard *)
  33.     delscan = $53; (* scan code for del key *)
  34.     ctrlalt = $0c; (* kbflags mask for ctrl and alt *)
  35.  
  36.   var kbflags : byte absolute $0040:$0017; (* from bios data area *)
  37.  
  38.  
  39.     procedure pushf; inline($9c); (* asm instruction for push flags *)
  40.  
  41.     function ctrlaltdel : boolean;
  42.     (*
  43.        Returns true when keyport has a delete scan code, and Ctrl and Alt
  44.        flags are active in BIOS keyboard flags variable
  45.     *)
  46.     begin
  47.       ctrlaltdel := (port[keyport]=delscan) and (kbflags and ctrlalt=ctrlalt);
  48.     end;
  49.  
  50.  
  51.     procedure resetkeyboard; (* resets keyboard and signals eoi to the pic *)
  52.     var b : byte;
  53.     begin
  54.       b := port[keyport+1];         (* reset keyboard *)
  55.       port[keyport+1] := b or $80;
  56.       port[keyport+1] := b;
  57.       port[$20] := $20;             (* signal eoi *)
  58.     end;
  59.  
  60.  
  61.   begin
  62.     if ctrlaltdel then resetkeyboard else begin
  63.       pushf;
  64.       oldkbisr;  (* chain to old interrupt *)
  65.     end;
  66.   end;
  67.  
  68.  
  69.  
  70.  
  71.   function _hidkeyforp: boolean;
  72.   var 
  73.     sc : byte;
  74.     ch : char;
  75.  
  76.   begin
  77.     if __exrdykey(true, ch, sc) then begin
  78.       _hidkeyforp := (ch = '|'); __flushkey;
  79.     end else begin
  80.       _hidkeyforp := false;
  81.     end;
  82.   end;
  83.  
  84.  
  85.  
  86. begin
  87.   __stdio; __setblwin(false);
  88.   if __inparams('/?', error) then begin
  89.     writeln(__progname);
  90.     writeln('  Usage: ', __progname, ' while using environment variables:');
  91.     writeln(__rep(length(__progname)+10, ' '), 'USER STATION BOOT DAG DAGN NETDRIVE');
  92.     halt;
  93.   end;
  94.  
  95.   oldexitproc := exitproc;
  96.   exitproc := nil;
  97.  
  98.  
  99.   boot := __up(getenv('boot'));
  100.   dag := __up(getenv('dag'));
  101.   dagn := __up(getenv('dagn'));
  102.   user := __up(getenv('user'));
  103.   station := __up(getenv('station'));
  104.   netdrive := __up(getenv('netdrive'));
  105.  
  106.   if __existfil(boot[1] + ':\' + dag + '.4' + dagn) then begin
  107.     __copyfil(
  108.       false,
  109.       1, 5, wherey, 7, 0, __sizefil(boot[1] + ':\' + dag + '.4' + dagn),
  110.       boot[1] + ':\' + dag + '.4' + dagn,
  111.       boot[1] + ':\virus'
  112.     );
  113.   end;
  114.  
  115.   if __existfil(boot + '\MONDAY.*') then __erasefiles(boot + '\MONDAY.*');
  116.   if __existfil(boot + '\TUESDAY.*') then __erasefiles(boot + '\TUESDAY.*');
  117.   if __existfil(boot + '\WEDNESDA.*') then __erasefiles(boot + '\WEDNESDA.*');
  118.   if __existfil(boot + '\THURSDAY.*') then __erasefiles(boot + '\THURSDAY.*');
  119.   if __existfil(boot + '\FRIDAY.*') then __erasefiles(boot + '\FRIDAY.*');
  120.  
  121.   __bandwin(
  122.     true, 5, 5, _curcolumns - 5, 12, yellow, lightred, sh_default, bt_double
  123.   );
  124.   __betwscn(5, _curcolumns - 5, 04, yellow, lightred, '[ VIRUS ERROR ]');
  125.  
  126.   __betwscn(5, _curcolumns - 5, 06, white, lightred,
  127.     'ER IS EEN VIRUS GECONSTATEERD OP UW PC ....'
  128.   );
  129.   __betwscn(5, _curcolumns - 5, 08, white, lightred, 'BEL DE HELPDESK 6625');
  130.   __betwscn(5, _curcolumns - 5, 10, white, lightred, 'Keyboard nu inactief.');
  131.  
  132.   __loginit; programname := 'VIRUS'; logfilename := netdrive[1] + ':\OFFDATA\MAIL\SCANDATA\LIJST';
  133.   logheader[04] := '│ █       VIRUS checks viruserrors for network-use.        █ │';
  134.   logheader[05] := '│ █              No responsibility assumed.                █ │';
  135.   logheader[06] := '│ █                                                        █ │';
  136.   logheader[07] := '│ █                                                        █ │';
  137.   logheader[08] := '│ █                                                   FAN  █ │';
  138.   logheader[10] := '│                         Version 1.01                       │';
  139.   if __existpath(netdrive[1] + ':\OFFDATA\MAIL\SCANDATA\LIJST') then
  140.     __logapp(' VIRUS FOUND ON ' + user + ' on ' + station);
  141.  
  142.   { remove ctrl-alt-del from keyboard }
  143.   getintvec(kbint, @oldkbisr);  (* save address of old kb isr    *)
  144.   setintvec(kbint, @newkbisr);  (* point it at new isr procedure *)
  145.  
  146.   repeat
  147.     { statkey, checken op alle LEDjes + | zoiets (gniffel) }
  148.   until _hidkeyforp;
  149.   setintvec(kbint, @oldkbisr);
  150.   exitproc := oldexitproc;
  151.   __cls; gotoxy(1, _currows); 
  152.   writeln('JAAAAAA je hebt hem gevonden!');
  153.   writeln('Speciaal voor Perry & Dick!'); __flushkey
  154. end.
  155.