home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / bc45 / msinc.pak / LMAUDIT.H < prev    next >
C/C++ Source or Header  |  1997-07-23  |  12KB  |  425 lines

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