关于int main(int argc,char argv[])的参数的含义和sqawnl()的参数的具体含义

来源:百度知道 编辑:UC知道 时间:2024/06/01 13:19:10
int main(int argc,char **argv)
{
int contral=0;
if(argc>1)
if(strcmp(argv[1],"/s")==0)
goto next1;
autorun_explorer();
spawnl(1,"c:\\windows\\system\\explorer.exe",NULL);
next1:
add_reg();
copy_virus();
make_rubbish();
/* remove_files(); */
spawnl(1,"c:\\windows\\system32\\mstsc32.exe"," /s",NULL);
return 0;
}就上面那个函数的每一步,每一个语句的具体含义是什么?
麻烦各位大哥说得详细点。。。。。先谢谢了。。。。。
这个函数中我最主要想知道的是if(argc>1)
if(strcmp(argv[1],"/s")==0)
goto next1;
中argc>1,strcmp(argv[1],"/s")==0是什么东西?还有 spawnl(1,"c:\\windows\\system\\explorer.exe",NULL);
是什么?里面的参数表示什么?

int main(int argc,char **argv)//argc,argv[]是命令行参数,其中argc室参数的个数,argv[]存的是参数的字符串,比如你做好了一个有命令行参数的程序存在D盘,那么在c提示符中输入D://程序名.exe aa bb aa 其中aa bb aa就是参数argc=4 argv[0]=D://...exe argv[1]=aa 以此类推
{
int contral=0;
if(argc>1)//如果参数除路径以外还有其他的
if(strcmp(argv[1],"/s")==0)
goto next1;
autorun_explorer();//这个应该是自定义函数
spawnl(1,"c:\\windows\\system\\explorer.exe",NULL);

/*函数名: spawnl
功 能: 创建并运行子程序
用 法: int spawnl(int mode, char *pathname, char *arg0,
arg1, ... argn, NULL);
程序例:

#include <process.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
int result;

clrscr();
result = spawnl(P_WAIT, "tcc.exe", NULL);
if (result == -1)
{
perror("Error from spawnl");
exit(1);
}