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.

91 lines
2.2 KiB

  1. /*****************************************************************************/
  2. /* Copyright (c) 1999-2001 Microsoft Corporation, All Rights Reserved /
  3. /*****************************************************************************/
  4. //=================================================================
  5. //
  6. // AccessRights.CPP -- Base class for obtaining effective access
  7. // rights.
  8. //
  9. // Copyright (c) 1999-2001 Microsoft Corporation, All Rights Reserved
  10. //
  11. // Revisions: 6/11/99 a-kevhu Created
  12. //
  13. //=================================================================
  14. #ifndef _CACCESSRIGHTS_H_
  15. #define _CACCESSRIGHTS_H_
  16. #ifdef NTONLY
  17. #define AR_GENERIC_FAILURE 0x00010001
  18. #define AR_BAD_SID 0x00010002
  19. #define AR_ACL_EMPTY 0x00010003
  20. #define AR_BAD_ACL 0x00010004
  21. #define AR_RET_CODE DWORD
  22. #define USER void*
  23. #define USER_SPECIFIER short
  24. #define USER_IS_PSID 0
  25. #define USER_IS_HANDLE 1
  26. class CAccessRights
  27. {
  28. public:
  29. // Constructors and destructor...
  30. CAccessRights(bool fUseCurThrTok = false);
  31. CAccessRights(const USER user, USER_SPECIFIER usp);
  32. CAccessRights(const USER psid, const PACL pacl, USER_SPECIFIER usp);
  33. CAccessRights(const PACL pacl, bool fUseCurThrTok = false);
  34. //CAccessRights(const CAccessRights &RAccessRights);
  35. ~CAccessRights();
  36. // Utility functions...
  37. bool SetUserToThisThread();
  38. bool SetUser(const USER user, USER_SPECIFIER usp);
  39. bool SetAcl(const PACL pacl);
  40. AR_RET_CODE GetEffectiveAccessRights(PACCESS_MASK pAccessMask);
  41. DWORD GetError() { return m_dwError; }
  42. bool GetCSid(CSid &csid, bool fResolve = false);
  43. protected:
  44. DWORD m_dwError;
  45. private:
  46. bool InitTrustee(bool fInitFromCurrentThread, const HANDLE hToken = NULL);
  47. bool InitSidFromToken(const HANDLE hThreadToken);
  48. AR_RET_CODE FillEmptyPACL(PACL *paclNew);
  49. TRUSTEE m_trustee;
  50. CSid m_csid;
  51. CAccessEntryList m_ael;
  52. };
  53. #endif
  54. #endif