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.

172 lines
5.1 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. <OBJECT classid=CLSID:FC7D9E02-3F9E-11d3-93C0-00C04F72DAF7 height=0 id=oSAFClassFactory width=0></OBJECT>
  8. <P>&nbsp;</P>
  9. <P>&nbsp;</P>
  10. <P align=center><FONT face="Times New Roman" size=5><STRONG>Unsolicited Remote Control Unittest</STRONG></FONT></P>
  11. <TABLE>
  12. <TR>
  13. <TD><BUTTON id=CreateRemoteDesktopConnectionButton name=CreateRemoteDesktopConnectionButton onclick=CreateRemoteDesktopConnectionButtonHandler()>CreateRemoteDesktopConnection</BUTTON></TD>
  14. </TR>
  15. <TR>
  16. <TD><I style size=20> Enter Server Name to invoke </I><B> ConnectRemoteDesktop </B> <INPUT name="ServerName" id="ServerName" style="WIDTH: 310px; HEIGHT: 20px;" size=40>&nbsp;&nbsp;&nbsp;</TD>
  17. <TD><BUTTON id=ConnectRemoteDesktopButton name=ConnectRemoteDesktopButton onclick=ConnectRemoteDesktopButtonHandler()>ConnectRemoteDesktop</BUTTON></TD>
  18. </TR>
  19. <TR><TD><BUTTON id=UsersButton name=UsersButton onclick=UsersButtonHandler()>Users</BUTTON></TD></TR>
  20. <TR><TD><BUTTON id=SessionsButton name=SessionsButton onclick=SessionsButtonHandler()>Sessions</BUTTON></TD></TR>
  21. <TR><TD><BUTTON id=RemoteConnectionParametersButton name=RemoteConnectionParametersButton onclick=RemoteConnectionParametersButtonHandler()>RemoteConnectionParameters</BUTTON></TD></TR>
  22. <TR><TD><BUTTON id=ModemButton name=ModemButton onclick=ModemButtonHandler()>ModemConnected</BUTTON></TD></TR>
  23. </TABLE>
  24. <SCRIPT Language="JScript">
  25. var oSAFRemoteDesktopConnection = null;
  26. var oSAFRemoteConnectionData = null;
  27. var oUsersCollection = null;
  28. var oSessionsCollection = null;
  29. var RemConnectionParms = null;
  30. function CreateRemoteDesktopConnectionButtonHandler()
  31. {
  32. alert("In CreateRemoteDesktopConnection Method");
  33. try
  34. {
  35. oSAFRemoteDesktopConnection = oSAFClassFactory.CreateObject_RemoteDesktopConnection();
  36. alert("SUCCEEDED : CreateRemoteDesktopConnection");
  37. }
  38. catch (e)
  39. {
  40. alert("FAILED : CreateRemoteDesktopConnection with error " + e.Description);
  41. }
  42. }
  43. function ConnectRemoteDesktopButtonHandler()
  44. {
  45. alert("In ConnectRemoteDesktop Method");
  46. if (oSAFRemoteDesktopConnection != null)
  47. {
  48. try
  49. {
  50. oSAFRemoteConnectionData = oSAFRemoteDesktopConnection.ConnectRemoteDesktop(ServerName.value);
  51. alert("SUCCEEDED : ConnectRemoteDesktop");
  52. }
  53. catch (e)
  54. {
  55. alert("FAILED : ConnectRemoteDesktop with error " + e.Description);
  56. }
  57. }
  58. else
  59. {
  60. alert("ERROR : oSAFRemoteDesktopConnection is NULL");
  61. }
  62. }
  63. function UsersButtonHandler()
  64. {
  65. alert("In Users Method");
  66. if (oSAFRemoteConnectionData != null)
  67. {
  68. try
  69. {
  70. oUsersCollection = oSAFRemoteConnectionData.Users();
  71. alert("SUCCEEDED : Users");
  72. // List the UsersCollection's details.
  73. var nUsersLen = oUsersCollection.Count;
  74. alert("Total Users Logged on : "+nUsersLen);
  75. for(i=1; i<= nUsersLen; i++)
  76. {
  77. oUserObj = oUsersCollection.item(i);
  78. alert("Index : " +i+" UserName : "+oUserObj.UserName+" DomainName : "+oUserObj.DomainName);
  79. }
  80. }
  81. catch (e)
  82. {
  83. alert("FAILED : Users with error " + e.Description);
  84. }
  85. }
  86. else
  87. {
  88. alert("ERROR : oSAFRemoteConnectionData is NULL");
  89. }
  90. }
  91. function SessionsButtonHandler()
  92. {
  93. alert("In Sessions Method");
  94. if (oSAFRemoteConnectionData != null)
  95. {
  96. try
  97. {
  98. oSessionsCollection = oSAFRemoteConnectionData.Sessions();
  99. alert("SUCCEEDED : Sessions");
  100. // List the SessionsCollection's details.
  101. var nSessionsLen = oSessionsCollection.Count;
  102. alert("Total Sessions : "+nSessionsLen);
  103. for(i=1; i<= nSessionsLen; i++)
  104. {
  105. oSessionObj = oSessionsCollection.item(i);
  106. alert("Index : " +i+" UserName : "+oSessionObj.UserName+" DomainName : "+oSessionObj.DomainName+" SessionID "+oSessionObj.SessionID+" SessionState "+oSessionObj.SessionState);
  107. }
  108. }
  109. catch (e)
  110. {
  111. alert("FAILED : Sesions with error " + e.Description);
  112. }
  113. }
  114. else
  115. {
  116. alert("ERROR : oSAFRemoteConnectionData is NULL");
  117. }
  118. }
  119. function RemoteConnectionParametersButtonHandler()
  120. {
  121. alert("In RemoteConnectionParameters Method");
  122. if (oSAFRemoteConnectionData != null)
  123. {
  124. try
  125. {
  126. oSessionObj = oSessionsCollection.item(1);
  127. RemConnectionParms = oSAFRemoteConnectionData.ConnectionParms(ServerName.value, oSessionObj.UserName, oSessionObj.DomainName, oSessionObj.SessionID, "");
  128. alert("SUCCEEDED : RemoteConnectionParms "+RemConnectionParms);
  129. }
  130. catch (e)
  131. {
  132. alert("FAILED : RemoteConnectionParms with error " + e.Description);
  133. }
  134. }
  135. else
  136. {
  137. alert("ERROR : oSAFRemoteConnectionData is NULL");
  138. }
  139. }
  140. function ModemButtonHandler()
  141. {
  142. alert("In the Modem Button Handler");
  143. if (oSAFRemoteConnectionData != null)
  144. {
  145. fConnected = oSAFRemoteConnectionData.ModemConnected(ServerName.value);
  146. alert("ModemConnected = " + fConnected);
  147. }
  148. }
  149. </SCRIPT>
  150. </BODY>
  151. </HTML>