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