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.

153 lines
3.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1992.
  5. //
  6. // File: peiter.cxx
  7. //
  8. // Contents: Implementation of PExposedIterator
  9. //
  10. // History: 18-Jan-93 DrewB Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #include <exphead.cxx>
  14. #pragma hdrstop
  15. #include <peiter.hxx>
  16. #include <expparam.hxx>
  17. //+---------------------------------------------------------------------------
  18. //
  19. // Member: PExposedIterator::hSkip, public
  20. //
  21. // Synopsis: Enumerator skip helper function
  22. //
  23. // History: 18-Jan-93 DrewB Created
  24. //
  25. //----------------------------------------------------------------------------
  26. SCODE PExposedIterator::hSkip(ULONG celt, BOOL fProps)
  27. {
  28. SCODE sc;
  29. SAFE_SEM;
  30. SAFE_ACCESS;
  31. SIterBuffer ib;
  32. olDebugOut((DEB_ITRACE, "In PExposedIterator::hSkip:%p(%lu, %d)\n",
  33. this, celt, fProps));
  34. olChk(TakeSafeSem());
  35. olChk(_ppdf->CheckReverted());
  36. SafeReadAccess();
  37. for (; celt>0; celt--)
  38. {
  39. sc = _ppdf->FindGreaterEntry(&_dfnKey, &ib, NULL, fProps);
  40. if (FAILED(sc))
  41. {
  42. if (sc == STG_E_NOMOREFILES)
  43. sc = S_FALSE;
  44. break;
  45. }
  46. _dfnKey.Set(&ib.dfnName);
  47. }
  48. olDebugOut((DEB_ITRACE, "Out PExposedIterator::hSkip\n"));
  49. EH_Err:
  50. return sc;
  51. }
  52. //+---------------------------------------------------------------------------
  53. //
  54. // Member: PExposedIterator::hRelease, public
  55. //
  56. // Synopsis: Release helper
  57. //
  58. // History: 18-Jan-93 DrewB Created
  59. //
  60. //----------------------------------------------------------------------------
  61. LONG PExposedIterator::hRelease(void)
  62. {
  63. LONG lRet;
  64. olDebugOut((DEB_ITRACE, "In PExposedIterator::hRelease:%p()\n", this));
  65. olAssert(_cReferences > 0);
  66. lRet = InterlockedDecrement(&_cReferences);
  67. olDebugOut((DEB_ITRACE, "Out PExposedIterator::hRelease => %lu\n", lRet));
  68. return lRet;
  69. }
  70. //+---------------------------------------------------------------------------
  71. //
  72. // Member: PExposedIterator::hQueryInterface, public
  73. //
  74. // Synopsis: QueryInterface helper
  75. //
  76. // History: 18-Jan-93 DrewB Created
  77. //
  78. //----------------------------------------------------------------------------
  79. SCODE PExposedIterator::hQueryInterface(REFIID iid,
  80. REFIID riidSelf,
  81. IUnknown *punkSelf,
  82. void **ppv)
  83. {
  84. SCODE sc;
  85. olDebugOut((DEB_ITRACE, "In PExposedIterator::hQueryInterface:%p("
  86. "riid, riidSelf, %p, %p)\n", this, punkSelf, ppv));
  87. OL_VALIDATE(QueryInterface(iid, ppv));
  88. #ifdef MULTIHEAP
  89. CSafeMultiHeap smh(_ppc);
  90. #endif
  91. olChk(_ppdf->CheckReverted());
  92. if (IsEqualIID(iid, riidSelf) || IsEqualIID(iid, IID_IUnknown))
  93. {
  94. *ppv = punkSelf;
  95. hAddRef();
  96. sc = S_OK;
  97. }
  98. else
  99. {
  100. sc = E_NOINTERFACE;
  101. }
  102. olDebugOut((DEB_ITRACE, "Out PExposedIterator::hQueryInterface\n"));
  103. EH_Err:
  104. return sc;
  105. }
  106. //+---------------------------------------------------------------------------
  107. //
  108. // Member: PExposedIterator::hReset, public
  109. //
  110. // Synopsis: Reset help
  111. //
  112. // History: 18-Jan-93 DrewB Created
  113. //
  114. //----------------------------------------------------------------------------
  115. SCODE PExposedIterator::hReset(void)
  116. {
  117. SCODE sc;
  118. SAFE_SEM;
  119. SAFE_ACCESS;
  120. olDebugOut((DEB_ITRACE, "In PExposedIterator::hReset:%p()\n", this));
  121. olChk(TakeSafeSem());
  122. SafeReadAccess();
  123. _dfnKey.Set((WORD)0, (BYTE *)NULL);
  124. sc = _ppdf->CheckReverted();
  125. olDebugOut((DEB_ITRACE, "Out PExposedIterator::hReset\n"));
  126. EH_Err:
  127. return sc;
  128. }