Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.9 KiB

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