/* Program to report possible bootsector VIRUS contamination This program is designed to sit in your AUTO folder. It simply reads the boot sector of your disk and checks to see is it is executable by TOS. By David Mace This program is on the Public Domain PSC 2 Box 10233 If you find it useful and feel guilty, APO San Francisco, CA send me money to make yourself feel 96367 better. I don't mind a bit. Written July 20, 1989 */ #include #include alert(string) char *string; { int r; r=Getrez(); lineaa(); if (Getrez()!=2) { Setscreen(-1L,-1L,0); Cconws("\007\033c\041"); } Cconws("\033E\n\n\n\n\n\n"); Cconws(string); Cconws("\n\n\n\n\rPress a key to continue...\007"); Cnecin(); if (Getrez()!=2) { Cconws("\033c\040"); Setscreen(-1L,-1L,r); } Cconws("\033E"); linea9(); } /* Check drive 'D' (A, D=0; B, D=1) for executable bootsector. Returns: 0=No problem, 1=Executable bootsector, -1=Could not read boot sector */ int check_drive(D) int D; { unsigned char buf[512]; unsigned int c,cs=0; if (Floprd(buf,0L,D,1,0,0,1)) return(-1); else { /* Calculate check sum */ cs=0; for (c=0;c<512;c+=2) cs+=((unsigned)(buf[c]<<8)+buf[c+1]); if(cs==0x1234) return(1); else return(0); } } main() { int r; Cconws("\033EChecking Drive A-"); r=check_drive(0); switch(r) { case -1: alert("\ The boot sector on the disk \n\r\ is unreadable!\n\r"); break; case 1: alert("\ The disk in drive A shows\n\r\ signs of possible virus contamination.\n\n\r\ Load a better detection program\n\r\ for better diagnosis.\n\r"); break; case 0: Cconws(" Bootsector harmless.\n\r"); break; } Cconws("\nSTOP THAT @%&#?! DRIVE\n\rBy David J. Mace\n\r"); }