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.

84 lines
3.3 KiB

  1. /*---------------------------------------------------------------------------
  2. File: NetObjEnumerator.h
  3. Comments: Declaration of the CNetObjEnumerator COM object. This COM object
  4. is used to get an enumeration for the members in a container and
  5. their properties. If user simply needs all the objects in a given
  6. container then they can use the GetContainerEnum method. If user
  7. wants to perform some advanced searches/queries then they should
  8. use the set of three functions (SetQuery, SetColumns, Execute) to
  9. Setup and execute a query against the container. Both sets of methods
  10. return IEnumVaraint supporting objects. This object will allow user
  11. to go through all the values returned by queries.
  12. (c) Copyright 1999, Mission Critical Software, Inc., All Rights Reserved
  13. Proprietary and confidential to Mission Critical Software, Inc.
  14. REVISION LOG ENTRY
  15. Revision By: Sham Chauthani
  16. Revised on 07/02/99 12:40:00
  17. ---------------------------------------------------------------------------
  18. */
  19. #ifndef __NETOBJENUMERATOR_H_
  20. #define __NETOBJENUMERATOR_H_
  21. #include "resource.h" // main symbols
  22. #include "Domain.h"
  23. /////////////////////////////////////////////////////////////////////////////
  24. // CNetObjEnumerator
  25. class ATL_NO_VTABLE CNetObjEnumerator :
  26. public CComObjectRootEx<CComMultiThreadModel>,
  27. public CComCoClass<CNetObjEnumerator, &CLSID_NetObjEnumerator>,
  28. public INetObjEnumerator
  29. {
  30. public:
  31. CNetObjEnumerator() : m_bSetQuery(false), m_bSetCols(false)
  32. {
  33. m_nCols = 0;
  34. m_pszAttr = NULL;
  35. m_pDom = NULL;
  36. }
  37. ~CNetObjEnumerator()
  38. {
  39. Cleanup();
  40. //delete the cached domain object
  41. if (m_pDom)
  42. {
  43. delete m_pDom;
  44. m_pDom = NULL;
  45. }
  46. }
  47. DECLARE_REGISTRY_RESOURCEID(IDR_NETOBJENUMERATOR)
  48. DECLARE_PROTECT_FINAL_CONSTRUCT()
  49. BEGIN_COM_MAP(CNetObjEnumerator)
  50. COM_INTERFACE_ENTRY(INetObjEnumerator)
  51. END_COM_MAP()
  52. // INetObjEnumerator
  53. public:
  54. STDMETHOD(Execute)(/*[out]*/ IEnumVARIANT ** pEnumerator);
  55. STDMETHOD(SetColumns)(/*[in]*/ SAFEARRAY * colNames);
  56. STDMETHOD(SetQuery)(/*[in]*/ BSTR sContainer, /*[in]*/ BSTR sDomain, /*[in,optional]*/ BSTR sQuery=L"(objectClass=*)", /*[in,optional]*/ long nCnt = 1, /*[in,optional]*/ long bMultiVal = FALSE);
  57. private:
  58. void Cleanup();
  59. long m_nCols; // Number of columns requested by the user.
  60. _bstr_t m_sQuery; // Stores the query set by the user. This will be used to query the info from AD.
  61. _bstr_t m_sContainer; // Stores the container name of where the search is to be made.
  62. _bstr_t m_sDomain; // Domain name that we are enumerating.
  63. bool m_bSetQuery; // Flag indicating whether SetQuery called or not
  64. bool m_bSetCols; // Similar flag for SetColumn
  65. LPWSTR *m_pszAttr; // Stores the array of columns requested by the user of the object.
  66. ADS_SEARCHPREF_INFO prefInfo; // The Search Scope
  67. BOOL m_bMultiVal; // Flag to indicate whether to return multivalues or not.
  68. CDomain * m_pDom; // Pointer to our domain object
  69. HRESULT CreateDomainObject(); //create the proper OS-specific domain object
  70. };
  71. #endif //__NETOBJENUMERATOR_H_