#include "stdio.h"
main()
{
FILE *fp;
char driver;
char path[20];
char name[20];
char c;
char YN1,YN2;
char dos1[20],dos2[20];
int i=0;
int flag=0;
for(;i<20;i++)
{
dos1[i]=dos2[i]=path[i]=name[i]='/0';
}
printf("Please input the driver./n");
scanf("%c",&driver);
sprintf(path,"%c://autorun.inf",driver);
fp=fopen(path,"r+");
if (!fp)
{
printf("No virus in %c./n",driver);
}
else
{
flag=1;
}
while((c=fgetc(fp))!=EOF)
{
if(c=='o'||'O'==c)
{
c=fgetc(fp);
if(c=='p'||'P'==c)
{
c=fgetc(fp);
if('e'==c||'E'==c)
{
c=fgetc(fp);
if('n'==c||'N'==c)
{
c=fgetc(fp);
if('='==c)
{ i=0;
while((c=fgetc(fp))!='/n'&&c!=EOF)
{
name[i]=c;
i++;
}
}
}
}
}
}
}
if('e'==name[strlen(name)-1])
{
printf("Find virus in %c://%s./n",driver,name);
}
else
{
flag=0;
}
if(flag)
{
printf("The virus is in %c://%s./n",driver,name);
sprintf(dos1,"del %c://autorun.inf",driver);
if(0==system(dos1))
{
printf("/nDelete %c://autorun.inf successfully./n",driver);
}
sprintf(dos2,"del %c://%s",driver,name);
if(0==system(dos2))
{
printf("/nDelete %c://%s successfuuly.",driver,name);
}
}
getch();
}