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.

155 lines
4.0 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: crowprov.hxx
  7. //
  8. // Contents: Row Provider Class Declaration
  9. //
  10. // Functions:
  11. //
  12. // Notes:
  13. //
  14. //
  15. // History: 07/10/96 | RenatoB | Created, lifted most from EricJ code
  16. //
  17. //----------------------------------------------------------------------------
  18. #ifndef _CROWPROV_H_
  19. #define _CROWPROV_H_
  20. #ifndef BUILD_FOR_NT40
  21. #include <vector> // STL vector
  22. #endif
  23. #define ICOLBUFF_MAX (1000)
  24. //-----------------------------------------------------------------------------
  25. // CRowProvider | ADSI Row provider
  26. //
  27. //
  28. //-----------------------------------------------------------------------------
  29. #define GET_CLASS_VALUE(a,n) \
  30. (_wcsicmp(a[n-1].CaseIgnoreString,L"Top") == 0 ? \
  31. a[0].CaseIgnoreString : a[n-1].CaseIgnoreString)
  32. #define GET_CLASS_LEN(a,n) \
  33. (_wcsicmp(a[n-1].CaseIgnoreString,L"Top") == 0 ? \
  34. (wcslen(a[0].CaseIgnoreString) + 1) * sizeof(WCHAR) : \
  35. (wcslen(a[n-1].CaseIgnoreString) + 1) * sizeof(WCHAR))
  36. typedef struct _db_search_column {
  37. ADS_SEARCH_COLUMN adsColumn;
  38. DBSTATUS dwStatus;
  39. DWORD dwLength;
  40. DBTYPE dwType;
  41. } DB_SEARCH_COLUMN, *PDB_SEARCH_COLUMN;
  42. class CRowProvider;
  43. class CRowProvider : INHERIT_TRACKING,
  44. public IRowProvider,
  45. public IColumnsInfo
  46. {
  47. friend class CRowset;
  48. private:
  49. enum Status {
  50. STAT_DIDINIT = 0x0001, // Did initialization
  51. STAT_ENDOFROWSET = 0x0002, // At end of rowset
  52. STAT_PREPOPULATE = 0x0040, // Prepopulate the buffers
  53. };
  54. IMalloc *_pMalloc;
  55. BOOL *_pMultiValued;
  56. ADS_SEARCH_HANDLE _hSearchHandle;
  57. //
  58. // Flag to indicate whether or not adspath is present in projection
  59. //
  60. BOOL _fADSPathPresent;
  61. //
  62. // Integer to track the column ID for AdsPath
  63. //
  64. int _iAdsPathIndex;
  65. PDB_SEARCH_COLUMN _pdbSearchCol;
  66. //Interface for IDsSearch.
  67. IDirectorySearch *_pDSSearch;
  68. DBCOLUMNINFO* _ColInfo;
  69. DBORDINAL _cColumns;
  70. OLECHAR *_pwchBuf;
  71. CCredentials *_pCredentials;
  72. STDMETHODIMP
  73. CRowProvider::CopyADs2VariantArray(
  74. PADS_SEARCH_COLUMN pADsColumn,
  75. PVARIANT *ppVariant
  76. );
  77. HRESULT SeekToNextRow(void);
  78. HRESULT SeekToPreviousRow(void);
  79. public:
  80. /* IUnknown methods */
  81. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) ;
  82. DECLARE_STD_REFCOUNTING
  83. DECLARE_IRowProvider_METHODS
  84. DECLARE_IColumnsInfo_METHODS
  85. STDMETHOD(GetURLFromHROW)(HROW hRow,LPOLESTR *ppwszURL,IRowset* pRowset);
  86. STDMETHODIMP
  87. CRowProvider::FInit(
  88. IDirectorySearch* pDSSearch,
  89. LPWSTR pszFilter,
  90. LPWSTR *pAttrs,
  91. DWORD cAttrs,
  92. DBORDINAL cColumns,
  93. DBCOLUMNINFO* rgInfo,
  94. OLECHAR* pStringsBuffer,
  95. BOOL *pMultiValued,
  96. BOOL fADSPathPresent,
  97. CCredentials *pCredentials);
  98. static
  99. HRESULT CRowProvider::CreateRowProvider(
  100. IDirectorySearch* pDSSearch,
  101. LPWSTR pszFilter,
  102. LPWSTR *pAttrs,
  103. DWORD cAttrs,
  104. DBORDINAL cColumns, // count of the rowset's columns
  105. DBCOLUMNINFO *rgInfo, // array of cColumns DBCOLUMNINFO's
  106. OLECHAR* pStringsBuffer, // the names of the columns are here
  107. REFIID riid,
  108. BOOL *pMultiValued,
  109. BOOL fADSPathPresent,
  110. CCredentials *pCredentials,
  111. void **ppvObj // the created Row provider
  112. );
  113. CRowProvider();
  114. ~CRowProvider();
  115. CCredentials *GetCredentials() { return _pCredentials; }
  116. DBORDINAL GetColumnCount() { return _cColumns; }
  117. HRESULT GetIndex(IColumnsInfo* pColumnsInfo, LPWSTR lpwszColName, int& iIndex);
  118. };
  119. #endif //_CROWPROV_H_