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.

208 lines
4.8 KiB

  1. #include "stdafx.h"
  2. #include "resource.h"
  3. #include "objects.h"
  4. #include "maindoc.h"
  5. #ifdef _DEBUG
  6. #define new DEBUG_NEW
  7. #undef THIS_FILE
  8. static char THIS_FILE[] = __FILE__;
  9. #endif
  10. /***********************************************************
  11. Function:
  12. Arguments:
  13. Return:
  14. Purpose:
  15. Author(s):
  16. Revision:
  17. Date:
  18. ***********************************************************/
  19. COleDsGeneric::COleDsGeneric( )
  20. {
  21. }
  22. /***********************************************************
  23. Function:
  24. Arguments:
  25. Return:
  26. Purpose:
  27. Author(s):
  28. Revision:
  29. Date:
  30. ***********************************************************/
  31. COleDsGeneric::COleDsGeneric( IUnknown *pIUnk): COleDsObject( pIUnk )
  32. {
  33. BOOL bContainer;
  34. IADsContainer* pContainer;
  35. HRESULT hResult;
  36. hResult = pIUnk->QueryInterface( IID_IADsContainer, (void**)&pContainer );
  37. bContainer = SUCCEEDED( hResult );
  38. if( SUCCEEDED( hResult ) )
  39. pContainer->Release( );
  40. m_bHasChildren = bContainer;
  41. m_bSupportAdd = bContainer;
  42. m_bSupportMove = bContainer;
  43. m_bSupportCopy = bContainer;
  44. }
  45. /***********************************************************
  46. Function:
  47. Arguments:
  48. Return:
  49. Purpose:
  50. Author(s):
  51. Revision:
  52. Date:
  53. ***********************************************************/
  54. /*void COleDsGeneric::SetClass( CClass* pClass )
  55. {
  56. /*CString strContainer;
  57. strContainer = pClass->GetAttribute( ca_Container );
  58. if( strContainer == _T("YES") || strContainer == _T("Yes") )
  59. {
  60. m_bHasChildren = TRUE;
  61. m_bSupportAdd = TRUE;
  62. m_bSupportMove = TRUE;
  63. m_bSupportCopy = TRUE;
  64. }
  65. COleDsObject::SetClass( pClass );
  66. } */
  67. /***********************************************************
  68. Function:
  69. Arguments:
  70. Return:
  71. Purpose:
  72. Author(s):
  73. Revision:
  74. Date:
  75. ***********************************************************/
  76. COleDsGeneric::~COleDsGeneric( )
  77. {
  78. }
  79. /***********************************************************
  80. Function:
  81. Arguments:
  82. Return:
  83. Purpose:
  84. Author(s):
  85. Revision:
  86. Date:
  87. ***********************************************************/
  88. DWORD COleDsGeneric::GetChildren( DWORD* pTokens,
  89. DWORD dwMaxChildren,
  90. CDialog* pQueryStatus,
  91. BOOL* pFilters,
  92. DWORD dwFilters )
  93. {
  94. HRESULT hResult;
  95. IADsContainer* pIContainer;
  96. if( NULL == m_pIUnk )
  97. {
  98. ASSERT( FALSE );
  99. return 0L;
  100. }
  101. if( !m_bHasChildren )
  102. return 0L;
  103. hResult = m_pIUnk->QueryInterface( IID_IADsContainer,
  104. (void**) &pIContainer );
  105. ASSERT( SUCCEEDED( hResult ) );
  106. COleDsObject::GetChildren( pTokens, dwMaxChildren, pQueryStatus,
  107. pFilters, dwFilters );
  108. COleDsObject::GetChildren( pIContainer );
  109. pIContainer->Release( );
  110. return m_dwCount;
  111. }
  112. /***********************************************************
  113. Function:
  114. Arguments:
  115. Return:
  116. Purpose:
  117. Author(s):
  118. Revision:
  119. Date:
  120. ***********************************************************/
  121. HRESULT COleDsGeneric::DeleteItem( COleDsObject* pObject )
  122. {
  123. if( !m_bHasChildren )
  124. return E_FAIL;
  125. return ContainerDeleteItem( pObject );
  126. }
  127. /***********************************************************
  128. Function:
  129. Arguments:
  130. Return:
  131. Purpose:
  132. Author(s):
  133. Revision:
  134. Date:
  135. ***********************************************************/
  136. HRESULT COleDsGeneric::AddItem( )
  137. {
  138. if( !m_bHasChildren )
  139. return E_FAIL;
  140. return ContainerAddItem( );
  141. }
  142. /***********************************************************
  143. Function:
  144. Arguments:
  145. Return:
  146. Purpose:
  147. Author(s):
  148. Revision:
  149. Date:
  150. ***********************************************************/
  151. HRESULT COleDsGeneric::MoveItem( )
  152. {
  153. if( !m_bHasChildren )
  154. return E_FAIL;
  155. return ContainerMoveItem( );
  156. }
  157. /***********************************************************
  158. Function:
  159. Arguments:
  160. Return:
  161. Purpose:
  162. Author(s):
  163. Revision:
  164. Date:
  165. ***********************************************************/
  166. HRESULT COleDsGeneric::CopyItem( )
  167. {
  168. if( !m_bHasChildren )
  169. return E_FAIL;
  170. return ContainerCopyItem( );
  171. }