home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / RTLWIN32.PAK / LMAUDIT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  10.7 KB  |  404 lines

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