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.

164 lines
5.3 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation 1996-2001.
  5. //
  6. // File: Attr.h
  7. //
  8. // Contents: definition of CModelessSceEditor & CAttribute
  9. //
  10. //----------------------------------------------------------------------------
  11. #if !defined(AFX_ATTR_H__CC37D278_ED8E_11D0_9C6E_00C04FB6C6FA__INCLUDED_)
  12. #define AFX_ATTR_H__CC37D278_ED8E_11D0_9C6E_00C04FB6C6FA__INCLUDED_
  13. #if _MSC_VER >= 1000
  14. #pragma once
  15. #endif // _MSC_VER >= 1000
  16. #include "resource.h"
  17. #include "cookie.h"
  18. #include "SelfDeletingPropertyPage.h"
  19. typedef struct tagModelessSheetData
  20. {
  21. bool bIsContainer;
  22. DWORD flag;
  23. HWND hwndParent;
  24. SE_OBJECT_TYPE SeType;
  25. CString strObjectName;
  26. PSECURITY_DESCRIPTOR* ppSeDescriptor;
  27. SECURITY_INFORMATION* pSeInfo;
  28. HWND* phwndSheet;
  29. } MLSHEET_DATA, *PMLSHEET_DATA;
  30. // this class is created for displaying modeless security editor dialog.
  31. // under MMC, modeless dialog won't work unless it is running inside its own
  32. // thread. When multiple sce editors can be launched for easy comparsions,
  33. // it is highly preferred that we launch it modeless. We must use this class
  34. // to create such modeless sce editors. It should be able to use one class to create
  35. // multiple modeless dialogs. However, this is not always working because of MMC
  36. // limitations. That is why the function Reset is not implemented at this time.
  37. //************************************************************************************
  38. // Important: this class depends on CUIThread implementations even though it only
  39. // has a CWinThread pointer. That is because of AfxBeginThread's return type
  40. //************************************************************************************
  41. // How to use this class:
  42. // (1) Create an instance when you need to create such a modeless dialog
  43. // (2) Call Create function to display the modeless. Usually the caller provides
  44. // ppSeDescriptor, pSeInfo, and phwndSheet. The caller wants to have a handle
  45. // to the dialog because we need to make sure that its parent is not allowed
  46. // to go away while the modeless is up and running.
  47. // (3) When certain actions should force the modeless dialog to go away, call Destroy
  48. // function (passing the modeless dialog's handle) to destroy the dialog.
  49. // (4) destruct the instance when no longer in use
  50. // See examples inside aservice.cpp/.h
  51. class CModelessDlgUIThread;
  52. class CModelessSceEditor
  53. {
  54. public:
  55. CModelessSceEditor(bool fIsContainer, DWORD flag, HWND hParent, SE_OBJECT_TYPE seType, LPCWSTR lpszObjName);
  56. virtual ~CModelessSceEditor();
  57. void Reset(bool fIsContainer, DWORD flag, HWND hParent, SE_OBJECT_TYPE seType, LPCWSTR lpszObjName);
  58. void Create(PSECURITY_DESCRIPTOR* ppSeDescriptor, SECURITY_INFORMATION* pSeInfo, HWND* phwndSheet);
  59. void Destroy(HWND hwndSheet);
  60. protected:
  61. MLSHEET_DATA m_MLShtData;
  62. CModelessDlgUIThread* m_pThread;
  63. };
  64. /////////////////////////////////////////////////////////////////////////////
  65. // CAttribute dialog
  66. void TrimNumber(CString &str);
  67. class CAttribute : public CSelfDeletingPropertyPage
  68. {
  69. // Construction
  70. public:
  71. CAttribute(UINT nTemplateID); // standard constructor
  72. virtual ~CAttribute();
  73. virtual void EnableUserControls( BOOL bEnable );
  74. void AddUserControl( UINT uID )
  75. {
  76. m_aUserCtrlIDs.Add(uID);
  77. };
  78. // Dialog Data
  79. //{{AFX_DATA(CAttribute)
  80. enum { IDD = IDD_ANALYZE_SECURITY };
  81. // NOTE: the ClassWizard will add data members here
  82. //}}AFX_DATA
  83. void SetReadOnly(BOOL bRO)
  84. {
  85. m_bReadOnly = bRO;
  86. }
  87. BOOL QueryReadOnly()
  88. {
  89. return m_bReadOnly;
  90. }
  91. // Overrides
  92. // ClassWizard generated virtual function overrides
  93. //{{AFX_VIRTUAL(CAttribute)
  94. protected:
  95. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  96. //}}AFX_VIRTUAL
  97. public:
  98. virtual BOOL OnInitDialog ();
  99. virtual void Initialize(CResult * pResult);
  100. virtual void SetSnapin(CSnapin * pSnapin);
  101. virtual void SetTitle(LPCTSTR sz)
  102. {
  103. m_strTitle = sz;
  104. };
  105. void SetConfigure( BOOL bConfigure );
  106. // Implementation
  107. protected:
  108. CSnapin * m_pSnapin;
  109. // Generated message map functions
  110. //{{AFX_MSG(CAttribute)
  111. virtual void OnCancel();
  112. virtual BOOL OnApply();
  113. afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  114. virtual afx_msg void OnConfigure();
  115. //}}AFX_MSG
  116. afx_msg BOOL OnHelp(WPARAM wParam, LPARAM lParam);
  117. afx_msg BOOL OnContextHelp(WPARAM wParam, LPARAM lParam);
  118. DECLARE_MESSAGE_MAP()
  119. void DoContextHelp (HWND hWndControl);
  120. virtual void SetInitialValue (DWORD_PTR dw)
  121. {
  122. dw;
  123. };
  124. CResult *m_pData;
  125. HWND m_hwndParent;
  126. CUIntArray m_aUserCtrlIDs; // User control IDS.
  127. BOOL m_bConfigure;
  128. BOOL m_bReadOnly;
  129. CString m_strTitle;
  130. // every dialog that wants to handle help, you have to assign appropriately this member
  131. DWORD_PTR m_pHelpIDs;
  132. // every dialog muse in its constructor add this line: m_uTemplateResID = IDD
  133. UINT m_uTemplateResID;
  134. public:
  135. static DWORD m_nDialogs;
  136. };
  137. //{{AFX_INSERT_LOCATION}}
  138. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  139. #endif // !defined(AFX_ATTR_H__CC37D278_ED8E_11D0_9C6E_00C04FB6C6FA__INCLUDED_)