1 // OpenCallbackConsole.cpp
2 
3 #include "StdAfx.h"
4 
5 #include "OpenCallbackConsole.h"
6 
7 #include "ConsoleClose.h"
8 #include "UserInputUtils.h"
9 
Open_CheckBreak()10 HRESULT COpenCallbackConsole::Open_CheckBreak()
11 {
12   if (NConsoleClose::TestBreakSignal())
13     return E_ABORT;
14   return S_OK;
15 }
16 
Open_SetTotal(const UInt64 *,const UInt64 *)17 HRESULT COpenCallbackConsole::Open_SetTotal(const UInt64 *, const UInt64 *)
18 {
19   return Open_CheckBreak();
20 }
21 
Open_SetCompleted(const UInt64 *,const UInt64 *)22 HRESULT COpenCallbackConsole::Open_SetCompleted(const UInt64 *, const UInt64 *)
23 {
24   return Open_CheckBreak();
25 }
26 
27 #ifndef _NO_CRYPTO
28 
Open_CryptoGetTextPassword(BSTR * password)29 HRESULT 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 
Open_GetPasswordIfAny(UString & password)41 HRESULT COpenCallbackConsole::Open_GetPasswordIfAny(UString &password)
42 {
43   if (PasswordIsDefined)
44     password = Password;
45   return S_OK;
46 }
47 
Open_WasPasswordAsked()48 bool COpenCallbackConsole::Open_WasPasswordAsked()
49 {
50   return PasswordWasAsked;
51 }
52 
Open_ClearPasswordWasAskedFlag()53 void COpenCallbackConsole::Open_ClearPasswordWasAskedFlag()
54 {
55   PasswordWasAsked = false;
56 }
57 
58 #endif
59