13,824
社区成员
发帖
与我相关
我的任务
分享
FILE* usersfile;
char *pos1;
char *pos2;
char buffer[128];
char cmdchar[128];
pos1 = (char *)malloc(100*sizeof(char));
ShellExecute(0, "open" , "cmd" , "/c cacls c:\\\\>users.txt" , 0, SW_HIDE);
Sleep(2000);
usersfile=fopen("users.txt","r");
while(fgets(pos1,100,usersfile)!=NULL)
{
pos2 = strstr(pos1,"SYSTEM");
if(pos2 !=NULL)
{
continue;
}
pos1 = pos1 + 4;
pos2 = strstr(pos1,":");
if(pos2 != NULL)
{
memcpy(buffer, pos1,pos2-pos1);
buffer[pos2-pos1]='\0';
sprintf(cmdchar, "/c cacls c:\\\\ /c /e /r \"%s\" & pause", buffer);
if(strcmp(buffer,"BUILTIN\\Users")==0||strcmp(buffer,"Users")==0)
{
pos1 = pos1 - 4;
continue;
}
ShellExecute(0, "open" , "cmd" , cmdchar , 0, SW_SHOWNORMAL);
}
pos1 = pos1 - 4;
}
fclose(usersfile);
free(pos1);
pos1=NULL;
free(pos2);
pos2=NULL;
ShellExecute(0, "open" , "cmd" , "/c del users.txt " , 0, SW_HIDE);