1 /***********************************************************************\
2 *                               lmaudit.d                               *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *                 Translated from MinGW Windows headers                 *
7 *                                                                       *
8 *                       Placed into public domain                       *
9 \***********************************************************************/
10 // COMMENT: This file may be deprecated.
11 module windows.lmaudit;
12 
13 private import windows.lmcons, windows.windef;
14 nothrow:
15 const LOGFLAGS_FORWARD  = 0;
16 const LOGFLAGS_BACKWARD = 1;
17 const LOGFLAGS_SEEK     = 2;
18 
19 const ACTION_LOCKOUT     = 0;
20 const ACTION_ADMINUNLOCK = 1;
21 
22 const AE_GUEST=0;
23 const AE_USER=1;
24 const AE_ADMIN=2;
25 const AE_NORMAL=0;
26 const AE_USERLIMIT=0;
27 const AE_GENERAL=0;
28 const AE_ERROR=1;
29 const AE_SESSDIS=1;
30 const AE_BADPW=1;
31 const AE_AUTODIS=2;
32 const AE_UNSHARE=2;
33 const AE_ADMINPRIVREQD=2;
34 const AE_ADMINDIS=3;
35 const AE_NOACCESSPERM=3;
36 const AE_ACCRESTRICT=4;
37 const AE_NORMAL_CLOSE=0;
38 const AE_SES_CLOSE=1;
39 const AE_ADMIN_CLOSE=2;
40 const AE_LIM_UNKNOWN=0;
41 const AE_LIM_LOGONHOURS=1;
42 const AE_LIM_EXPIRED=2;
43 const AE_LIM_INVAL_WKSTA=3;
44 const AE_LIM_DISABLED=4;
45 const AE_LIM_DELETED=5;
46 const AE_MOD=0;
47 const AE_DELETE=1;
48 const AE_ADD=2;
49 
50 const AE_UAS_USER   = 0;
51 const AE_UAS_GROUP  = 1;
52 const AE_UAS_MODALS = 2;
53 
54 const SVAUD_SERVICE       = 1;
55 const SVAUD_GOODSESSLOGON = 6;
56 const SVAUD_BADSESSLOGON  = 24;
57 const SVAUD_SESSLOGON     = SVAUD_GOODSESSLOGON|SVAUD_BADSESSLOGON;
58 const SVAUD_GOODNETLOGON  = 96;
59 const SVAUD_BADNETLOGON   = 384;
60 const SVAUD_NETLOGON      = SVAUD_GOODNETLOGON|SVAUD_BADNETLOGON;
61 const SVAUD_LOGON         = SVAUD_NETLOGON|SVAUD_SESSLOGON;
62 const SVAUD_GOODUSE       = 0x600;
63 const SVAUD_BADUSE        = 0x1800;
64 const SVAUD_USE           = SVAUD_GOODUSE|SVAUD_BADUSE;
65 const SVAUD_USERLIST      = 8192;
66 const SVAUD_PERMISSIONS   = 16384;
67 const SVAUD_RESOURCE      = 32768;
68 const SVAUD_LOGONLIM      = 65536;
69 
70 const AA_AUDIT_ALL=1;
71 const AA_A_OWNER=4;
72 const AA_CLOSE=8;
73 const AA_S_OPEN=16;
74 const AA_S_WRITE=32;
75 const AA_S_CREATE=32;
76 const AA_S_DELETE=64;
77 const AA_S_ACL=128;
78 const AA_S_ALL=253;
79 const AA_F_OPEN=256;
80 const AA_F_WRITE=512;
81 const AA_F_CREATE=512;
82 const AA_F_DELETE=1024;
83 const AA_F_ACL=2048;
84 const AA_F_ALL = AA_F_OPEN|AA_F_WRITE|AA_F_DELETE|AA_F_ACL;
85 const AA_A_OPEN=2048;
86 const AA_A_WRITE=4096;
87 const AA_A_CREATE=8192;
88 const AA_A_DELETE=16384;
89 const AA_A_ACL=32768;
90 const AA_A_ALL = AA_F_OPEN|AA_F_WRITE|AA_F_DELETE|AA_F_ACL;
91 
92 struct AUDIT_ENTRY{
93 	DWORD ae_len;
94 	DWORD ae_reserved;
95 	DWORD ae_time;
96 	DWORD ae_type;
97 	DWORD ae_data_offset;
98 	DWORD ae_data_size;
99 }
100 alias AUDIT_ENTRY* PAUDIT_ENTRY, LPAUDIT_ENTRY;
101 
102 struct HLOG{
103 	DWORD time;
104 	DWORD last_flags;
105 	DWORD offset;
106 	DWORD rec_offset;
107 }
108 alias HLOG* PHLOG, LPHLOG;
109 
110 struct AE_SRVSTATUS{
111 	DWORD ae_sv_status;
112 }
113 alias AE_SRVSTATUS* PAE_SRVSTATUS, LPAE_SRVSTATUS;
114 
115 struct AE_SESSLOGON{
116 	DWORD ae_so_compname;
117 	DWORD ae_so_username;
118 	DWORD ae_so_privilege;
119 }
120 alias AE_SESSLOGON* PAE_SESSLOGON, LPAE_SESSLOGON;
121 
122 struct AE_SESSLOGOFF{
123 	DWORD ae_sf_compname;
124 	DWORD ae_sf_username;
125 	DWORD ae_sf_reason;
126 }
127 alias AE_SESSLOGOFF* PAE_SESSLOGOFF, LPAE_SESSLOGOFF;
128 
129 struct AE_SESSPWERR{
130 	DWORD ae_sp_compname;
131 	DWORD ae_sp_username;
132 }
133 alias AE_SESSPWERR* PAE_SESSPWERR, LPAE_SESSPWERR;
134 
135 struct AE_CONNSTART{
136 	DWORD ae_ct_compname;
137 	DWORD ae_ct_username;
138 	DWORD ae_ct_netname;
139 	DWORD ae_ct_connid;
140 }
141 alias AE_CONNSTART* PAE_CONNSTART, LPAE_CONNSTART;
142 
143 struct AE_CONNSTOP{
144 	DWORD ae_cp_compname;
145 	DWORD ae_cp_username;
146 	DWORD ae_cp_netname;
147 	DWORD ae_cp_connid;
148 	DWORD ae_cp_reason;
149 }
150 alias AE_CONNSTOP* PAE_CONNSTOP, LPAE_CONNSTOP;
151 
152 struct AE_CONNREJ{
153 	DWORD ae_cr_compname;
154 	DWORD ae_cr_username;
155 	DWORD ae_cr_netname;
156 	DWORD ae_cr_reason;
157 }
158 alias AE_CONNREJ* PAE_CONNREJ, LPAE_CONNREJ;
159 
160 struct AE_RESACCESS{
161 	DWORD ae_ra_compname;
162 	DWORD ae_ra_username;
163 	DWORD ae_ra_resname;
164 	DWORD ae_ra_operation;
165 	DWORD ae_ra_returncode;
166 	DWORD ae_ra_restype;
167 	DWORD ae_ra_fileid;
168 }
169 alias AE_RESACCESS* PAE_RESACCESS, LPAE_RESACCESS;
170 
171 struct AE_RESACCESSREJ{
172 	DWORD ae_rr_compname;
173 	DWORD ae_rr_username;
174 	DWORD ae_rr_resname;
175 	DWORD ae_rr_operation;
176 }
177 alias AE_RESACCESSREJ* PAE_RESACCESSREJ, LPAE_RESACCESSREJ;
178 
179 struct AE_CLOSEFILE{
180 	DWORD ae_cf_compname;
181 	DWORD ae_cf_username;
182 	DWORD ae_cf_resname;
183 	DWORD ae_cf_fileid;
184 	DWORD ae_cf_duration;
185 	DWORD ae_cf_reason;
186 }
187 alias AE_CLOSEFILE* PAE_CLOSEFILE, LPAE_CLOSEFILE;
188 
189 struct AE_SERVICESTAT{
190 	DWORD ae_ss_compname;
191 	DWORD ae_ss_username;
192 	DWORD ae_ss_svcname;
193 	DWORD ae_ss_status;
194 	DWORD ae_ss_code;
195 	DWORD ae_ss_text;
196 	DWORD ae_ss_returnval;
197 }
198 alias AE_SERVICESTAT* PAE_SERVICESTAT, LPAE_SERVICESTAT;
199 
200 struct AE_ACLMOD{
201 	DWORD ae_am_compname;
202 	DWORD ae_am_username;
203 	DWORD ae_am_resname;
204 	DWORD ae_am_action;
205 	DWORD ae_am_datalen;
206 }
207 alias AE_ACLMOD* PAE_ACLMOD, LPAE_ACLMOD;
208 
209 struct AE_UASMOD{
210 	DWORD ae_um_compname;
211 	DWORD ae_um_username;
212 	DWORD ae_um_resname;
213 	DWORD ae_um_rectype;
214 	DWORD ae_um_action;
215 	DWORD ae_um_datalen;
216 }
217 alias AE_UASMOD* PAE_UASMOD, LPAE_UASMOD;
218 
219 struct AE_NETLOGON{
220 	DWORD ae_no_compname;
221 	DWORD ae_no_username;
222 	DWORD ae_no_privilege;
223 	DWORD ae_no_authflags;
224 }
225 alias AE_NETLOGON* PAE_NETLOGON, LPAE_NETLOGON;
226 
227 struct AE_NETLOGOFF{
228 	DWORD ae_nf_compname;
229 	DWORD ae_nf_username;
230 	DWORD ae_nf_reserved1;
231 	DWORD ae_nf_reserved2;
232 }
233 alias AE_NETLOGOFF* PAE_NETLOGOFF, LPAE_NETLOGOFF;
234 
235 struct AE_ACCLIM{
236 	DWORD ae_al_compname;
237 	DWORD ae_al_username;
238 	DWORD ae_al_resname;
239 	DWORD ae_al_limit;
240 }
241 alias AE_ACCLIM* PAE_ACCLIM, LPAE_ACCLIM;
242 
243 struct AE_LOCKOUT{
244 	DWORD ae_lk_compname;
245 	DWORD ae_lk_username;
246 	DWORD ae_lk_action;
247 	DWORD ae_lk_bad_pw_count;
248 }
249 alias AE_LOCKOUT* PAE_LOCKOUT, LPAE_LOCKOUT;
250 
251 struct AE_GENERIC{
252 	DWORD ae_ge_msgfile;
253 	DWORD ae_ge_msgnum;
254 	DWORD ae_ge_params;
255 	DWORD ae_ge_param1;
256 	DWORD ae_ge_param2;
257 	DWORD ae_ge_param3;
258 	DWORD ae_ge_param4;
259 	DWORD ae_ge_param5;
260 	DWORD ae_ge_param6;
261 	DWORD ae_ge_param7;
262 	DWORD ae_ge_param8;
263 	DWORD ae_ge_param9;
264 }
265 alias AE_GENERIC* PAE_GENERIC, LPAE_GENERIC;
266 
267 extern (Windows) {
268 deprecated {
269 NET_API_STATUS NetAuditClear(LPCWSTR,LPCWSTR,LPCWSTR);
270 NET_API_STATUS NetAuditRead(LPTSTR,LPTSTR,LPHLOG,DWORD,PDWORD,DWORD,DWORD,PBYTE*,DWORD,PDWORD,PDWORD);
271 NET_API_STATUS NetAuditWrite(DWORD,PBYTE,DWORD,LPTSTR,PBYTE);
272 }
273 }
274 
275 /+
276 /* MinGW: These conflict with struct typedefs, why? */
277 const AE_SRVSTATUS=0;
278 const AE_SESSLOGON=1;
279 const AE_SESSLOGOFF=2;
280 const AE_SESSPWERR=3;
281 const AE_CONNSTART=4;
282 const AE_CONNSTOP=5;
283 const AE_CONNREJ=6;
284 const AE_RESACCESS=7;
285 const AE_RESACCESSREJ=8;
286 const AE_CLOSEFILE=9;
287 const AE_SERVICESTAT=11;
288 const AE_ACLMOD=12;
289 const AE_UASMOD=13;
290 const AE_NETLOGON=14;
291 const AE_NETLOGOFF=15;
292 const AE_NETLOGDENIED=16;
293 const AE_ACCLIMITEXCD=17;
294 const AE_RESACCESS2=18;
295 const AE_ACLMODFAIL=19;
296 const AE_LOCKOUT=20;
297 const AE_GENERIC_TYPE=21;
298 const AE_SRVSTART=0;
299 const AE_SRVPAUSED=1;
300 const AE_SRVCONT=2;
301 const AE_SRVSTOP=3;
302 +/