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.

158 lines
3.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. class CMsgServer : public CComServer
  16. {
  17. HRESULT Initialize()
  18. {
  19. ENTER_API_CALL
  20. BOOL bRes;
  21. HRESULT hr;
  22. CWbemPtr<CUnkInternal> pFactory;
  23. pFactory = new CSingletonClassFactory<CMsgServiceNT>(GetLifeControl());
  24. if ( pFactory == NULL )
  25. {
  26. return WBEM_E_OUT_OF_MEMORY;
  27. }
  28. hr = AddClassInfo( CLSID_WmiMessageService,
  29. pFactory,
  30. TEXT("Message Service"),
  31. TRUE );
  32. if ( FAILED(hr) )
  33. {
  34. return hr;
  35. }
  36. pFactory = new CSimpleClassFactory<CMsgRpcSender>(GetLifeControl());
  37. if ( pFactory == NULL )
  38. {
  39. return WBEM_E_OUT_OF_MEMORY;
  40. }
  41. hr = AddClassInfo( CLSID_WmiMessageRpcSender,
  42. pFactory,
  43. TEXT("Rpc Message Sender"),
  44. TRUE );
  45. if ( FAILED(hr) )
  46. {
  47. return hr;
  48. }
  49. pFactory = new CSimpleClassFactory<CMsgRpcReceiver>(GetLifeControl());
  50. if ( pFactory == NULL )
  51. {
  52. return WBEM_E_OUT_OF_MEMORY;
  53. }
  54. hr = AddClassInfo( CLSID_WmiMessageRpcReceiver,
  55. pFactory,
  56. TEXT("Rpc Message Receiver"),
  57. TRUE );
  58. if ( FAILED(hr) )
  59. {
  60. return hr;
  61. }
  62. pFactory = new CSimpleClassFactory<CMsgMultiSendReceive>(GetLifeControl());
  63. if ( pFactory == NULL )
  64. {
  65. return WBEM_E_OUT_OF_MEMORY;
  66. }
  67. hr = AddClassInfo( CLSID_WmiMessageMultiSendReceive,
  68. pFactory,
  69. TEXT("Message Multi SendReceive"),
  70. TRUE );
  71. if ( FAILED(hr) )
  72. {
  73. return hr;
  74. }
  75. pFactory= new CSimpleClassFactory<CSmartObjectMarshaler>(GetLifeControl());
  76. if ( pFactory == NULL )
  77. {
  78. return WBEM_E_OUT_OF_MEMORY;
  79. }
  80. hr = AddClassInfo( CLSID_WmiSmartObjectMarshal,
  81. pFactory,
  82. TEXT("Smart Object Marshaler"),
  83. TRUE );
  84. if ( FAILED(hr) )
  85. {
  86. return hr;
  87. }
  88. pFactory= new CSimpleClassFactory<CSmartObjectUnmarshaler>(GetLifeControl());
  89. if ( pFactory == NULL )
  90. {
  91. return WBEM_E_OUT_OF_MEMORY;
  92. }
  93. hr = AddClassInfo( CLSID_WmiSmartObjectUnmarshal,
  94. pFactory,
  95. TEXT("Smart Object Marshaler"),
  96. TRUE );
  97. if ( FAILED(hr) )
  98. {
  99. return hr;
  100. }
  101. return hr;
  102. EXIT_API_CALL
  103. }
  104. void UnInitialize()
  105. {
  106. }
  107. void Register( )
  108. {
  109. }
  110. void Unregister( )
  111. {
  112. }
  113. } g_Server;