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.

129 lines
4.6 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. LPTSTR pszFailureMsg; //If Comparison failed for some reason, this
  27. //contain error message to display
  28. HRESULT hrResult;
  29. BOOL bAbortThread;
  30. NTFS_COMPARE_DATA(HDPA h, DWORD dw) : hItemList(h),
  31. dwSIFlags(dw),
  32. siConflict(0),
  33. idsSaclPrompt(0),
  34. idsDaclPrompt(0),
  35. pszSaclConflict(NULL),
  36. pszDaclConflict(NULL),
  37. pszFailureMsg(NULL) {}
  38. ~NTFS_COMPARE_DATA();
  39. };
  40. typedef NTFS_COMPARE_DATA *PNTFS_COMPARE_DATA;
  41. class CNTFSSecurity;
  42. struct NTFS_PF_DATA
  43. {
  44. SECURITY_INFORMATION si;
  45. CNTFSSecurity * pNTFSSec;
  46. PSECURITY_DESCRIPTOR pSD;
  47. BOOL bCancel;
  48. };
  49. typedef NTFS_PF_DATA * PNTFS_PF_DATA;
  50. class CNTFSSecurity : public CSecurityInformation
  51. {
  52. private:
  53. HANDLE m_hCompareThread;
  54. PNTFS_COMPARE_DATA m_pCompareData;
  55. IProgressDialog *m_pProgressDlg;
  56. HWND m_hwndPopupOwner;
  57. PSECURITY_DESCRIPTOR m_psdOwnerFullControl;
  58. LPWSTR m_pszSystemDrive;
  59. LPWSTR m_pszSystemRoot;
  60. BOOL m_bShowLossInheritedAclWarning;
  61. public:
  62. CNTFSSecurity(SE_OBJECT_TYPE seType,BOOL bShowLossInheritedAclWarning);
  63. virtual ~CNTFSSecurity();
  64. STDMETHOD(Initialize)(HDPA hItemList,
  65. DWORD dwFlags,
  66. LPTSTR pszServer,
  67. LPTSTR pszObject);
  68. // ISecurityInformation methods not handled by CSecurityInformation
  69. // or overridden here.
  70. STDMETHOD(GetAccessRights)(const GUID* pguidObjectType,
  71. DWORD dwFlags,
  72. PSI_ACCESS *ppAccess,
  73. ULONG *pcAccesses,
  74. ULONG *piDefaultAccess);
  75. STDMETHOD(MapGeneric)(const GUID *pguidObjectType,
  76. UCHAR *pAceFlags,
  77. ACCESS_MASK *pmask);
  78. STDMETHOD(GetInheritTypes)(PSI_INHERIT_TYPE *ppInheritTypes,
  79. ULONG *pcInheritTypes);
  80. STDMETHOD(GetSecurity)(SECURITY_INFORMATION si,
  81. PSECURITY_DESCRIPTOR *ppSD,
  82. BOOL fDefault);
  83. STDMETHOD(SetSecurity)(SECURITY_INFORMATION si,
  84. PSECURITY_DESCRIPTOR pSD);
  85. STDMETHOD(PropertySheetPageCallback)(HWND hwnd,
  86. UINT uMsg,
  87. SI_PAGE_TYPE uPage);
  88. STDMETHOD(GetInheritSource)(SECURITY_INFORMATION si,
  89. PACL pACL,
  90. PINHERITED_FROM *ppInheritArray);
  91. HWND GetHwndPopOwner() { return m_hwndPopupOwner; }
  92. HRESULT SetProgress(LPTSTR pszFile);
  93. HRESULT GiveOwnerFullControl(LPCWSTR lpszFileName, PSECURITY_DESCRIPTOR pSD, PBOOL pbIsFile );
  94. protected:
  95. HRESULT SetSecurityLocal(SECURITY_INFORMATION si,
  96. PSECURITY_DESCRIPTOR pSD,
  97. LPBOOL pbNotAllApplied = NULL);
  98. void CreateProgressDialog(SECURITY_INFORMATION si);
  99. void CloseProgressDialog(void);
  100. HRESULT BuildOwnerFullControlSD(PSECURITY_DESCRIPTOR pSD);
  101. STDMETHOD(WriteObjectSecurity)(LPCTSTR pszObject,
  102. SECURITY_INFORMATION si,
  103. PSECURITY_DESCRIPTOR pSD);
  104. void WaitForComparison();
  105. static DWORD WINAPI NTFSReadSD(LPCTSTR pszObject,
  106. SECURITY_INFORMATION si,
  107. PSECURITY_DESCRIPTOR* ppSD);
  108. static DWORD WINAPI NTFSCompareThreadProc(LPVOID pvData);
  109. };
  110. #endif /* _NTFSSI_H_ */