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 _LMAUDIT_
7 #define _LMAUDIT_
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 #ifndef _LMHLOGDEFINED_
14 #define _LMHLOGDEFINED_
15 
16   typedef struct _HLOG {
17     DWORD time;
18     DWORD last_flags;
19     DWORD offset;
20     DWORD rec_offset;
21   } HLOG,*PHLOG,*LPHLOG;
22 
23 #define LOGFLAGS_FORWARD 0
24 #define LOGFLAGS_BACKWARD 0x1
25 #define LOGFLAGS_SEEK 0x2
26 #endif
27 
28   DWORD WINAPI NetAuditClear(LPCWSTR server,LPCWSTR backupfile,LPCWSTR service);
29   DWORD WINAPI NetAuditRead(LPCWSTR server,LPCWSTR service,LPHLOG auditloghandle,DWORD offset,LPDWORD reserved1,DWORD reserved2,DWORD offsetflag,LPBYTE *bufptr,DWORD prefmaxlen,LPDWORD bytesread,LPDWORD totalavailable);
30   DWORD WINAPI NetAuditWrite(DWORD type,LPBYTE buf,DWORD numbytes,LPCWSTR service,LPBYTE reserved);
31 
32   typedef struct _AUDIT_ENTRY {
33     DWORD ae_len;
34     DWORD ae_reserved;
35     DWORD ae_time;
36     DWORD ae_type;
37     DWORD ae_data_offset;
38     DWORD ae_data_size;
39   } AUDIT_ENTRY,*PAUDIT_ENTRY,*LPAUDIT_ENTRY;
40 
41 #define REVISED_AUDIT_ENTRY_STRUCT
42 
43   typedef struct _AE_SRVSTATUS {
44     DWORD ae_sv_status;
45   } AE_SRVSTATUS,*PAE_SRVSTATUS,*LPAE_SRVSTATUS;
46 
47   typedef struct _AE_SESSLOGON {
48     DWORD ae_so_compname;
49     DWORD ae_so_username;
50     DWORD ae_so_privilege;
51   } AE_SESSLOGON,*PAE_SESSLOGON,*LPAE_SESSLOGON;
52 
53   typedef struct _AE_SESSLOGOFF {
54     DWORD ae_sf_compname;
55     DWORD ae_sf_username;
56     DWORD ae_sf_reason;
57   } AE_SESSLOGOFF,*PAE_SESSLOGOFF,*LPAE_SESSLOGOFF;
58 
59   typedef struct _AE_SESSPWERR {
60     DWORD ae_sp_compname;
61     DWORD ae_sp_username;
62   } AE_SESSPWERR,*PAE_SESSPWERR,*LPAE_SESSPWERR;
63 
64   typedef struct _AE_CONNSTART {
65     DWORD ae_ct_compname;
66     DWORD ae_ct_username;
67     DWORD ae_ct_netname;
68     DWORD ae_ct_connid;
69   } AE_CONNSTART,*PAE_CONNSTART,*LPAE_CONNSTART;
70 
71   typedef struct _AE_CONNSTOP {
72     DWORD ae_cp_compname;
73     DWORD ae_cp_username;
74     DWORD ae_cp_netname;
75     DWORD ae_cp_connid;
76     DWORD ae_cp_reason;
77   } AE_CONNSTOP,*PAE_CONNSTOP,*LPAE_CONNSTOP;
78 
79   typedef struct _AE_CONNREJ {
80     DWORD ae_cr_compname;
81     DWORD ae_cr_username;
82     DWORD ae_cr_netname;
83     DWORD ae_cr_reason;
84   } AE_CONNREJ,*PAE_CONNREJ,*LPAE_CONNREJ;
85 
86   typedef struct _AE_RESACCESS {
87     DWORD ae_ra_compname;
88     DWORD ae_ra_username;
89     DWORD ae_ra_resname;
90     DWORD ae_ra_operation;
91     DWORD ae_ra_returncode;
92     DWORD ae_ra_restype;
93     DWORD ae_ra_fileid;
94   } AE_RESACCESS,*PAE_RESACCESS,*LPAE_RESACCESS;
95 
96   typedef struct _AE_RESACCESSREJ {
97     DWORD ae_rr_compname;
98     DWORD ae_rr_username;
99     DWORD ae_rr_resname;
100     DWORD ae_rr_operation;
101   } AE_RESACCESSREJ,*PAE_RESACCESSREJ,*LPAE_RESACCESSREJ;
102 
103   typedef struct _AE_CLOSEFILE {
104     DWORD ae_cf_compname;
105     DWORD ae_cf_username;
106     DWORD ae_cf_resname;
107     DWORD ae_cf_fileid;
108     DWORD ae_cf_duration;
109     DWORD ae_cf_reason;
110   } AE_CLOSEFILE,*PAE_CLOSEFILE,*LPAE_CLOSEFILE;
111 
112   typedef struct _AE_SERVICESTAT {
113     DWORD ae_ss_compname;
114     DWORD ae_ss_username;
115     DWORD ae_ss_svcname;
116     DWORD ae_ss_status;
117     DWORD ae_ss_code;
118     DWORD ae_ss_text;
119     DWORD ae_ss_returnval;
120   } AE_SERVICESTAT,*PAE_SERVICESTAT,*LPAE_SERVICESTAT;
121 
122   typedef struct _AE_ACLMOD {
123     DWORD ae_am_compname;
124     DWORD ae_am_username;
125     DWORD ae_am_resname;
126     DWORD ae_am_action;
127     DWORD ae_am_datalen;
128   } AE_ACLMOD,*PAE_ACLMOD,*LPAE_ACLMOD;
129 
130   typedef struct _AE_UASMOD {
131     DWORD ae_um_compname;
132     DWORD ae_um_username;
133     DWORD ae_um_resname;
134     DWORD ae_um_rectype;
135     DWORD ae_um_action;
136     DWORD ae_um_datalen;
137   } AE_UASMOD,*PAE_UASMOD,*LPAE_UASMOD;
138 
139   typedef struct _AE_NETLOGON {
140     DWORD ae_no_compname;
141     DWORD ae_no_username;
142     DWORD ae_no_privilege;
143     DWORD ae_no_authflags;
144   } AE_NETLOGON,*PAE_NETLOGON,*LPAE_NETLOGON;
145 
146   typedef struct _AE_NETLOGOFF {
147     DWORD ae_nf_compname;
148     DWORD ae_nf_username;
149     DWORD ae_nf_reserved1;
150     DWORD ae_nf_reserved2;
151   } AE_NETLOGOFF,*PAE_NETLOGOFF,*LPAE_NETLOGOFF;
152 
153   typedef struct _AE_ACCLIM {
154     DWORD ae_al_compname;
155     DWORD ae_al_username;
156     DWORD ae_al_resname;
157     DWORD ae_al_limit;
158   } AE_ACCLIM,*PAE_ACCLIM,*LPAE_ACCLIM;
159 
160 #define ACTION_LOCKOUT 00
161 #define ACTION_ADMINUNLOCK 01
162 
163   typedef struct _AE_LOCKOUT {
164     DWORD ae_lk_compname;
165     DWORD ae_lk_username;
166     DWORD ae_lk_action;
167     DWORD ae_lk_bad_pw_count;
168   } AE_LOCKOUT,*PAE_LOCKOUT,*LPAE_LOCKOUT;
169 
170   typedef struct _AE_GENERIC {
171     DWORD ae_ge_msgfile;
172     DWORD ae_ge_msgnum;
173     DWORD ae_ge_params;
174     DWORD ae_ge_param1;
175     DWORD ae_ge_param2;
176     DWORD ae_ge_param3;
177     DWORD ae_ge_param4;
178     DWORD ae_ge_param5;
179     DWORD ae_ge_param6;
180     DWORD ae_ge_param7;
181     DWORD ae_ge_param8;
182     DWORD ae_ge_param9;
183   } AE_GENERIC,*PAE_GENERIC,*LPAE_GENERIC;
184 
185 #define AE_SRVSTATUS 0
186 #define AE_SESSLOGON 1
187 #define AE_SESSLOGOFF 2
188 #define AE_SESSPWERR 3
189 #define AE_CONNSTART 4
190 #define AE_CONNSTOP 5
191 #define AE_CONNREJ 6
192 #define AE_RESACCESS 7
193 #define AE_RESACCESSREJ 8
194 #define AE_CLOSEFILE 9
195 #define AE_SERVICESTAT 11
196 #define AE_ACLMOD 12
197 #define AE_UASMOD 13
198 #define AE_NETLOGON 14
199 #define AE_NETLOGOFF 15
200 #define AE_NETLOGDENIED 16
201 #define AE_ACCLIMITEXCD 17
202 #define AE_RESACCESS2 18
203 #define AE_ACLMODFAIL 19
204 #define AE_LOCKOUT 20
205 #define AE_GENERIC_TYPE 21
206 
207 #define AE_SRVSTART 0
208 #define AE_SRVPAUSED 1
209 #define AE_SRVCONT 2
210 #define AE_SRVSTOP 3
211 
212 #define AE_GUEST 0
213 #define AE_USER 1
214 #define AE_ADMIN 2
215 
216 #define AE_NORMAL 0
217 #define AE_USERLIMIT 0
218 #define AE_GENERAL 0
219 #define AE_ERROR 1
220 #define AE_SESSDIS 1
221 #define AE_BADPW 1
222 #define AE_AUTODIS 2
223 #define AE_UNSHARE 2
224 #define AE_ADMINPRIVREQD 2
225 #define AE_ADMINDIS 3
226 #define AE_NOACCESSPERM 3
227 #define AE_ACCRESTRICT 4
228 
229 #define AE_NORMAL_CLOSE 0
230 #define AE_SES_CLOSE 1
231 #define AE_ADMIN_CLOSE 2
232 
233 #define AE_LIM_UNKNOWN 0
234 #define AE_LIM_LOGONHOURS 1
235 #define AE_LIM_EXPIRED 2
236 #define AE_LIM_INVAL_WKSTA 3
237 #define AE_LIM_DISABLED 4
238 #define AE_LIM_DELETED 5
239 
240 #define AE_MOD 0
241 #define AE_DELETE 1
242 #define AE_ADD 2
243 
244 #define AE_UAS_USER 0
245 #define AE_UAS_GROUP 1
246 #define AE_UAS_MODALS 2
247 
248 #define SVAUD_SERVICE 0x1
249 #define SVAUD_GOODSESSLOGON 0x6
250 #define SVAUD_BADSESSLOGON 0x18
251 #define SVAUD_SESSLOGON (SVAUD_GOODSESSLOGON | SVAUD_BADSESSLOGON)
252 #define SVAUD_GOODNETLOGON 0x60
253 #define SVAUD_BADNETLOGON 0x180
254 #define SVAUD_NETLOGON (SVAUD_GOODNETLOGON | SVAUD_BADNETLOGON)
255 #define SVAUD_LOGON (SVAUD_NETLOGON | SVAUD_SESSLOGON)
256 #define SVAUD_GOODUSE 0x600
257 #define SVAUD_BADUSE 0x1800
258 #define SVAUD_USE (SVAUD_GOODUSE | SVAUD_BADUSE)
259 #define SVAUD_USERLIST 0x2000
260 #define SVAUD_PERMISSIONS 0x4000
261 #define SVAUD_RESOURCE 0x8000
262 #define SVAUD_LOGONLIM 0x00010000
263 
264 #define AA_AUDIT_ALL 0x0001
265 #define AA_A_OWNER 0x0004
266 #define AA_CLOSE 0x0008
267 #define AA_S_OPEN 0x0010
268 #define AA_S_WRITE 0x0020
269 #define AA_S_CREATE 0x0020
270 #define AA_S_DELETE 0x0040
271 #define AA_S_ACL 0x0080
272 #define AA_S_ALL (AA_S_OPEN | AA_S_WRITE | AA_S_DELETE | AA_S_ACL)
273 #define AA_F_OPEN 0x0100
274 #define AA_F_WRITE 0x0200
275 #define AA_F_CREATE 0x0200
276 #define AA_F_DELETE 0x0400
277 #define AA_F_ACL 0x0800
278 #define AA_F_ALL (AA_F_OPEN | AA_F_WRITE | AA_F_DELETE | AA_F_ACL)
279 
280 #define AA_A_OPEN 0x1000
281 #define AA_A_WRITE 0x2000
282 #define AA_A_CREATE 0x2000
283 #define AA_A_DELETE 0x4000
284 #define AA_A_ACL 0x8000
285 #define AA_A_ALL (AA_F_OPEN | AA_F_WRITE | AA_F_DELETE | AA_F_ACL)
286 
287 #ifdef __cplusplus
288 }
289 #endif
290 #endif
291