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.

107 lines
3.3 KiB

  1. // Copyright (c) 1997-1999 Microsoft Corporation
  2. #ifndef __SECURITYOBJECT__
  3. #define __SECURITYOBJECT__
  4. #include "precomp.h"
  5. #include "..\common\SshWbemHelpers.h"
  6. #include <wbemcli.h>
  7. #include "aclui.h"
  8. #include "DataSrc.h"
  9. struct __declspec(uuid("965FC360-16FF-11d0-91CB-00AA00BBB723")) ISecurityInformation;
  10. // This class just define the interface and creates the aclui tab.
  11. class ATL_NO_VTABLE CSecurityInformation : public ISecurityInformation,
  12. public CComObjectRoot
  13. {
  14. protected:
  15. virtual ~CSecurityInformation();
  16. DECLARE_NOT_AGGREGATABLE(CSecurityInformation)
  17. BEGIN_COM_MAP(CSecurityInformation)
  18. COM_INTERFACE_ENTRY(ISecurityInformation)
  19. END_COM_MAP()
  20. // *** ISecurityInformation methods ***
  21. STDMETHOD(GetObjectInformation)(PSI_OBJECT_INFO pObjectInfo) = 0;
  22. STDMETHOD(GetSecurity) (THIS_ SECURITY_INFORMATION RequestedInformation,
  23. PSECURITY_DESCRIPTOR *ppSecurityDescriptor,
  24. BOOL fDefault ) = 0;
  25. STDMETHOD(SetSecurity)(SECURITY_INFORMATION SecurityInformation,
  26. PSECURITY_DESCRIPTOR pSecurityDescriptor) = 0;
  27. STDMETHOD(GetAccessRights)(const GUID *pguidObjectType,
  28. DWORD dwFlags,
  29. PSI_ACCESS *ppAccess,
  30. ULONG *pcAccesses,
  31. ULONG *piDefaultAccess) = 0;
  32. STDMETHOD(MapGeneric)(const GUID *pguidObjectType,
  33. UCHAR *pAceFlags,
  34. ACCESS_MASK *pMask) = 0;
  35. STDMETHOD(GetInheritTypes)(PSI_INHERIT_TYPE *ppInheritTypes,
  36. ULONG *pcInheritTypes) = 0;
  37. STDMETHOD(PropertySheetPageCallback)(HWND hwnd,
  38. UINT uMsg,
  39. SI_PAGE_TYPE uPage);
  40. };
  41. //==========================================================
  42. // This class handles the security descriptors directly. (Nova M3 and later)
  43. class CSDSecurity : public CComObject<CSecurityInformation>
  44. {
  45. public:
  46. CSDSecurity(struct NSNODE *nsNode,
  47. _bstr_t server,
  48. bool local);
  49. // *** ISecurityInformation methods ***
  50. STDMETHOD(GetObjectInformation)(PSI_OBJECT_INFO pObjectInfo);
  51. STDMETHOD(GetSecurity) (THIS_ SECURITY_INFORMATION RequestedInformation,
  52. PSECURITY_DESCRIPTOR *ppSecurityDescriptor,
  53. BOOL fDefault );
  54. STDMETHOD(SetSecurity)(SECURITY_INFORMATION SecurityInformation,
  55. PSECURITY_DESCRIPTOR pSecurityDescriptor);
  56. STDMETHOD(GetAccessRights)(const GUID *pguidObjectType,
  57. DWORD dwFlags,
  58. PSI_ACCESS *ppAccess,
  59. ULONG *pcAccesses,
  60. ULONG *piDefaultAccess);
  61. STDMETHOD(MapGeneric)(const GUID *pguidObjectType,
  62. UCHAR *pAceFlags,
  63. ACCESS_MASK *pMask);
  64. STDMETHOD(GetInheritTypes)(PSI_INHERIT_TYPE *ppInheritTypes,
  65. ULONG *pcInheritTypes);
  66. HRESULT InitializeOwnerandGroup(PSECURITY_DESCRIPTOR *ppSecurityDescriptor);
  67. protected:
  68. /* CWbemServices m_WbemServices;
  69. _bstr_t m_path; // for the reconnect trick.
  70. _bstr_t m_display;
  71. */ _bstr_t m_server;
  72. struct NSNODE *m_nsNode;
  73. bool m_local;
  74. LPWSTR CloneWideString(_bstr_t pszSrc);
  75. void ProtectACLs(SECURITY_INFORMATION si, PSECURITY_DESCRIPTOR pSD);
  76. SID *m_pSidOwner;
  77. SID *m_pSidGroup;
  78. DWORD m_nLengthOwner;
  79. DWORD m_nLengthGroup;
  80. BOOL m_bOwnerDefaulted;
  81. BOOL m_bGroupDefaulted;
  82. };
  83. #endif __SECURITYOBJECT__