ping: Add some missing includes.
[wine] / include / ntsecapi.h
1 /*
2  * Copyright (C) 1999 Juergen Schmied
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 __WINE_NTSECAPI_H
20 #define __WINE_NTSECAPI_H
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* defined(__cplusplus) */
25
26 /* Policy access rights */
27 #define POLICY_VIEW_LOCAL_INFORMATION           0x00000001L
28 #define POLICY_VIEW_AUDIT_INFORMATION           0x00000002L
29 #define POLICY_GET_PRIVATE_INFORMATION          0x00000004L
30 #define POLICY_TRUST_ADMIN                      0x00000008L
31 #define POLICY_CREATE_ACCOUNT                   0x00000010L
32 #define POLICY_CREATE_SECRET                    0x00000020L
33 #define POLICY_CREATE_PRIVILEGE                 0x00000040L
34 #define POLICY_SET_DEFAULT_QUOTA_LIMITS         0x00000080L
35 #define POLICY_SET_AUDIT_REQUIREMENTS           0x00000100L
36 #define POLICY_AUDIT_LOG_ADMIN                  0x00000200L
37 #define POLICY_SERVER_ADMIN                     0x00000400L
38 #define POLICY_LOOKUP_NAMES                     0x00000800L
39 #define POLICY_NOTIFICATION                     0x00001000L
40
41 #define POLICY_ALL_ACCESS                       ( \
42     STANDARD_RIGHTS_REQUIRED | \
43     POLICY_VIEW_LOCAL_INFORMATION | \
44     POLICY_VIEW_AUDIT_INFORMATION | \
45     POLICY_GET_PRIVATE_INFORMATION | \
46     POLICY_TRUST_ADMIN | \
47     POLICY_CREATE_ACCOUNT | \
48     POLICY_CREATE_SECRET | \
49     POLICY_CREATE_PRIVILEGE | \
50     POLICY_SET_DEFAULT_QUOTA_LIMITS | \
51     POLICY_SET_AUDIT_REQUIREMENTS | \
52     POLICY_AUDIT_LOG_ADMIN | \
53     POLICY_SERVER_ADMIN | \
54     POLICY_LOOKUP_NAMES)
55
56
57 #define POLICY_READ                             ( \
58     STANDARD_RIGHTS_READ | \
59     POLICY_VIEW_AUDIT_INFORMATION | \
60     POLICY_GET_PRIVATE_INFORMATION)
61
62 #define POLICY_WRITE                            ( \
63    STANDARD_RIGHTS_WRITE | \
64    POLICY_TRUST_ADMIN | \
65    POLICY_CREATE_ACCOUNT | \
66    POLICY_CREATE_SECRET | \
67    POLICY_CREATE_PRIVILEGE | \
68    POLICY_SET_DEFAULT_QUOTA_LIMITS | \
69    POLICY_SET_AUDIT_REQUIREMENTS | \
70    POLICY_AUDIT_LOG_ADMIN | \
71    POLICY_SERVER_ADMIN)
72
73 #define POLICY_EXECUTE                          ( \
74    STANDARD_RIGHTS_EXECUTE | \
75    POLICY_VIEW_LOCAL_INFORMATION | \
76    POLICY_LOOKUP_NAMES)
77
78 #define POLICY_AUDIT_EVENT_UNCHANGED 0x00000000L
79 #define POLICY_AUDIT_EVENT_SUCCESS   0x00000001L
80 #define POLICY_AUDIT_EVENT_FAILURE   0x00000002L
81 #define POLICY_AUDIT_EVENT_NONE      0x00000004L
82
83 #define POLICY_AUDIT_EVENT_MASK (POLICY_AUDIT_EVENT_SUCCESS | \
84                                  POLICY_AUDIT_EVENT_FAILURE | \
85                                  POLICY_AUDIT_EVENT_NONE)
86
87 /* logon rights names */
88 #define SE_BATCH_LOGON_NAME \
89  TEXT("SeBatchLogonRight")
90 #define SE_INTERACTIVE_LOGON_NAME \
91  TEXT("SeInteractiveLogonRight")
92 #define SE_NETWORK_LOGON_NAME \
93  TEXT("SeNetworkLogonRight")
94 #define SE_REMOTE_INTERACTIVE_LOGON_NAME \
95  TEXT("SeRemoteInteractiveLogonRight")
96 #define SE_SERVICE_LOGON_NAME \
97  TEXT("SeServiceLogonRight")
98 #define SE_DENY_BATCH_LOGON_NAME \
99  TEXT("SeDenyBatchLogonRight")
100 #define SE_DENY_INTERACTIVE_LOGON_NAME \
101  TEXT("SeDenyInteractiveLogonRight")
102 #define SE_DENY_NETWORK_LOGON_NAME \
103  TEXT("SeDenyNetworkLogonRight")
104 #define SE_DENY_REMOTE_INTERACTIVE_LOGON_NAME \
105  TEXT("SeDenyRemoteInteractiveLogonRight")
106 #define SE_DENY_SERVICE_LOGON_NAME \
107  TEXT("SeDenyServiceLogonRight")
108
109 #ifndef WINE_NTSTATUS_DECLARED
110 #define WINE_NTSTATUS_DECLARED
111 typedef LONG NTSTATUS;
112 #endif
113 #ifndef WINE_PNTSTATUS_DECLARED
114 #define WINE_PNTSTATUS_DECLARED
115 typedef NTSTATUS *PNTSTATUS;
116 #endif
117
118 typedef enum _SECURITY_LOGON_TYPE
119 {
120     Interactive = 2,
121     Network,
122     Batch,
123     Service,
124     Proxy
125 } SECURITY_LOGON_TYPE, *PSECURITY_LOGON_TYPE;
126
127 typedef enum _POLICY_AUDIT_EVENT_TYPE
128 {
129     AuditCategorySystem,
130     AuditCategoryLogon,
131     AuditCategoryObjectAccess,
132     AuditCategoryPrivilegeUse,
133     AuditCategoryDetailedTracking,
134     AuditCategoryPolicyChange,
135     AuditCategoryAccountManagement
136 } POLICY_AUDIT_EVENT_TYPE, *PPOLICY_AUDIT_EVENT_TYPE;
137
138 #ifndef __STRING_DEFINED__
139 #define __STRING_DEFINED__
140 typedef struct _STRING {
141   USHORT Length;
142   USHORT MaximumLength;
143   PCHAR Buffer;
144 } STRING, *PSTRING;
145 #endif
146
147 #ifndef __UNICODE_STRING_DEFINED__
148 #define __UNICODE_STRING_DEFINED__
149 typedef struct _UNICODE_STRING {
150   USHORT Length;        /* bytes */
151   USHORT MaximumLength; /* bytes */
152   PWSTR  Buffer;
153 } UNICODE_STRING, *PUNICODE_STRING;
154 #endif
155
156 #ifndef __OBJECT_ATTRIBUTES_DEFINED__
157 #define __OBJECT_ATTRIBUTES_DEFINED__
158 typedef struct _OBJECT_ATTRIBUTES {
159   ULONG Length;
160   HANDLE RootDirectory;
161   PUNICODE_STRING ObjectName;
162   ULONG Attributes;
163   PVOID SecurityDescriptor;       /* type SECURITY_DESCRIPTOR */
164   PVOID SecurityQualityOfService; /* type SECURITY_QUALITY_OF_SERVICE */
165 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
166 #endif
167
168 typedef UNICODE_STRING LSA_UNICODE_STRING, *PLSA_UNICODE_STRING;
169 typedef STRING LSA_STRING, *PLSA_STRING;
170 typedef OBJECT_ATTRIBUTES LSA_OBJECT_ATTRIBUTES, *PLSA_OBJECT_ATTRIBUTES;
171
172 typedef PVOID LSA_HANDLE, *PLSA_HANDLE;
173 typedef ULONG LSA_ENUMERATION_HANDLE, *PLSA_ENUMERATION_HANDLE;
174 typedef ULONG LSA_OPERATIONAL_MODE, *PLSA_OPERATIONAL_MODE;
175
176 typedef enum
177 {
178         PolicyAuditLogInformation = 1,
179         PolicyAuditEventsInformation,
180         PolicyPrimaryDomainInformation,
181         PolicyPdAccountInformation,
182         PolicyAccountDomainInformation,
183         PolicyLsaServerRoleInformation,
184         PolicyReplicaSourceInformation,
185         PolicyDefaultQuotaInformation,
186         PolicyModificationInformation,
187         PolicyAuditFullSetInformation,
188         PolicyAuditFullQueryInformation,
189         PolicyDnsDomainInformation
190 } POLICY_INFORMATION_CLASS, *PPOLICY_INFORMATION_CLASS;
191
192 typedef ULONG POLICY_AUDIT_EVENT_OPTIONS, *PPOLICY_AUDIT_EVENT_OPTIONS;
193
194 typedef struct _POLICY_AUDIT_EVENTS_INFO
195 {
196         BOOLEAN AuditingMode;
197         PPOLICY_AUDIT_EVENT_OPTIONS EventAuditingOptions;
198         ULONG MaximumAuditEventCount;
199 } POLICY_AUDIT_EVENTS_INFO, *PPOLICY_AUDIT_EVENTS_INFO;
200
201 typedef struct _POLICY_PRIMARY_DOMAIN_INFO
202 {
203     LSA_UNICODE_STRING Name;
204     PSID Sid;
205 } POLICY_PRIMARY_DOMAIN_INFO, *PPOLICY_PRIMARY_DOMAIN_INFO;
206
207 typedef struct _POLICY_ACCOUNT_DOMAIN_INFO
208 {
209     LSA_UNICODE_STRING DomainName;
210     PSID DomainSid;
211 } POLICY_ACCOUNT_DOMAIN_INFO, *PPOLICY_ACCOUNT_DOMAIN_INFO;
212
213 typedef struct _POLICY_DNS_DOMAIN_INFO
214 {
215     LSA_UNICODE_STRING Name;
216     LSA_UNICODE_STRING DnsDomainName;
217     LSA_UNICODE_STRING DnsForestName;
218     GUID DomainGuid;
219     PSID Sid;
220 } POLICY_DNS_DOMAIN_INFO, *PPOLICY_DNS_DOMAIN_INFO;
221
222 typedef enum _POLICY_LSA_SERVER_ROLE
223 {
224     PolicyServerRoleBackup = 2,
225     PolicyServerRolePrimary
226 } POLICY_LSA_SERVER_ROLE, *PPOLICY_LSA_SERVER_ROLE;
227
228 typedef struct _POLICY_LSA_SERVER_ROLE_INFO
229 {
230     POLICY_LSA_SERVER_ROLE LsaServerRole;
231 } POLICY_LSA_SERVER_ROLE_INFO, *PPOLICY_LSA_SERVER_ROLE_INFO;
232
233 typedef struct _POLICY_MODIFICATION_INFO
234 {
235     LARGE_INTEGER ModifiedId;
236     LARGE_INTEGER DatabaseCreationTime;
237 } POLICY_MODIFICATION_INFO, *PPOLICY_MODIFICATION_INFO;
238
239 typedef struct _SECURITY_LOGON_SESSION_DATA {
240     ULONG Size;
241     LUID LogonId;
242     LSA_UNICODE_STRING UserName;
243     LSA_UNICODE_STRING LogonDomain;
244     LSA_UNICODE_STRING AuthenticationPackage;
245     ULONG LogonType;
246     ULONG Session;
247     PSID Sid;
248     LARGE_INTEGER LogonTime;
249     LSA_UNICODE_STRING LogonServer;
250     LSA_UNICODE_STRING DnsDomainName;
251     LSA_UNICODE_STRING Upn;
252 } SECURITY_LOGON_SESSION_DATA, *PSECURITY_LOGON_SESSION_DATA;
253
254 typedef struct
255 {
256     SID_NAME_USE Use;
257     LSA_UNICODE_STRING Name;
258     LONG DomainIndex;
259 } LSA_TRANSLATED_NAME, *PLSA_TRANSLATED_NAME;
260
261 typedef struct
262 {
263     LSA_UNICODE_STRING Name;
264     PSID Sid;
265 } LSA_TRUST_INFORMATION, *PLSA_TRUST_INFORMATION;
266
267 typedef struct
268 {
269     ULONG Entries;
270     PLSA_TRUST_INFORMATION Domains;
271 } LSA_REFERENCED_DOMAIN_LIST, *PLSA_REFERENCED_DOMAIN_LIST;
272
273 typedef struct _LSA_TRANSLATED_SID
274 {
275     SID_NAME_USE Use;
276     ULONG RelativeId;
277     LONG DomainIndex;
278 } LSA_TRANSLATED_SID, *PLSA_TRANSLATED_SID;
279
280 typedef struct _TRUSTED_DOMAIN_INFORMATION_EX
281 {
282     LSA_UNICODE_STRING Name;
283     LSA_UNICODE_STRING FlatName;
284     PSID Sid;
285     ULONG TrustDirection;
286     ULONG TrustType;
287     ULONG TrustAttributes;
288 } TRUSTED_DOMAIN_INFORMATION_EX, *PTRUSTED_DOMAIN_INFORMATION_EX;
289
290 typedef struct _LSA_AUTH_INFORMATION
291 {
292     LARGE_INTEGER LastUpdateTime;
293     ULONG AuthType;
294     ULONG AuthInfoLength;
295     PUCHAR AuthInfo;
296 } LSA_AUTH_INFORMATION, *PLSA_AUTH_INFORMATION;
297
298 typedef struct _TRUSTED_DOMAIN_AUTH_INFORMATION
299 {
300     ULONG IncomingAuthInfos;
301     PLSA_AUTH_INFORMATION IncomingAuthenticationInformation;
302     PLSA_AUTH_INFORMATION IncomingPreviousAuthenticationInformation;
303     ULONG OutgoingAuthInfos;
304     PLSA_AUTH_INFORMATION OutgoingAuthenticationInformation;
305     PLSA_AUTH_INFORMATION OutgoingPreviousAuthenticationInformation;
306 } TRUSTED_DOMAIN_AUTH_INFORMATION, *PTRUSTED_DOMAIN_AUTH_INFORMATION;
307
308 typedef struct _LSA_TRANSLATED_SID2
309 {
310     SID_NAME_USE Use;
311     PSID Sid;
312     LONG DomainIndex;
313     ULONG Flags;
314 } LSA_TRANSLATED_SID2, *PLSA_TRANSLATED_SID2;
315
316 typedef enum _TRUSTED_INFORMATION_CLASS
317 {
318     TrustedDomainNameInformation = 1,
319     TrustedControllersInformation,
320     TrustedPosixOffsetInformation,
321     TrustedPasswordInformation,
322     TrustedDomainInformationBasic,
323     TrustedDomainInformationEx,
324     TrustedDomainAuthInformation,
325     TrustedDomainFullInformation
326 } TRUSTED_INFORMATION_CLASS, *PTRUSTED_INFORMATION_CLASS;
327
328 typedef enum _POLICY_NOTIFICATION_INFORMATION_CLASS
329 {
330     PolicyNotifyAuditEventsInformation = 1,
331     PolicyNotifyAccountDomainInformation,
332     PolicyNotifyServerRoleInformation,
333     PolicyNotifyDnsDomainInformation,
334     PolicyNotifyDomainEfsInformation,
335     PolicyNotifyDomainKerberosTicketInformation,
336     PolicyNotifyMachineAccountPasswordInformation
337 } POLICY_NOTIFICATION_INFORMATION_CLASS, *PPOLICY_NOTIFICATION_INFORMATION_CLASS;
338
339 #define RtlGenRandom                    SystemFunction036
340 #define RtlEncryptMemory                SystemFunction040
341 #define RtlDecryptMemory                SystemFunction041
342
343 BOOLEAN WINAPI RtlGenRandom(PVOID,ULONG);
344 NTSTATUS WINAPI RtlEncryptMemory(PVOID,ULONG,ULONG);
345 NTSTATUS WINAPI RtlDecryptMemory(PVOID,ULONG,ULONG);
346
347 NTSTATUS WINAPI LsaAddAccountRights(LSA_HANDLE,PSID,PLSA_UNICODE_STRING,ULONG);
348 NTSTATUS WINAPI LsaCallAuthenticationPackage(HANDLE,ULONG,PVOID,ULONG,PVOID*,PULONG,PNTSTATUS);
349 NTSTATUS WINAPI LsaClose(LSA_HANDLE);
350 NTSTATUS WINAPI LsaConnectUntrusted(PHANDLE);
351 NTSTATUS WINAPI LsaCreateTrustedDomainEx(LSA_HANDLE,PTRUSTED_DOMAIN_INFORMATION_EX,
352                                          PTRUSTED_DOMAIN_AUTH_INFORMATION,ACCESS_MASK,PLSA_HANDLE);
353 NTSTATUS WINAPI LsaDeleteTrustedDomain(LSA_HANDLE,PSID);
354 NTSTATUS WINAPI LsaDeregisterLogonProcess(HANDLE);
355 NTSTATUS WINAPI LsaEnumerateAccountRights(LSA_HANDLE,PSID,PLSA_UNICODE_STRING*,PULONG);
356 NTSTATUS WINAPI LsaEnumerateAccountsWithUserRight(LSA_HANDLE,PLSA_UNICODE_STRING,PVOID*,PULONG);
357 NTSTATUS WINAPI LsaEnumerateLogonSessions(PULONG,PLUID*);
358 NTSTATUS WINAPI LsaEnumerateTrustedDomains(LSA_HANDLE,PLSA_ENUMERATION_HANDLE,PVOID*,ULONG,PULONG);
359 NTSTATUS WINAPI LsaEnumerateTrustedDomainsEx(LSA_HANDLE,PLSA_ENUMERATION_HANDLE,PVOID*,ULONG,PULONG);
360 NTSTATUS WINAPI LsaFreeMemory(PVOID);
361 NTSTATUS WINAPI LsaFreeReturnBuffer(PVOID);
362 NTSTATUS WINAPI LsaGetLogonSessionData(PLUID,PSECURITY_LOGON_SESSION_DATA*);
363 NTSTATUS WINAPI LsaLogonUser(HANDLE,PLSA_STRING,SECURITY_LOGON_TYPE,ULONG,PVOID,ULONG,PTOKEN_GROUPS,PTOKEN_SOURCE,PVOID*,PULONG,PLUID,PHANDLE,PQUOTA_LIMITS,PNTSTATUS);
364 NTSTATUS WINAPI LsaLookupAuthenticationPackage(HANDLE,PLSA_STRING,PULONG);
365 NTSTATUS WINAPI LsaLookupNames(LSA_HANDLE,ULONG,PLSA_UNICODE_STRING,PLSA_REFERENCED_DOMAIN_LIST*,
366                                PLSA_TRANSLATED_SID*);
367 NTSTATUS WINAPI LsaLookupNames2(LSA_HANDLE,ULONG,ULONG,PLSA_UNICODE_STRING,PLSA_REFERENCED_DOMAIN_LIST*,
368                                 PLSA_TRANSLATED_SID2*);
369 NTSTATUS WINAPI LsaLookupSids(LSA_HANDLE,ULONG,PSID *,PLSA_REFERENCED_DOMAIN_LIST *,PLSA_TRANSLATED_NAME *);
370 ULONG WINAPI LsaNtStatusToWinError(NTSTATUS);
371 NTSTATUS WINAPI LsaOpenPolicy(PLSA_UNICODE_STRING,PLSA_OBJECT_ATTRIBUTES,ACCESS_MASK,PLSA_HANDLE);
372 NTSTATUS WINAPI LsaOpenTrustedDomainByName(LSA_HANDLE,PLSA_UNICODE_STRING,ACCESS_MASK,PLSA_HANDLE);
373 NTSTATUS WINAPI LsaQueryInformationPolicy(LSA_HANDLE,POLICY_INFORMATION_CLASS,PVOID*);
374 NTSTATUS WINAPI LsaQueryTrustedDomainInfo(LSA_HANDLE,PSID,TRUSTED_INFORMATION_CLASS,PVOID*);
375 NTSTATUS WINAPI LsaQueryTrustedDomainInfoByName(LSA_HANDLE,PLSA_UNICODE_STRING,TRUSTED_INFORMATION_CLASS,PVOID*);
376 NTSTATUS WINAPI LsaRegisterLogonProcess(PLSA_STRING,PHANDLE,PLSA_OPERATIONAL_MODE);
377 NTSTATUS WINAPI LsaRegisterPolicyChangeNotification(POLICY_NOTIFICATION_INFORMATION_CLASS,HANDLE);
378 NTSTATUS WINAPI LsaRemoveAccountRights(LSA_HANDLE,PSID,BOOLEAN,PLSA_UNICODE_STRING,ULONG);
379 NTSTATUS WINAPI LsaRetrievePrivateData(LSA_HANDLE,PLSA_UNICODE_STRING,PLSA_UNICODE_STRING*);
380 NTSTATUS WINAPI LsaSetInformationPolicy(LSA_HANDLE,POLICY_INFORMATION_CLASS,PVOID);
381 NTSTATUS WINAPI LsaSetTrustedDomainInfoByName(LSA_HANDLE,PLSA_UNICODE_STRING,TRUSTED_INFORMATION_CLASS,PVOID);
382 NTSTATUS WINAPI LsaSetTrustedDomainInformation(LSA_HANDLE,PSID,TRUSTED_INFORMATION_CLASS,PVOID);
383 NTSTATUS WINAPI LsaStorePrivateData(LSA_HANDLE,PLSA_UNICODE_STRING,PLSA_UNICODE_STRING);
384 NTSTATUS WINAPI LsaUnregisterPolicyChangeNotification(POLICY_NOTIFICATION_INFORMATION_CLASS,HANDLE);
385
386 #ifdef __cplusplus
387 } /* extern "C" */
388 #endif /* defined(__cplusplus) */
389
390 #endif /* !defined(__WINE_NTSECAPI_H) */