home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / lmaudit.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  10.7 KB  |  404 lines

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