用vc++穷举windows应用程序密码(续)
void EnumPasswordString(void)
{ if(!bFetched) return;
//若产生的密码尚未使用,不再产生密码,直接返回退出
bFetched=false;
CString lpszCharSet;
char lpszCurrentPassword[30]="";
CString lpszTmpCurrentPassword;
GetPrivateProfileString("设置","穷举方法","数字",lpszMethod,sizeof(lpszMethod),"Setup.ini");
//得到上一次密码产生的办法,不同的办法定义不同的密码字符集,并得到相应的密码
if(strstr(lpszMethod,"数字")!=NULL)
{lpszCharSet.Format ("%s","0123456789");
GetPrivateProfileString("数字","当前密码","0",(LPTSTR)lpszCurrentPassword,sizeof(lpszCurrentPassword),"Setup.ini");
}
if(strstr(lpszMethod,"小写字母")!=NULL)
{lpszCharSet.Format("%s","abcdefghijklmnopqrstuvwxyz" );
GetPrivateProfileString("小写字母","当前密码","a",(LPTSTR)lpszCurrentPassword,sizeof(lpszCurrentPassword),"Setup.ini");
}
if(strstr(lpszMethod,"大写字母")!=NULL)
{lpszCharSet.Format("%s","ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
GetPrivateProfileString("大写字母","当前密码","A",(LPTSTR)lpszCurrentPassword,sizeof(lpszCurrentPassword),"Setup.ini");
}
if(strstr(lpszMethod, "大小写字母组合")!=NULL)
{lpszCharSet.Format("%s","abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") ;
GetPrivateProfileString("大小写字母组合","当前密码","a",(LPTSTR)lpszCurrentPassword,sizeof(lpszCurrentPassword),"Setup.ini");
}

