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.

135 lines
3.3 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. /*++
  3. Copyright (C) Microsoft Corporation, 1998 - 1999
  4. Module Name:
  5. NTGroups.h
  6. Abstract:
  7. Declaration of the CIASGroupsAttributeEditor class.
  8. This class is the C++ implementation of the IIASAttributeEditor interface on
  9. the NTGroups Attribute Editor COM object.
  10. See NTGroups.cpp for implementation.
  11. Revision History:
  12. mmaguire 08/11/98 - created based on byao's code to add groups
  13. --*/
  14. //////////////////////////////////////////////////////////////////////////////
  15. #if !defined(_GROUPS_ATTRIBUTE_EDITOR_H_)
  16. #define _GROUPS_ATTRIBUTE_EDITOR_H_
  17. #include <objsel.h>
  18. //////////////////////////////////////////////////////////////////////////////
  19. // BEGIN INCLUDES
  20. //
  21. // where we can find what this class derives from:
  22. //
  23. //
  24. // where we can find what this class has or uses:
  25. //
  26. //
  27. // END INCLUDES
  28. //////////////////////////////////////////////////////////////////////////////
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CIASGroupAttributeEditor
  31. class ATL_NO_VTABLE CIASGroupsAttributeEditor :
  32. public CComObjectRootEx<CComSingleThreadModel>,
  33. public CComCoClass<CIASGroupsAttributeEditor, &CLSID_IASGroupsAttributeEditor>,
  34. public IDispatchImpl<IIASAttributeEditor, &IID_IIASAttributeEditor, &LIBID_NAPMMCLib>
  35. {
  36. public:
  37. CIASGroupsAttributeEditor()
  38. {
  39. }
  40. DECLARE_REGISTRY_RESOURCEID(IDR_NAPSNAPIN)
  41. BEGIN_COM_MAP(CIASGroupsAttributeEditor)
  42. COM_INTERFACE_ENTRY(IIASAttributeEditor)
  43. COM_INTERFACE_ENTRY(IDispatch)
  44. END_COM_MAP()
  45. // IIASAttributeEditor:
  46. public:
  47. STDMETHOD(GetDisplayInfo)(/*[in]*/ IIASAttributeInfo *pIASAttributeInfo, /*[in]*/ VARIANT *pAttributeValue, /*[out]*/ BSTR *pVendorName, /*[out]*/ BSTR *pValueAsString, /*[in, out]*/ BSTR *pReserved );
  48. STDMETHOD(Edit)(/*[in]*/ IIASAttributeInfo *pIASAttributeInfo, /*[in]*/ VARIANT *pAttributeValue, /*[in, out]*/ BSTR *pReserved );
  49. };
  50. // We define a class for a list of groups which encapsulates some of the
  51. // problems of maintaining a list of SID/Human Readable NT Groups.
  52. typedef std::pair< CComBSTR /* bstrTextualSid */, CComBSTR /* bstrHumanReadable */ > GROUPPAIR;
  53. typedef std::vector< GROUPPAIR > GROUPLIST;
  54. class GroupList : public GROUPLIST
  55. {
  56. public:
  57. HRESULT PopulateGroupsFromVariant( VARIANT * pvarGroups );
  58. HRESULT PopulateVariantFromGroups( VARIANT * pvarGroups );
  59. HRESULT PickNtGroups( HWND hWndParent );
  60. // This BSTR is needed because popping up group picker and
  61. // correctly converting SIDs to HumanReadable text
  62. // requires machine name.
  63. CComBSTR m_bstrServerName;
  64. #ifdef DEBUG
  65. HRESULT DebugPrintGroups();
  66. #endif DEBUG
  67. protected:
  68. HRESULT AddPairToGroups( GROUPPAIR &thePair );
  69. #ifndef OLD_OBJECT_PICKER
  70. HRESULT AddSelectionSidsToGroup( PDS_SELECTION_LIST pDsSelList );
  71. #else // OLD_OBJECT_PICKER
  72. HRESULT AddSelectionSidsToGroup( PDSSELECTIONLIST pDsSelList );
  73. #endif // OLD_OBJECT_PICKER
  74. };
  75. // class to populate the groups in list view control ...
  76. class NTGroup_ListView : public GroupList
  77. {
  78. public:
  79. NTGroup_ListView() : m_hListView ( NULL ), m_hParent(NULL) { };
  80. void SetListView(HWND hListView, HWND hParent = NULL) {m_hListView = hListView; m_hParent = hParent;};
  81. BOOL PopulateGroupList( int iStartIndex );
  82. DWORD AddMoreGroups();
  83. DWORD RemoveSelectedGroups();
  84. protected:
  85. HWND m_hListView;
  86. HWND m_hParent;
  87. };
  88. #endif // _GROUPS_ATTRIBUTE_EDITOR_H_