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.

398 lines
10 KiB

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