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