1// OpenCallbackConsole.cpp
2
3#include "StdAfx.h"
4
5#include "OpenCallbackConsole.h"
6
7#include "ConsoleClose.h"
8#include "UserInputUtils.h"
9
10HRESULT COpenCallbackConsole::Open_CheckBreak()
11{
12  if (NConsoleClose::TestBreakSignal())
13    return E_ABORT;
14  return S_OK;
15}
16
17HRESULT COpenCallbackConsole::Open_SetTotal(const UInt64 *, const UInt64 *)
18{
19  return Open_CheckBreak();
20}
21
22HRESULT COpenCallbackConsole::Open_SetCompleted(const UInt64 *, const UInt64 *)
23{
24  return Open_CheckBreak();
25}
26
27#ifndef _NO_CRYPTO
28
29HRESULT COpenCallbackConsole::Open_CryptoGetTextPassword(BSTR *password)
30{
31  PasswordWasAsked = true;
32  RINOK(Open_CheckBreak());
33  if (!PasswordIsDefined)
34  {
35    Password = GetPassword(OutStream);
36    PasswordIsDefined = true;
37  }
38  return StringToBstr(Password, password);
39}
40
41HRESULT COpenCallbackConsole::Open_GetPasswordIfAny(bool &passwordIsDefined, UString &password)
42{
43  passwordIsDefined = PasswordIsDefined;
44  password = Password;
45  return S_OK;
46}
47
48bool COpenCallbackConsole::Open_WasPasswordAsked()
49{
50  return PasswordWasAsked;
51}
52
53void COpenCallbackConsole::Open_ClearPasswordWasAskedFlag()
54{
55  PasswordWasAsked = false;
56}
57
58#endif
59