1 | /**
|
---|
2 | * This file has no copyright assigned and is placed in the Public Domain.
|
---|
3 | * This file is part of the mingw-w64 runtime package.
|
---|
4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
---|
5 | */
|
---|
6 | #ifndef _WINCRED_H_
|
---|
7 | #define _WINCRED_H_
|
---|
8 |
|
---|
9 | #include <_mingw.h>
|
---|
10 | #include <_mingw_unicode.h>
|
---|
11 | #include <apisetcconv.h>
|
---|
12 |
|
---|
13 | #ifdef __cplusplus
|
---|
14 | extern "C" {
|
---|
15 | #endif
|
---|
16 |
|
---|
17 | #ifndef __SECHANDLE_DEFINED__
|
---|
18 | #define __SECHANDLE_DEFINED__
|
---|
19 |
|
---|
20 | typedef struct _SecHandle {
|
---|
21 | ULONG_PTR dwLower;
|
---|
22 | ULONG_PTR dwUpper;
|
---|
23 | } SecHandle,*PSecHandle;
|
---|
24 | #endif
|
---|
25 |
|
---|
26 | typedef PSecHandle PCtxtHandle;
|
---|
27 |
|
---|
28 | #ifndef _WINBASE_
|
---|
29 | #ifndef _FILETIME_
|
---|
30 | #define _FILETIME_
|
---|
31 |
|
---|
32 | typedef struct _FILETIME {
|
---|
33 | DWORD dwLowDateTime;
|
---|
34 | DWORD dwHighDateTime;
|
---|
35 | } FILETIME;
|
---|
36 |
|
---|
37 | typedef struct _FILETIME *PFILETIME;
|
---|
38 | typedef struct _FILETIME *LPFILETIME;
|
---|
39 | #endif
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #if !defined (_NTDEF_) && !defined (_NTSTATUS_PSDK)
|
---|
43 | #define _NTSTATUS_PSDK
|
---|
44 | typedef LONG NTSTATUS,*PNTSTATUS;
|
---|
45 | #endif
|
---|
46 |
|
---|
47 | #define STATUS_LOGON_FAILURE ((NTSTATUS)0xC000006D)
|
---|
48 | #define STATUS_WRONG_PASSWORD ((NTSTATUS)0xC000006A)
|
---|
49 | #define STATUS_PASSWORD_EXPIRED ((NTSTATUS)0xC0000071)
|
---|
50 | #define STATUS_PASSWORD_MUST_CHANGE ((NTSTATUS)0xC0000224)
|
---|
51 | #define STATUS_ACCESS_DENIED ((NTSTATUS)0xC0000022)
|
---|
52 | #define STATUS_DOWNGRADE_DETECTED ((NTSTATUS)0xC0000388)
|
---|
53 | #define STATUS_AUTHENTICATION_FIREWALL_FAILED ((NTSTATUS)0xC0000413)
|
---|
54 | #define STATUS_ACCOUNT_DISABLED ((NTSTATUS)0xC0000072)
|
---|
55 | #define STATUS_ACCOUNT_RESTRICTION ((NTSTATUS)0xC000006E)
|
---|
56 | #define STATUS_ACCOUNT_LOCKED_OUT ((NTSTATUS)0xC0000234)
|
---|
57 | #define STATUS_ACCOUNT_EXPIRED ((NTSTATUS)0xC0000193)
|
---|
58 | #define STATUS_LOGON_TYPE_NOT_GRANTED ((NTSTATUS)0xC000015B)
|
---|
59 |
|
---|
60 | #define NERR_BASE 2100
|
---|
61 | #define NERR_PasswordExpired (NERR_BASE+142)
|
---|
62 |
|
---|
63 | #define CREDUIP_IS_USER_PASSWORD_ERROR(_Status) ((_Status)==ERROR_LOGON_FAILURE || (_Status)==HRESULT_FROM_WIN32(ERROR_LOGON_FAILURE) || (_Status)==STATUS_LOGON_FAILURE || (_Status)==HRESULT_FROM_NT(STATUS_LOGON_FAILURE) || (_Status)==ERROR_ACCESS_DENIED || (_Status)==HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED) || (_Status)==STATUS_ACCESS_DENIED || (_Status)==HRESULT_FROM_NT(STATUS_ACCESS_DENIED) || (_Status)==ERROR_INVALID_PASSWORD || (_Status)==HRESULT_FROM_WIN32(ERROR_INVALID_PASSWORD) || (_Status)==STATUS_WRONG_PASSWORD || (_Status)==HRESULT_FROM_NT(STATUS_WRONG_PASSWORD) || (_Status)==SEC_E_NO_CREDENTIALS || (_Status)==SEC_E_LOGON_DENIED)
|
---|
64 | #define CREDUIP_IS_DOWNGRADE_ERROR(_Status) ((_Status)==ERROR_DOWNGRADE_DETECTED || (_Status)==HRESULT_FROM_WIN32(ERROR_DOWNGRADE_DETECTED) || (_Status)==STATUS_DOWNGRADE_DETECTED || (_Status)==HRESULT_FROM_NT(STATUS_DOWNGRADE_DETECTED))
|
---|
65 | #define CREDUIP_IS_EXPIRED_ERROR(_Status) ((_Status)==ERROR_PASSWORD_EXPIRED || (_Status)==HRESULT_FROM_WIN32(ERROR_PASSWORD_EXPIRED) || (_Status)==STATUS_PASSWORD_EXPIRED || (_Status)==HRESULT_FROM_NT(STATUS_PASSWORD_EXPIRED) || (_Status)==ERROR_PASSWORD_MUST_CHANGE || (_Status)==HRESULT_FROM_WIN32(ERROR_PASSWORD_MUST_CHANGE) || (_Status)==STATUS_PASSWORD_MUST_CHANGE || (_Status)==HRESULT_FROM_NT(STATUS_PASSWORD_MUST_CHANGE) || (_Status)==NERR_PasswordExpired || (_Status)==HRESULT_FROM_WIN32(NERR_PasswordExpired))
|
---|
66 | #define CREDUI_IS_AUTHENTICATION_ERROR(_Status) (CREDUIP_IS_USER_PASSWORD_ERROR(_Status) || CREDUIP_IS_DOWNGRADE_ERROR(_Status) || CREDUIP_IS_EXPIRED_ERROR(_Status))
|
---|
67 | #define CREDUI_NO_PROMPT_AUTHENTICATION_ERROR(_Status) ((_Status)==ERROR_AUTHENTICATION_FIREWALL_FAILED || (_Status)==HRESULT_FROM_WIN32(ERROR_AUTHENTICATION_FIREWALL_FAILED) || (_Status)==STATUS_AUTHENTICATION_FIREWALL_FAILED || (_Status)==HRESULT_FROM_NT(STATUS_AUTHENTICATION_FIREWALL_FAILED) || (_Status)==ERROR_ACCOUNT_DISABLED || (_Status)==HRESULT_FROM_WIN32(ERROR_ACCOUNT_DISABLED) || (_Status)==STATUS_ACCOUNT_DISABLED || (_Status)==HRESULT_FROM_NT(STATUS_ACCOUNT_DISABLED) || (_Status)==ERROR_ACCOUNT_RESTRICTION || (_Status)==HRESULT_FROM_WIN32(ERROR_ACCOUNT_RESTRICTION) || (_Status)==STATUS_ACCOUNT_RESTRICTION || (_Status)==HRESULT_FROM_NT(STATUS_ACCOUNT_RESTRICTION) || (_Status)==ERROR_ACCOUNT_LOCKED_OUT || (_Status)==HRESULT_FROM_WIN32(ERROR_ACCOUNT_LOCKED_OUT) || (_Status)==STATUS_ACCOUNT_LOCKED_OUT || (_Status)==HRESULT_FROM_NT(STATUS_ACCOUNT_LOCKED_OUT) || (_Status)==ERROR_ACCOUNT_EXPIRED || (_Status)==HRESULT_FROM_WIN32(ERROR_ACCOUNT_EXPIRED) || (_Status)==STATUS_ACCOUNT_EXPIRED || (_Status)==HRESULT_FROM_NT(STATUS_ACCOUNT_EXPIRED) || (_Status)==ERROR_LOGON_TYPE_NOT_GRANTED || (_Status)==HRESULT_FROM_WIN32(ERROR_LOGON_TYPE_NOT_GRANTED) || (_Status)==STATUS_LOGON_TYPE_NOT_GRANTED || (_Status)==HRESULT_FROM_NT(STATUS_LOGON_TYPE_NOT_GRANTED))
|
---|
68 |
|
---|
69 | #define CRED_MAX_STRING_LENGTH 256
|
---|
70 | #define CRED_MAX_USERNAME_LENGTH (256+1+256)
|
---|
71 | #define CRED_MAX_GENERIC_TARGET_NAME_LENGTH 32767
|
---|
72 | #define CRED_MAX_DOMAIN_TARGET_NAME_LENGTH (256+1+80)
|
---|
73 | #define CRED_MAX_VALUE_SIZE 256
|
---|
74 | #define CRED_MAX_ATTRIBUTES 64
|
---|
75 |
|
---|
76 | typedef struct _CREDENTIAL_ATTRIBUTEA {
|
---|
77 | LPSTR Keyword;
|
---|
78 | DWORD Flags;
|
---|
79 | DWORD ValueSize;
|
---|
80 | LPBYTE Value;
|
---|
81 | } CREDENTIAL_ATTRIBUTEA,*PCREDENTIAL_ATTRIBUTEA;
|
---|
82 |
|
---|
83 | typedef struct _CREDENTIAL_ATTRIBUTEW {
|
---|
84 | LPWSTR Keyword;
|
---|
85 | DWORD Flags;
|
---|
86 | DWORD ValueSize;
|
---|
87 | LPBYTE Value;
|
---|
88 | } CREDENTIAL_ATTRIBUTEW,*PCREDENTIAL_ATTRIBUTEW;
|
---|
89 |
|
---|
90 | __MINGW_TYPEDEF_AW(CREDENTIAL_ATTRIBUTE)
|
---|
91 | __MINGW_TYPEDEF_AW(PCREDENTIAL_ATTRIBUTE)
|
---|
92 |
|
---|
93 | #define CRED_SESSION_WILDCARD_NAME_W L"*Session"
|
---|
94 | #define CRED_SESSION_WILDCARD_NAME_A "*Session"
|
---|
95 | #define CRED_SESSION_WILDCARD_NAME_LENGTH (sizeof(CRED_SESSION_WILDCARD_NAME_A)-1)
|
---|
96 |
|
---|
97 | #define CRED_SESSION_WILDCARD_NAME __MINGW_NAME_UAW(CRED_SESSION_WILDCARD_NAME)
|
---|
98 |
|
---|
99 | #define CRED_FLAGS_PASSWORD_FOR_CERT 0x0001
|
---|
100 | #define CRED_FLAGS_PROMPT_NOW 0x0002
|
---|
101 | #define CRED_FLAGS_USERNAME_TARGET 0x0004
|
---|
102 | #define CRED_FLAGS_OWF_CRED_BLOB 0x0008
|
---|
103 | #define CRED_FLAGS_VALID_FLAGS 0x000F
|
---|
104 |
|
---|
105 | #define CRED_TYPE_GENERIC 1
|
---|
106 | #define CRED_TYPE_DOMAIN_PASSWORD 2
|
---|
107 | #define CRED_TYPE_DOMAIN_CERTIFICATE 3
|
---|
108 | #define CRED_TYPE_DOMAIN_VISIBLE_PASSWORD 4
|
---|
109 | #define CRED_TYPE_MAXIMUM 5
|
---|
110 | #define CRED_TYPE_MAXIMUM_EX (CRED_TYPE_MAXIMUM+1000)
|
---|
111 |
|
---|
112 | #define CRED_MAX_CREDENTIAL_BLOB_SIZE 512
|
---|
113 |
|
---|
114 | #define CRED_PERSIST_NONE 0
|
---|
115 | #define CRED_PERSIST_SESSION 1
|
---|
116 | #define CRED_PERSIST_LOCAL_MACHINE 2
|
---|
117 | #define CRED_PERSIST_ENTERPRISE 3
|
---|
118 |
|
---|
119 | typedef struct _CREDENTIALA {
|
---|
120 | DWORD Flags;
|
---|
121 | DWORD Type;
|
---|
122 | LPSTR TargetName;
|
---|
123 | LPSTR Comment;
|
---|
124 | FILETIME LastWritten;
|
---|
125 | DWORD CredentialBlobSize;
|
---|
126 | LPBYTE CredentialBlob;
|
---|
127 | DWORD Persist;
|
---|
128 | DWORD AttributeCount;
|
---|
129 | PCREDENTIAL_ATTRIBUTEA Attributes;
|
---|
130 | LPSTR TargetAlias;
|
---|
131 | LPSTR UserName;
|
---|
132 | } CREDENTIALA,*PCREDENTIALA;
|
---|
133 |
|
---|
134 | typedef struct _CREDENTIALW {
|
---|
135 | DWORD Flags;
|
---|
136 | DWORD Type;
|
---|
137 | LPWSTR TargetName;
|
---|
138 | LPWSTR Comment;
|
---|
139 | FILETIME LastWritten;
|
---|
140 | DWORD CredentialBlobSize;
|
---|
141 | LPBYTE CredentialBlob;
|
---|
142 | DWORD Persist;
|
---|
143 | DWORD AttributeCount;
|
---|
144 | PCREDENTIAL_ATTRIBUTEW Attributes;
|
---|
145 | LPWSTR TargetAlias;
|
---|
146 | LPWSTR UserName;
|
---|
147 | } CREDENTIALW,*PCREDENTIALW;
|
---|
148 |
|
---|
149 | __MINGW_TYPEDEF_AW(CREDENTIAL)
|
---|
150 | __MINGW_TYPEDEF_AW(PCREDENTIAL)
|
---|
151 |
|
---|
152 | #define CRED_TI_SERVER_FORMAT_UNKNOWN 0x0001
|
---|
153 | #define CRED_TI_DOMAIN_FORMAT_UNKNOWN 0x0002
|
---|
154 | #define CRED_TI_ONLY_PASSWORD_REQUIRED 0x0004
|
---|
155 | #define CRED_TI_USERNAME_TARGET 0x0008
|
---|
156 | #define CRED_TI_CREATE_EXPLICIT_CRED 0x0010
|
---|
157 | #define CRED_TI_WORKGROUP_MEMBER 0x0020
|
---|
158 | #define CRED_TI_VALID_FLAGS 0x003F
|
---|
159 |
|
---|
160 | typedef struct _CREDENTIAL_TARGET_INFORMATIONA {
|
---|
161 | LPSTR TargetName;
|
---|
162 | LPSTR NetbiosServerName;
|
---|
163 | LPSTR DnsServerName;
|
---|
164 | LPSTR NetbiosDomainName;
|
---|
165 | LPSTR DnsDomainName;
|
---|
166 | LPSTR DnsTreeName;
|
---|
167 | LPSTR PackageName;
|
---|
168 | ULONG Flags;
|
---|
169 | DWORD CredTypeCount;
|
---|
170 | LPDWORD CredTypes;
|
---|
171 | } CREDENTIAL_TARGET_INFORMATIONA,*PCREDENTIAL_TARGET_INFORMATIONA;
|
---|
172 |
|
---|
173 | typedef struct _CREDENTIAL_TARGET_INFORMATIONW {
|
---|
174 | LPWSTR TargetName;
|
---|
175 | LPWSTR NetbiosServerName;
|
---|
176 | LPWSTR DnsServerName;
|
---|
177 | LPWSTR NetbiosDomainName;
|
---|
178 | LPWSTR DnsDomainName;
|
---|
179 | LPWSTR DnsTreeName;
|
---|
180 | LPWSTR PackageName;
|
---|
181 | ULONG Flags;
|
---|
182 | DWORD CredTypeCount;
|
---|
183 | LPDWORD CredTypes;
|
---|
184 | } CREDENTIAL_TARGET_INFORMATIONW,*PCREDENTIAL_TARGET_INFORMATIONW;
|
---|
185 |
|
---|
186 | __MINGW_TYPEDEF_AW(CREDENTIAL_TARGET_INFORMATION)
|
---|
187 | __MINGW_TYPEDEF_AW(PCREDENTIAL_TARGET_INFORMATION)
|
---|
188 |
|
---|
189 | #define CERT_HASH_LENGTH 20
|
---|
190 |
|
---|
191 | typedef struct _CERT_CREDENTIAL_INFO {
|
---|
192 | ULONG cbSize;
|
---|
193 | UCHAR rgbHashOfCert[CERT_HASH_LENGTH];
|
---|
194 | } CERT_CREDENTIAL_INFO,*PCERT_CREDENTIAL_INFO;
|
---|
195 |
|
---|
196 | typedef struct _USERNAME_TARGET_CREDENTIAL_INFO {
|
---|
197 | LPWSTR UserName;
|
---|
198 | } USERNAME_TARGET_CREDENTIAL_INFO,*PUSERNAME_TARGET_CREDENTIAL_INFO;
|
---|
199 |
|
---|
200 | typedef enum _CRED_MARSHAL_TYPE {
|
---|
201 | CertCredential = 1,UsernameTargetCredential
|
---|
202 | } CRED_MARSHAL_TYPE,*PCRED_MARSHAL_TYPE;
|
---|
203 |
|
---|
204 | typedef struct _CREDUI_INFOA {
|
---|
205 | DWORD cbSize;
|
---|
206 | HWND hwndParent;
|
---|
207 | PCSTR pszMessageText;
|
---|
208 | PCSTR pszCaptionText;
|
---|
209 | HBITMAP hbmBanner;
|
---|
210 | } CREDUI_INFOA,*PCREDUI_INFOA;
|
---|
211 |
|
---|
212 | typedef struct _CREDUI_INFOW {
|
---|
213 | DWORD cbSize;
|
---|
214 | HWND hwndParent;
|
---|
215 | PCWSTR pszMessageText;
|
---|
216 | PCWSTR pszCaptionText;
|
---|
217 | HBITMAP hbmBanner;
|
---|
218 | } CREDUI_INFOW,*PCREDUI_INFOW;
|
---|
219 |
|
---|
220 | __MINGW_TYPEDEF_AW(CREDUI_INFO)
|
---|
221 | __MINGW_TYPEDEF_AW(PCREDUI_INFO)
|
---|
222 |
|
---|
223 | #define CREDUI_MAX_MESSAGE_LENGTH 32767
|
---|
224 | #define CREDUI_MAX_CAPTION_LENGTH 128
|
---|
225 | #define CREDUI_MAX_GENERIC_TARGET_LENGTH CRED_MAX_GENERIC_TARGET_NAME_LENGTH
|
---|
226 | #define CREDUI_MAX_DOMAIN_TARGET_LENGTH CRED_MAX_DOMAIN_TARGET_NAME_LENGTH
|
---|
227 | #define CREDUI_MAX_USERNAME_LENGTH CRED_MAX_USERNAME_LENGTH
|
---|
228 | #define CREDUI_MAX_PASSWORD_LENGTH (CRED_MAX_CREDENTIAL_BLOB_SIZE / 2)
|
---|
229 |
|
---|
230 | #define CREDUI_FLAGS_INCORRECT_PASSWORD 0x00001
|
---|
231 | #define CREDUI_FLAGS_DO_NOT_PERSIST 0x00002
|
---|
232 | #define CREDUI_FLAGS_REQUEST_ADMINISTRATOR 0x00004
|
---|
233 | #define CREDUI_FLAGS_EXCLUDE_CERTIFICATES 0x00008
|
---|
234 | #define CREDUI_FLAGS_REQUIRE_CERTIFICATE 0x00010
|
---|
235 | #define CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX 0x00040
|
---|
236 | #define CREDUI_FLAGS_ALWAYS_SHOW_UI 0x00080
|
---|
237 | #define CREDUI_FLAGS_REQUIRE_SMARTCARD 0x00100
|
---|
238 | #define CREDUI_FLAGS_PASSWORD_ONLY_OK 0x00200
|
---|
239 | #define CREDUI_FLAGS_VALIDATE_USERNAME 0x00400
|
---|
240 | #define CREDUI_FLAGS_COMPLETE_USERNAME 0x00800
|
---|
241 | #define CREDUI_FLAGS_PERSIST 0x01000
|
---|
242 | #define CREDUI_FLAGS_SERVER_CREDENTIAL 0x04000
|
---|
243 | #define CREDUI_FLAGS_EXPECT_CONFIRMATION 0x20000
|
---|
244 | #define CREDUI_FLAGS_GENERIC_CREDENTIALS 0x40000
|
---|
245 | #define CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS 0x80000
|
---|
246 | #define CREDUI_FLAGS_KEEP_USERNAME 0x100000
|
---|
247 |
|
---|
248 | #define CREDUI_FLAGS_PROMPT_VALID (CREDUI_FLAGS_INCORRECT_PASSWORD | CREDUI_FLAGS_DO_NOT_PERSIST | CREDUI_FLAGS_REQUEST_ADMINISTRATOR | CREDUI_FLAGS_EXCLUDE_CERTIFICATES | CREDUI_FLAGS_REQUIRE_CERTIFICATE | CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX | CREDUI_FLAGS_ALWAYS_SHOW_UI | CREDUI_FLAGS_REQUIRE_SMARTCARD | CREDUI_FLAGS_PASSWORD_ONLY_OK | CREDUI_FLAGS_VALIDATE_USERNAME | CREDUI_FLAGS_COMPLETE_USERNAME | CREDUI_FLAGS_PERSIST | CREDUI_FLAGS_SERVER_CREDENTIAL | CREDUI_FLAGS_EXPECT_CONFIRMATION | CREDUI_FLAGS_GENERIC_CREDENTIALS | CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS | CREDUI_FLAGS_KEEP_USERNAME)
|
---|
249 |
|
---|
250 | #define CRED_PRESERVE_CREDENTIAL_BLOB 0x1
|
---|
251 |
|
---|
252 | #define CredWrite __MINGW_NAME_AW(CredWrite)
|
---|
253 | #define CredRead __MINGW_NAME_AW(CredRead)
|
---|
254 | #define CredEnumerate __MINGW_NAME_AW(CredEnumerate)
|
---|
255 | #define CredWriteDomainCredentials __MINGW_NAME_AW(CredWriteDomainCredentials)
|
---|
256 | #define CredReadDomainCredentials __MINGW_NAME_AW(CredReadDomainCredentials)
|
---|
257 | #define CredDelete __MINGW_NAME_AW(CredDelete)
|
---|
258 | #define CredRename __MINGW_NAME_AW(CredRename)
|
---|
259 | #define CredGetTargetInfo __MINGW_NAME_AW(CredGetTargetInfo)
|
---|
260 | #define CredMarshalCredential __MINGW_NAME_AW(CredMarshalCredential)
|
---|
261 | #define CredUnmarshalCredential __MINGW_NAME_AW(CredUnmarshalCredential)
|
---|
262 | #define CredIsMarshaledCredential __MINGW_NAME_AW(CredIsMarshaledCredential)
|
---|
263 | #define CredUIPromptForCredentials __MINGW_NAME_AW(CredUIPromptForCredentials)
|
---|
264 | #define CredUIParseUserName __MINGW_NAME_AW(CredUIParseUserName)
|
---|
265 | #define CredUICmdLinePromptForCredentials __MINGW_NAME_AW(CredUICmdLinePromptForCredentials)
|
---|
266 | #define CredUIConfirmCredentials __MINGW_NAME_AW(CredUIConfirmCredentials)
|
---|
267 |
|
---|
268 | WINADVAPI WINBOOL WINAPI CredWriteW(PCREDENTIALW Credential,DWORD Flags);
|
---|
269 | WINADVAPI WINBOOL WINAPI CredWriteA(PCREDENTIALA Credential,DWORD Flags);
|
---|
270 | WINADVAPI WINBOOL WINAPI CredReadW(LPCWSTR TargetName,DWORD Type,DWORD Flags,PCREDENTIALW *Credential);
|
---|
271 | WINADVAPI WINBOOL WINAPI CredReadA(LPCSTR TargetName,DWORD Type,DWORD Flags,PCREDENTIALA *Credential);
|
---|
272 | WINADVAPI WINBOOL WINAPI CredEnumerateW(LPCWSTR Filter,DWORD Flags,DWORD *Count,PCREDENTIALW **Credential);
|
---|
273 | WINADVAPI WINBOOL WINAPI CredEnumerateA(LPCSTR Filter,DWORD Flags,DWORD *Count,PCREDENTIALA **Credential);
|
---|
274 | WINADVAPI WINBOOL WINAPI CredWriteDomainCredentialsW(PCREDENTIAL_TARGET_INFORMATIONW TargetInfo,PCREDENTIALW Credential,DWORD Flags);
|
---|
275 | WINADVAPI WINBOOL WINAPI CredWriteDomainCredentialsA(PCREDENTIAL_TARGET_INFORMATIONA TargetInfo,PCREDENTIALA Credential,DWORD Flags);
|
---|
276 |
|
---|
277 | #define CRED_CACHE_TARGET_INFORMATION 0x1
|
---|
278 |
|
---|
279 | WINADVAPI WINBOOL WINAPI CredReadDomainCredentialsW(PCREDENTIAL_TARGET_INFORMATIONW TargetInfo,DWORD Flags,DWORD *Count,PCREDENTIALW **Credential);
|
---|
280 | WINADVAPI WINBOOL WINAPI CredReadDomainCredentialsA(PCREDENTIAL_TARGET_INFORMATIONA TargetInfo,DWORD Flags,DWORD *Count,PCREDENTIALA **Credential);
|
---|
281 | WINADVAPI WINBOOL WINAPI CredDeleteW(LPCWSTR TargetName,DWORD Type,DWORD Flags);
|
---|
282 | WINADVAPI WINBOOL WINAPI CredDeleteA(LPCSTR TargetName,DWORD Type,DWORD Flags);
|
---|
283 | WINADVAPI WINBOOL WINAPI CredRenameW(LPCWSTR OldTargetName,LPCWSTR NewTargetName,DWORD Type,DWORD Flags);
|
---|
284 | WINADVAPI WINBOOL WINAPI CredRenameA(LPCSTR OldTargetName,LPCSTR NewTargetName,DWORD Type,DWORD Flags);
|
---|
285 |
|
---|
286 | #define CRED_ALLOW_NAME_RESOLUTION 0x1
|
---|
287 |
|
---|
288 | WINADVAPI WINBOOL WINAPI CredGetTargetInfoW(LPCWSTR TargetName,DWORD Flags,PCREDENTIAL_TARGET_INFORMATIONW *TargetInfo);
|
---|
289 | WINADVAPI WINBOOL WINAPI CredGetTargetInfoA(LPCSTR TargetName,DWORD Flags,PCREDENTIAL_TARGET_INFORMATIONA *TargetInfo);
|
---|
290 | WINADVAPI WINBOOL WINAPI CredMarshalCredentialW(CRED_MARSHAL_TYPE CredType,PVOID Credential,LPWSTR *MarshaledCredential);
|
---|
291 | WINADVAPI WINBOOL WINAPI CredMarshalCredentialA(CRED_MARSHAL_TYPE CredType,PVOID Credential,LPSTR *MarshaledCredential);
|
---|
292 | WINADVAPI WINBOOL WINAPI CredUnmarshalCredentialW(LPCWSTR MarshaledCredential,PCRED_MARSHAL_TYPE CredType,PVOID *Credential);
|
---|
293 | WINADVAPI WINBOOL WINAPI CredUnmarshalCredentialA(LPCSTR MarshaledCredential,PCRED_MARSHAL_TYPE CredType,PVOID *Credential);
|
---|
294 | WINADVAPI WINBOOL WINAPI CredIsMarshaledCredentialW(LPCWSTR MarshaledCredential);
|
---|
295 | WINADVAPI WINBOOL WINAPI CredIsMarshaledCredentialA(LPCSTR MarshaledCredential);
|
---|
296 | WINADVAPI WINBOOL WINAPI CredGetSessionTypes (DWORD MaximumPersistCount,LPDWORD MaximumPersist);
|
---|
297 | WINADVAPI VOID WINAPI CredFree (PVOID Buffer);
|
---|
298 | CREDUIAPI DWORD WINAPI CredUIPromptForCredentialsW(PCREDUI_INFOW pUiInfo,PCWSTR pszTargetName,PCtxtHandle pContext,DWORD dwAuthError,PWSTR pszUserName,ULONG ulUserNameBufferSize,PWSTR pszPassword,ULONG ulPasswordBufferSize,WINBOOL *save,DWORD dwFlags);
|
---|
299 | CREDUIAPI DWORD WINAPI CredUIPromptForCredentialsA(PCREDUI_INFOA pUiInfo,PCSTR pszTargetName,PCtxtHandle pContext,DWORD dwAuthError,PSTR pszUserName,ULONG ulUserNameBufferSize,PSTR pszPassword,ULONG ulPasswordBufferSize,WINBOOL *save,DWORD dwFlags);
|
---|
300 | CREDUIAPI DWORD WINAPI CredUIParseUserNameW(CONST WCHAR *UserName,WCHAR *user,ULONG userBufferSize,WCHAR *domain,ULONG domainBufferSize);
|
---|
301 | CREDUIAPI DWORD WINAPI CredUIParseUserNameA(CONST CHAR *userName,CHAR *user,ULONG userBufferSize,CHAR *domain,ULONG domainBufferSize);
|
---|
302 | CREDUIAPI DWORD WINAPI CredUICmdLinePromptForCredentialsW(PCWSTR pszTargetName,PCtxtHandle pContext,DWORD dwAuthError,PWSTR UserName,ULONG ulUserBufferSize,PWSTR pszPassword,ULONG ulPasswordBufferSize,PBOOL pfSave,DWORD dwFlags);
|
---|
303 | CREDUIAPI DWORD WINAPI CredUICmdLinePromptForCredentialsA(PCSTR pszTargetName,PCtxtHandle pContext,DWORD dwAuthError,PSTR UserName,ULONG ulUserBufferSize,PSTR pszPassword,ULONG ulPasswordBufferSize,PBOOL pfSave,DWORD dwFlags);
|
---|
304 | CREDUIAPI DWORD WINAPI CredUIConfirmCredentialsW(PCWSTR pszTargetName,WINBOOL bConfirm);
|
---|
305 | CREDUIAPI DWORD WINAPI CredUIConfirmCredentialsA(PCSTR pszTargetName,WINBOOL bConfirm);
|
---|
306 | CREDUIAPI DWORD WINAPI CredUIStoreSSOCredW (PCWSTR pszRealm,PCWSTR pszUsername,PCWSTR pszPassword,WINBOOL bPersist);
|
---|
307 | CREDUIAPI DWORD WINAPI CredUIReadSSOCredW (PCWSTR pszRealm,PWSTR *ppszUsername);
|
---|
308 |
|
---|
309 | #if (_WIN32_WINNT >= 0x0600)
|
---|
310 | #define CredFindBestCredential __MINGW_NAME_AW(CredFindBestCredential)
|
---|
311 | #define CredIsProtected __MINGW_NAME_AW(CredIsProtected)
|
---|
312 | #define CredPackAuthenticationBuffer __MINGW_NAME_AW(CredPackAuthenticationBuffer)
|
---|
313 | #define CredProtect __MINGW_NAME_AW(CredProtect)
|
---|
314 | #define CredUIPromptForWindowsCredentials __MINGW_NAME_AW(CredUIPromptForWindowsCredentials)
|
---|
315 | #define CredUnPackAuthenticationBuffer __MINGW_NAME_AW(CredUnPackAuthenticationBuffer)
|
---|
316 | #define CredUnprotect __MINGW_NAME_AW(CredUnprotect)
|
---|
317 |
|
---|
318 | #define CREDUIWIN_GENERIC 0x1
|
---|
319 | #define CREDUIWIN_CHECKBOX 0x2
|
---|
320 | #define CREDUIWIN_AUTHPACKAGE_ONLY 0x10
|
---|
321 | #define CREDUIWIN_IN_CRED_ONLY 0x20
|
---|
322 | #define CREDUIWIN_ENUMERATE_ADMINS 0x100
|
---|
323 | #define CREDUIWIN_ENUMERATE_CURRENT_USER 0x200
|
---|
324 | #define CREDUIWIN_SECURE_PROMPT 0x1000
|
---|
325 | #define CREDUIWIN_PACK_32_WOW 0x10000000
|
---|
326 |
|
---|
327 | typedef enum _CRED_PROTECTION_TYPE {
|
---|
328 | CredUnprotected = 0,
|
---|
329 | CredUserProtection = 1,
|
---|
330 | CredTrustedProtection = 2
|
---|
331 | } CRED_PROTECTION_TYPE, *PCRED_PROTECTION_TYPE;
|
---|
332 |
|
---|
333 | WINADVAPI WINBOOL WINAPI CredFindBestCredentialA(
|
---|
334 | LPCSTR TargetName,
|
---|
335 | DWORD Type,
|
---|
336 | DWORD Flags,
|
---|
337 | PCREDENTIALA *Credential
|
---|
338 | );
|
---|
339 |
|
---|
340 | WINADVAPI WINBOOL WINAPI CredFindBestCredentialW(
|
---|
341 | LPCWSTR TargetName,
|
---|
342 | DWORD Type,
|
---|
343 | DWORD Flags,
|
---|
344 | PCREDENTIALW *Credential
|
---|
345 | );
|
---|
346 |
|
---|
347 | WINADVAPI WINBOOL WINAPI CredIsProtectedA(
|
---|
348 | LPSTR pszProtectedCredentials,
|
---|
349 | CRED_PROTECTION_TYPE *pProtectionType
|
---|
350 | );
|
---|
351 |
|
---|
352 | WINADVAPI WINBOOL WINAPI CredIsProtectedW(
|
---|
353 | LPWSTR pszProtectedCredentials,
|
---|
354 | CRED_PROTECTION_TYPE *pProtectionType
|
---|
355 | );
|
---|
356 |
|
---|
357 | CREDUIAPI WINBOOL WINAPI CredPackAuthenticationBufferA(
|
---|
358 | DWORD dwFlags,
|
---|
359 | LPSTR pszUserName,
|
---|
360 | LPSTR pszPassword,
|
---|
361 | PBYTE pPackedCredentials,
|
---|
362 | DWORD *pcbPackedCredentials
|
---|
363 | );
|
---|
364 |
|
---|
365 | CREDUIAPI WINBOOL WINAPI CredPackAuthenticationBufferW(
|
---|
366 | DWORD dwFlags,
|
---|
367 | LPWSTR pszUserName,
|
---|
368 | LPWSTR pszPassword,
|
---|
369 | PBYTE pPackedCredentials,
|
---|
370 | DWORD *pcbPackedCredentials
|
---|
371 | );
|
---|
372 |
|
---|
373 | WINADVAPI WINBOOL WINAPI CredProtectW(
|
---|
374 | WINBOOL fAsSelf,
|
---|
375 | LPWSTR pszCredentials,
|
---|
376 | DWORD cchCredentials,
|
---|
377 | LPWSTR pszProtectedCredentials,
|
---|
378 | DWORD *pcchMaxChars,
|
---|
379 | CRED_PROTECTION_TYPE *ProtectionType
|
---|
380 | );
|
---|
381 |
|
---|
382 | WINADVAPI WINBOOL WINAPI CredProtectA(
|
---|
383 | WINBOOL fAsSelf,
|
---|
384 | LPSTR pszCredentials,
|
---|
385 | DWORD cchCredentials,
|
---|
386 | LPSTR pszProtectedCredentials,
|
---|
387 | DWORD *pcchMaxChars,
|
---|
388 | CRED_PROTECTION_TYPE *ProtectionType
|
---|
389 | );
|
---|
390 |
|
---|
391 | CREDUIAPI DWORD WINAPI CredUIPromptForWindowsCredentialsA(
|
---|
392 | PCREDUI_INFOA pUiInfo,
|
---|
393 | DWORD dwAuthError,
|
---|
394 | ULONG *pulAuthPackage,
|
---|
395 | LPCVOID pvInAuthBuffer,
|
---|
396 | ULONG ulInAuthBufferSize,
|
---|
397 | LPVOID *ppvOutAuthBuffer,
|
---|
398 | ULONG *pulOutAuthBufferSize,
|
---|
399 | WINBOOL *pfSave,
|
---|
400 | DWORD dwFlags
|
---|
401 | );
|
---|
402 |
|
---|
403 | CREDUIAPI DWORD WINAPI CredUIPromptForWindowsCredentialsW(
|
---|
404 | PCREDUI_INFOW pUiInfo,
|
---|
405 | DWORD dwAuthError,
|
---|
406 | ULONG *pulAuthPackage,
|
---|
407 | LPCVOID pvInAuthBuffer,
|
---|
408 | ULONG ulInAuthBufferSize,
|
---|
409 | LPVOID *ppvOutAuthBuffer,
|
---|
410 | ULONG *pulOutAuthBufferSize,
|
---|
411 | WINBOOL *pfSave,
|
---|
412 | DWORD dwFlags
|
---|
413 | );
|
---|
414 |
|
---|
415 | CREDUIAPI WINBOOL WINAPI CredUnPackAuthenticationBufferA(
|
---|
416 | DWORD dwFlags,
|
---|
417 | PVOID pAuthBuffer,
|
---|
418 | DWORD cbAuthBuffer,
|
---|
419 | LPSTR pszUserName,
|
---|
420 | DWORD *pcchMaxUserName,
|
---|
421 | LPSTR pszDomainName,
|
---|
422 | DWORD *pcchMaxDomainame,
|
---|
423 | LPSTR pszPassword,
|
---|
424 | DWORD *pcchMaxPassword
|
---|
425 | );
|
---|
426 |
|
---|
427 | CREDUIAPI WINBOOL WINAPI CredUnPackAuthenticationBufferW(
|
---|
428 | DWORD dwFlags,
|
---|
429 | PVOID pAuthBuffer,
|
---|
430 | DWORD cbAuthBuffer,
|
---|
431 | LPWSTR pszUserName,
|
---|
432 | DWORD *pcchMaxUserName,
|
---|
433 | LPWSTR pszDomainName,
|
---|
434 | DWORD *pcchMaxDomainame,
|
---|
435 | LPWSTR pszPassword,
|
---|
436 | DWORD *pcchMaxPassword
|
---|
437 | );
|
---|
438 |
|
---|
439 | WINADVAPI WINBOOL WINAPI CredUnprotectA(
|
---|
440 | WINBOOL fAsSelf,
|
---|
441 | LPSTR pszProtectedCredentials,
|
---|
442 | DWORD cchCredentials,
|
---|
443 | LPSTR pszCredentials,
|
---|
444 | DWORD *pcchMaxChars
|
---|
445 | );
|
---|
446 |
|
---|
447 | WINADVAPI WINBOOL WINAPI CredUnprotectW(
|
---|
448 | WINBOOL fAsSelf,
|
---|
449 | LPWSTR pszProtectedCredentials,
|
---|
450 | DWORD cchCredentials,
|
---|
451 | LPWSTR pszCredentials,
|
---|
452 | DWORD *pcchMaxChars
|
---|
453 | );
|
---|
454 |
|
---|
455 | #endif /* (_WIN32_WINNT >= 0x0600) */
|
---|
456 |
|
---|
457 | #ifdef __cplusplus
|
---|
458 | }
|
---|
459 | #endif
|
---|
460 |
|
---|
461 | #endif /* _WINCRED_H_ */
|
---|
462 |
|
---|