| 905 | |
| 906 | #if !defined(RAR_NOCRYPT) |
| 907 | void 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 |
nothing calls this directly
no test coverage detected