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.

302 lines
7.0 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // PostCreateServices.h
  7. //
  8. // Description:
  9. // PostCreateServices implementation.
  10. //
  11. // Maintained By:
  12. // Geoffrey Pease (GPease) 15-JUN-2000
  13. //
  14. //////////////////////////////////////////////////////////////////////////////
  15. #include "pch.h"
  16. #include "GroupHandle.h"
  17. #include "ResourceEntry.h"
  18. #include "IPrivatePostCfgResource.h"
  19. #include "PostCreateServices.h"
  20. DEFINE_THISCLASS("CPostCreateServices")
  21. // ************************************************************************
  22. //
  23. // Constructor / Destructor
  24. //
  25. // ************************************************************************
  26. //////////////////////////////////////////////////////////////////////////////
  27. //
  28. // HRESULT
  29. // CPostCreateServices::S_HrCreateInstance(
  30. // IUnknown ** ppunkOut
  31. // )
  32. //
  33. //////////////////////////////////////////////////////////////////////////////
  34. HRESULT
  35. CPostCreateServices::S_HrCreateInstance(
  36. IUnknown ** ppunkOut
  37. )
  38. {
  39. TraceFunc( "" );
  40. HRESULT hr = E_UNEXPECTED;
  41. Assert( ppunkOut != NULL );
  42. CPostCreateServices * pdummy = new CPostCreateServices;
  43. if ( pdummy != NULL )
  44. {
  45. hr = THR( pdummy->HrInit( ) );
  46. if ( SUCCEEDED( hr ) )
  47. {
  48. hr = THR( pdummy->TypeSafeQI( IUnknown, ppunkOut ) );
  49. }
  50. pdummy->Release( );
  51. }
  52. else
  53. {
  54. hr = E_OUTOFMEMORY;
  55. }
  56. HRETURN( hr );
  57. } // S_HrCreateInstance( )
  58. //////////////////////////////////////////////////////////////////////////////
  59. //
  60. // CPostCreateServices::CPostCreateServices( void )
  61. //
  62. //////////////////////////////////////////////////////////////////////////////
  63. CPostCreateServices::CPostCreateServices( void )
  64. {
  65. TraceFunc( "" );
  66. InterlockedIncrement( &g_cObjects );
  67. TraceFuncExit();
  68. } // CPostCreateServices( )
  69. //////////////////////////////////////////////////////////////////////////////
  70. //
  71. // HRESULT
  72. // CPostCreateServices::HrInit( void )
  73. //
  74. //////////////////////////////////////////////////////////////////////////////
  75. HRESULT
  76. CPostCreateServices::HrInit( void )
  77. {
  78. TraceFunc( "" );
  79. HRESULT hr = S_OK;
  80. // IUnknown stuff
  81. Assert( m_cRef == 0 );
  82. AddRef( ); // Add one count
  83. // Resource
  84. Assert( m_presentry == NULL );
  85. HRETURN( hr );
  86. } // HrInit( )
  87. //////////////////////////////////////////////////////////////////////////////
  88. //
  89. // CPostCreateServices::~CPostCreateServices( )
  90. //
  91. //////////////////////////////////////////////////////////////////////////////
  92. CPostCreateServices::~CPostCreateServices( )
  93. {
  94. TraceFunc( "" );
  95. InterlockedDecrement( &g_cObjects );
  96. TraceFuncExit();
  97. } // ~CPostCreateServices( )
  98. // ************************************************************************
  99. //
  100. // IUnknown
  101. //
  102. // ************************************************************************
  103. //////////////////////////////////////////////////////////////////////////////
  104. //
  105. // STDMETHODIMP
  106. // CPostCreateServices::QueryInterface(
  107. // REFIID riid,
  108. // LPVOID *ppv
  109. // )
  110. //
  111. //////////////////////////////////////////////////////////////////////////////
  112. STDMETHODIMP
  113. CPostCreateServices::QueryInterface(
  114. REFIID riid,
  115. LPVOID *ppv
  116. )
  117. {
  118. TraceQIFunc( riid, ppv );
  119. HRESULT hr = E_NOINTERFACE;
  120. if ( IsEqualIID( riid, IID_IUnknown ) )
  121. {
  122. *ppv = static_cast< IClusCfgResourcePostCreate * >( this );
  123. hr = S_OK;
  124. } // if: IUnknown
  125. else if ( IsEqualIID( riid, IID_IClusCfgResourcePostCreate ) )
  126. {
  127. *ppv = TraceInterface( __THISCLASS__, IClusCfgResourcePostCreate, this, 0 );
  128. hr = S_OK;
  129. } // else if: IClusCfgResourcePostCreate
  130. else if ( IsEqualIID( riid, IID_IPrivatePostCfgResource ) )
  131. {
  132. *ppv = TraceInterface( __THISCLASS__, IPrivatePostCfgResource, this, 0 );
  133. hr = S_OK;
  134. } // else if: IPrivatePostCfgResource
  135. if ( SUCCEEDED( hr ) )
  136. {
  137. ((IUnknown*) *ppv)->AddRef( );
  138. } // if: success
  139. QIRETURN( hr, riid );
  140. } // QueryInterface( )
  141. //////////////////////////////////////////////////////////////////////////////
  142. //
  143. // STDMETHODIMP_(ULONG)
  144. // CPostCreateServices::AddRef( void )
  145. //
  146. //////////////////////////////////////////////////////////////////////////////
  147. STDMETHODIMP_(ULONG)
  148. CPostCreateServices::AddRef( void )
  149. {
  150. TraceFunc( "[IUnknown]" );
  151. m_cRef ++; // apartment model
  152. RETURN( m_cRef );
  153. } // AddRef( )
  154. //////////////////////////////////////////////////////////////////////////////
  155. //
  156. // STDMETHODIMP_(ULONG)
  157. // CPostCreateServices::Release( void )
  158. //
  159. //////////////////////////////////////////////////////////////////////////////
  160. STDMETHODIMP_(ULONG)
  161. CPostCreateServices::Release( void )
  162. {
  163. TraceFunc( "[IUnknown]" );
  164. m_cRef --; // apartment model
  165. if ( m_cRef )
  166. RETURN( m_cRef );
  167. TraceDo( delete this );
  168. RETURN(0);
  169. } // Release( )
  170. //****************************************************************************
  171. //
  172. // IClusCfgResourcePostCreate
  173. //
  174. //****************************************************************************
  175. //////////////////////////////////////////////////////////////////////////////
  176. //
  177. // STDMETHODIMP
  178. // CPostCreateServices::ChangeName(
  179. // LPCWSTR pcszNameIn
  180. // )
  181. //
  182. //////////////////////////////////////////////////////////////////////////////
  183. STDMETHODIMP
  184. CPostCreateServices::ChangeName(
  185. LPCWSTR pcszNameIn
  186. )
  187. {
  188. TraceFunc1( "[IClusCfgResourcePostCreate] pcszNameIn = '%s'", pcszNameIn );
  189. HRESULT hr = E_UNEXPECTED;
  190. HRETURN( hr );
  191. } // ChangeName( )
  192. //////////////////////////////////////////////////////////////////////////////
  193. //
  194. // STDMETHODIMP
  195. // CPostCreateServices::SendResourceControl(
  196. // DWORD dwControlCode,
  197. // LPVOID lpInBuffer,
  198. // DWORD cbInBufferSize,
  199. // LPVOID lpOutBuffer,
  200. // DWORD cbOutBufferSize,
  201. // LPDWORD lpcbBytesReturned
  202. // )
  203. //
  204. //////////////////////////////////////////////////////////////////////////////
  205. STDMETHODIMP
  206. CPostCreateServices::SendResourceControl(
  207. DWORD dwControlCode,
  208. LPVOID lpInBuffer,
  209. DWORD cbInBufferSize,
  210. LPVOID lpOutBuffer,
  211. DWORD cbOutBufferSize,
  212. LPDWORD lpcbBytesReturned
  213. )
  214. {
  215. TraceFunc( "[IClusCfgResourcePostCreate]" );
  216. HRESULT hr = THR( E_NOTIMPL );
  217. HRETURN( hr );
  218. } // SendResourceControl( )
  219. //****************************************************************************
  220. //
  221. // IPrivatePostCfgResource
  222. //
  223. //****************************************************************************
  224. //////////////////////////////////////////////////////////////////////////////
  225. //
  226. // STDMETHODIMP
  227. // CPostCreateServices::SetEntry(
  228. // CResourceEntry * presentryIn
  229. // )
  230. //
  231. //////////////////////////////////////////////////////////////////////////////
  232. STDMETHODIMP
  233. CPostCreateServices::SetEntry(
  234. CResourceEntry * presentryIn
  235. )
  236. {
  237. TraceFunc( "[IPrivatePostCfgResource]" );
  238. HRESULT hr = S_OK;
  239. m_presentry = presentryIn;
  240. HRETURN( hr );
  241. } // SetEntry( )