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.

247 lines
5.3 KiB

  1. *++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. Abstract:
  5. History:
  6. --*/
  7. #include "precomp.h"
  8. #include <commain.h>
  9. #include <clsfac.h>
  10. #include "msgsvc.h"
  11. #include "multsend.h"
  12. #include "smrtmrsh.h"
  13. #include "rpcsend.h"
  14. #include "rpcrecv.h"
  15. #include "msmqsend.h"
  16. #include "msmqrecv.h"
  17. #include "msmqqmgr.h"
  18. #include "msmqq.h"
  19. #include "objacces.h"
  20. #include <tchar.h>
  21. class CMsgServer : public CComServer
  22. {
  23. HRESULT Initialize()
  24. {
  25. ENTER_API_CALL
  26. BOOL bRes;
  27. HRESULT hr;
  28. CWbemPtr<CUnkInternal> pFactory;
  29. pFactory = new CSingletonClassFactory<CMsgServiceNT>(GetLifeControl());
  30. if ( pFactory == NULL )
  31. {
  32. return WBEM_E_OUT_OF_MEMORY;
  33. }
  34. hr = AddClassInfo( CLSID_WmiMessageService,
  35. pFactory,
  36. _T("Message Service"),
  37. TRUE );
  38. if ( FAILED(hr) )
  39. {
  40. return hr;
  41. }
  42. pFactory = new CSimpleClassFactory<CMsgRpcSender>(GetLifeControl());
  43. if ( pFactory == NULL )
  44. {
  45. return WBEM_E_OUT_OF_MEMORY;
  46. }
  47. hr = AddClassInfo( CLSID_WmiMessageRpcSender,
  48. pFactory,
  49. _T("Rpc Message Sender"),
  50. TRUE );
  51. if ( FAILED(hr) )
  52. {
  53. return hr;
  54. }
  55. pFactory = new CSimpleClassFactory<CMsgRpcReceiver>(GetLifeControl());
  56. if ( pFactory == NULL )
  57. {
  58. return WBEM_E_OUT_OF_MEMORY;
  59. }
  60. hr = AddClassInfo( CLSID_WmiMessageRpcReceiver,
  61. pFactory,
  62. _T("Rpc Message Receiver"),
  63. TRUE );
  64. if ( FAILED(hr) )
  65. {
  66. return hr;
  67. }
  68. pFactory = new CSimpleClassFactory<CMsgMultiSendReceive>(GetLifeControl());
  69. if ( pFactory == NULL )
  70. {
  71. return WBEM_E_OUT_OF_MEMORY;
  72. }
  73. hr = AddClassInfo( CLSID_WmiMessageMultiSendReceive,
  74. pFactory,
  75. _T("Message Multi SendReceive"),
  76. TRUE );
  77. if ( FAILED(hr) )
  78. {
  79. return hr;
  80. }
  81. pFactory= new CSimpleClassFactory<CSmartObjectMarshaler>(GetLifeControl());
  82. if ( pFactory == NULL )
  83. {
  84. return WBEM_E_OUT_OF_MEMORY;
  85. }
  86. hr = AddClassInfo( CLSID_WmiSmartObjectMarshal,
  87. pFactory,
  88. _T("Smart Object Marshaler"),
  89. TRUE );
  90. if ( FAILED(hr) )
  91. {
  92. return hr;
  93. }
  94. pFactory= new CSimpleClassFactory<CSmartObjectUnmarshaler>(GetLifeControl());
  95. if ( pFactory == NULL )
  96. {
  97. return WBEM_E_OUT_OF_MEMORY;
  98. }
  99. hr = AddClassInfo( CLSID_WmiSmartObjectUnmarshal,
  100. pFactory,
  101. _T("Smart Object Marshaler"),
  102. TRUE );
  103. if ( FAILED(hr) )
  104. {
  105. return hr;
  106. }
  107. pFactory=new CSimpleClassFactory<CObjectAccessFactory>(GetLifeControl());
  108. if ( pFactory == NULL )
  109. {
  110. return WBEM_E_OUT_OF_MEMORY;
  111. }
  112. hr = AddClassInfo( CLSID_WmiSmartObjectAccessFactory,
  113. pFactory,
  114. _T("Smart Object Access Factory"),
  115. TRUE );
  116. if ( FAILED(hr) )
  117. {
  118. return hr;
  119. }
  120. #ifdef __WHISTLER_UNCUT
  121. pFactory = new CSimpleClassFactory<CMsgMsmqSender>(GetLifeControl());
  122. if ( pFactory == NULL )
  123. {
  124. return WBEM_E_OUT_OF_MEMORY;
  125. }
  126. hr = AddClassInfo( CLSID_WmiMessageMsmqSender,
  127. pFactory,
  128. _T("MSMQ Message Sender"),
  129. TRUE );
  130. if ( FAILED(hr) )
  131. {
  132. return hr;
  133. }
  134. pFactory = new CSimpleClassFactory<CMsgMsmqReceiver>(GetLifeControl());
  135. if ( pFactory == NULL )
  136. {
  137. return WBEM_E_OUT_OF_MEMORY;
  138. }
  139. hr = AddClassInfo( CLSID_WmiMessageMsmqReceiver,
  140. pFactory,
  141. _T("MSMQ Message Receiver"),
  142. TRUE );
  143. if ( FAILED(hr) )
  144. {
  145. return hr;
  146. }
  147. pFactory = new CClassFactory<CMsgMsmqQueue>(GetLifeControl());
  148. if ( pFactory == NULL )
  149. {
  150. return WBEM_E_OUT_OF_MEMORY;
  151. }
  152. hr = AddClassInfo( CLSID_WmiMessageQueue,
  153. pFactory,
  154. _T("MSMQ Message Queue"),
  155. TRUE );
  156. if ( FAILED(hr) )
  157. {
  158. return hr;
  159. }
  160. pFactory = new CSimpleClassFactory<CMsgMsmqQueueMgr>(GetLifeControl());
  161. if ( pFactory == NULL )
  162. {
  163. return WBEM_E_OUT_OF_MEMORY;
  164. }
  165. hr = AddClassInfo( CLSID_WmiMessageQueueManager,
  166. pFactory,
  167. _T("MSMQ Message Queue Mager"),
  168. TRUE );
  169. #endif
  170. return hr;
  171. EXIT_API_CALL
  172. }
  173. void UnInitialize()
  174. {
  175. }
  176. void Register( )
  177. {
  178. }
  179. void Unregister( )
  180. {
  181. }
  182. } g_Server;