msi/tests: Fix some test failures on Win9x and WinMe.
[wine] / include / wincred.h
1 /*
2  * Copyright (C) 2006 Robert Shearman (for CodeWeavers)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #ifndef _WINCRED_H_
20 #define _WINCRED_H_
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 #ifdef _ADVAPI32_
27 #define WINADVAPI
28 #else
29 #define WINADVAPI DECLSPEC_IMPORT
30 #endif
31
32 #ifndef __SECHANDLE_DEFINED__
33 #define __SECHANDLE_DEFINED__
34 typedef struct _SecHandle
35 {
36     ULONG_PTR dwLower;
37     ULONG_PTR dwUpper;
38 } SecHandle, *PSecHandle;
39 #endif
40
41 #ifndef __WINE_CTXTHANDLE_DEFINED__
42 #define __WINE_CTXTHANDLE_DEFINED__
43 typedef SecHandle CtxtHandle;
44 typedef PSecHandle PCtxtHandle;
45 #endif
46
47 typedef struct _CREDENTIAL_ATTRIBUTEA
48 {
49     LPSTR Keyword;
50     DWORD Flags;
51     DWORD ValueSize;
52     LPBYTE Value;
53 } CREDENTIAL_ATTRIBUTEA, *PCREDENTIAL_ATTRIBUTEA;
54
55 typedef struct _CREDENTIAL_ATTRIBUTEW
56 {
57     LPWSTR Keyword;
58     DWORD Flags;
59     DWORD ValueSize;
60     LPBYTE Value;
61 } CREDENTIAL_ATTRIBUTEW, *PCREDENTIAL_ATTRIBUTEW;
62
63 DECL_WINELIB_TYPE_AW(CREDENTIAL_ATTRIBUTE)
64 DECL_WINELIB_TYPE_AW(PCREDENTIAL_ATTRIBUTE)
65
66 typedef struct _CREDENTIALA
67 {
68     DWORD Flags;
69     DWORD Type;
70     LPSTR TargetName;
71     LPSTR Comment;
72     FILETIME LastWritten;
73     DWORD CredentialBlobSize;
74     LPBYTE CredentialBlob;
75     DWORD Persist;
76     DWORD AttributeCount;
77     PCREDENTIAL_ATTRIBUTEA Attributes;
78     LPSTR TargetAlias;
79     LPSTR UserName;
80 } CREDENTIALA, *PCREDENTIALA;
81
82 typedef struct _CREDENTIALW
83 {
84     DWORD Flags;
85     DWORD Type;
86     LPWSTR TargetName;
87     LPWSTR Comment;
88     FILETIME LastWritten;
89     DWORD CredentialBlobSize;
90     LPBYTE CredentialBlob;
91     DWORD Persist;
92     DWORD AttributeCount;
93     PCREDENTIAL_ATTRIBUTEW Attributes;
94     LPWSTR TargetAlias;
95     LPWSTR UserName;
96 } CREDENTIALW, *PCREDENTIALW;
97
98 DECL_WINELIB_TYPE_AW(CREDENTIAL)
99 DECL_WINELIB_TYPE_AW(PCREDENTIAL)
100
101 typedef struct _CREDUI_INFOA
102 {
103     DWORD cbSize;
104     HWND hwndParent;
105     PCSTR pszMessageText;
106     PCSTR pszCaptionText;
107     HBITMAP hbmBanner;
108 } CREDUI_INFOA, *PCREDUI_INFOA;
109
110 typedef struct _CREDUI_INFOW
111 {
112     DWORD cbSize;
113     HWND hwndParent;
114     PCWSTR pszMessageText;
115     PCWSTR pszCaptionText;
116     HBITMAP hbmBanner;
117 } CREDUI_INFOW, *PCREDUI_INFOW;
118
119 DECL_WINELIB_TYPE_AW(CREDUI_INFO)
120 DECL_WINELIB_TYPE_AW(PCREDUI_INFO)
121
122 #define CRED_MAX_STRING_LENGTH              256
123 #define CRED_MAX_USERNAME_LENGTH            513
124 #define CRED_MAX_GENERIC_TARGET_NAME_LENGTH 32767
125 #define CRED_MAX_DOMAIN_TARGET_NAME_LENGTH  337
126 #define CRED_MAX_VALUE_SIZE                 256
127 #define CRED_MAX_ATTRIBUTES                 64
128
129 #define CRED_MAX_BLOB_SIZE                  512
130
131 #define CREDUI_MAX_MESSAGE_LENGTH 32767
132 #define CREDUI_MAX_CAPTION_LENGTH 128
133 #define CREDUI_MAX_GENERIC_TARGET_LENGTH CRED_MAX_GENERIC_TARGET_NAME_LENGTH
134 #define CREDUI_MAX_DOMAIN_TARGET_LENGTH CRED_MAX_DOMAIN_TARGET_LENGTH
135 #define CREDUI_MAX_USERNAME_LENGTH CRED_MAX_USERNAME_LENGTH
136 #define CREDUI_MAX_PASSWORD_LENGTH (CRED_MAX_CREDENTIAL_BLOB_SIZE / 2)
137
138 /* flags for CREDENTIAL::Flags */
139 #define CRED_FLAGS_PASSWORD_FOR_CERT                0x0001
140 #define CRED_FLAGS_PROMPT_NOW                       0x0002
141 #define CRED_FLAGS_USERNAME_TARGET                  0x0004
142 #define CRED_FLAGS_OWF_CRED_BLOB                    0x0008
143 #define CRED_FLAGS_VALID_FLAGS                      0x000f
144
145 /* values for CREDENTIAL::Type */
146 #define CRED_TYPE_GENERIC                           1
147 #define CRED_TYPE_DOMAIN_PASSWORD                   2
148 #define CRED_TYPE_DOMAIN_CERTIFICATE                3
149 #define CRED_TYPE_DOMAIN_VISIBLE_PASSWORD           4
150 #define CRED_TYPE_GENERIC_CERTIFICATE               5
151 #define CRED_TYPE_MAXIMUM                           6
152 #define CRED_TYPE_MAXIMUM_EX                        (CRED_TYPE_MAXIMUM+1000)
153
154 /* values for CREDENTIAL::Persist */
155 #define CRED_PERSIST_NONE                           0
156 #define CRED_PERSIST_SESSION                        1
157 #define CRED_PERSIST_LOCAL_MACHINE                  2
158 #define CRED_PERSIST_ENTERPRISE                     3
159
160 #define CREDUI_FLAGS_INCORRECT_PASSWORD             0x00000001
161 #define CREDUI_FLAGS_DO_NOT_PERSIST                 0x00000002
162 #define CREDUI_FLAGS_REQUEST_ADMINISTRATOR          0x00000004
163 #define CREDUI_FLAGS_EXCLUDE_CERTIFICATES           0x00000008
164 #define CREDUI_FLAGS_REQUIRE_CERTIFICATE            0x00000010
165 #define CREDUI_FLAGS_SHOW_SAVE_CHECK_BOX            0x00000040
166 #define CREDUI_FLAGS_ALWAYS_SHOW_UI                 0x00000080
167 #define CREDUI_FLAGS_REQUIRE_SMARTCARD              0x00000100
168 #define CREDUI_FLAGS_PASSWORD_ONLY_OK               0x00000200
169 #define CREDUI_FLAGS_VALIDATE_USERNAME              0x00000400
170 #define CREDUI_FLAGS_COMPLETE_USERNAME              0x00000800
171 #define CREDUI_FLAGS_PERSIST                        0x00001000
172 #define CREDUI_FLAGS_SERVER_CREDENTIAL              0x00004000
173 #define CREDUI_FLAGS_EXPECT_CONFIRMATION            0x00020000
174 #define CREDUI_FLAGS_GENERIC_CREDENTIALS            0x00040000
175 #define CREDUI_FLAGS_USERNAME_TARGET_CREDENTIALS    0x00080000
176 #define CREDUI_FLAGS_KEEP_USERNAME                  0x00100000
177
178 /* flags for CredWrite and CredWriteDomainCredentials */
179 #define CRED_PRESERVE_CREDENTIAL_BLOB               0x00000001
180
181 WINADVAPI BOOL  WINAPI CredDeleteA(LPCSTR,DWORD,DWORD);
182 WINADVAPI BOOL  WINAPI CredDeleteW(LPCWSTR,DWORD,DWORD);
183 #define                CredDelete WINELIB_NAME_AW(CredDelete)
184 WINADVAPI BOOL  WINAPI CredEnumerateA(LPCSTR,DWORD,DWORD *,PCREDENTIALA **);
185 WINADVAPI BOOL  WINAPI CredEnumerateW(LPCWSTR,DWORD,DWORD *,PCREDENTIALW **);
186 #define                CredEnumerate WINELIB_NAME_AW(CredEnumerate)
187 WINADVAPI VOID  WINAPI CredFree(PVOID);
188 WINADVAPI BOOL  WINAPI CredGetSessionTypes(DWORD,LPDWORD);
189 WINADVAPI BOOL  WINAPI CredReadA(LPCSTR,DWORD,DWORD,PCREDENTIALA *);
190 WINADVAPI BOOL  WINAPI CredReadW(LPCWSTR,DWORD,DWORD,PCREDENTIALW *);
191 #define                CredRead WINELIB_NAME_AW(CredRead)
192 WINADVAPI BOOL  WINAPI CredRenameA(LPCSTR,LPCSTR,DWORD,DWORD);
193 WINADVAPI BOOL  WINAPI CredRenameW(LPCWSTR,LPCWSTR,DWORD,DWORD);
194 #define                CredRename WINELIB_NAME_AW(CredRename)
195 WINADVAPI BOOL  WINAPI CredWriteA(PCREDENTIALA,DWORD);
196 WINADVAPI BOOL  WINAPI CredWriteW(PCREDENTIALW,DWORD);
197 #define                CredWrite WINELIB_NAME_AW(CredWrite)
198
199 DWORD WINAPI CredUICmdLinePromptForCredentialsW(PCWSTR,PCtxtHandle,DWORD,PWSTR,ULONG,PWSTR,ULONG,PBOOL,DWORD);
200 DWORD WINAPI CredUICmdLinePromptForCredentialsA(PCSTR,PCtxtHandle,DWORD,PSTR,ULONG,PSTR,ULONG,PBOOL,DWORD);
201 #define      CredUICmdLinePromptForCredentials WINELIB_NAME_AW(CredUICmdLinePromptForCredentials)
202 DWORD WINAPI CredUIConfirmCredentialsW(PCWSTR,BOOL);
203 DWORD WINAPI CredUIConfirmCredentialsA(PCSTR,BOOL);
204 #define      CredUIConfirmCredentials WINELIB_NAME_AW(CredUIConfirmCredentials)
205 DWORD WINAPI CredUIParseUserNameW(PCWSTR,PWSTR,ULONG,PWSTR,ULONG);
206 DWORD WINAPI CredUIParseUserNameA(PCSTR,PSTR,ULONG,PSTR,ULONG);
207 #define      CredUIParseUserName WINELIB_NAME_AW(CredUIParseUserName)
208 DWORD WINAPI CredUIPromptForCredentialsW(PCREDUI_INFOW,PCWSTR,PCtxtHandle,DWORD,PWSTR,ULONG,PWSTR,ULONG,PBOOL,DWORD);
209 DWORD WINAPI CredUIPromptForCredentialsA(PCREDUI_INFOA,PCSTR,PCtxtHandle,DWORD,PSTR,ULONG,PSTR,ULONG,PBOOL,DWORD);
210 #define      CredUIPromptForCredentials WINELIB_NAME_AW(CredUIPromptForCredentials)
211 DWORD WINAPI CredUIStoreSSOCredW(PCWSTR,PCWSTR,PCWSTR,BOOL);
212 /* Note: no CredUIStoreSSOCredA in PSDK header */
213 DWORD WINAPI CredUIReadSSOCredW(PCWSTR,PWSTR*);
214 /* Note: no CredUIReadSSOCredA in PSDK header */
215
216 #ifdef __cplusplus
217 }
218 #endif
219
220 #endif /* _WINCRED_H_ */