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.

166 lines
5.6 KiB

  1. /****************************************************************************/
  2. /* Module: rcvapi.cpp */
  3. /* */
  4. /* Purpose: Receiver Thread initialization - in the Core */
  5. /* */
  6. /* Copyright(C) Microsoft Corporation 1999 */
  7. /* */
  8. /****************************************************************************/
  9. #include <adcg.h>
  10. extern "C" {
  11. #define TRC_GROUP TRC_GROUP_CORE
  12. #define TRC_FILE "rcvapi"
  13. #include <atrcapi.h>
  14. }
  15. #include "rcv.h"
  16. #include "autil.h"
  17. #include "cd.h"
  18. #include "op.h"
  19. #include "cm.h"
  20. #include "wui.h"
  21. #include "uh.h"
  22. #include "od.h"
  23. #include "sp.h"
  24. #include "clx.h"
  25. DWORD g_dwRCVDbgStatus = 0;
  26. #define RCV_DBG_INIT_CALLED 0x01
  27. #define RCV_DBG_INIT_DONE 0x02
  28. #define RCV_DBG_TERM_CALLED 0x04
  29. #define RCV_DBG_TERM_ACTUAL_DONE1 0x08
  30. #define RCV_DBG_TERM_ACTUAL_DONE2 0x10
  31. #define RCV_DBG_TERM_RETURN 0x20
  32. CRCV::CRCV(CObjs* objs)
  33. {
  34. _pClientObjects = objs;
  35. _fRCVInitComplete = FALSE;
  36. }
  37. CRCV::~CRCV()
  38. {
  39. }
  40. /****************************************************************************/
  41. /* Name: RCV_Init */
  42. /* */
  43. /* Purpose: Initialize the Receiver Thread */
  44. /* */
  45. /* Returns: None */
  46. /* */
  47. /* Params: None */
  48. /* */
  49. /****************************************************************************/
  50. DCVOID DCAPI CRCV::RCV_Init(DCVOID)
  51. {
  52. DC_BEGIN_FN("RCV_Init");
  53. g_dwRCVDbgStatus |= RCV_DBG_INIT_CALLED;
  54. TRC_ASSERT(_pClientObjects, (TB,_T("_pClientObjects is NULL")));
  55. _pClientObjects->AddObjReference(RCV_OBJECT_FLAG);
  56. _pCm = _pClientObjects->_pCMObject;
  57. _pUh = _pClientObjects->_pUHObject;
  58. _pOd = _pClientObjects->_pODObject;
  59. _pOp = _pClientObjects->_pOPObject;
  60. _pSp = _pClientObjects->_pSPObject;
  61. _pClx = _pClientObjects->_pCLXObject;
  62. _pUt = _pClientObjects->_pUtObject;
  63. _pCd = _pClientObjects->_pCdObject;
  64. _pUi = _pClientObjects->_pUiObject;
  65. // Initialize subcomponents of the Core in the Receiver Thread.
  66. _pCm->CM_Init();
  67. _pUh->UH_Init();
  68. _pOd->OD_Init();
  69. _pOp->OP_Init();
  70. _pSp->SP_Init();
  71. // Initialize Client Extension DLL
  72. TRC_DBG((TB, _T("RCV Initialising Client Extension DLL")));
  73. _pClx->CLX_Init(_pUi->UI_GetUIMainWindow(), _pUi->_UI.CLXCmdLine);
  74. // Allow UI to call Core functions
  75. _pUi->UI_SetCoreInitialized();
  76. //
  77. // This needs to be a direct call because the CD won't be able
  78. // to post to the UI layer because the ActiveX control is blocked
  79. // waiting on the core init event (blocking the main wnd loop on thread 0).
  80. //
  81. _pUi->UI_NotifyAxLayerCoreInit();
  82. // Tell the UI that the core has initialized
  83. _pCd->CD_DecoupleSimpleNotification(CD_UI_COMPONENT,
  84. _pUi,
  85. CD_NOTIFICATION_FUNC(CUI,UI_OnCoreInitialized),
  86. (ULONG_PTR) 0);
  87. _fRCVInitComplete = TRUE;
  88. g_dwRCVDbgStatus |= RCV_DBG_INIT_DONE;
  89. DC_END_FN();
  90. return;
  91. } /* RCV_Init */
  92. /****************************************************************************/
  93. /* Name: RCV_Term */
  94. /* */
  95. /* Purpose: Terminate the Receiver Thread */
  96. /* */
  97. /* Returns: None */
  98. /* */
  99. /* Params: None */
  100. /* */
  101. /****************************************************************************/
  102. DCVOID DCAPI CRCV::RCV_Term(DCVOID)
  103. {
  104. DC_BEGIN_FN("RCV_Term");
  105. g_dwRCVDbgStatus |= RCV_DBG_TERM_CALLED;
  106. if(_fRCVInitComplete)
  107. {
  108. g_dwRCVDbgStatus |= RCV_DBG_TERM_ACTUAL_DONE1;
  109. // Terminate subcomponents of the Core in the Receiver Thread.
  110. _pSp->SP_Term();
  111. _pOp->OP_Term();
  112. _pOd->OD_Term();
  113. _pUh->UH_Term();
  114. _pCm->CM_Term();
  115. //
  116. // Terminate utilities.
  117. //
  118. _pUt->UT_Term();
  119. // Terminate the Client Extension DLL
  120. // CLX_Term used to be called before CO_Term in UI_Term. CLX_Term
  121. // needs to be called after the SND and RCV threads are terminated.
  122. // So, we move CLX_Term after UI_Term in the recv thread
  123. //
  124. _pClx->CLX_Term();
  125. _pClientObjects->ReleaseObjReference(RCV_OBJECT_FLAG);
  126. g_dwRCVDbgStatus |= RCV_DBG_TERM_ACTUAL_DONE2;
  127. }
  128. g_dwRCVDbgStatus |= RCV_DBG_TERM_RETURN;
  129. DC_END_FN();
  130. return;
  131. } /* RCV_Term */