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.

128 lines
4.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: ntfssi.h
  8. //
  9. // This file contains the definition of the CNTFSSecurity object.
  10. //
  11. //--------------------------------------------------------------------------
  12. #ifndef _NTFSSI_H_
  13. #define _NTFSSI_H_
  14. #include "si.h"
  15. STDMETHODIMP
  16. CheckFileAccess(LPCTSTR pszObjectName, LPDWORD pdwAccessGranted);
  17. struct NTFS_COMPARE_DATA
  18. {
  19. HDPA hItemList;
  20. DWORD dwSIFlags;
  21. SECURITY_INFORMATION siConflict;
  22. UINT idsSaclPrompt;
  23. UINT idsDaclPrompt;
  24. LPTSTR pszSaclConflict;
  25. LPTSTR pszDaclConflict;
  26. HRESULT hrResult;
  27. BOOL bAbortThread;
  28. NTFS_COMPARE_DATA(HDPA h, DWORD dw) : hItemList(h), dwSIFlags(dw) {}
  29. ~NTFS_COMPARE_DATA();
  30. };
  31. typedef NTFS_COMPARE_DATA *PNTFS_COMPARE_DATA;
  32. class CNTFSSecurity;
  33. struct NTFS_PF_DATA
  34. {
  35. SECURITY_INFORMATION si;
  36. CNTFSSecurity * pNTFSSec;
  37. PSECURITY_DESCRIPTOR pSD;
  38. BOOL bCancel;
  39. };
  40. typedef NTFS_PF_DATA * PNTFS_PF_DATA;
  41. class CNTFSSecurity : public CSecurityInformation
  42. {
  43. private:
  44. HANDLE m_hCompareThread;
  45. PNTFS_COMPARE_DATA m_pCompareData;
  46. IProgressDialog *m_pProgressDlg;
  47. HWND m_hwndPopupOwner;
  48. PSECURITY_DESCRIPTOR m_psdOwnerFullControl;
  49. public:
  50. CNTFSSecurity(SE_OBJECT_TYPE seType);
  51. virtual ~CNTFSSecurity();
  52. STDMETHOD(Initialize)(HDPA hItemList,
  53. DWORD dwFlags,
  54. LPTSTR pszServer,
  55. LPTSTR pszObject);
  56. // ISecurityInformation methods not handled by CSecurityInformation
  57. // or overridden here.
  58. STDMETHOD(GetAccessRights)(const GUID* pguidObjectType,
  59. DWORD dwFlags,
  60. PSI_ACCESS *ppAccess,
  61. ULONG *pcAccesses,
  62. ULONG *piDefaultAccess);
  63. STDMETHOD(MapGeneric)(const GUID *pguidObjectType,
  64. UCHAR *pAceFlags,
  65. ACCESS_MASK *pmask);
  66. STDMETHOD(GetInheritTypes)(PSI_INHERIT_TYPE *ppInheritTypes,
  67. ULONG *pcInheritTypes);
  68. STDMETHOD(GetSecurity)(SECURITY_INFORMATION si,
  69. PSECURITY_DESCRIPTOR *ppSD,
  70. BOOL fDefault);
  71. STDMETHOD(SetSecurity)(SECURITY_INFORMATION si,
  72. PSECURITY_DESCRIPTOR pSD);
  73. STDMETHOD(PropertySheetPageCallback)(HWND hwnd,
  74. UINT uMsg,
  75. SI_PAGE_TYPE uPage);
  76. STDMETHOD(GetInheritSource)(SECURITY_INFORMATION si,
  77. PACL pACL,
  78. PINHERITED_FROM *ppInheritArray);
  79. HWND GetHwndPopOwner() { return m_hwndPopupOwner; }
  80. HRESULT SetProgress(LPTSTR pszFile);
  81. HRESULT GiveOwnerFullControl(LPCWSTR lpszFileName, PSECURITY_DESCRIPTOR pSD, PBOOL pbIsFile );
  82. protected:
  83. HRESULT SetSecurityLocal(SECURITY_INFORMATION si,
  84. PSECURITY_DESCRIPTOR pSD,
  85. LPBOOL pbNotAllApplied = NULL);
  86. void CreateProgressDialog(SECURITY_INFORMATION si);
  87. void CloseProgressDialog(void);
  88. HRESULT BuildOwnerFullControlSD(PSECURITY_DESCRIPTOR pSD);
  89. #ifdef SUPPORT_NTFS_DEFAULT
  90. HRESULT GetParentSecurity(SECURITY_INFORMATION si,
  91. PSECURITY_DESCRIPTOR *ppSD);
  92. HRESULT GetDefaultSecurity(SECURITY_INFORMATION si,
  93. PSECURITY_DESCRIPTOR *ppSD);
  94. #endif
  95. #ifdef DONT_USE_ACLAPI
  96. STDMETHOD(ReadObjectSecurity)(LPCTSTR pszObject,
  97. SECURITY_INFORMATION si,
  98. PSECURITY_DESCRIPTOR *ppSD);
  99. #endif // DONT_USE_ACLAPI
  100. STDMETHOD(WriteObjectSecurity)(LPCTSTR pszObject,
  101. SECURITY_INFORMATION si,
  102. PSECURITY_DESCRIPTOR pSD);
  103. void WaitForComparison();
  104. static DWORD WINAPI NTFSReadSD(LPCTSTR pszObject,
  105. SECURITY_INFORMATION si,
  106. PSECURITY_DESCRIPTOR* ppSD);
  107. static DWORD WINAPI NTFSCompareThreadProc(LPVOID pvData);
  108. };
  109. #endif /* _NTFSSI_H_ */