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.

89 lines
1.8 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1999
  5. //
  6. // File: DSQuery.h
  7. //
  8. // Contents: Query object for DS snapin
  9. //
  10. // History: 04-dec-96 jimharr Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #ifndef __QUERY_H__
  14. #define __QUERY_H__
  15. #define QUERY_PAGESIZE 50
  16. //
  17. // CDSSearch
  18. //
  19. class CDSSearch
  20. {
  21. public:
  22. CDSSearch();
  23. ~CDSSearch();
  24. // INTERFACES
  25. public:
  26. HRESULT Init(IDirectorySearch * pObj);
  27. HRESULT Init(PCWSTR pszPath, const CDSCmdCredentialObject& refCredObject);
  28. HRESULT DoQuery(BOOL bAttrOnly = FALSE);
  29. HRESULT GetNextRow ();
  30. HRESULT GetColumn(LPWSTR Attribute,
  31. PADS_SEARCH_COLUMN pColumnData);
  32. HRESULT FreeColumn(PADS_SEARCH_COLUMN pColumnData)
  33. {
  34. return m_pObj->FreeColumn(pColumnData);
  35. };
  36. HRESULT SetAttributeList (LPTSTR *pszAttribs, INT cAttrs);
  37. HRESULT SetSearchScope (ADS_SCOPEENUM scope);
  38. HRESULT SetFilterString (LPWSTR pszFilter)
  39. {
  40. if (!pszFilter)
  41. {
  42. return E_INVALIDARG;
  43. }
  44. if (m_pwszFilter)
  45. {
  46. delete[] m_pwszFilter;
  47. m_pwszFilter = NULL;
  48. }
  49. m_pwszFilter = new WCHAR[wcslen(pszFilter) + 1];
  50. if (!m_pwszFilter)
  51. {
  52. return E_OUTOFMEMORY;
  53. }
  54. wcscpy(m_pwszFilter, pszFilter);
  55. return S_OK;
  56. };
  57. HRESULT GetNextColumnName(LPWSTR *ppszColumnName);
  58. VOID FreeColumnName(LPWSTR pszColumnName)
  59. {
  60. FreeADsMem(pszColumnName);
  61. }
  62. //Attributes
  63. public:
  64. IDirectorySearch * m_pObj;
  65. ADS_SEARCH_HANDLE m_SearchHandle;
  66. protected:
  67. LPWSTR m_pwszFilter;
  68. LPWSTR * m_ppszAttr;
  69. DWORD m_CountAttr;
  70. ADS_SCOPEENUM m_scope;
  71. private:
  72. void _Reset();
  73. BOOL m_bInitialized;
  74. };
  75. #endif //__DSQUERY_H__