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.

144 lines
3.0 KiB

  1. #include "precomp.h"
  2. //
  3. // AWC.CPP
  4. // Active Window Coordinator
  5. //
  6. // Copyright(c) Microsoft 1997-
  7. //
  8. #define MLZ_FILE_ZONE ZONE_CORE
  9. //
  10. // AWC_ReceivedPacket()
  11. //
  12. void ASShare::AWC_ReceivedPacket
  13. (
  14. ASPerson * pasPerson,
  15. PS20DATAPACKET pPacket
  16. )
  17. {
  18. PAWCPACKET pAWCPacket;
  19. UINT activateWhat;
  20. HWND hwnd;
  21. DebugEntry(ASShare::AWC_ReceivedPacket);
  22. ValidatePerson(pasPerson);
  23. pAWCPacket = (PAWCPACKET)pPacket;
  24. //
  25. // We trace the person ID out here so we don't bother to do it
  26. // elsewhere in this function on TRACE lines.
  27. //
  28. TRACE_OUT(("AWC_ReceivedPacket from [%d] - msg %x token %u data 0x%08x",
  29. pasPerson->mcsID,
  30. pAWCPacket->msg,
  31. pAWCPacket->token,
  32. pAWCPacket->data1));
  33. switch (pAWCPacket->msg)
  34. {
  35. case AWC_MSG_SAS:
  36. {
  37. //
  38. // Cause Ctrl+Alt+Del to be injected if we're in a service app,
  39. // we're hosting, and we're controlled by the sender.
  40. //
  41. if ((g_asOptions & AS_SERVICE) && (pasPerson->m_caInControlOf == m_pasLocal))
  42. {
  43. ASSERT(m_pHost);
  44. OSI_InjectCtrlAltDel();
  45. }
  46. break;
  47. }
  48. }
  49. DebugExitVOID(ASShare::AWC_ReceivedPacket);
  50. }
  51. //
  52. // FUNCTION: AWC_SendMsg
  53. //
  54. // DESCRIPTION:
  55. //
  56. // Sends a AWC message to remote system
  57. // * Requests to activate are just to one host
  58. // * Notifications of activation are to everyone
  59. //
  60. // RETURNS: TRUE or FALSE - success or failure
  61. //
  62. //
  63. BOOL ASShare::AWC_SendMsg
  64. (
  65. UINT nodeID,
  66. UINT msg,
  67. UINT data1,
  68. UINT data2
  69. )
  70. {
  71. PAWCPACKET pAWCPacket;
  72. BOOL rc = FALSE;
  73. #ifdef _DEBUG
  74. UINT sentSize;
  75. #endif
  76. DebugEntry(ASShare::AWC_SendMsg);
  77. //
  78. // Allocate correct sized packet.
  79. //
  80. pAWCPacket = (PAWCPACKET)SC_AllocPkt(PROT_STR_UPDATES, nodeID, sizeof(AWCPACKET));
  81. if (!pAWCPacket)
  82. {
  83. WARNING_OUT(("Failed to alloc AWC packet"));
  84. DC_QUIT;
  85. }
  86. //
  87. // Set up the data header for an AWC message.
  88. //
  89. pAWCPacket->header.data.dataType = DT_AWC;
  90. //
  91. // Now set up the AWC fields. By passing AWC_SYNC_MSG_TOKEN in the
  92. // token field, we ensure that back-level remotes will never drop our
  93. // packets.
  94. //
  95. pAWCPacket->msg = (TSHR_UINT16)msg;
  96. pAWCPacket->data1 = data1;
  97. pAWCPacket->data2 = data2;
  98. pAWCPacket->token = 0;
  99. //
  100. // Send the packet.
  101. //
  102. if (m_scfViewSelf)
  103. AWC_ReceivedPacket(m_pasLocal, &(pAWCPacket->header));
  104. #ifdef _DEBUG
  105. sentSize =
  106. #endif // _DEBUG
  107. DCS_CompressAndSendPacket(PROT_STR_UPDATES, nodeID,
  108. &(pAWCPacket->header), sizeof(*pAWCPacket));
  109. TRACE_OUT(("AWC packet size: %08d, sent: %08d", sizeof(*pAWCPacket), sentSize));
  110. rc = TRUE;
  111. DC_EXIT_POINT:
  112. DebugExitDWORD(ASShare::AWC_SendMsg, rc);
  113. return(rc);
  114. }