1 // IPassword.h 2 3 #ifndef __IPASSWORD_H 4 #define __IPASSWORD_H 5 6 #include "../Common/MyTypes.h" 7 #include "../Common/MyUnknown.h" 8 9 #include "IDecl.h" 10 11 #define PASSWORD_INTERFACE(i, x) DECL_INTERFACE(i, 5, x) 12 13 /* 14 How to use output parameter (BSTR *password): 15 16 in: The caller is required to set BSTR value as NULL (no string). 17 The callee (in 7-Zip code) ignores the input value stored in BSTR variable, 18 19 out: The callee rewrites BSTR variable (*password) with new allocated string pointer. 20 The caller must free BSTR string with function SysFreeString(); 21 */ 22 23 PASSWORD_INTERFACE(ICryptoGetTextPassword, 0x10) 24 { 25 STDMETHOD(CryptoGetTextPassword)(BSTR *password) PURE; 26 }; 27 28 29 /* 30 CryptoGetTextPassword2() 31 in: 32 The caller is required to set BSTR value as NULL (no string). 33 The caller is not required to set (*passwordIsDefined) value. 34 35 out: 36 Return code: != S_OK : error code 37 Return code: S_OK : success 38 39 if (*passwordIsDefined == 1), the variable (*password) contains password string 40 41 if (*passwordIsDefined == 0), the password is not defined, 42 but the callee still could set (*password) to some allocated string, for example, as empty string. 43 44 The caller must free BSTR string with function SysFreeString() 45 */ 46 47 48 PASSWORD_INTERFACE(ICryptoGetTextPassword2, 0x11) 49 { 50 STDMETHOD(CryptoGetTextPassword2)(Int32 *passwordIsDefined, BSTR *password) PURE; 51 }; 52 53 #endif 54