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