Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

417 lines
11 KiB

  1. /*++ BUILD Version: 0003 // Increment this if a change has global effects
  2. Copyright (c) 1991-1993 Microsoft Corporation
  3. Module Name:
  4. lmaudit.h
  5. Abstract:
  6. This module defines the API function prototypes and data structures
  7. for the following groups of NT API functions:
  8. NetAudit
  9. Author:
  10. Dan Lafferty (danl) 29-Mar-1991
  11. Environment:
  12. User Mode - Win32
  13. Notes:
  14. You must include NETCONS.H before this file, since this file depends
  15. on values defined in NETCONS.H.
  16. Revision History:
  17. 28-Mar-1991 Danl
  18. Ported from LM2.0 and the LMNETAPI spec.
  19. 25-Apr-1991 DanHi
  20. Added define for HLOG used by both audit and error logs, surrounded
  21. by a protective ifdef. Changed ae_ss_status to ae_sv_status to match
  22. LanMan
  23. 12-Nov-1991 JohnRo
  24. AUDIT_ENTRY structure needs changes to prevent alignment/padding bugs.
  25. Added OPTIONAL keyword as applicable. Work toward UNICODE.
  26. 26-Oct-1992 JohnRo
  27. Correct typedef name for pointer to AE_SRVSTATUS.
  28. Added AE_LOCKOUT structure and typedef.
  29. --*/
  30. #ifndef _LMAUDIT_
  31. #define _LMAUDIT_
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. #ifndef _LMHLOGDEFINED_
  36. #define _LMHLOGDEFINED_
  37. typedef struct _HLOG {
  38. DWORD time;
  39. DWORD last_flags;
  40. DWORD offset;
  41. DWORD rec_offset;
  42. } HLOG, *PHLOG, *LPHLOG;
  43. #define LOGFLAGS_FORWARD 0
  44. #define LOGFLAGS_BACKWARD 0x1
  45. #define LOGFLAGS_SEEK 0x2
  46. #endif
  47. //
  48. // Function Prototypes - Audit
  49. //
  50. NET_API_STATUS NET_API_FUNCTION
  51. NetAuditClear (
  52. IN LPTSTR server OPTIONAL,
  53. IN LPTSTR backupfile OPTIONAL,
  54. IN LPTSTR service OPTIONAL // WARNING: buggy support before LM 2.0C!!
  55. );
  56. NET_API_STATUS NET_API_FUNCTION
  57. NetAuditRead (
  58. IN LPTSTR server OPTIONAL,
  59. IN LPTSTR service OPTIONAL, // WARNING: buggy support before LM 2.0C!!
  60. IN LPHLOG auditloghandle,
  61. IN DWORD offset,
  62. IN LPDWORD reserved1 OPTIONAL,
  63. IN DWORD reserved2,
  64. IN DWORD offsetflag,
  65. OUT LPBYTE *bufptr,
  66. IN DWORD prefmaxlen,
  67. OUT LPDWORD bytesread,
  68. OUT LPDWORD totalavailable
  69. );
  70. NET_API_STATUS NET_API_FUNCTION
  71. NetAuditWrite (
  72. IN DWORD type,
  73. IN LPBYTE buf,
  74. IN DWORD numbytes,
  75. IN LPTSTR service OPTIONAL,
  76. IN LPBYTE reserved OPTIONAL
  77. );
  78. //
  79. // Data Structures - Audit
  80. //
  81. typedef struct _AUDIT_ENTRY {
  82. DWORD ae_len;
  83. DWORD ae_reserved;
  84. DWORD ae_time;
  85. DWORD ae_type;
  86. DWORD ae_data_offset; /* Offset from beginning
  87. address of audit_entry */
  88. DWORD ae_data_size; // byte count of ae_data area (not incl pad).
  89. } AUDIT_ENTRY, *PAUDIT_ENTRY, *LPAUDIT_ENTRY;
  90. // BUGBUG: Temporary to let users ifdef on this struct layout.
  91. #define REVISED_AUDIT_ENTRY_STRUCT
  92. typedef struct _AE_SRVSTATUS {
  93. DWORD ae_sv_status;
  94. } AE_SRVSTATUS, *PAE_SRVSTATUS, *LPAE_SRVSTATUS;
  95. typedef struct _AE_SESSLOGON {
  96. DWORD ae_so_compname;
  97. DWORD ae_so_username;
  98. DWORD ae_so_privilege;
  99. } AE_SESSLOGON, *PAE_SESSLOGON, *LPAE_SESSLOGON;
  100. typedef struct _AE_SESSLOGOFF {
  101. DWORD ae_sf_compname;
  102. DWORD ae_sf_username;
  103. DWORD ae_sf_reason;
  104. } AE_SESSLOGOFF, *PAE_SESSLOGOFF, *LPAE_SESSLOGOFF;
  105. typedef struct _AE_SESSPWERR {
  106. DWORD ae_sp_compname;
  107. DWORD ae_sp_username;
  108. } AE_SESSPWERR, *PAE_SESSPWERR, *LPAE_SESSPWERR;
  109. typedef struct _AE_CONNSTART {
  110. DWORD ae_ct_compname;
  111. DWORD ae_ct_username;
  112. DWORD ae_ct_netname;
  113. DWORD ae_ct_connid;
  114. } AE_CONNSTART, *PAE_CONNSTART, *LPAE_CONNSTART;
  115. typedef struct _AE_CONNSTOP {
  116. DWORD ae_cp_compname;
  117. DWORD ae_cp_username;
  118. DWORD ae_cp_netname;
  119. DWORD ae_cp_connid;
  120. DWORD ae_cp_reason;
  121. } AE_CONNSTOP, *PAE_CONNSTOP, *LPAE_CONNSTOP;
  122. typedef struct _AE_CONNREJ {
  123. DWORD ae_cr_compname;
  124. DWORD ae_cr_username;
  125. DWORD ae_cr_netname;
  126. DWORD ae_cr_reason;
  127. } AE_CONNREJ, *PAE_CONNREJ, *LPAE_CONNREJ;
  128. typedef struct _AE_RESACCESS {
  129. DWORD ae_ra_compname;
  130. DWORD ae_ra_username;
  131. DWORD ae_ra_resname;
  132. DWORD ae_ra_operation;
  133. DWORD ae_ra_returncode;
  134. DWORD ae_ra_restype;
  135. DWORD ae_ra_fileid;
  136. } AE_RESACCESS, *PAE_RESACCESS, *LPAE_RESACCESS;
  137. typedef struct _AE_RESACCESSREJ {
  138. DWORD ae_rr_compname;
  139. DWORD ae_rr_username;
  140. DWORD ae_rr_resname;
  141. DWORD ae_rr_operation;
  142. } AE_RESACCESSREJ, *PAE_RESACCESSREJ, *LPAE_RESACCESSREJ;
  143. typedef struct _AE_CLOSEFILE {
  144. DWORD ae_cf_compname;
  145. DWORD ae_cf_username;
  146. DWORD ae_cf_resname;
  147. DWORD ae_cf_fileid;
  148. DWORD ae_cf_duration;
  149. DWORD ae_cf_reason;
  150. } AE_CLOSEFILE, *PAE_CLOSEFILE, *LPAE_CLOSEFILE;
  151. typedef struct _AE_SERVICESTAT {
  152. DWORD ae_ss_compname;
  153. DWORD ae_ss_username;
  154. DWORD ae_ss_svcname;
  155. DWORD ae_ss_status;
  156. DWORD ae_ss_code;
  157. DWORD ae_ss_text;
  158. DWORD ae_ss_returnval;
  159. } AE_SERVICESTAT, *PAE_SERVICESTAT, *LPAE_SERVICESTAT;
  160. typedef struct _AE_ACLMOD {
  161. DWORD ae_am_compname;
  162. DWORD ae_am_username;
  163. DWORD ae_am_resname;
  164. DWORD ae_am_action;
  165. DWORD ae_am_datalen;
  166. } AE_ACLMOD, *PAE_ACLMOD, *LPAE_ACLMOD;
  167. typedef struct _AE_UASMOD {
  168. DWORD ae_um_compname;
  169. DWORD ae_um_username;
  170. DWORD ae_um_resname;
  171. DWORD ae_um_rectype;
  172. DWORD ae_um_action;
  173. DWORD ae_um_datalen;
  174. } AE_UASMOD, *PAE_UASMOD, *LPAE_UASMOD;
  175. typedef struct _AE_NETLOGON {
  176. DWORD ae_no_compname;
  177. DWORD ae_no_username;
  178. DWORD ae_no_privilege;
  179. DWORD ae_no_authflags;
  180. } AE_NETLOGON, *PAE_NETLOGON, *LPAE_NETLOGON;
  181. typedef struct _AE_NETLOGOFF {
  182. DWORD ae_nf_compname;
  183. DWORD ae_nf_username;
  184. DWORD ae_nf_reserved1;
  185. DWORD ae_nf_reserved2;
  186. } AE_NETLOGOFF, *PAE_NETLOGOFF, *LPAE_NETLOGOFF;
  187. typedef struct _AE_ACCLIM {
  188. DWORD ae_al_compname;
  189. DWORD ae_al_username;
  190. DWORD ae_al_resname;
  191. DWORD ae_al_limit;
  192. } AE_ACCLIM, *PAE_ACCLIM, *LPAE_ACCLIM;
  193. #define ACTION_LOCKOUT 00
  194. #define ACTION_ADMINUNLOCK 01
  195. typedef struct _AE_LOCKOUT {
  196. DWORD ae_lk_compname; // Ptr to computername of client.
  197. DWORD ae_lk_username; // Ptr to username of client (NULL
  198. // if same as computername).
  199. DWORD ae_lk_action; // Action taken on account:
  200. // 0 means locked out, 1 means not.
  201. DWORD ae_lk_bad_pw_count; // Bad password count at the time
  202. // of lockout.
  203. } AE_LOCKOUT, *PAE_LOCKOUT, *LPAE_LOCKOUT;
  204. typedef struct _AE_GENERIC {
  205. DWORD ae_ge_msgfile;
  206. DWORD ae_ge_msgnum;
  207. DWORD ae_ge_params;
  208. DWORD ae_ge_param1;
  209. DWORD ae_ge_param2;
  210. DWORD ae_ge_param3;
  211. DWORD ae_ge_param4;
  212. DWORD ae_ge_param5;
  213. DWORD ae_ge_param6;
  214. DWORD ae_ge_param7;
  215. DWORD ae_ge_param8;
  216. DWORD ae_ge_param9;
  217. } AE_GENERIC, *PAE_GENERIC, *LPAE_GENERIC;
  218. //
  219. // Special Values and Constants - Audit
  220. //
  221. //
  222. // Audit entry types (field ae_type in audit_entry).
  223. //
  224. #define AE_SRVSTATUS 0
  225. #define AE_SESSLOGON 1
  226. #define AE_SESSLOGOFF 2
  227. #define AE_SESSPWERR 3
  228. #define AE_CONNSTART 4
  229. #define AE_CONNSTOP 5
  230. #define AE_CONNREJ 6
  231. #define AE_RESACCESS 7
  232. #define AE_RESACCESSREJ 8
  233. #define AE_CLOSEFILE 9
  234. #define AE_SERVICESTAT 11
  235. #define AE_ACLMOD 12
  236. #define AE_UASMOD 13
  237. #define AE_NETLOGON 14
  238. #define AE_NETLOGOFF 15
  239. #define AE_NETLOGDENIED 16
  240. #define AE_ACCLIMITEXCD 17
  241. #define AE_RESACCESS2 18
  242. #define AE_ACLMODFAIL 19
  243. #define AE_LOCKOUT 20
  244. #define AE_GENERIC_TYPE 21
  245. //
  246. // Values for ae_ss_status field of ae_srvstatus.
  247. //
  248. #define AE_SRVSTART 0
  249. #define AE_SRVPAUSED 1
  250. #define AE_SRVCONT 2
  251. #define AE_SRVSTOP 3
  252. //
  253. // Values for ae_so_privilege field of ae_sesslogon.
  254. //
  255. #define AE_GUEST 0
  256. #define AE_USER 1
  257. #define AE_ADMIN 2
  258. //
  259. // Values for various ae_XX_reason fields.
  260. //
  261. #define AE_NORMAL 0
  262. #define AE_USERLIMIT 0
  263. #define AE_GENERAL 0
  264. #define AE_ERROR 1
  265. #define AE_SESSDIS 1
  266. #define AE_BADPW 1
  267. #define AE_AUTODIS 2
  268. #define AE_UNSHARE 2
  269. #define AE_ADMINPRIVREQD 2
  270. #define AE_ADMINDIS 3
  271. #define AE_NOACCESSPERM 3
  272. #define AE_ACCRESTRICT 4
  273. #define AE_NORMAL_CLOSE 0
  274. #define AE_SES_CLOSE 1
  275. #define AE_ADMIN_CLOSE 2
  276. //
  277. // Values for xx_subreason fields.
  278. //
  279. #define AE_LIM_UNKNOWN 0
  280. #define AE_LIM_LOGONHOURS 1
  281. #define AE_LIM_EXPIRED 2
  282. #define AE_LIM_INVAL_WKSTA 3
  283. #define AE_LIM_DISABLED 4
  284. #define AE_LIM_DELETED 5
  285. //
  286. // Values for xx_action fields
  287. //
  288. #define AE_MOD 0
  289. #define AE_DELETE 1
  290. #define AE_ADD 2
  291. //
  292. // Types of UAS record for um_rectype field
  293. //
  294. #define AE_UAS_USER 0
  295. #define AE_UAS_GROUP 1
  296. #define AE_UAS_MODALS 2
  297. //
  298. // Bitmasks for auditing events
  299. //
  300. // The parentheses around the hex constants broke h_to_inc
  301. // and have been purged from the face of the earth.
  302. //
  303. #define SVAUD_SERVICE 0x1
  304. #define SVAUD_GOODSESSLOGON 0x6
  305. #define SVAUD_BADSESSLOGON 0x18
  306. #define SVAUD_SESSLOGON (SVAUD_GOODSESSLOGON | SVAUD_BADSESSLOGON)
  307. #define SVAUD_GOODNETLOGON 0x60
  308. #define SVAUD_BADNETLOGON 0x180
  309. #define SVAUD_NETLOGON (SVAUD_GOODNETLOGON | SVAUD_BADNETLOGON)
  310. #define SVAUD_LOGON (SVAUD_NETLOGON | SVAUD_SESSLOGON)
  311. #define SVAUD_GOODUSE 0x600
  312. #define SVAUD_BADUSE 0x1800
  313. #define SVAUD_USE (SVAUD_GOODUSE | SVAUD_BADUSE)
  314. #define SVAUD_USERLIST 0x2000
  315. #define SVAUD_PERMISSIONS 0x4000
  316. #define SVAUD_RESOURCE 0x8000
  317. #define SVAUD_LOGONLIM 0x00010000
  318. //
  319. // Resource access audit bitmasks.
  320. //
  321. #define AA_AUDIT_ALL 0x0001
  322. #define AA_A_OWNER 0x0004
  323. #define AA_CLOSE 0x0008
  324. #define AA_S_OPEN 0x0010
  325. #define AA_S_WRITE 0x0020
  326. #define AA_S_CREATE 0x0020
  327. #define AA_S_DELETE 0x0040
  328. #define AA_S_ACL 0x0080
  329. #define AA_S_ALL ( AA_S_OPEN | AA_S_WRITE | AA_S_DELETE | AA_S_ACL)
  330. #define AA_F_OPEN 0x0100
  331. #define AA_F_WRITE 0x0200
  332. #define AA_F_CREATE 0x0200
  333. #define AA_F_DELETE 0x0400
  334. #define AA_F_ACL 0x0800
  335. #define AA_F_ALL ( AA_F_OPEN | AA_F_WRITE | AA_F_DELETE | AA_F_ACL)
  336. // Pinball-specific
  337. #define AA_A_OPEN 0x1000
  338. #define AA_A_WRITE 0x2000
  339. #define AA_A_CREATE 0x2000
  340. #define AA_A_DELETE 0x4000
  341. #define AA_A_ACL 0x8000
  342. #define AA_A_ALL ( AA_F_OPEN | AA_F_WRITE | AA_F_DELETE | AA_F_ACL)
  343. #ifdef __cplusplus
  344. }
  345. #endif
  346. #endif // _LMAUDIT_