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
2.1 KiB

  1. /*++
  2. Copyright (C) 1998-2001 Microsoft Corporation
  3. Module Name:
  4. SECURE.CPP
  5. Abstract:
  6. defines various routines used for ACL based security.
  7. It is defined in secure.h
  8. History:
  9. a-davj 05-NOV-98 Created.
  10. --*/
  11. #ifndef _SECURE_H_
  12. #define _SECURE_H_
  13. // Implements the methods that the __SystemSecurity class supports
  14. // A variation of the CFlexArray which deletes the entries
  15. class CFlexAceArray : public CFlexArray
  16. {
  17. public:
  18. CFlexAceArray(){};
  19. ~CFlexAceArray();
  20. HRESULT Serialize(void ** pData, DWORD * pdwSize);
  21. HRESULT Deserialize(void * pData);
  22. };
  23. enum { SecFlagProvider = 0x2,
  24. SecFlagWin9XLocal = 0x4,
  25. SecFlagInProcLogin = 0x20000,
  26. };
  27. #define FULL_RIGHTS WBEM_METHOD_EXECUTE | WBEM_FULL_WRITE_REP | WBEM_PARTIAL_WRITE_REP | \
  28. WBEM_WRITE_PROVIDER | WRITE_DAC | READ_CONTROL | WBEM_ENABLE | WBEM_REMOTE_ACCESS
  29. HRESULT GetAces(CFlexAceArray * pFlex, LPWSTR pNsName, bool bNT);
  30. HRESULT PutAces(CFlexAceArray * pFlex, LPWSTR pNsName);
  31. BOOL IsRemote(HANDLE hToken);
  32. CBaseAce * ConvertOldObjectToAce(IWbemClassObject * pObj, bool bGroup);
  33. HRESULT SetSecurityForNS(IWmiDbSession * pSession,IWmiDbHandle *pNSToSet,
  34. IWmiDbSession * pParentSession, IWmiDbHandle * pNSParent, BOOL bExisting = FALSE);
  35. HRESULT CopyInheritAces(CNtSecurityDescriptor & sd, CNtSecurityDescriptor & sdParent);
  36. HRESULT GetSDFromProperty(LPWSTR pPropName, CNtSecurityDescriptor &sd, IWbemClassObject *pThisNSObject);
  37. HRESULT CopySDIntoProperty(LPWSTR pPropName, CNtSecurityDescriptor &sd, IWbemClassObject *pThisNSObject);
  38. HRESULT AddDefaultRootAces(CNtAcl * pacl);
  39. HRESULT StoreSDIntoNamespace(IWmiDbSession * pSession, IWmiDbHandle *pNSToSet, CNtSecurityDescriptor & sd);
  40. bool IsAceValid(DWORD dwMask, DWORD dwType, DWORD dwFlag);
  41. BOOL IsValidAclForNSSecurity (CNtAcl* acl);
  42. //
  43. // Auto reverts the sec flag to TRUE. Always set the flag to true upon method completion
  44. //
  45. class AutoRevertSecTlsFlag
  46. {
  47. private:
  48. LPVOID m_bDir ;
  49. public:
  50. AutoRevertSecTlsFlag ( LPVOID );
  51. AutoRevertSecTlsFlag ( );
  52. ~AutoRevertSecTlsFlag ( );
  53. VOID SetSecTlsFlag ( LPVOID );
  54. };
  55. #endif