BOOL GetWebLoginParam(LPWSTR lpszAccount, int nAccLen, LPWSTR lpszPswd, int nPswdLen, bool& bOnline) { LPWSTR lpCommandLine = GetCommandLine(); wchar_t* pPos = wcsstr(lpCommandLine, COMMANDLINE_CODE_WEBLOGIN); if(NULL != pPos) { pPos += wcslen(COMMANDLINE_CODE_WEBLOGIN); } else { pPos = wcsstr(lpCommandLine, COMMANDLINE_CODE_WEBTRAYLOGIN); if(pPos == NULL) return FALSE; pPos += wcslen(COMMANDLINE_CODE_WEBTRAYLOGIN); } wchar_t szOnline[10] = {0}; swscanf(pPos, L"%s", szOnline); if(wcscmp(szOnline, L"1") == 0) { bOnline = true; } else { bOnline = false; } pPos += wcslen(szOnline); pPos++; wchar_t szAccount[MAX_PATH] = {0}; swscanf(pPos, L"%s", szAccount); int nLen = _tcslen(szAccount); if(0 == nLen || nAccLen <= nLen) return FALSE; wcscpy(lpszAccount, szAccount); pPos += nLen; while(nLen < 16) { if(nLen > 8) { memcpy(&szAccount[nLen], szAccount, sizeof(wchar_t)*(16-nLen)); } else { memcpy(&szAccount[nLen], szAccount, sizeof(wchar_t)*nLen); } nLen = _tcslen(szAccount); } wchar_t szPswd[MAX_PATH] = {0}; pPos++; swscanf(pPos, L"%s", szPswd); if(0 == _tcslen(szPswd)) return FALSE; BYTE byTemp[MAX_PATH] = {0}; int nDstLen = MAX_PATH; if(!Base64Decode2(szPswd, _tcslen(szPswd), byTemp, &nDstLen)) { return FALSE; } string strAccount2 = string_helper::from( wstring(szAccount)); BlowFishDecode((byte*)strAccount2.c_str(), nDstLen, byTemp); wstring strPswdMd5 = string_helper::from( string((char*)byTemp)); if(strPswdMd5.length() < nPswdLen) { wcscpy(lpszPswd, strPswdMd5.c_str()); return TRUE; } else { return FALSE; } }
void c6_decode_xml_blob(unsigned char *dst, size_t dst_len, unsigned char *md5_key) { BlowFishDecode(dst_len, dst, 16, md5_key); }