void RePoint()
{
char szCmd[100];
DWORD dwRePointResult = INVALID_FILE_ATTRIBUTES;
char szRePointFile[100];
char szLog[100];
DWORD dwRePointCounts = 0;
memset(szCmd,0,sizeof(char)*100);
if(Form1->CheckBox1->Checked == false)
{
strcpy(szDefaultOrOther,"smsguest");
}
else
{
strcpy(szDefaultOrOther,"default");
}
sprintf(szCmd,"C:\\makemobo.bat %c 1 %s",szNewDriveLetter[0],szDefaultOrOther);
if(GetFileAttributes("C:\\makemobo.bat")==INVALID_FILE_ATTRIBUTES)
{
MessageBox(NULL,"未找到makemobo.bat文件,请联系管理员!","错误",0);
Form1->Button1->Enabled = true;
}
else
{
sprintf(szRePointFile,"%s:\\smsapp",szNewDriveLetter);
ShowMessage(szRePointFile);
do
{
if(dwRePointCounts>0)
{
sprintf(szLog,"配置个人重定向失败,正在重试第%d次配置",dwRePointCounts+1);
Form1->Label2->Caption = szLog;
}
execwait(NULL,szCmd,200000);
dwRePointResult = GetFileAttributes(szRePointFile);
dwRePointCounts++;
}
while((dwRePointResult == INVALID_FILE_ATTRIBUTES)&&(dwRePointCounts<dwRePointMaxCounts));
if(dwRePointResult != INVALID_FILE_ATTRIBUTES)
{
Form1->Label2->Caption ="配置个人重定向成功!";
}
}
}
配置个人重定向是否成功的循环
最新推荐文章于 2024-01-02 18:29:24 发布