1370b324cSopenharmony_ci// IPassword.h
2370b324cSopenharmony_ci
3370b324cSopenharmony_ci#ifndef ZIP7_INC_IPASSWORD_H
4370b324cSopenharmony_ci#define ZIP7_INC_IPASSWORD_H
5370b324cSopenharmony_ci
6370b324cSopenharmony_ci#include "../Common/MyTypes.h"
7370b324cSopenharmony_ci
8370b324cSopenharmony_ci#include "IDecl.h"
9370b324cSopenharmony_ci
10370b324cSopenharmony_ciZ7_PURE_INTERFACES_BEGIN
11370b324cSopenharmony_ci
12370b324cSopenharmony_ci#define Z7_IFACE_CONSTR_PASSWORD(i, n) \
13370b324cSopenharmony_ci  Z7_DECL_IFACE_7ZIP(i, 5, n) \
14370b324cSopenharmony_ci  { Z7_IFACE_COM7_PURE(i) };
15370b324cSopenharmony_ci
16370b324cSopenharmony_ci/*
17370b324cSopenharmony_ciHow to use output parameter (BSTR *password):
18370b324cSopenharmony_ci
19370b324cSopenharmony_ciin:  The caller is required to set BSTR value as NULL (no string).
20370b324cSopenharmony_ci     The callee (in 7-Zip code) ignores the input value stored in BSTR variable,
21370b324cSopenharmony_ci
22370b324cSopenharmony_ciout: The callee rewrites BSTR variable (*password) with new allocated string pointer.
23370b324cSopenharmony_ci     The caller must free BSTR string with function SysFreeString();
24370b324cSopenharmony_ci*/
25370b324cSopenharmony_ci
26370b324cSopenharmony_ci#define Z7_IFACEM_ICryptoGetTextPassword(x) \
27370b324cSopenharmony_ci  x(CryptoGetTextPassword(BSTR *password))
28370b324cSopenharmony_ciZ7_IFACE_CONSTR_PASSWORD(ICryptoGetTextPassword, 0x10)
29370b324cSopenharmony_ci
30370b324cSopenharmony_ci
31370b324cSopenharmony_ci/*
32370b324cSopenharmony_ciCryptoGetTextPassword2()
33370b324cSopenharmony_ciin:
34370b324cSopenharmony_ci  The caller is required to set BSTR value as NULL (no string).
35370b324cSopenharmony_ci  The caller is not required to set (*passwordIsDefined) value.
36370b324cSopenharmony_ci
37370b324cSopenharmony_ciout:
38370b324cSopenharmony_ci  Return code: != S_OK : error code
39370b324cSopenharmony_ci  Return code:    S_OK : success
40370b324cSopenharmony_ci
41370b324cSopenharmony_ci  if (*passwordIsDefined == 1), the variable (*password) contains password string
42370b324cSopenharmony_ci
43370b324cSopenharmony_ci  if (*passwordIsDefined == 0), the password is not defined,
44370b324cSopenharmony_ci     but the callee still could set (*password) to some allocated string, for example, as empty string.
45370b324cSopenharmony_ci
46370b324cSopenharmony_ci  The caller must free BSTR string with function SysFreeString()
47370b324cSopenharmony_ci*/
48370b324cSopenharmony_ci
49370b324cSopenharmony_ci#define Z7_IFACEM_ICryptoGetTextPassword2(x) \
50370b324cSopenharmony_ci  x(CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password))
51370b324cSopenharmony_ciZ7_IFACE_CONSTR_PASSWORD(ICryptoGetTextPassword2, 0x11)
52370b324cSopenharmony_ci
53370b324cSopenharmony_ciZ7_PURE_INTERFACES_END
54370b324cSopenharmony_ci#endif
55