コード例 #1
0
HRESULT CUpdateCallbackGUI2::ShowAskPasswordDialog()
{
  CPasswordDialog dialog;
  ProgressDialog->WaitCreating();
  if (dialog.Create(*ProgressDialog) != IDOK)
    return E_ABORT;
  Password = dialog.Password;
  PasswordIsDefined = true;
  return S_OK;
}
コード例 #2
0
ファイル: UpdateCallbackGUI.cpp プロジェクト: BIAINC/7Zip
HRESULT CUpdateCallbackGUI::Open_CryptoGetTextPassword(BSTR *password)
{
  PasswordWasAsked = true;
  if (!PasswordIsDefined)
  {
    CPasswordDialog dialog;
    if (dialog.Create(ProgressDialog) == IDCANCEL)
      return E_ABORT;
    Password = dialog.Password;
    PasswordIsDefined = true;
  }
  return StringToBstr(Password, password);
}
コード例 #3
0
STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword(BSTR *password)
{
  *password = NULL;
  if (!_passwordIsDefined)
  {
    CPasswordDialog dialog;
    if (dialog.Create(_parentWindow) == IDCANCEL)
      return E_ABORT;
    _password = dialog.Password;
    _passwordIsDefined = true;
  }
  return StringToBstr(_password, password);
}
コード例 #4
0
STDMETHODIMP CUpdateCallback100Imp::CryptoGetTextPassword(BSTR *password)
{
  *password = NULL;
  if (!_passwordIsDefined)
  {
    CPasswordDialog dialog;
    ProgressDialog->WaitCreating();
    if (dialog.Create(*ProgressDialog) != IDOK)
      return E_ABORT;
    _password = dialog.Password;
    _passwordIsDefined = true;
  }
  return StringToBstr(_password, password);
}
コード例 #5
0
ファイル: OpenCallbackGUI.cpp プロジェクト: lofter2011/Icefox
HRESULT COpenCallbackGUI::CryptoGetTextPassword(BSTR *password)
{
    if (!PasswordIsDefined)
    {
        CPasswordDialog dialog;
        if (dialog.Create(ParentWindow) == IDCANCEL)
            return E_ABORT;
        Password = dialog.Password;
        PasswordIsDefined = true;
    }
    CMyComBSTR tempName(Password);
    *password = tempName.Detach();
    return S_OK;
}
コード例 #6
0
ファイル: OpenCallback.cpp プロジェクト: Bernieboy/nds4ios
STDMETHODIMP COpenArchiveCallback::CryptoGetTextPassword(BSTR *password)
{
  PasswordWasAsked = true;
  if (!PasswordIsDefined)
  {
    CPasswordDialog dialog;
   
    if (dialog.Create(ProgressDialog) == IDCANCEL)
      return E_ABORT;

    Password = dialog.Password;
    PasswordIsDefined = true;
  }
  return StringToBstr(Password, password);
}
コード例 #7
0
ファイル: UpdateCallbackGUI.cpp プロジェクト: BIAINC/7Zip
HRESULT CUpdateCallbackGUI::CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password)
{
  if (!PasswordIsDefined)
  {
    if (AskPassword)
    {
      CPasswordDialog dialog;
      if (dialog.Create(ProgressDialog) == IDCANCEL)
        return E_ABORT;
      Password = dialog.Password;
      PasswordIsDefined = true;
    }
  }
  *passwordIsDefined = BoolToInt(PasswordIsDefined);
  return StringToBstr(Password, password);
}
コード例 #8
0
void testCPasswordDialog()
{
    CPasswordDialog dialog;

	int ret = dialog.Create(0);
	if (ret == IDOK) {
    		UString Password = dialog.Password;
		UString msg  = wxT("CPasswordDialog => IDOK password=\"");
		msg += Password;
		msg += wxT("\"");
		myErrorMsg(msg);
	}
	else if (ret == IDCANCEL) myErrorMsg(wxT("CPasswordDialog => IDCANCEL"));
	else  myErrorMsg(wxT("CPasswordDialog => ?"));

}
コード例 #9
0
ファイル: OpenCallback.cpp プロジェクト: OwenTan/AndroidP7zip
STDMETHODIMP COpenArchiveCallback::CryptoGetTextPassword(BSTR *password)
{
  COM_TRY_BEGIN
  PasswordWasAsked = true;
  if (!PasswordIsDefined)
  {
    CPasswordDialog dialog;
    bool showPassword = NExtract::Read_ShowPassword();
    dialog.ShowPassword = showPassword;
   
    ProgressDialog.WaitCreating();
    if (dialog.Create(ProgressDialog) != IDOK)
      return E_ABORT;

    Password = dialog.Password;
    PasswordIsDefined = true;
    if (dialog.ShowPassword != showPassword)
      NExtract::Save_ShowPassword(dialog.ShowPassword);
  }
  return StringToBstr(Password, password);
  COM_TRY_END
}
コード例 #10
0
ファイル: PlugIn.cpp プロジェクト: gayancc/keepass
bool COublietteImportPlugin::ImportOublietteFile(LPCTSTR name)
{
    OublietteFile file(name);
    if (!file) {
        MessageBox(
            m_PluginAPI->GetMainWindowHandle()
        ,   file.getLastErrorMessage().c_str()
        ,   PLUGIN_NAME
        ,   MB_OK|MB_ICONWARNING
        );
        return false;
    }

    // TODO: Maybe use m_PluginAPI->ShowDialog() here in the future, when it is
    // implemented.

    // Switch to the DLL's resources.
    AFX_MANAGE_STATE(AfxGetStaticModuleState())

    CPasswordDialog dialog;
    if (dialog.DoModal()!=IDOK) {
        return false;
    }

    // Try to decrypt the file with the specified password.
    CT2CA password(dialog.GetPassword());
    OublietteFile::CipherTextHeader const* header=file.decryptData(password.m_psz);
    if (!header) {
        MessageBox(
            m_PluginAPI->GetMainWindowHandle()
        ,   file.getLastErrorMessage().c_str()
        ,   PLUGIN_NAME
        ,   MB_OK|MB_ICONWARNING
        );
        return false;
    }

    // Create a top-level group to import to.
    PW_GROUP g;
    ZeroMemory(&g,sizeof(PW_GROUP));

    if (m_Database->GetGroupId(PLUGIN_NAME)==DWORD_MAX) {
        // DWORD uGroupId;
        g.uImageId=49; // Open folder icon.
        g.pszGroupName=PLUGIN_NAME;
        g.tCreation=ConvertDateTime(header->getCreationTime());
        g.tLastMod=ConvertDateTime(header->getModificationTime());
        g.tLastAccess=ConvertDateTime(header->getModificationTime());
        m_PluginAPI->GetNeverExpireTime(&g.tExpire);
        // USHORT usLevel;

        m_Database->AddGroup(&g);
    }

    // Try to find Oubliette's path in the registry to read category names.
    TCHAR buffer[256];
    ULONG size;
    CString ini;

    ZeroMemory(buffer,sizeof(buffer));

    CRegKey r;
    if (r.Open(HKEY_LOCAL_MACHINE,_T("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Oubliette_is1"),KEY_READ)==ERROR_SUCCESS) {
        size=_countof(buffer);
        r.QueryStringValue(_T("Inno Setup: App Path"),buffer,&size);
        ini=buffer;
        ini+=_T("\\Oubliette.ini");
    }

    g.usLevel=1;

    // Loop over all entries and add them to KeePass.
    PW_ENTRY e;
    for (int i=0;i<header->getCount();++i) {
        OublietteFile::Account account=file.processNext();
        g.uImageId=account.category;

        // Add a "Subgroup" for every used Oubliette category.
        CString category=file.getCategoryName(account.category).c_str();
        if (category.IsEmpty()) {
            category.Format(_T("Category%i"),account.category+1);
            GetPrivateProfileString("Categories",category,category,buffer,size,ini);
            g.pszGroupName=buffer;
        }
        g.pszGroupName=category.GetBuffer();

        // Create each category only once; empty categories are not created.
        DWORD dwGroupId=m_Database->GetGroupId(g.pszGroupName);
        if (dwGroupId==DWORD_MAX) {
            m_Database->AddGroup(&g);
            dwGroupId=m_Database->GetGroupId(g.pszGroupName);
        }

        ZeroMemory(&e,sizeof(PW_ENTRY));
        // BYTE uuid[16];
        e.uGroupId=dwGroupId;
        e.uImageId=g.uImageId;

        CA2CT pszTitle(account.name.c_str());
        e.pszTitle=const_cast<TCHAR*>(pszTitle.m_psz);

        CA2CT pszURL(account.url.c_str());
        e.pszURL=const_cast<TCHAR*>(pszURL.m_psz);

        CA2CT pszUserName(account.username.c_str());
        e.pszUserName=const_cast<TCHAR*>(pszUserName.m_psz);

        CA2CT pszPassword(account.password.c_str());
        e.pszPassword=const_cast<TCHAR*>(pszPassword.m_psz);
        e.uPasswordLen=static_cast<DWORD>(_tcslen(e.pszPassword));

        std::string additional;

        if (!account.email.empty()) {
            additional+="Email:\n"+account.email;
        }

        if (!account.note.empty()) {
            if (!additional.empty()) {
                additional+="\n\n";
            }
            additional+="Note:\n"+account.note;
        }

        if (!account.memo.empty()) {
            if (!additional.empty()) {
                additional+="\n\n";
            }
            additional+="Memo:\n"+account.memo;
        }

        CA2CT pszAdditional(additional.c_str());
        e.pszAdditional=const_cast<TCHAR*>(pszAdditional.m_psz);

        e.tCreation=ConvertDateTime(account.created);
        e.tLastMod=ConvertDateTime(account.created);
        e.tLastAccess=g.tLastAccess;
        if (account.expires.isValid()) {
            e.tExpire=ConvertDateTime(account.expires);
        }
        else {
            m_PluginAPI->GetNeverExpireTime(&e.tExpire);
        }

        // TCHAR *pszBinaryDesc;
        // BYTE *pBinaryData;
        // DWORD uBinaryDataLen;

        m_Database->AddEntry(&e);
    }

    m_PluginAPI->SetFileModified(TRUE);
    m_PluginAPI->UpdateUI();
    m_PluginAPI->UpdateToolBar();

    INT item=m_PluginAPI->GetEntryListItemCount();
    m_PluginAPI->EntryListEnsureVisible(item,FALSE);

    return true;
}