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.

217 lines
9.4 KiB

  1. /**MOD+**********************************************************************/
  2. /* Module: orint.cpp */
  3. /* */
  4. /* Purpose: Output Requestor internal functions */
  5. /* */
  6. /* Copyright(C) Microsoft Corporation 1997 */
  7. /* */
  8. /****************************************************************************/
  9. #include <adcg.h>
  10. extern "C" {
  11. #define TRC_GROUP TRC_GROUP_CORE
  12. #define TRC_FILE "worint"
  13. #include <atrcapi.h>
  14. }
  15. #include "autil.h"
  16. #include "wui.h"
  17. #include "or.h"
  18. #include "sl.h"
  19. /**PROC+*********************************************************************/
  20. /* Name: ORSendRefreshRectanglePDU */
  21. /* */
  22. /* Purpose: Builds and sends a RefreshRectanglePDU */
  23. /* */
  24. /* Returns: Nothing */
  25. /* */
  26. /* Params: None */
  27. /* */
  28. /**PROC-*********************************************************************/
  29. DCVOID DCINTERNAL COR::ORSendRefreshRectanglePDU(DCVOID)
  30. {
  31. PTS_REFRESH_RECT_PDU pSendBuffer;
  32. SL_BUFHND bufHandle;
  33. DC_BEGIN_FN("ORSendRefreshRectanglePDU");
  34. /************************************************************************/
  35. /* If we can't get a buffer, abandon the send */
  36. /************************************************************************/
  37. if (!_pSl->SL_GetBuffer(TS_REFRESH_RECT_PDU_SIZE,
  38. (PPDCUINT8) &pSendBuffer,
  39. &bufHandle))
  40. {
  41. TRC_NRM((TB, _T("Failed to GetBuffer")));
  42. DC_QUIT;
  43. }
  44. TRC_NRM((TB, _T("GetBuffer succeeded")));
  45. /************************************************************************/
  46. /* Fill in the buffer with a RefreshRect PDU */
  47. /************************************************************************/
  48. DC_MEMSET(pSendBuffer, 0, TS_REFRESH_RECT_PDU_SIZE);
  49. pSendBuffer->shareDataHeader.shareControlHeader.pduType =
  50. TS_PROTOCOL_VERSION | TS_PDUTYPE_DATAPDU;
  51. pSendBuffer->shareDataHeader.shareControlHeader.pduSource =
  52. _pUi->UI_GetClientMCSID();
  53. TS_DATAPKT_LEN(pSendBuffer) = TS_REFRESH_RECT_PDU_SIZE;
  54. TS_UNCOMP_LEN(pSendBuffer) = TS_REFRESH_RECT_UNCOMP_LEN;
  55. pSendBuffer->shareDataHeader.shareID = _pUi->UI_GetShareID();
  56. pSendBuffer->shareDataHeader.streamID = TS_STREAM_LOW;
  57. pSendBuffer->shareDataHeader.pduType2 = TS_PDUTYPE2_REFRESH_RECT;
  58. /************************************************************************/
  59. /* Set a single rectangle. */
  60. /************************************************************************/
  61. pSendBuffer->numberOfAreas = 1;
  62. RECT_TO_TS_RECTANGLE16(&(pSendBuffer->areaToRefresh[0]),
  63. &_OR.invalidRect)
  64. /************************************************************************/
  65. /* Now send the buffer */
  66. /************************************************************************/
  67. _pSl->SL_SendPacket((PDCUINT8)pSendBuffer,
  68. TS_REFRESH_RECT_PDU_SIZE,
  69. RNS_SEC_ENCRYPT,
  70. bufHandle,
  71. _pUi->UI_GetClientMCSID(),
  72. _pUi->UI_GetChannelID(),
  73. TS_HIGHPRIORITY);
  74. DC_MEMSET(&_OR.invalidRect, 0, sizeof(RECT));
  75. _OR.invalidRectEmpty = TRUE;
  76. DC_EXIT_POINT:
  77. DC_END_FN();
  78. return;
  79. } /* ORSendRefreshRectanglePDU */
  80. /**PROC+*********************************************************************/
  81. /* Name: ORSendSuppressOutputPDU */
  82. /* */
  83. /* Purpose: Builds and sends a SuppressOutputPDU */
  84. /* */
  85. /* Returns: Nothing */
  86. /* */
  87. /* Params: None */
  88. /* */
  89. /**PROC-*********************************************************************/
  90. DCVOID DCINTERNAL COR::ORSendSuppressOutputPDU(DCVOID)
  91. {
  92. PTS_SUPPRESS_OUTPUT_PDU pSendBuffer;
  93. SL_BUFHND bufHandle;
  94. DCUINT numberOfRectangles;
  95. TS_RECTANGLE16 tsRect;
  96. DCSIZE desktopSize;
  97. DC_BEGIN_FN("ORSendSuppressOutputPDU");
  98. TRC_ASSERT((_OR.pendingSendSuppressOutputPDU),
  99. (TB,_T("Not expecting to send SupressOutput")));
  100. /************************************************************************/
  101. /* If _OR.outputSuppressed is set then the number of rectangles is 0, if */
  102. /* not the number of rectangle is 1 and we should put the desktop area */
  103. /* in the PDU */
  104. /************************************************************************/
  105. if (_OR.outputSuppressed)
  106. {
  107. numberOfRectangles = 0;
  108. // prevent tsRect not initialized warning
  109. tsRect.top = 0;
  110. tsRect.left = 0;
  111. tsRect.bottom = 0;
  112. tsRect.right = 0;
  113. }
  114. else
  115. {
  116. numberOfRectangles = 1;
  117. /********************************************************************/
  118. /* Get the rectangle to send and put it in tsRect */
  119. /********************************************************************/
  120. _pUi->UI_GetDesktopSize(&desktopSize);
  121. tsRect.top = (DCUINT16) 0;
  122. tsRect.left = (DCUINT16) 0;
  123. tsRect.bottom = (DCUINT16) desktopSize.height;
  124. tsRect.right = (DCUINT16) desktopSize.width;
  125. }
  126. /************************************************************************/
  127. /* If we can't get a buffer, abandon the send */
  128. /************************************************************************/
  129. if (!_pSl->SL_GetBuffer( TS_SUPPRESS_OUTPUT_PDU_SIZE(numberOfRectangles),
  130. (PPDCUINT8) &pSendBuffer,
  131. &bufHandle))
  132. {
  133. TRC_NRM((TB, _T("Get Buffer failed")));
  134. DC_QUIT;
  135. }
  136. TRC_NRM((TB, _T("Get Buffer succeeded")));
  137. /************************************************************************/
  138. /* Fill in the buffer with a RefreshRec PDU */
  139. /************************************************************************/
  140. DC_MEMSET(pSendBuffer,
  141. 0,
  142. TS_SUPPRESS_OUTPUT_PDU_SIZE(numberOfRectangles));
  143. pSendBuffer->shareDataHeader.shareControlHeader.pduType =
  144. TS_PROTOCOL_VERSION | TS_PDUTYPE_DATAPDU;
  145. pSendBuffer->shareDataHeader.shareControlHeader.pduSource =
  146. _pUi->UI_GetClientMCSID();
  147. TS_DATAPKT_LEN(pSendBuffer)
  148. = (DCUINT16) TS_SUPPRESS_OUTPUT_PDU_SIZE(numberOfRectangles);
  149. TS_UNCOMP_LEN(pSendBuffer)
  150. = (DCUINT16) TS_SUPPRESS_OUTPUT_UNCOMP_LEN(numberOfRectangles);
  151. pSendBuffer->shareDataHeader.shareID = _pUi->UI_GetShareID();
  152. pSendBuffer->shareDataHeader.streamID = TS_STREAM_LOW;
  153. pSendBuffer->shareDataHeader.pduType2 = TS_PDUTYPE2_SUPPRESS_OUTPUT;
  154. pSendBuffer->numberOfRectangles = (DCUINT8) numberOfRectangles;
  155. /************************************************************************/
  156. /* If we have a rectangle to put into the PDU, put it in */
  157. /************************************************************************/
  158. if (numberOfRectangles == 1)
  159. {
  160. DC_MEMCPY(pSendBuffer->includedRectangle,
  161. &tsRect,
  162. sizeof(TS_RECTANGLE16));
  163. }
  164. TRC_NRM((TB, _T("Sending SuppressOutputPDU")));
  165. /************************************************************************/
  166. /* Send the PDU */
  167. /************************************************************************/
  168. _pSl->SL_SendPacket((PDCUINT8)pSendBuffer,
  169. TS_SUPPRESS_OUTPUT_PDU_SIZE(numberOfRectangles),
  170. RNS_SEC_ENCRYPT,
  171. bufHandle,
  172. _pUi->UI_GetClientMCSID(),
  173. _pUi->UI_GetChannelID(),
  174. TS_HIGHPRIORITY);
  175. _OR.pendingSendSuppressOutputPDU = FALSE;
  176. DC_EXIT_POINT:
  177. DC_END_FN();
  178. return;
  179. } /* ORSendSuppressOutputPDU */