home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / sdktools / winnt / cacls / daclwrap.hxx < prev    next >
Text File  |  1995-03-13  |  2KB  |  72 lines

  1. //+-------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1995, Microsoft Corporation.
  4. //
  5. //  File:        daclwrap.hxx
  6. //
  7. //  Contents:    class encapsulating file security.
  8. //
  9. //  Classes:     CDaclWrap
  10. //
  11. //  History:     Nov-93        Created         DaveMont
  12. //
  13. //--------------------------------------------------------------------
  14. #ifndef __DACLWRAP__
  15. #define __DACLWRAP__
  16.  
  17. #include <t2.hxx>
  18. #include <accacc.hxx>
  19.  
  20. //+-------------------------------------------------------------------
  21. //
  22. //  Class:      CDaclWrap
  23. //
  24. //  Purpose:    encapsulation of File security (ie. a wrapper around a
  25. //              DACL)  This class provides methods to build a new acl,
  26. //              with intent to merge it with an existing DACL on a file.
  27. //
  28. //--------------------------------------------------------------------
  29. typedef struct
  30. {
  31.     CAccountAccess *pcaa;
  32.     ULONG option;
  33. } SACCOUNTANDOPTIONS;
  34.  
  35. class CDaclWrap
  36. {
  37. public:
  38.  
  39.     CDaclWrap();
  40.  
  41.    ~CDaclWrap();
  42.  
  43.     // building the new dacl, based on previous SetAccess inputs and
  44.     // the input DACL
  45.  
  46. ULONG BuildAcl(ACL **pnewdacl, ACL *poldacl, UCHAR revision, BOOL fdir);
  47.  
  48.     // adding, replacing and removing aces
  49.  
  50. ULONG SetAccess(ULONG option, WCHAR *Name, WCHAR *System, ULONG access);
  51.  
  52. private:
  53.  
  54. ULONG _GetNewAclSize(ULONG *caclsize, ACL *poldacl, BOOL fdir);
  55. ULONG _SetDeniedAce(ACL *dacl, ACCESS_MASK mask, SID *psid, BOOL fdir);
  56. ULONG _SetAllowedAce(ACL *dacl, ACCESS_MASK mask, SID *psid, BOOL fdir);
  57. ULONG _FillNewAcl(ACL *pnewdacl, ACL *poldacl, BOOL fdir);
  58. ULONG _AllocateNewAcl(ACL **pnewdacl, ULONG caclsize, ULONG revision);
  59.  
  60.     ULONG               _acessize            ;
  61.     ULONG               _ccaa                ;
  62.     SACCOUNTANDOPTIONS  _aaa[CMAXACES]       ;
  63. };
  64.  
  65. #endif // __DACLWRAP__
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.