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

Method RequestArcPassword

Libraries/unrar/arcread.cpp:907–946  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

905
906#if !defined(RAR_NOCRYPT)
907void Archive::RequestArcPassword()
908{
909 if (!Cmd->Password.IsSet())
910 {
911#ifdef RARDLL
912 if (Cmd->Callback!=NULL)
913 {
914 wchar PasswordW[MAXPASSWORD];
915 *PasswordW=0;
916 if (Cmd->Callback(UCM_NEEDPASSWORDW,Cmd->UserData,(LPARAM)PasswordW,ASIZE(PasswordW))==-1)
917 *PasswordW=0;
918 if (*PasswordW==0)
919 {
920 char PasswordA[MAXPASSWORD];
921 *PasswordA=0;
922 if (Cmd->Callback(UCM_NEEDPASSWORD,Cmd->UserData,(LPARAM)PasswordA,ASIZE(PasswordA))==-1)
923 *PasswordA=0;
924 GetWideName(PasswordA,NULL,PasswordW,ASIZE(PasswordW));
925 cleandata(PasswordA,sizeof(PasswordA));
926 }
927 Cmd->Password.Set(PasswordW);
928 cleandata(PasswordW,sizeof(PasswordW));
929 }
930 if (!Cmd->Password.IsSet())
931 {
932 Close();
933 Cmd->DllError=ERAR_MISSING_PASSWORD;
934 ErrHandler.Exit(RARX_USERBREAK);
935 }
936#else
937 if (!uiGetPassword(UIPASSWORD_ARCHIVE,FileName,&Cmd->Password))
938 {
939 Close();
940 uiMsg(UIERROR_INCERRCOUNT); // Prevent archive deleting if delete after extraction is on.
941 ErrHandler.Exit(RARX_USERBREAK);
942 }
943#endif
944 Cmd->ManualPassword=true;
945 }
946}
947#endif
948
949

Callers

nothing calls this directly

Calls 7

GetWideNameFunction · 0.85
cleandataFunction · 0.85
uiMsgFunction · 0.85
SetMethod · 0.80
ExitMethod · 0.80
uiGetPasswordFunction · 0.70
IsSetMethod · 0.45

Tested by

no test coverage detected