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.

1355 lines
39 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995.
  5. //
  6. // File: crowprov.cxx
  7. //
  8. // Contents: IProvider implementation for ADSI rowsets
  9. //
  10. // Functions:
  11. //
  12. // Notes:
  13. //
  14. //
  15. // History: 07/10/96 | RenatoB | Created, lifted most from EricJ code
  16. //-----------------------------------------------------------------------------
  17. // Includes
  18. #include "oleds.hxx"
  19. HRESULT
  20. PackLargeInteger(
  21. LARGE_INTEGER *plargeint,
  22. PVARIANT pVarDestObject
  23. );
  24. HRESULT
  25. PackDNWithBinary(
  26. PADS_DN_WITH_BINARY pDNWithBinary,
  27. PVARIANT pVarDestObject
  28. );
  29. HRESULT
  30. PackDNWithString(
  31. PADS_DN_WITH_STRING pDNWithString,
  32. PVARIANT pVarDestObject
  33. );
  34. //+---------------------------------------------------------------------------
  35. //
  36. // Function: CreateRowProvider
  37. //
  38. // Synopsis: @mfunc Creates and initializes a Row provider .
  39. //
  40. //----------------------------------------------------------------------------
  41. HRESULT
  42. CRowProvider::CreateRowProvider(
  43. IDirectorySearch * pDSSearch,
  44. LPWSTR pszFilter,
  45. LPWSTR * ppszAttrs,
  46. DWORD cAttrs,
  47. DBORDINAL cColumns, // count of the rowset's columns
  48. DBCOLUMNINFO * rgInfo, // array of cColumns DBCOLUMNINFO's
  49. OLECHAR* pStringsBuffer, // the names of the columns are here
  50. REFIID riid,
  51. BOOL * pMultiValued,
  52. BOOL fADSPathPresent,
  53. CCredentials * pCredentials,
  54. void ** ppvObj // the created Row provider
  55. )
  56. {
  57. HRESULT hr;
  58. CRowProvider * pRowProvider = NULL;
  59. if( ppvObj )
  60. *ppvObj = NULL;
  61. else
  62. BAIL_ON_FAILURE( hr = E_INVALIDARG );
  63. pRowProvider = new CRowProvider();
  64. if( pRowProvider == NULL )
  65. BAIL_ON_FAILURE( hr = E_OUTOFMEMORY );
  66. //
  67. //initialize rowprovider with the search filter and the columnsinfo
  68. //
  69. hr = pRowProvider->FInit(
  70. pDSSearch,
  71. pszFilter,
  72. ppszAttrs,
  73. cAttrs,
  74. cColumns,
  75. rgInfo,
  76. pStringsBuffer,
  77. pMultiValued,
  78. fADSPathPresent,
  79. pCredentials
  80. );
  81. if( FAILED(hr) ) {
  82. delete pRowProvider;
  83. BAIL_ON_FAILURE( hr );
  84. }
  85. //
  86. // This interface pointer is embedded in the pRowProvider.
  87. //
  88. pDSSearch = NULL;
  89. hr = pRowProvider->QueryInterface( riid, ppvObj);
  90. if( FAILED(hr) ) {
  91. delete pRowProvider;
  92. BAIL_ON_FAILURE( hr );
  93. }
  94. pRowProvider->Release();
  95. RRETURN( S_OK );
  96. error:
  97. if( pDSSearch )
  98. pDSSearch->Release();
  99. RRETURN( hr );
  100. }
  101. //+---------------------------------------------------------------------------
  102. //
  103. // Function: CRowProvider::CRowProvider
  104. //
  105. //----------------------------------------------------------------------------
  106. CRowProvider::CRowProvider()
  107. :
  108. _pMalloc (NULL),
  109. _cColumns (0),
  110. _ColInfo (NULL),
  111. _pwchBuf (NULL),
  112. _hSearchHandle (NULL),
  113. _pdbSearchCol (NULL),
  114. _pDSSearch (NULL),
  115. _pMultiValued (NULL),
  116. _fADSPathPresent (FALSE),
  117. _iAdsPathIndex (0),
  118. _pCredentials (NULL)
  119. {
  120. }
  121. //+---------------------------------------------------------------------------
  122. //
  123. // Function: CRowProvider::~CRowProvider
  124. //
  125. //----------------------------------------------------------------------------
  126. CRowProvider::~CRowProvider()
  127. {
  128. ULONG i;
  129. if( _hSearchHandle != NULL )
  130. _pDSSearch->CloseSearchHandle(_hSearchHandle);
  131. if( _pDSSearch != NULL )
  132. _pDSSearch->Release();
  133. // Release the memory allocated for columns and ColumnsInfo
  134. if (_pMalloc != NULL) {
  135. if( _pdbSearchCol != NULL ) {
  136. _pMalloc->Free((void*)_pdbSearchCol);
  137. }
  138. if( _ColInfo != NULL )
  139. _pMalloc->Free(_ColInfo);
  140. if( _pwchBuf != NULL )
  141. _pMalloc->Free(_pwchBuf);
  142. _pMalloc->Release();
  143. }
  144. if( _pMultiValued ) {
  145. FreeADsMem(_pMultiValued);
  146. }
  147. if( _pCredentials )
  148. delete _pCredentials;
  149. };
  150. //+---------------------------------------------------------------------------
  151. //
  152. // Function: CRowProvider::Finit
  153. //
  154. //----------------------------------------------------------------------------
  155. STDMETHODIMP
  156. CRowProvider::FInit(
  157. IDirectorySearch * pDSSearch,
  158. LPWSTR pszFilter,
  159. LPWSTR * ppszAttrs,
  160. DWORD cAttrs,
  161. DBORDINAL cColumns,
  162. DBCOLUMNINFO * rgInfo,
  163. OLECHAR * pStringsBuffer,
  164. BOOL * pMultiValued,
  165. BOOL fADSPathPresent,
  166. CCredentials * pCredentials)
  167. {
  168. HRESULT hr;
  169. ULONG i;
  170. ULONG cChars, cCharDispl;
  171. //
  172. // Asserts
  173. //
  174. ADsAssert(cColumns);
  175. ADsAssert(rgInfo);
  176. ADsAssert(pDSSearch);
  177. _cColumns= cColumns;
  178. hr = CoGetMalloc(MEMCTX_TASK, &_pMalloc);
  179. BAIL_ON_FAILURE( hr );
  180. _ColInfo = (DBCOLUMNINFO*)_pMalloc->Alloc((size_t)(cColumns *sizeof(DBCOLUMNINFO)));
  181. if( _ColInfo == NULL )
  182. BAIL_ON_FAILURE( hr=E_OUTOFMEMORY );
  183. memcpy(_ColInfo, rgInfo, (size_t)(cColumns * sizeof(DBCOLUMNINFO)));
  184. cChars = _pMalloc->GetSize(pStringsBuffer);
  185. _pwchBuf = (WCHAR*)_pMalloc->Alloc(cChars);
  186. if( _pwchBuf == NULL )
  187. BAIL_ON_FAILURE( hr=E_OUTOFMEMORY );
  188. memcpy(_pwchBuf, (void*)pStringsBuffer , cChars);
  189. for (i=0; i<_cColumns; i++) {
  190. if( rgInfo[i].pwszName ) {
  191. cCharDispl = (ULONG)(rgInfo[i].pwszName - pStringsBuffer);
  192. _ColInfo[i].pwszName = _pwchBuf + cCharDispl;
  193. _ColInfo[i].columnid.uName.pwszName = _pwchBuf + cCharDispl;
  194. }
  195. }
  196. // We have adspath at the end of the attribute list.
  197. _fADSPathPresent = fADSPathPresent ;
  198. //Store credentials if non-NULL.
  199. if( pCredentials ) {
  200. //We don't expect that _pCredentials is already non-NULL
  201. ADsAssert(_pCredentials == NULL);
  202. _pCredentials = new CCredentials(*pCredentials);
  203. if( !_pCredentials )
  204. BAIL_ON_FAILURE( hr=E_OUTOFMEMORY );
  205. }
  206. if( _fADSPathPresent == FALSE )
  207. cAttrs++;
  208. //
  209. // Create _pdbSearchCol, a member containing an array
  210. // of DB_SEARCH_COLUMN.
  211. // Reason for this is that trowset.cpp sometimes asks
  212. // for GetColumn twice: one to get the size of the column
  213. // and one to get the data.
  214. // Since OLEDP copies data, we do not want to have two copies
  215. // around
  216. //
  217. _pdbSearchCol = (PDB_SEARCH_COLUMN)_pMalloc->Alloc((ULONG)((cColumns + 1)*sizeof(DB_SEARCH_COLUMN)));
  218. if( _pdbSearchCol == NULL ) {
  219. hr = E_OUTOFMEMORY;
  220. goto error;
  221. }
  222. _pDSSearch = pDSSearch;
  223. hr = _pDSSearch->ExecuteSearch(
  224. pszFilter,
  225. ppszAttrs,
  226. cAttrs,
  227. &_hSearchHandle
  228. );
  229. BAIL_ON_FAILURE( hr );
  230. _pMultiValued = pMultiValued;
  231. RRETURN( hr );
  232. error:
  233. if( _pMalloc != NULL ) {
  234. if( _pdbSearchCol != NULL ) {
  235. _pMalloc->Free((void*)_pdbSearchCol);
  236. _pdbSearchCol= NULL;
  237. };
  238. if( _ColInfo != NULL ) {
  239. _pMalloc->Free(_ColInfo);
  240. _ColInfo = NULL;
  241. }
  242. if( _pwchBuf != NULL ) {
  243. _pMalloc->Free(_pwchBuf);
  244. _pwchBuf = NULL;
  245. }
  246. _pMalloc->Release();
  247. _pMalloc = NULL;
  248. };
  249. if (_hSearchHandle != NULL)
  250. _pDSSearch->CloseSearchHandle(_hSearchHandle);
  251. _hSearchHandle = NULL;
  252. _pDSSearch = NULL;
  253. RRETURN( hr );
  254. }
  255. //+---------------------------------------------------------------------------
  256. //
  257. // Function: CRowProvider::QueryInterface
  258. //
  259. //----------------------------------------------------------------------------
  260. STDMETHODIMP
  261. CRowProvider::QueryInterface(
  262. REFIID riid,
  263. LPVOID * ppv)
  264. {
  265. if( !ppv )
  266. RRETURN( E_INVALIDARG );
  267. if( riid == IID_IUnknown
  268. || riid == IID_IRowProvider )
  269. *ppv = (IRowProvider FAR *) this;
  270. else if( riid == IID_IColumnsInfo )
  271. *ppv = (IColumnsInfo FAR *) this;
  272. else {
  273. *ppv = NULL;
  274. return E_NOINTERFACE;
  275. }
  276. AddRef();
  277. RRETURN( S_OK );
  278. }
  279. //-----------------------------------------------------------------------------
  280. //
  281. // Function: CRowProvider::NextRow
  282. //
  283. // Synopsis: Advance to the next row.
  284. //
  285. // Called by: Client.
  286. // Called when: To advance to next row.
  287. // This sets the "current" row.
  288. // Initially the "current" row is prior to the first actual row.
  289. // (Which means This must be called prior to the first GetColumn call.)
  290. //
  291. //----------------------------------------------------------------------------
  292. STDMETHODIMP
  293. CRowProvider::NextRow()
  294. {
  295. HRESULT hr;
  296. ULONG i;
  297. DWORD dwType, dwExtError = ERROR_SUCCESS;
  298. VARTYPE vType = VT_NULL;
  299. const int ERROR_BUF_SIZE = 512;
  300. const int NAME_BUF_SIZE = 128;
  301. WCHAR ErrorBuf[ERROR_BUF_SIZE];
  302. WCHAR NameBuf[NAME_BUF_SIZE];
  303. do {
  304. // Clear the ADSI extended error, so that after the call to GetNextRow,
  305. // we can safely check if an extended error was set.
  306. ADsSetLastError(ERROR_SUCCESS, NULL, NULL);
  307. dwExtError = ERROR_SUCCESS;
  308. //
  309. // read the next row
  310. //
  311. hr = _pDSSearch->GetNextRow(
  312. _hSearchHandle
  313. );
  314. // we should treat SIZE_LIMIT_EXCEEDED error message as
  315. // S_ADS_NOMORE_ROWS
  316. // in the future, we might want to return this error message
  317. // to the user under non-paged search situation
  318. if (LIMIT_EXCEEDED_ERROR(hr))
  319. hr = S_ADS_NOMORE_ROWS;
  320. BAIL_ON_FAILURE( hr );
  321. if (hr == S_ADS_NOMORE_ROWS)
  322. {
  323. // check if more results are likely (pagedTimeLimit search). If so,
  324. // we will keep trying till a row is obtained.
  325. hr = ADsGetLastError(&dwExtError, ErrorBuf, ERROR_BUF_SIZE,
  326. NameBuf, NAME_BUF_SIZE);
  327. BAIL_ON_FAILURE(hr);
  328. if (dwExtError != ERROR_MORE_DATA)
  329. // we really have no more data
  330. RRETURN(DB_S_ENDOFROWSET);
  331. }
  332. } while(ERROR_MORE_DATA == dwExtError);
  333. //
  334. //read all the columnsinto _pdbSearchCol leaving the bookmark column
  335. //
  336. for (i=1; i<_cColumns; i++) {
  337. hr = _pDSSearch->GetColumn(
  338. _hSearchHandle,
  339. _ColInfo[i].pwszName,
  340. &(_pdbSearchCol[i].adsColumn)
  341. );
  342. if (FAILED(hr) && hr != E_ADS_COLUMN_NOT_SET)
  343. goto error;
  344. if (hr == E_ADS_COLUMN_NOT_SET ||
  345. _pdbSearchCol[i].adsColumn.dwNumValues == 0) {
  346. _pdbSearchCol[i].dwStatus = DBSTATUS_S_ISNULL;
  347. _pdbSearchCol[i].dwType = DBTYPE_EMPTY;
  348. _pdbSearchCol[i].dwLength = 0;
  349. hr = S_OK;
  350. }
  351. else if (_ColInfo[i].wType == (DBTYPE_VARIANT | DBTYPE_BYREF)) {
  352. _pdbSearchCol[i].dwStatus = DBSTATUS_S_OK;
  353. _pdbSearchCol[i].dwType = _ColInfo[i].wType;
  354. _pdbSearchCol[i].dwLength = sizeof(VARIANT);
  355. }
  356. else if ((ULONG) _pdbSearchCol[i].adsColumn.dwADsType >= g_cMapADsTypeToDBType ||
  357. g_MapADsTypeToDBType[_pdbSearchCol[i].adsColumn.dwADsType].wType == DBTYPE_NULL) {
  358. _pdbSearchCol[i].dwStatus = DBSTATUS_E_CANTCONVERTVALUE;
  359. _pdbSearchCol[i].dwType = DBTYPE_EMPTY;
  360. _pdbSearchCol[i].dwLength = 0;
  361. }
  362. else {
  363. _pdbSearchCol[i].dwStatus = DBSTATUS_S_OK;
  364. _pdbSearchCol[i].dwType = g_MapADsTypeToDBType[_pdbSearchCol[i].adsColumn.dwADsType].wType;
  365. switch (_pdbSearchCol[i].dwType & ~DBTYPE_BYREF) {
  366. case DBTYPE_WSTR:
  367. _pdbSearchCol[i].dwLength =
  368. (wcslen( _pdbSearchCol[i].adsColumn.pADsValues[0].CaseIgnoreString)) *
  369. sizeof (WCHAR);
  370. break;
  371. case DBTYPE_BYTES:
  372. if(_pdbSearchCol[i].adsColumn.dwADsType == ADSTYPE_OCTET_STRING)
  373. _pdbSearchCol[i].dwLength =
  374. _pdbSearchCol[i].adsColumn.pADsValues[0].OctetString.dwLength;
  375. else if(_pdbSearchCol[i].adsColumn.dwADsType ==
  376. ADSTYPE_NT_SECURITY_DESCRIPTOR)
  377. _pdbSearchCol[i].dwLength =
  378. _pdbSearchCol[i].adsColumn.pADsValues[0].SecurityDescriptor.dwLength;
  379. else if(_pdbSearchCol[i].adsColumn.dwADsType ==
  380. ADSTYPE_PROV_SPECIFIC)
  381. _pdbSearchCol[i].dwLength =
  382. _pdbSearchCol[i].adsColumn.pADsValues[0].ProviderSpecific.dwLength;
  383. break;
  384. default:
  385. _pdbSearchCol[i].dwLength = g_MapADsTypeToDBType[_pdbSearchCol[i].adsColumn.dwADsType].ulSize;
  386. }
  387. }
  388. }
  389. if ((FALSE == _fADSPathPresent))
  390. {
  391. hr = _pDSSearch->GetColumn(
  392. _hSearchHandle,
  393. L"AdsPath",
  394. &(_pdbSearchCol[i].adsColumn)
  395. );
  396. if FAILED(hr)
  397. goto error;
  398. }
  399. RRETURN(hr);
  400. error:
  401. RRETURN(hr);
  402. }
  403. //-----------------------------------------------------------------------------
  404. //
  405. // Function: CRowProvider::GetColumn
  406. //
  407. // Synopsis: @mfunc Get a column value.
  408. //
  409. // We only provide a ptr to the value -- retained in our memory
  410. // space.
  411. //
  412. // Called by: Client.
  413. // Called when: After NextRow, once for each column.
  414. //
  415. //----------------------------------------------------------------------------
  416. STDMETHODIMP
  417. CRowProvider::GetColumn(
  418. ULONG iCol,
  419. DBSTATUS *pdbStatus,
  420. ULONG *pdwLength,
  421. BYTE *pbData
  422. )
  423. {
  424. DBTYPE columnType = 0;
  425. DBSTATUS dbStatus_temp = 0;
  426. BOOL is_Ref = FALSE;
  427. HRESULT hr = S_OK;
  428. ADsAssert( 1 <= iCol && iCol <= _cColumns );
  429. //
  430. // Note that the caller gives us a ptr to where to put the data.
  431. // We can fill in dwStatus, dwLength.
  432. // For pbData, we assume this is a ptr to where we are to write our ptr.
  433. //
  434. columnType = _ColInfo[iCol].wType;
  435. if ((columnType & DBTYPE_ARRAY) || (columnType & DBTYPE_VECTOR) ) {
  436. if (pdbStatus != NULL)
  437. *pdbStatus= DBSTATUS_E_UNAVAILABLE;
  438. if (pdwLength != NULL)
  439. *pdwLength = 0;
  440. RRETURN(DB_S_ERRORSOCCURRED);
  441. }
  442. if (pdwLength!= NULL)
  443. *pdwLength = _pdbSearchCol[iCol].dwLength;
  444. dbStatus_temp = _pdbSearchCol[iCol].dwStatus;
  445. if (columnType & DBTYPE_BYREF)
  446. is_Ref = TRUE;
  447. columnType &= (~DBTYPE_BYREF);
  448. if (pbData != NULL && dbStatus_temp == DBSTATUS_S_OK) {
  449. switch (columnType) {
  450. case DBTYPE_BOOL:
  451. * (VARIANT_BOOL*) pbData = _pdbSearchCol[iCol].adsColumn.pADsValues[0].Boolean ?
  452. VARIANT_TRUE: VARIANT_FALSE;
  453. break;
  454. case DBTYPE_I4:
  455. * (DWORD*) pbData = _pdbSearchCol[iCol].adsColumn.pADsValues[0].Integer;
  456. break;
  457. case DBTYPE_WSTR:
  458. *(WCHAR**)pbData = _pdbSearchCol[iCol].adsColumn.pADsValues[0].CaseIgnoreString;
  459. break;
  460. case DBTYPE_BYTES:
  461. if(_pdbSearchCol[iCol].adsColumn.dwADsType ==
  462. ADSTYPE_OCTET_STRING)
  463. *(BYTE**)pbData = _pdbSearchCol[iCol].adsColumn.pADsValues[0].OctetString.lpValue;
  464. else if(_pdbSearchCol[iCol].adsColumn.dwADsType ==
  465. ADSTYPE_NT_SECURITY_DESCRIPTOR)
  466. *(BYTE**)pbData = _pdbSearchCol[iCol].adsColumn.pADsValues[0].SecurityDescriptor.lpValue;
  467. else if(_pdbSearchCol[iCol].adsColumn.dwADsType ==
  468. ADSTYPE_PROV_SPECIFIC)
  469. *(BYTE**)pbData = _pdbSearchCol[iCol].adsColumn.pADsValues[0].ProviderSpecific.lpValue;
  470. break;
  471. case DBTYPE_DATE:
  472. {
  473. double date = 0;
  474. hr = SystemTimeToVariantTime(
  475. &_pdbSearchCol[iCol].adsColumn.pADsValues[0].UTCTime,
  476. &date);
  477. if( FAILED(hr) )
  478. if (pdbStatus != NULL)
  479. *pdbStatus= DBSTATUS_E_CANTCONVERTVALUE;
  480. BAIL_ON_FAILURE(hr);
  481. *(double*)pbData = date;
  482. break;
  483. }
  484. case DBTYPE_VARIANT:
  485. if (_pMultiValued[iCol] == FALSE) {
  486. PVARIANT pVariant = (PVARIANT) AllocADsMem(sizeof(VARIANT));
  487. if (!pVariant) {
  488. if (pdbStatus != NULL)
  489. *pdbStatus= DBSTATUS_E_CANTCONVERTVALUE;
  490. hr = E_OUTOFMEMORY;
  491. BAIL_ON_FAILURE(hr);
  492. }
  493. if(_pdbSearchCol[iCol].adsColumn.dwADsType ==
  494. ADSTYPE_LARGE_INTEGER)
  495. hr = PackLargeInteger(
  496. &_pdbSearchCol[iCol].adsColumn.pADsValues[0].LargeInteger, pVariant);
  497. else if(_pdbSearchCol[iCol].adsColumn.dwADsType ==
  498. ADSTYPE_DN_WITH_BINARY)
  499. hr = PackDNWithBinary(_pdbSearchCol[iCol].adsColumn.pADsValues[0].pDNWithBinary, pVariant);
  500. else if(_pdbSearchCol[iCol].adsColumn.dwADsType ==
  501. ADSTYPE_DN_WITH_STRING)
  502. hr = PackDNWithString(_pdbSearchCol[iCol].adsColumn.pADsValues[0].pDNWithString, pVariant);
  503. if( FAILED(hr) )
  504. if (pdbStatus != NULL)
  505. *pdbStatus= DBSTATUS_E_CANTCONVERTVALUE;
  506. BAIL_ON_FAILURE(hr);
  507. *((PVARIANT*)pbData) = pVariant;
  508. }
  509. else {
  510. hr = CopyADs2VariantArray(
  511. &_pdbSearchCol[iCol].adsColumn,
  512. (PVARIANT *) pbData
  513. );
  514. if (hr == E_ADS_CANT_CONVERT_DATATYPE) {
  515. dbStatus_temp= DBSTATUS_E_UNAVAILABLE;
  516. break;
  517. }
  518. if( FAILED(hr) )
  519. if (pdbStatus != NULL)
  520. *pdbStatus= DBSTATUS_E_CANTCONVERTVALUE;
  521. BAIL_ON_FAILURE(hr);
  522. }
  523. break;
  524. default:
  525. dbStatus_temp= DBSTATUS_E_UNAVAILABLE;
  526. break;
  527. };
  528. };
  529. if (pdbStatus == 0)
  530. RRETURN(S_OK);
  531. if (pdbStatus != NULL)
  532. *pdbStatus = dbStatus_temp;
  533. if (dbStatus_temp == DBSTATUS_S_OK || dbStatus_temp == DBSTATUS_S_ISNULL)
  534. RRETURN(S_OK);
  535. else
  536. RRETURN(DB_S_ERRORSOCCURRED);
  537. error:
  538. RRETURN(hr);
  539. }
  540. HRESULT CRowProvider::GetIndex(
  541. IColumnsInfo* pColumnsInfo,
  542. LPWSTR lpwszColName,
  543. int& iIndex
  544. )
  545. {
  546. #if (!defined(BUILD_FOR_NT40))
  547. HRESULT hr = S_OK;
  548. int iColumn;
  549. DBCOLUMNINFO* pColumnInfo = NULL;
  550. DBORDINAL cColumns = 0;
  551. OLECHAR* pStringsBuffer = NULL;
  552. iIndex = 0;
  553. hr = pColumnsInfo->GetColumnInfo(&cColumns, &pColumnInfo, &pStringsBuffer);
  554. BAIL_ON_FAILURE(hr);
  555. for(iColumn = 0; iColumn < cColumns; iColumn++)
  556. {
  557. if(pColumnInfo[iColumn].pwszName == NULL || lpwszColName == NULL)
  558. continue;
  559. if(!_wcsicmp(pColumnInfo[iColumn].pwszName, lpwszColName))
  560. {
  561. iIndex = iColumn;
  562. break;
  563. }
  564. }
  565. if (pColumnInfo)
  566. _pMalloc->Free((void*)pColumnInfo);
  567. if (pStringsBuffer)
  568. _pMalloc->Free((void*)pStringsBuffer);
  569. RRETURN(S_OK);
  570. error:
  571. if (pColumnInfo)
  572. _pMalloc->Free((void*)pColumnInfo);
  573. if (pStringsBuffer)
  574. _pMalloc->Free((void*)pStringsBuffer);
  575. RRETURN(hr);
  576. #else
  577. RRETURN(E_FAIL);
  578. #endif
  579. }
  580. STDMETHODIMP CRowProvider::GetURLFromHROW(
  581. HROW hRow,
  582. LPOLESTR *ppwszURL,
  583. IRowset* pRowset
  584. )
  585. {
  586. #if (!defined(BUILD_FOR_NT40))
  587. HRESULT hr = S_OK;
  588. auto_rel<IAccessor> pAccessor;
  589. auto_rel<IColumnsInfo> pColumnsInfo;
  590. HACCESSOR hAccessor = NULL;
  591. DBBINDING Bindings[1];
  592. CComVariant varData;
  593. if ((NULL == hRow) || (NULL == ppwszURL) || (NULL == pRowset))
  594. RRETURN(E_INVALIDARG);
  595. *ppwszURL = NULL;
  596. // If adspath is in the list of columns selected
  597. // return that value.
  598. if (_fADSPathPresent)
  599. {
  600. VariantInit(&varData);
  601. Bindings[0].dwPart = DBPART_VALUE;
  602. Bindings[0].dwMemOwner = DBMEMOWNER_CLIENTOWNED;
  603. Bindings[0].eParamIO = DBPARAMIO_NOTPARAM;
  604. Bindings[0].wType = DBTYPE_VARIANT;
  605. Bindings[0].pTypeInfo = NULL;
  606. Bindings[0].obValue = 0;
  607. Bindings[0].bPrecision = 0;
  608. Bindings[0].bScale = 0;
  609. Bindings[0].cbMaxLen = sizeof(VARIANT);
  610. Bindings[0].pObject = NULL;
  611. Bindings[0].pBindExt = NULL;
  612. Bindings[0].dwFlags = 0;
  613. hr = pRowset->QueryInterface(IID_IAccessor, (void**)&pAccessor);
  614. BAIL_ON_FAILURE(hr);
  615. if (_iAdsPathIndex == 0)
  616. {
  617. hr = pRowset->QueryInterface(__uuidof(IColumnsInfo), (void **)&pColumnsInfo);
  618. BAIL_ON_FAILURE(hr);
  619. hr = GetIndex(pColumnsInfo, L"AdsPath", _iAdsPathIndex);
  620. if (0 == _iAdsPathIndex)
  621. hr = E_UNEXPECTED;
  622. BAIL_ON_FAILURE(hr);
  623. }
  624. Bindings[0].iOrdinal = _iAdsPathIndex;
  625. Bindings[0].obValue = NULL;
  626. hr = pAccessor->CreateAccessor(DBACCESSOR_ROWDATA,sizeof(Bindings)/sizeof(Bindings[0]) , Bindings, 0, &hAccessor, NULL);
  627. BAIL_ON_FAILURE(hr);
  628. hr = pRowset->GetData(hRow, hAccessor, &varData);
  629. BAIL_ON_FAILURE(hr);
  630. ADsAssert(varData.vt == VT_BSTR);
  631. ADsAssert(varData.bstrVal);
  632. // allocate the string and copy data
  633. *ppwszURL = (LPWSTR ) _pMalloc->Alloc(sizeof(WCHAR) * (wcslen(varData.bstrVal) + 1));
  634. if (NULL == *ppwszURL)
  635. {
  636. hr = E_OUTOFMEMORY;
  637. BAIL_ON_FAILURE(hr);
  638. }
  639. wcscpy(*ppwszURL, varData.bstrVal);
  640. if (hAccessor)
  641. pAccessor->ReleaseAccessor(hAccessor, NULL);
  642. }
  643. else
  644. {
  645. ADS_CASE_IGNORE_STRING padsPath;
  646. hr = ((CRowset *)pRowset)->GetADsPathFromHROW(hRow, &padsPath);
  647. BAIL_ON_FAILURE(hr);
  648. *ppwszURL = (LPWSTR ) _pMalloc->Alloc(sizeof(WCHAR) *
  649. (wcslen(padsPath) +1));
  650. if (NULL == *ppwszURL)
  651. {
  652. hr = E_OUTOFMEMORY;
  653. BAIL_ON_FAILURE(hr);
  654. }
  655. wcscpy(*ppwszURL, padsPath);
  656. }
  657. RRETURN(S_OK);
  658. error:
  659. if (hAccessor)
  660. pAccessor->ReleaseAccessor(hAccessor, NULL);
  661. RRETURN(hr);
  662. #else
  663. RRETURN(E_FAIL);
  664. #endif
  665. }
  666. //+---------------------------------------------------------------------------
  667. //
  668. // Function: CRowProvider::GetColumnInfo
  669. //
  670. // Synopsis: @mfunc Get Column Info.
  671. //
  672. //----------------------------------------------------------------------------
  673. STDMETHODIMP
  674. CRowProvider::GetColumnInfo(
  675. DBORDINAL * pcColumns,
  676. DBCOLUMNINFO ** pprgInfo,
  677. WCHAR ** ppStringsBuffer
  678. )
  679. {
  680. DBORDINAL i;
  681. ULONG cChars, cCharDispl;
  682. HRESULT hr = S_OK;
  683. DBCOLUMNINFO * prgInfo = NULL;
  684. WCHAR * pStrBuffer = NULL;
  685. //
  686. // Asserts
  687. //
  688. ADsAssert(_pMalloc);
  689. ADsAssert(_cColumns);
  690. ADsAssert(_ColInfo);
  691. ADsAssert(_pwchBuf);
  692. if( pcColumns )
  693. *pcColumns = 0;
  694. if( pprgInfo )
  695. *pprgInfo = NULL;
  696. if( ppStringsBuffer )
  697. *ppStringsBuffer = NULL;
  698. if( (pcColumns == NULL) || (pprgInfo == NULL) || (ppStringsBuffer == NULL) )
  699. BAIL_ON_FAILURE( hr=E_INVALIDARG );
  700. prgInfo = (DBCOLUMNINFO*)_pMalloc->Alloc((ULONG)(_cColumns * sizeof(DBCOLUMNINFO)));
  701. if( prgInfo == NULL )
  702. BAIL_ON_FAILURE( hr=E_OUTOFMEMORY );
  703. memcpy(prgInfo, _ColInfo, (size_t)(_cColumns * sizeof(DBCOLUMNINFO)));
  704. cChars = _pMalloc->GetSize(_pwchBuf);
  705. pStrBuffer = (WCHAR*)_pMalloc->Alloc(cChars);
  706. if( pStrBuffer == NULL )
  707. BAIL_ON_FAILURE( hr=E_OUTOFMEMORY );
  708. memcpy(pStrBuffer, (void*)_pwchBuf , cChars);
  709. for (i=1; i<_cColumns; i++) {
  710. cCharDispl = (ULONG)(_ColInfo[i].pwszName - _pwchBuf);
  711. prgInfo[i].pwszName = pStrBuffer + cCharDispl;
  712. prgInfo[i].columnid.uName.pwszName = pStrBuffer + cCharDispl;
  713. };
  714. *pcColumns = _cColumns;
  715. *pprgInfo = prgInfo;
  716. *ppStringsBuffer = pStrBuffer;
  717. RRETURN( S_OK );
  718. error:
  719. if( !prgInfo )
  720. _pMalloc->Free(prgInfo);
  721. if( pStrBuffer != NULL )
  722. _pMalloc->Free(pStrBuffer);
  723. RRETURN( hr );
  724. };
  725. //+---------------------------------------------------------------------------
  726. //
  727. // Function: CRowProvider::MapColumnIDs
  728. //
  729. // Synopsis: @mfunc Map Column IDs.
  730. //
  731. //----------------------------------------------------------------------------
  732. STDMETHODIMP
  733. CRowProvider::MapColumnIDs(
  734. DBORDINAL cColumnIDs,
  735. const DBID rgColumnIDs[],
  736. DBORDINAL rgColumns[]
  737. )
  738. {
  739. ULONG found = 0;
  740. DBORDINAL i;
  741. DBORDINAL cValidCols = 0;
  742. //
  743. // No Column IDs are set when GetColumnInfo returns ColumnsInfo structure.
  744. // Hence, any value of ID will not match with any column
  745. //
  746. DBORDINAL iCol;
  747. //
  748. // No-Op if cColumnIDs is 0
  749. //
  750. if( cColumnIDs == 0 )
  751. RRETURN( S_OK );
  752. // Spec-defined checks.
  753. // Note that this guarantees we can access rgColumnIDs[] in loop below.
  754. // (Because we'll just fall through.)
  755. if( cColumnIDs && (!rgColumnIDs || !rgColumns) )
  756. RRETURN( E_INVALIDARG );
  757. //
  758. // Set the columns ordinals to invalid values
  759. //
  760. for (iCol=0; iCol < cColumnIDs; iCol++) {
  761. // Initialize
  762. rgColumns[iCol] = DB_INVALIDCOLUMN;
  763. //
  764. // The columnid with the Bookmark or the same name
  765. //
  766. if( rgColumnIDs[iCol].eKind == DBKIND_GUID_PROPID &&
  767. rgColumnIDs[iCol].uGuid.guid == DBCOL_SPECIALCOL &&
  768. rgColumnIDs[iCol].uName.ulPropid == 2 ) {
  769. rgColumns[iCol] = 0;
  770. cValidCols++;
  771. continue;
  772. }
  773. //
  774. // The columnid with the Column Name
  775. //
  776. if( rgColumnIDs[iCol].eKind == DBKIND_NAME &&
  777. rgColumnIDs[iCol].uName.pwszName ) {
  778. //
  779. // Find the name in the list of Attributes
  780. //
  781. for (ULONG iOrdinal=0; iOrdinal < _cColumns; iOrdinal++) {
  782. if( _ColInfo[iOrdinal].columnid.eKind == DBKIND_NAME &&
  783. !_wcsicmp(_ColInfo[iOrdinal].columnid.uName.pwszName,
  784. rgColumnIDs[iCol].uName.pwszName) ) {
  785. rgColumns[iCol] = iOrdinal;
  786. cValidCols++;
  787. break;
  788. }
  789. }
  790. }
  791. }
  792. if( cValidCols == 0 )
  793. RRETURN( DB_E_ERRORSOCCURRED );
  794. else if( cValidCols < cColumnIDs )
  795. RRETURN( DB_S_ERRORSOCCURRED );
  796. else
  797. RRETURN( S_OK );
  798. }
  799. STDMETHODIMP
  800. CRowProvider::CopyADs2VariantArray(
  801. PADS_SEARCH_COLUMN pADsColumn,
  802. PVARIANT *ppVariant
  803. )
  804. {
  805. SAFEARRAY *aList = NULL;
  806. SAFEARRAYBOUND aBound;
  807. VARTYPE vType = VT_NULL;
  808. HRESULT hr = S_OK;
  809. ULONG i;
  810. PVARIANT pVariant = NULL, pVarArray = NULL;
  811. BOOL fSafeArrayLocked = FALSE;
  812. ADsAssert(ppVariant);
  813. *ppVariant = NULL;
  814. aBound.lLbound = 0;
  815. aBound.cElements = pADsColumn->dwNumValues;
  816. pVariant = (PVARIANT) AllocADsMem(sizeof(VARIANT));
  817. if (!pVariant) {
  818. RRETURN(E_OUTOFMEMORY);
  819. }
  820. if ((ULONG) pADsColumn->dwADsType >= g_cMapADsTypeToVarType ||
  821. (vType = g_MapADsTypeToVarType[pADsColumn->dwADsType]) == VT_NULL) {
  822. BAIL_ON_FAILURE(hr = E_ADS_CANT_CONVERT_DATATYPE);
  823. }
  824. aList = SafeArrayCreate( VT_VARIANT, 1, &aBound );
  825. if (aList == NULL)
  826. BAIL_ON_FAILURE(hr = E_OUTOFMEMORY);
  827. hr = SafeArrayAccessData( aList, (void **) &pVarArray );
  828. if (FAILED(hr)) {
  829. SafeArrayDestroy( aList );
  830. goto error;
  831. }
  832. fSafeArrayLocked = TRUE;
  833. for (i=0; i<aBound.cElements; i++) {
  834. (V_VT(pVarArray+i)) = vType;
  835. switch (vType) {
  836. case VT_I4:
  837. V_I4(pVarArray+i) = pADsColumn->pADsValues[i].Integer;
  838. break;
  839. case VT_DISPATCH:
  840. if(pADsColumn->dwADsType == ADSTYPE_LARGE_INTEGER)
  841. hr = PackLargeInteger(&pADsColumn->pADsValues[i].LargeInteger,
  842. pVarArray+i);
  843. else if(pADsColumn->dwADsType == ADSTYPE_DN_WITH_BINARY)
  844. hr = PackDNWithBinary(pADsColumn->pADsValues[i].pDNWithBinary,
  845. pVarArray+i);
  846. else if(pADsColumn->dwADsType == ADSTYPE_DN_WITH_STRING)
  847. hr = PackDNWithString(pADsColumn->pADsValues[i].pDNWithString,
  848. pVarArray+i);
  849. BAIL_ON_FAILURE(hr);
  850. break;
  851. case VT_BOOL:
  852. V_I4(pVarArray+i) = pADsColumn->pADsValues[i].Boolean ?
  853. VARIANT_TRUE: VARIANT_FALSE;
  854. break;
  855. case VT_BSTR:
  856. hr = ADsAllocString (
  857. pADsColumn->pADsValues[i].CaseIgnoreString,
  858. &(V_BSTR(pVarArray+i))
  859. );
  860. BAIL_ON_FAILURE(hr);
  861. break;
  862. case VT_DATE:
  863. {
  864. double date = 0;
  865. hr = SystemTimeToVariantTime(
  866. &pADsColumn->pADsValues[i].UTCTime,
  867. &date);
  868. BAIL_ON_FAILURE(hr);
  869. V_DATE(pVarArray+i)= date;
  870. break;
  871. }
  872. case (VT_UI1 | VT_ARRAY):
  873. VariantInit(pVarArray+i);
  874. if(pADsColumn->dwADsType == ADSTYPE_OCTET_STRING)
  875. hr = BinaryToVariant(
  876. pADsColumn->pADsValues[i].OctetString.dwLength,
  877. pADsColumn->pADsValues[i].OctetString.lpValue,
  878. pVarArray+i);
  879. else if(pADsColumn->dwADsType == ADSTYPE_NT_SECURITY_DESCRIPTOR)
  880. hr = BinaryToVariant(
  881. pADsColumn->pADsValues[i].SecurityDescriptor.dwLength,
  882. pADsColumn->pADsValues[i].SecurityDescriptor.lpValue,
  883. pVarArray+i);
  884. else if(pADsColumn->dwADsType == ADSTYPE_PROV_SPECIFIC)
  885. hr = BinaryToVariant(
  886. pADsColumn->pADsValues[i].ProviderSpecific.dwLength,
  887. pADsColumn->pADsValues[i].ProviderSpecific.lpValue,
  888. pVarArray+i);
  889. BAIL_ON_FAILURE(hr);
  890. break;
  891. default:
  892. BAIL_ON_FAILURE(hr = E_ADS_CANT_CONVERT_DATATYPE);
  893. break;
  894. }
  895. }
  896. fSafeArrayLocked = FALSE;
  897. SafeArrayUnaccessData( aList );
  898. V_VT((PVARIANT)pVariant) = VT_ARRAY | VT_VARIANT;
  899. V_ARRAY((PVARIANT)pVariant) = aList;
  900. *ppVariant = pVariant;
  901. RRETURN(S_OK);
  902. error:
  903. if (fSafeArrayLocked && (NULL != aList))
  904. {
  905. SafeArrayUnaccessData( aList );
  906. SafeArrayDestroy( aList );
  907. }
  908. if (pVariant) {
  909. FreeADsMem(pVariant);
  910. }
  911. RRETURN(hr);
  912. }
  913. HRESULT
  914. PackLargeInteger(
  915. LARGE_INTEGER *plargeint,
  916. PVARIANT pVarDestObject
  917. )
  918. {
  919. HRESULT hr = S_OK;
  920. IADsLargeInteger * pLargeInteger = NULL;
  921. IDispatch * pDispatch = NULL;
  922. hr = CoCreateInstance(
  923. CLSID_LargeInteger,
  924. NULL,
  925. CLSCTX_INPROC_SERVER,
  926. IID_IADsLargeInteger,
  927. (void **) &pLargeInteger);
  928. BAIL_ON_FAILURE(hr);
  929. hr = pLargeInteger->put_LowPart(plargeint->LowPart);
  930. BAIL_ON_FAILURE(hr);
  931. hr = pLargeInteger->put_HighPart(plargeint->HighPart);
  932. BAIL_ON_FAILURE(hr);
  933. hr = pLargeInteger->QueryInterface(
  934. IID_IDispatch,
  935. (void **) &pDispatch
  936. );
  937. BAIL_ON_FAILURE(hr);
  938. V_VT(pVarDestObject) = VT_DISPATCH;
  939. V_DISPATCH(pVarDestObject) = pDispatch;
  940. error:
  941. if (pLargeInteger) {
  942. pLargeInteger->Release();
  943. }
  944. RRETURN(hr);
  945. }
  946. HRESULT
  947. PackDNWithBinary(
  948. PADS_DN_WITH_BINARY pDNWithBinary,
  949. PVARIANT pVarDestObject
  950. )
  951. {
  952. HRESULT hr;
  953. IADsDNWithBinary *pIADsDNWithBinary = NULL;
  954. BSTR bstrTemp = NULL;
  955. SAFEARRAYBOUND aBound;
  956. SAFEARRAY *aList = NULL;
  957. CHAR HUGEP *pArray = NULL;
  958. IDispatch *pIDispatch = NULL;
  959. if( (NULL == pDNWithBinary) || (NULL == pVarDestObject) )
  960. BAIL_ON_FAILURE(hr = E_INVALIDARG);
  961. hr = CoCreateInstance(
  962. CLSID_DNWithBinary,
  963. NULL,
  964. CLSCTX_INPROC_SERVER,
  965. IID_IADsDNWithBinary,
  966. (void **) &pIADsDNWithBinary
  967. );
  968. BAIL_ON_FAILURE(hr);
  969. if (pDNWithBinary->pszDNString) {
  970. hr = ADsAllocString(pDNWithBinary->pszDNString, &bstrTemp);
  971. BAIL_ON_FAILURE(hr);
  972. //
  973. // Put the value in the object - we can only set BSTR's
  974. //
  975. hr = pIADsDNWithBinary->put_DNString(bstrTemp);
  976. BAIL_ON_FAILURE(hr);
  977. }
  978. aBound.lLbound = 0;
  979. aBound.cElements = pDNWithBinary->dwLength;
  980. aList = SafeArrayCreate( VT_UI1, 1, &aBound );
  981. if ( aList == NULL )
  982. {
  983. hr = E_OUTOFMEMORY;
  984. BAIL_ON_FAILURE(hr);
  985. }
  986. hr = SafeArrayAccessData( aList, (void HUGEP * FAR *) &pArray );
  987. BAIL_ON_FAILURE(hr);
  988. memcpy( pArray, pDNWithBinary->lpBinaryValue, aBound.cElements );
  989. SafeArrayUnaccessData( aList );
  990. V_VT(pVarDestObject) = VT_ARRAY | VT_UI1;
  991. V_ARRAY(pVarDestObject) = aList;
  992. hr = pIADsDNWithBinary->put_BinaryValue(*pVarDestObject);
  993. VariantClear(pVarDestObject);
  994. BAIL_ON_FAILURE(hr);
  995. hr = pIADsDNWithBinary->QueryInterface(
  996. IID_IDispatch,
  997. (void **) &pIDispatch
  998. );
  999. BAIL_ON_FAILURE(hr);
  1000. V_VT(pVarDestObject) = VT_DISPATCH;
  1001. V_DISPATCH(pVarDestObject) = pIDispatch;
  1002. error:
  1003. if(pIADsDNWithBinary)
  1004. pIADsDNWithBinary->Release();
  1005. if (bstrTemp)
  1006. ADsFreeString(bstrTemp);
  1007. RRETURN(hr);
  1008. }
  1009. HRESULT
  1010. PackDNWithString(
  1011. PADS_DN_WITH_STRING pDNWithString,
  1012. PVARIANT pVarDestObject
  1013. )
  1014. {
  1015. HRESULT hr;
  1016. IADsDNWithString *pIADsDNWithString = NULL;
  1017. BSTR bstrDNVal = NULL;
  1018. BSTR bstrStrVal = NULL;
  1019. IDispatch *pIDispatch;
  1020. if( (NULL == pDNWithString) || (NULL == pVarDestObject) )
  1021. BAIL_ON_FAILURE(hr = E_INVALIDARG);
  1022. hr = CoCreateInstance(
  1023. CLSID_DNWithString,
  1024. NULL,
  1025. CLSCTX_INPROC_SERVER,
  1026. IID_IADsDNWithString,
  1027. (void **) &pIADsDNWithString
  1028. );
  1029. BAIL_ON_FAILURE(hr);
  1030. if (pDNWithString->pszDNString) {
  1031. hr = ADsAllocString(pDNWithString->pszDNString, &bstrDNVal);
  1032. BAIL_ON_FAILURE(hr);
  1033. hr = pIADsDNWithString->put_DNString(bstrDNVal);
  1034. BAIL_ON_FAILURE(hr);
  1035. }
  1036. if (pDNWithString->pszStringValue) {
  1037. hr = ADsAllocString(
  1038. pDNWithString->pszStringValue,
  1039. &bstrStrVal
  1040. );
  1041. BAIL_ON_FAILURE(hr);
  1042. hr = pIADsDNWithString->put_StringValue(bstrStrVal);
  1043. BAIL_ON_FAILURE(hr);
  1044. }
  1045. hr = pIADsDNWithString->QueryInterface(
  1046. IID_IDispatch,
  1047. (void **) &pIDispatch
  1048. );
  1049. BAIL_ON_FAILURE(hr);
  1050. V_VT(pVarDestObject) = VT_DISPATCH;
  1051. V_DISPATCH(pVarDestObject) = pIDispatch;
  1052. error:
  1053. if(pIADsDNWithString)
  1054. pIADsDNWithString->Release();
  1055. if (bstrDNVal) {
  1056. ADsFreeString(bstrDNVal);
  1057. }
  1058. if (bstrStrVal) {
  1059. ADsFreeString(bstrStrVal);
  1060. }
  1061. RRETURN(hr);
  1062. }
  1063. HRESULT
  1064. CRowProvider::SeekToNextRow(void)
  1065. {
  1066. HRESULT hr;
  1067. DWORD dwExtError = ERROR_SUCCESS;
  1068. const int ERROR_BUF_SIZE = 512;
  1069. const int NAME_BUF_SIZE = 128;
  1070. WCHAR ErrorBuf[ERROR_BUF_SIZE];
  1071. WCHAR NameBuf[NAME_BUF_SIZE];
  1072. do {
  1073. // Clear the ADSI extended error, so that after the call to GetNextRow,
  1074. // we can safely check if an extended error was set.
  1075. ADsSetLastError(ERROR_SUCCESS, NULL, NULL);
  1076. dwExtError = ERROR_SUCCESS;
  1077. //
  1078. // read the next row
  1079. //
  1080. hr = _pDSSearch->GetNextRow(
  1081. _hSearchHandle
  1082. );
  1083. // we should treat SIZE_LIMIT_EXCEEDED error message as
  1084. // S_ADS_NOMORE_ROWS
  1085. // in the future, we might want to return this error message
  1086. // to the user under non-paged search situation
  1087. if (LIMIT_EXCEEDED_ERROR(hr))
  1088. hr = S_ADS_NOMORE_ROWS;
  1089. BAIL_ON_FAILURE( hr );
  1090. if (hr == S_ADS_NOMORE_ROWS)
  1091. {
  1092. // check if more results are likely (pagedTimeLimit search). If so,
  1093. // we will keep trying till a row is obtained.
  1094. hr = ADsGetLastError(&dwExtError, ErrorBuf, ERROR_BUF_SIZE,
  1095. NameBuf, NAME_BUF_SIZE);
  1096. BAIL_ON_FAILURE(hr);
  1097. if (dwExtError != ERROR_MORE_DATA)
  1098. // we really have no more data
  1099. RRETURN(S_ADS_NOMORE_ROWS);
  1100. }
  1101. } while(ERROR_MORE_DATA == dwExtError);
  1102. error:
  1103. RRETURN(hr);
  1104. }
  1105. HRESULT
  1106. CRowProvider::SeekToPreviousRow(void)
  1107. {
  1108. RRETURN( _pDSSearch->GetPreviousRow(_hSearchHandle) );
  1109. }