home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / WIN_NT / LMAPI.ZIP / H / LMAUDIT.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-07  |  10.3 KB  |  387 lines

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