MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / ExtrGetPassword

Method ExtrGetPassword

Libraries/unrar/extract.cpp:986–1022  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

984
985#ifndef RARDLL
986bool CmdExtract::ExtrGetPassword(Archive &Arc,const wchar *ArcFileName)
987{
988 if (!Cmd->Password.IsSet())
989 {
990 if (!uiGetPassword(UIPASSWORD_FILE,ArcFileName,&Cmd->Password)/* || !Cmd->Password.IsSet()*/)
991 {
992 // Suppress "test is ok" message if user cancelled the password prompt.
993// 2019.03.23: If some archives are tested ok and prompt is cancelled for others,
994// do we really need to suppress "test is ok"? Also if we set an empty password
995// and "Use for all archives" in WinRAR Ctrl+P and skip some encrypted archives.
996// We commented out this UIERROR_INCERRCOUNT for now.
997// uiMsg(UIERROR_INCERRCOUNT);
998 return false;
999 }
1000 Cmd->ManualPassword=true;
1001 }
1002#if !defined(SILENT)
1003 else
1004 if (!GlobalPassword && !Arc.FileHead.Solid)
1005 {
1006 eprintf(St(MUseCurPsw),ArcFileName);
1007 switch(Cmd->AllYes ? 1 : Ask(St(MYesNoAll)))
1008 {
1009 case -1:
1010 ErrHandler.Exit(RARX_USERBREAK);
1011 case 2:
1012 if (!uiGetPassword(UIPASSWORD_FILE,ArcFileName,&Cmd->Password))
1013 return false;
1014 break;
1015 case 3:
1016 GlobalPassword=true;
1017 break;
1018 }
1019 }
1020#endif
1021 return true;
1022}
1023#endif
1024
1025

Callers

nothing calls this directly

Calls 6

StFunction · 0.85
ExitMethod · 0.80
uiGetPasswordFunction · 0.70
eprintfFunction · 0.70
AskFunction · 0.70
IsSetMethod · 0.45

Tested by

no test coverage detected