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.

74 lines
3.1 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. /////////////////////////////////////////////////////////////////////////////
  23. // CNetObjEnumerator
  24. class ATL_NO_VTABLE CNetObjEnumerator :
  25. public CComObjectRootEx<CComMultiThreadModel>,
  26. public CComCoClass<CNetObjEnumerator, &CLSID_NetObjEnumerator>,
  27. public INetObjEnumerator
  28. {
  29. public:
  30. CNetObjEnumerator() : m_bSetQuery(false), m_bSetCols(false)
  31. {
  32. m_nCols = 0;
  33. m_pszAttr = NULL;
  34. }
  35. ~CNetObjEnumerator()
  36. {
  37. Cleanup();
  38. }
  39. DECLARE_REGISTRY_RESOURCEID(IDR_NETOBJENUMERATOR)
  40. DECLARE_PROTECT_FINAL_CONSTRUCT()
  41. BEGIN_COM_MAP(CNetObjEnumerator)
  42. COM_INTERFACE_ENTRY(INetObjEnumerator)
  43. END_COM_MAP()
  44. // INetObjEnumerator
  45. public:
  46. STDMETHOD(Execute)(/*[out]*/ IEnumVARIANT ** pEnumerator);
  47. STDMETHOD(SetColumns)(/*[in]*/ SAFEARRAY * colNames);
  48. STDMETHOD(SetQuery)(/*[in]*/ BSTR sContainer, /*[in]*/ BSTR sDomain, /*[in,optional]*/ BSTR sQuery=L"(objectClass=*)", /*[in,optional]*/ long nCnt = 1, /*[in,optional]*/ long bMultiVal = FALSE);
  49. STDMETHOD(GetContainerEnum)(/*[in]*/ BSTR sContainerName, /*[in]*/ BSTR sDomainName, /*[out]*/ IEnumVARIANT ** ppVarEnum);
  50. private:
  51. void Cleanup();
  52. long m_nCols; // Number of columns requested by the user.
  53. _bstr_t m_sQuery; // Stores the query set by the user. This will be used to query the info from AD.
  54. _bstr_t m_sContainer; // Stores the container name of where the search is to be made.
  55. _bstr_t m_sDomain; // Domain name that we are enumerating.
  56. bool m_bSetQuery; // Flag indicating whether SetQuery called or not
  57. bool m_bSetCols; // Similar flag for SetColumn
  58. LPWSTR *m_pszAttr; // Stores the array of columns requested by the user of the object.
  59. ADS_SEARCHPREF_INFO prefInfo; // The Search Scope
  60. BOOL m_bMultiVal; // Flag to indicate whether to return multivalues or not.
  61. };
  62. #endif //__NETOBJENUMERATOR_H_