Source code of Windows XP (NT5)
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.

110 lines
2.8 KiB

  1. // PermPage.h : Declaration of the standard permissions page class
  2. #ifndef __PERMPAGE_H_INCLUDED__
  3. #define __PERMPAGE_H_INCLUDED__
  4. #include "aclui.h"
  5. class CSecurityInformation : public ISecurityInformation, public CComObjectRoot
  6. {
  7. DECLARE_NOT_AGGREGATABLE(CSecurityInformation)
  8. BEGIN_COM_MAP(CSecurityInformation)
  9. COM_INTERFACE_ENTRY(ISecurityInformation)
  10. END_COM_MAP()
  11. // *** ISecurityInformation methods ***
  12. STDMETHOD(GetObjectInformation)(
  13. IN PSI_OBJECT_INFO pObjectInfo
  14. ) = 0;
  15. STDMETHOD(GetSecurity)(
  16. IN SECURITY_INFORMATION RequestedInformation,
  17. OUT PSECURITY_DESCRIPTOR *ppSecurityDescriptor,
  18. IN BOOL fDefault
  19. ) = 0;
  20. STDMETHOD(SetSecurity)(
  21. IN SECURITY_INFORMATION SecurityInformation,
  22. IN PSECURITY_DESCRIPTOR pSecurityDescriptor
  23. ) = 0;
  24. STDMETHOD(GetAccessRights)(
  25. const GUID *pguidObjectType,
  26. DWORD dwFlags,
  27. PSI_ACCESS *ppAccess,
  28. ULONG *pcAccesses,
  29. ULONG *piDefaultAccess
  30. );
  31. STDMETHOD(MapGeneric)(
  32. const GUID *pguidObjectType,
  33. UCHAR *pAceFlags,
  34. ACCESS_MASK *pMask
  35. );
  36. STDMETHOD(GetInheritTypes)(
  37. PSI_INHERIT_TYPE *ppInheritTypes,
  38. ULONG *pcInheritTypes
  39. );
  40. STDMETHOD(PropertySheetPageCallback)(
  41. HWND hwnd,
  42. UINT uMsg,
  43. SI_PAGE_TYPE uPage
  44. );
  45. protected:
  46. HRESULT
  47. NewDefaultDescriptor(
  48. OUT PSECURITY_DESCRIPTOR *ppsd,
  49. IN SECURITY_INFORMATION RequestedInformation
  50. );
  51. HRESULT
  52. MakeSelfRelativeCopy(
  53. IN PSECURITY_DESCRIPTOR psdOriginal,
  54. OUT PSECURITY_DESCRIPTOR *ppsdNew
  55. );
  56. };
  57. class CShareSecurityInformation : public CSecurityInformation
  58. {
  59. private:
  60. CString m_strMachineName;
  61. CString m_strShareName;
  62. CString m_strPageTitle;
  63. public:
  64. void SetMachineName( LPCTSTR pszMachineName )
  65. {
  66. m_strMachineName = pszMachineName;
  67. }
  68. void SetShareName( LPCTSTR pszShareName )
  69. {
  70. m_strShareName = pszShareName;
  71. }
  72. void SetPageTitle( LPCTSTR pszPageTitle )
  73. {
  74. m_strPageTitle = pszPageTitle;
  75. }
  76. // note: these should be LPCTSTR but are left this way for convenience
  77. LPTSTR QueryMachineName()
  78. {
  79. return (m_strMachineName.IsEmpty())
  80. ? NULL
  81. : const_cast<LPTSTR>((LPCTSTR)m_strMachineName);
  82. }
  83. LPTSTR QueryShareName()
  84. {
  85. return const_cast<LPTSTR>((LPCTSTR)m_strShareName);
  86. }
  87. LPTSTR QueryPageTitle()
  88. {
  89. return const_cast<LPTSTR>((LPCTSTR)m_strPageTitle);
  90. }
  91. // *** ISecurityInformation methods ***
  92. STDMETHOD(GetObjectInformation) (PSI_OBJECT_INFO pObjectInfo );
  93. };
  94. HRESULT
  95. MyCreateShareSecurityPage(
  96. IN LPPROPERTYSHEETCALLBACK pCallBack,
  97. IN CShareSecurityInformation *pSecInfo,
  98. IN LPCTSTR pszMachineName,
  99. IN LPCTSTR pszShareName
  100. );
  101. #endif // ~__PERMPAGE_H_INCLUDED__