用vc++穷举windows应用程序密码(续)(2)
if(strstr(lpszMethod, "数字字母组合")!=NULL)
{lpszCharSet.Format("%s","0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") ;
GetPrivateProfileString("数字字母组合","当前密码","0",(LPTSTR)lpszCurrentPassword,sizeof(lpszCurrentPassword),"Setup.ini");
}
if(strstr(lpszMethod, "所有字符")!=NULL)
{ lpszCharSet.Format("%s","0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*()_+`-=,./';[]{}|:"<>?" );
GetPrivateProfileString("所有字符","当前密码","0",(LPTSTR)lpszCurrentPassword,sizeof(lpszCurrentPassword),"Setup.ini");
}
if(strstr(lpszMethod, "数据字典")!=NULL)
{unsigned long nFilePos=GetPrivateProfileInt(lpszPath,"文件指针",0,"Setup.ini");//得到上次取密码的文件指针
CFile m_file;
m_file.Open (lpszPath,0,NULL);
if(nFilePos==m_file.GetLength())
{ m_file.Close ();
m_bEnum=false;
::EnableWindow(::GetDlgItem(m_hwnd,IDOK),TRUE);
::EnableWindow(::GetDlgItem(m_hwnd,IDCANCEL),TRUE);
::EnableWindow(::GetDlgItem(m_hwnd,IDPause),FALSE);
::SetFocus(::GetDlgItem(m_hwnd,IDOK));
return ;
//密码字典已经遍历完毕,停止线程枚举
}
m_file.Seek (nFilePos,0);
int i=0;
for(;;)
{m_file.Read(lpszPassword+i,1);//依次读取密码字符,跳过回车换行符
if ((char)lpszPassword[i]!=0x0d)
{nFilePos++;
i++;
m_file.Seek (nFilePos,0);

