1111 BOOL , DWORD , FILETIME , LPCWSTR )
1212
1313from win32ctypes .core .compat import is_text
14- from ._common import LPBYTE , _PyBytes_FromStringAndSize
15- from ._util import function_factory , check_zero_factory , dlls
14+ from ._common import LPBYTE , _PyBytes_FromStringAndSize , PDWORD
15+ from ._util import function_factory , check_false_factory , dlls
1616from ._nl_support import _GetACP
1717
1818
@@ -67,17 +67,19 @@ def fromdict(cls, credential, flags=0):
6767
6868
6969PCREDENTIAL = POINTER (CREDENTIAL )
70+ PPCREDENTIAL = POINTER (PCREDENTIAL )
71+ PPPCREDENTIAL = POINTER (PPCREDENTIAL )
7072
7173
72- def make_unicode (password ):
74+ def make_unicode (text ):
7375 """ Convert the input string to unicode.
7476
7577 """
76- if is_text (password ):
77- return password
78+ if is_text (text ):
79+ return text
7880 else :
7981 code_page = _GetACP ()
80- return password .decode (encoding = str (code_page ), errors = 'strict' )
82+ return text .decode (encoding = str (code_page ), errors = 'strict' )
8183
8284
8385def credential2dict (creds ):
@@ -93,22 +95,33 @@ def credential2dict(creds):
9395 return credential
9496
9597
98+ def _CredEnumerate (Filter , Flags , Count , pppCredential ):
99+ filter_ = LPCWSTR (Filter )
100+ _BaseCredEnumerate (filter_ , Flags , Count , pppCredential )
101+
102+
96103_CredWrite = function_factory (
97104 dlls .advapi32 .CredWriteW ,
98105 [PCREDENTIAL , DWORD ],
99106 BOOL ,
100- check_zero_factory ("CredWrite" ))
107+ check_false_factory ("CredWrite" ))
101108
102109_CredRead = function_factory (
103110 dlls .advapi32 .CredReadW ,
104- [LPCWSTR , DWORD , DWORD , POINTER ( PCREDENTIAL ) ],
111+ [LPCWSTR , DWORD , DWORD , PPCREDENTIAL ],
105112 BOOL ,
106- check_zero_factory ("CredRead" ))
113+ check_false_factory ("CredRead" ))
107114
108115_CredDelete = function_factory (
109116 dlls .advapi32 .CredDeleteW ,
110117 [LPCWSTR , DWORD , DWORD ],
111118 BOOL ,
112- check_zero_factory ("CredDelete" ))
119+ check_false_factory ("CredDelete" ))
120+
121+ _BaseCredEnumerate = function_factory (
122+ dlls .advapi32 .CredEnumerateW ,
123+ [LPCWSTR , DWORD , PDWORD , PPPCREDENTIAL ],
124+ BOOL ,
125+ check_false_factory ("CredEnumerate" ))
113126
114127_CredFree = function_factory (dlls .advapi32 .CredFree , [PCREDENTIAL ])
0 commit comments