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.

188 lines
4.5 KiB

  1. <HTML>
  2. <HEAD>
  3. <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
  4. <TITLE></TITLE>
  5. </HEAD>
  6. <BODY>
  7. <P>&nbsp;</P>
  8. <P>&nbsp;</P>
  9. <P align=center><FONT face="Arial Black" size=5><STRONG>PCHealth Remote Control
  10. Unittest (Server)</STRONG></FONT></P>
  11. <TABLE>
  12. <TBODY>
  13. <TR>
  14. <TD><BUTTON id=CreateNewSession name=CreateNewSession onclick=CreateNewSession()>Create new RDS Session (Session Resolver not set)</BUTTON></TD>
  15. <TD></TD>
  16. </TR>
  17. </TBODY>
  18. </TABLE>
  19. <TABLE>
  20. <TBODY>
  21. <TR>
  22. <TD><BUTTON id=CreateNewSessionResolve name=CreateNewSessionResolve onclick=CreateNewSessionResolve()>Create new RDS Session (Session Resolver set)</BUTTON></TD>
  23. <TD></TD>
  24. </TR>
  25. </TBODY>
  26. </TABLE>
  27. <TABLE>
  28. <TR>
  29. <TD></INPUT></TD>
  30. </TR>
  31. <TR>
  32. <TD></INPUT></TD>
  33. <TD></TD>
  34. </TR>
  35. </TABLE><BUTTON id=CloseSession name=CloseSession onclick=CloseSession()>Close open RDS Session</BUTTON>
  36. <SCRIPT Language="JScript">
  37. var RDSHost = null;
  38. var RemoteDesktopSession = null;
  39. var ChannelManager = null;
  40. var ChatChannel = null;
  41. var tFileName = "\\\\pchealth\\public\\rc\\parms.txt";
  42. function UpdateConnectParms() {
  43. if (RemoteDesktopSession != null) {
  44. var str;
  45. str = RemoteDesktopSession.ConnectParms;
  46. connectParms.value = str;
  47. }
  48. }
  49. function CreateNewSession() {
  50. if (RemoteDesktopSession != null)
  51. {
  52. alert("Must close existing session first.");
  53. return;
  54. }
  55. RDSHost = new ActiveXObject("RDSHost.SAFRemoteDesktopServerHost.1");
  56. RemoteDesktopSession = RDSHost.CreateRemoteDesktopSession(4, 0, 0);
  57. var x;
  58. ChannelManager = RemoteDesktopSession.ChannelManager;
  59. ChatChannel = ChannelManager.OpenDataChannel("70");
  60. ChatChannel.OnChannelDataReady = function()
  61. { OnChannelDataReadyEvent(); }
  62. // Bind events.
  63. RemoteDesktopSession.OnConnected = function()
  64. { OnClientConnected(); }
  65. RemoteDesktopSession.OnDisconnected = function()
  66. { OnClientDisconnected(); }
  67. //
  68. // Save the connection Params
  69. //
  70. SaveConnectParms();
  71. }
  72. function CreateNewSessionResolve() {
  73. if (RemoteDesktopSession != null)
  74. {
  75. alert("Must close existing session first.");
  76. return;
  77. }
  78. RDSHost = new ActiveXObject("RDSHost.SAFRemoteDesktopServerHost.1");
  79. RemoteDesktopSession = RDSHost.CreateRemoteDesktopSession(4, 1, 0);
  80. var x;
  81. ChannelManager = RemoteDesktopSession.ChannelManager;
  82. ChatChannel = ChannelManager.OpenDataChannel("70");
  83. ChatChannel.OnChannelDataReady = function()
  84. { OnChannelDataReadyEvent(); }
  85. // Bind events.
  86. RemoteDesktopSession.OnConnected = function()
  87. { OnClientConnected(); }
  88. RemoteDesktopSession.OnDisconnected = function()
  89. { OnClientDisconnected(); }
  90. //
  91. // Save the connection Params
  92. //
  93. SaveConnectParms();
  94. }
  95. function SaveConnectParms()
  96. {
  97. //
  98. // Save the connection Params
  99. //
  100. var str = RemoteDesktopSession.ConnectParms;
  101. var fso = new ActiveXObject("Scripting.FileSystemObject");
  102. var fileHandle = fso.CreateTextFile( tFileName );
  103. fileHandle.Write( str );
  104. fileHandle.Close();
  105. }
  106. function OpenExistingSession() {
  107. if (RemoteDesktopSession != null)
  108. {
  109. alert("Must close existing session first.");
  110. return;
  111. }
  112. RDSHost = new ActiveXObject("RDSHost.SAFRemoteDesktopServerHost.1");
  113. RemoteDesktopSession = RDSHost.OpenRemoteDesktopSession(existingParms.value);
  114. var x;
  115. ChannelManager = RemoteDesktopSession.ChannelManager;
  116. ChatChannel = ChannelManager.OpenDataChannel("70");
  117. ChatChannel.OnChannelDataReady = function()
  118. { OnChannelDataReadyEvent(); }
  119. // Bind events.
  120. RemoteDesktopSession.OnConnected = function()
  121. { OnClientConnected(); }
  122. RemoteDesktopSession.OnDisconnected = function()
  123. { OnClientDisconnected(); }
  124. }
  125. function CloseSession() {
  126. if (RemoteDesktopSession != null) {
  127. RDSHost.CloseRemoteDesktopSession(RemoteDesktopSession);
  128. RemoteDesktopSession = null;
  129. }
  130. //
  131. // Delete Connection Parms
  132. //
  133. var fso;
  134. ��� fso = new ActiveXObject("Scripting.FileSystemObject");
  135. ��� fso.DeleteFile(tFileName);
  136. }
  137. function SendChatButtonHandler() {
  138. if (ChatChannel != null) {
  139. ChatChannel.SendChannelData(chatText.value);
  140. }
  141. }
  142. function OnChannelDataReadyEvent(channelName) {
  143. var str;
  144. str = ChatChannel.ReceiveChannelData()
  145. incomingChatText.value = incomingChatText.value + "\n" + str;
  146. }
  147. function OnClientConnected() {
  148. alert("Client connected.");
  149. }
  150. function OnClientDisconnected() {
  151. alert("Client disconnected.");
  152. }
  153. </SCRIPT>
  154. </BODY>
  155. </HTML>