home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / Runimage / Cbuilder4 / Include / LMAUDIT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-26  |  10.7 KB  |  401 lines

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