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.

357 lines
15 KiB

  1. <HTML>
  2. <HEAD>
  3. <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
  4. <TITLE></TITLE>
  5. </HEAD>
  6. <BODY topMargin=0>
  7. <TABLE>
  8. <TR>
  9. <TD><BUTTON id=createListenButton name=createListenButton onclick=createListenButtonHandler()>Create Listen</BUTTON></TD>
  10. <TD><INPUT id=expertConnectParms name=expertConnectParms
  11. style="WIDTH: 400px" width="400"></INPUT></TD>
  12. <TD><BUTTON id=startListenButton name=startListenButton onclick=startListenButtonHandler()>Start Listen</BUTTON></TD>
  13. <TD><BUTTON id=stopListenButton name=stopListenButton onclick=stopListenButtonHandler()>Stop Listen</BUTTON></TD>
  14. <TD><BUTTON id=acceptListenButton name=acceptListenButton onclick=acceptListenButtonHandler()>Accept</BUTTON></TD>
  15. <TR>
  16. <TD><BUTTON id=connectButton name=connectButton onclick=ConnectButtonHandler()>Connect</BUTTON></TD>
  17. <TD><INPUT id=parmsInput name=parmsInput
  18. style="WIDTH: 400px" width="400"></INPUT></TD>
  19. <TD><BUTTON id=disconnectButton name=disconnectButton onclick=DisconnectButtonHandler()>Disconnect</BUTTON></TD></TR>
  20. </TABLE>
  21. <TABLE border=0 cellPadding=0 cellSpacing=0>
  22. <TBODY>
  23. <TR>
  24. <TD>
  25. <P>
  26. <OBJECT id=ClientHost
  27. style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; WIDTH: 640px; BORDER-BOTTOM: black 1px solid; HEIGHT: 480px"
  28. height=480 width=640
  29. data=data:application/x-oleobject;base64,UOCbKT7ot02n2thv3r/m0AADAAAlQgAAnDEAAA==
  30. classid=clsid:299BE050-E83E-4DB7-A7DA-D86FDEBFE6D0
  31. name=ClientHost></OBJECT>
  32. </P>
  33. </TD>
  34. </TR>
  35. </TBODY>
  36. </TABLE>
  37. <P></P>
  38. <BUTTON id=remoteControlButton name=RemoteControlButton onclick=RemoteControlButtonHandler()>Remote Control</BUTTON>
  39. <BUTTON id=stopRemoteControlButton name=stopRemoteControlButton onclick=RemoteControlEndButtonHandler()>Stop Remote Control</BUTTON>&nbsp;
  40. <TABLE>
  41. <TR>
  42. <TD>
  43. <TABLE>
  44. <TR>
  45. <TD><INPUT id=incomingChatText name=incomingChatText height="150" style="WIDTH: 275px; HEIGHT: 150px" width="275"
  46. ></INPUT></TD>
  47. </TR>
  48. <TR>
  49. <TD><INPUT id=chatText name=chatText style="WIDTH: 275px" width="275" ></INPUT></TD>
  50. <TD><BUTTON id=sendChatButton name=sendChatButton onclick=SendChatButtonHandler()>Send</BUTTON></TD>
  51. </TR>
  52. </TABLE>
  53. </TD>
  54. </TR>
  55. </TABLE>
  56. <SCRIPT Language="JScript">
  57. var RemoteDesktopClientObj = null;
  58. var QryMgr = null;
  59. var FolderNodeId = 0;
  60. var RootDataCol = null;
  61. var ChannelManager = null;
  62. var ChatChannel = null;
  63. var Server = null;
  64. var Port = null;
  65. var expertParm = null;
  66. function ConnectedHandler() {
  67. Server = RemoteDesktopClientObj.ConnectedServer;
  68. Port = RemoteDesktopClientObj.ConnectedPort;
  69. alert("ClientHost_Connected " + Server + " " + Port);
  70. }
  71. function ListenConnectHandler(status) {
  72. if( status == 0 ) {
  73. alert("Listen succeeded, click Accept to connect");
  74. }
  75. else {
  76. alert( "ListenConnect failed with status " + status );
  77. }
  78. }
  79. function SendChatButtonHandler() {
  80. if (ChatChannel != null) {
  81. ChatChannel.SendChannelData(chatText.value);
  82. }
  83. }
  84. function DisconnectButtonHandler() {
  85. if (RemoteDesktopClientObj != null) {
  86. RemoteDesktopClientObj.DisconnectFromServer();
  87. }
  88. }
  89. function RemoteControlButtonHandler() {
  90. if (RemoteDesktopClientObj != null) {
  91. RemoteDesktopClientObj.ConnectRemoteDesktop();
  92. }
  93. }
  94. function RemoteControlEndButtonHandler() {
  95. if (RemoteDesktopClientObj != null) {
  96. RemoteDesktopClientObj.DisconnectRemoteDesktop();
  97. }
  98. }
  99. function DisconnectedHandler(reason) {
  100. var str = "Unknown Error!!!!";
  101. switch(reason) {
  102. case 0 : str = "SAFERROR_NOERROR";
  103. break;
  104. case 1 : str = "SAFERROR_NOINFO";
  105. break;
  106. case 3 : str = "SAFERROR_LOCALNOTERROR";
  107. break;
  108. case 4 : str = "SAFERROR_REMOTEBYUSER";
  109. break;
  110. case 5 : str = "SAFERROR_BYSERVER";
  111. break;
  112. case 6 : str = "SAFERROR_DNSLOOKUPFAILED";
  113. break;
  114. case 7 : str = "SAFERROR_OUTOFMEMORY";
  115. break;
  116. case 8 : str = "SAFERROR_CONNECTIONTIMEDOUT";
  117. break;
  118. case 9 : str = "SAFERROR_SOCKETCONNECTFAILED";
  119. break;
  120. case 11 : str = "SAFERROR_HOSTNOTFOUND";
  121. break;
  122. case 12 : str = "SAFERROR_WINSOCKSENDFAILED";
  123. break;
  124. case 14 : str = "SAFERROR_INVALIDIPADDR";
  125. break;
  126. case 15 : str = "SAFERROR_SOCKETRECVFAILED";
  127. break;
  128. case 18 : str = "SAFERROR_INVALIDENCRYPTION";
  129. break;
  130. case 20 : str = "SAFERROR_GETHOSTBYNAMEFAILED";
  131. break;
  132. case 21 : str = "SAFERROR_LICENSINGFAILED";
  133. break;
  134. case 22 : str = "SAFERROR_ENCRYPTIONERROR";
  135. break;
  136. case 23 : str = "SAFERROR_DECRYPTIONERROR";
  137. break;
  138. case 24 : str = "SAFERROR_INVALIDPARAMETERSTRING";
  139. break;
  140. case 25 : str = "SAFERROR_HELPSESSIONNOTFOUND";
  141. break;
  142. case 26 : str = "SAFERROR_INVALIDPASSWORD";
  143. break;
  144. case 27 : str = "SAFERROR_HELPSESSIONEXPIRED";
  145. break;
  146. case 28 : str = "SAFERROR_CANTOPENRESOLVER";
  147. break;
  148. case 29 : str = "SAFERROR_UNKNOWNSESSMGRERROR";
  149. break;
  150. case 30 : str = "SAFERROR_CANTFORMLINKTOUSERSESSION";
  151. break;
  152. case 31 : str = "SAFERROR_SHADOWFAILED";
  153. break;
  154. case 32 : str = "SAFERROR_RCPROTOCOLERROR";
  155. break;
  156. case 33 : str = "SAFERROR_RCUNKNOWNERROR";
  157. break;
  158. case 34 : str = "SAFERROR_INTERNALERROR";
  159. break;
  160. }
  161. var msg = "ClientHost_Disconnected: " + str;
  162. alert(msg);
  163. }
  164. function RemoteControlRequestCompleteHandler(status) {
  165. var str = "Unknown Error!!!!";
  166. if (status != 0) {
  167. switch(status) {
  168. case 0 : str = "SAFERROR_NOERROR";
  169. break;
  170. case 1 : str = "SAFERROR_NOINFO";
  171. break;
  172. case 3 : str = "SAFERROR_LOCALNOTERROR";
  173. break;
  174. case 4 : str = "SAFERROR_REMOTEBYUSER";
  175. break;
  176. case 5 : str = "SAFERROR_BYSERVER";
  177. break;
  178. case 6 : str = "SAFERROR_DNSLOOKUPFAILED";
  179. break;
  180. case 7 : str = "SAFERROR_OUTOFMEMORY";
  181. break;
  182. case 8 : str = "SAFERROR_CONNECTIONTIMEDOUT";
  183. break;
  184. case 9 : str = "SAFERROR_SOCKETCONNECTFAILED";
  185. break;
  186. case 11 : str = "SAFERROR_HOSTNOTFOUND";
  187. break;
  188. case 12 : str = "SAFERROR_WINSOCKSENDFAILED";
  189. break;
  190. case 14 : str = "SAFERROR_INVALIDIPADDR";
  191. break;
  192. case 15 : str = "SAFERROR_SOCKETRECVFAILED";
  193. break;
  194. case 18 : str = "SAFERROR_INVALIDENCRYPTION";
  195. break;
  196. case 20 : str = "SAFERROR_GETHOSTBYNAMEFAILED";
  197. break;
  198. case 21 : str = "SAFERROR_LICENSINGFAILED";
  199. break;
  200. case 22 : str = "SAFERROR_ENCRYPTIONERROR";
  201. break;
  202. case 23 : str = "SAFERROR_DECRYPTIONERROR";
  203. break;
  204. case 24 : str = "SAFERROR_INVALIDPARAMETERSTRING";
  205. break;
  206. case 25 : str = "SAFERROR_HELPSESSIONNOTFOUND";
  207. break;
  208. case 26 : str = "SAFERROR_INVALIDPASSWORD";
  209. break;
  210. case 27 : str = "SAFERROR_HELPSESSIONEXPIRED";
  211. break;
  212. case 28 : str = "SAFERROR_CANTOPENRESOLVER";
  213. break;
  214. case 29 : str = "SAFERROR_UNKNOWNSESSMGRERROR";
  215. break;
  216. case 30 : str = "SAFERROR_CANTFORMLINKTOUSERSESSION";
  217. break;
  218. case 31 : str = "SAFERROR_SHADOWFAILED";
  219. break;
  220. case 32 : str = "SAFERROR_RCPROTOCOLERROR";
  221. break;
  222. case 33 : str = "SAFERROR_RCUNKNOWNERROR";
  223. break;
  224. case 34 : str = "SAFERROR_INTERNALERROR";
  225. break;
  226. }
  227. var msg = "RemoteControlRequestCompleteHandler: " + str;
  228. alert(msg);
  229. }
  230. }
  231. function ChannelDataReadyHandler(channelID) {
  232. var str;
  233. str = ChatChannel.ReceiveChannelData();
  234. incomingChatText.value = incomingChatText.value + "\n" + str;
  235. }
  236. function ConnectButtonHandler() {
  237. if (RemoteDesktopClientObj == null) {
  238. RemoteDesktopClientObj = ClientHost.GetRemoteDesktopClient();
  239. // RemoteDesktopClientObj.EnableSmartSizing = true;
  240. // Bind the event handlers for this object.
  241. RemoteDesktopClientObj.OnConnected = function()
  242. { ConnectedHandler(); }
  243. RemoteDesktopClientObj.OnDisconnected = function(reason)
  244. { DisconnectedHandler(reason); }
  245. RemoteDesktopClientObj.OnConnectRemoteDesktopComplete = function(status)
  246. { RemoteControlRequestCompleteHandler(status); }
  247. RemoteDesktopClientObj.OnListenConnect = function(status)
  248. { ListenConnectHandler(status); }
  249. // Add the 'chat' channel.
  250. ChannelManager = RemoteDesktopClientObj.ChannelManager;
  251. if (ChatChannel == null) {
  252. ChatChannel = ChannelManager.OpenDataChannel("70");
  253. ChatChannel.OnChannelDataReady = function()
  254. { ChannelDataReadyHandler(); }
  255. }
  256. }
  257. RemoteDesktopClientObj.ConnectParms = parmsInput.value;
  258. RemoteDesktopClientObj.ConnectToServer("12345");
  259. }
  260. function createListenButtonHandler() {
  261. if (RemoteDesktopClientObj == null) {
  262. RemoteDesktopClientObj = ClientHost.GetRemoteDesktopClient();
  263. // RemoteDesktopClientObj.EnableSmartSizing = true;
  264. // Bind the event handlers for this object.
  265. RemoteDesktopClientObj.OnConnected = function()
  266. { ConnectedHandler(); }
  267. RemoteDesktopClientObj.OnDisconnected = function(reason)
  268. { DisconnectedHandler(reason); }
  269. RemoteDesktopClientObj.OnConnectRemoteDesktopComplete = function(status)
  270. { RemoteControlRequestCompleteHandler(status); }
  271. RemoteDesktopClientObj.OnListenConnect = function(status)
  272. { ListenConnectHandler(status); }
  273. // Add the 'chat' channel.
  274. ChannelManager = RemoteDesktopClientObj.ChannelManager;
  275. if (ChatChannel == null) {
  276. ChatChannel = ChannelManager.OpenDataChannel("70");
  277. ChatChannel.OnChannelDataReady = function()
  278. { ChannelDataReadyHandler(); }
  279. }
  280. }
  281. expertParm = RemoteDesktopClientObj.CreateListenEndpoint( 0 );
  282. expertConnectParms.value = expertParm;
  283. alert("Click Start Listen to begin waiting for connection");
  284. }
  285. function acceptListenButtonHandler() {
  286. if (RemoteDesktopClientObj == null) {
  287. alert("Must Create Listen first");
  288. }
  289. else if( parmsInput.value == "" ) {
  290. alert("No connect parm.");
  291. }
  292. else {
  293. RemoteDesktopClientObj.ConnectParms = parmsInput.value;
  294. RemoteDesktopClientObj.AcceptListenConnection( "12345" );
  295. }
  296. }
  297. function stopListenButtonHandler() {
  298. if (RemoteDesktopClientObj == null) {
  299. alert("Must Create Listen first");
  300. }
  301. else {
  302. expertParm = RemoteDesktopClientObj.StopListen();
  303. }
  304. }
  305. function startListenButtonHandler() {
  306. if (RemoteDesktopClientObj == null) {
  307. alert("Must Create Listen first");
  308. }
  309. else {
  310. expertParm = RemoteDesktopClientObj.StartListen( 0 );
  311. }
  312. }
  313. </SCRIPT>
  314. </BODY>
  315. </HTML>