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.

177 lines
4.2 KiB

  1. //
  2. // CONTROL.H
  3. // Control by us, control of us
  4. //
  5. // Copyright (c) Microsoft 1997-
  6. //
  7. #ifndef _H_CA
  8. #define _H_CA
  9. //
  10. //
  11. // CONSTANTS
  12. //
  13. //
  14. #define CA_SEND_EVENT 0x0001
  15. #define CA_ALLOW_EVENT 0x0002
  16. //
  17. // Cleanup flags
  18. //
  19. #define CACLEAR_HOST 0x0001
  20. #define CACLEAR_VIEW 0x0002
  21. #define CACLEAR_ALL 0x0003
  22. //
  23. // Queued responses to control requests. We try to send them right away,
  24. // but that can fail.
  25. // Here's the logic:
  26. //
  27. // (1) For TAKING/RELEASING control (viewer)
  28. // There's only one at most pending. That's because a pending RELEASE
  29. // cancels out a pending TAKE.
  30. //
  31. // (2) For RESPONDING/REVOKING control (host)
  32. // These never cancel out. Each one will have a successive sequence ID.
  33. // There should NEVER be a pending BOUNCE in the queue with a
  34. // pending RESPOND for the same controller/request ID. Of course not,
  35. // since we don't change our state until the packet goes out,
  36. // and if the RESPOND CONFIRM packet hasn't gone out, we wouldn't
  37. // be bouncing anybody.
  38. //
  39. // Outgoing requests take precedence over incoming ones. In other words,
  40. // if the UI/user/SDK code asks us to take control of a remote, we will
  41. // turn any pending RESPOND CONFIRM packets into RESPOND DENIED ones. If
  42. // we are in control of another already, take will fail, it's the intermediate
  43. // phase that's undoable only.
  44. //
  45. // Here's the basic logic flow to TAKE CONTROL:
  46. // Viewer makes new sequence ID
  47. // Viewer sends private packet to host, requesting control
  48. // Viewer changes state to "asked for control"
  49. // Host receives private packet
  50. // Host sends private response packet to viewer, confirming or denying control
  51. // If confirming, host broadcasts notification to everybody sometime
  52. // later.
  53. // When viewer gets response, viewer moves to incontrol state, or
  54. // backs off
  55. //
  56. // Here's the basic logic flow to RELEASE CONTROL:
  57. // Viewer initiated:
  58. // Send INFORM RELEASED private packet to host
  59. // Change state to not in control
  60. // Host receives private packet
  61. // Host ignores if out of date (bounced already or whatever)
  62. // Host changes state to not controlled otherwise
  63. // Host initiated:
  64. // Send INFORM BOUNCED private packet to viewer
  65. // Change state to not controlled
  66. // Viewer receives private packet
  67. // Viewer ignores if out of date (released already or whatever)
  68. // Viewer changes state to not in control otherwise
  69. //
  70. // While pending take control, waiting to here confirmation, or in control
  71. // pending requests to control us are denied.
  72. //
  73. enum
  74. {
  75. REQUEST_2X = 0,
  76. REQUEST_30
  77. };
  78. typedef struct tagCA2XREQ
  79. {
  80. UINT_PTR data1;
  81. UINT_PTR data2;
  82. }
  83. CA2XREQ;
  84. typedef union
  85. {
  86. CA_RTC_PACKET rtc;
  87. CA_REPLY_RTC_PACKET rrtc;
  88. CA_RGC_PACKET rgc;
  89. CA_REPLY_RGC_PACKET rrgc;
  90. CA_PPC_PACKET ppc;
  91. CA_INFORM_PACKET inform;
  92. }
  93. CA30P;
  94. typedef CA30P * PCA30P;
  95. class ASPerson;
  96. typedef struct tagCA30PENDING
  97. {
  98. ASPerson * pasReplyTo;
  99. UINT_PTR mcsOrg;
  100. UINT msg;
  101. CA30P request;
  102. }
  103. CA30PENDING;
  104. typedef CA30PENDING * PCA30PENDING;
  105. typedef struct tagCA30XREQ
  106. {
  107. CA30P packet;
  108. }
  109. CA30REQ;
  110. //
  111. // Private send/responses get queued up and our state can NOT change until
  112. // they go out.
  113. //
  114. typedef struct tagCAREQUEST
  115. {
  116. STRUCTURE_STAMP
  117. BASEDLIST chain;
  118. UINT type;
  119. UINT_PTR destID;
  120. UINT msg;
  121. union
  122. {
  123. CA2XREQ req2x;
  124. CA30REQ req30;
  125. }
  126. req;
  127. }
  128. CAREQUEST;
  129. typedef CAREQUEST * PCAREQUEST;
  130. //
  131. // The location of the keyboard language toggle hotkey setting in the
  132. // registry.
  133. //
  134. #define LANGUAGE_TOGGLE_KEY "keyboard layout\\toggle"
  135. #define LANGUAGE_TOGGLE_KEY_VAL "Hotkey"
  136. //
  137. // A value we use to indicate that the registry entry is not present - it
  138. // could be any value except for '1', '2', or '3'
  139. //
  140. #define LANGUAGE_TOGGLE_NOT_PRESENT 0
  141. //
  142. // Query dialog
  143. //
  144. #define IDT_CAQUERY 50
  145. #define PERIOD_CAQUERY 30000 // 30 seconds
  146. INT_PTR CALLBACK CAQueryDlgProc(HWND, UINT, WPARAM, LPARAM);
  147. #endif // _H_CA