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