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.

249 lines
5.1 KiB

  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <%
  4. '==================================================
  5. ' Terminal Services Web Client
  6. '
  7. ' Copyright (c) Microsoft Corporation. All rights reserved.
  8. '
  9. '==================================================
  10. %>
  11. <!-- #include virtual="/admin/sh_page.asp" -->
  12. <!-- #include virtual="/admin/NASServeStatusBar.asp" -->
  13. <!-- #include virtual="/admin/tabs.asp" -->
  14. <%
  15. Function GetPathToHost()
  16. GetPathToHost = m_VirtualRoot
  17. End Function
  18. Function GetUserName()
  19. Dim domainAndUser
  20. Dim loginUser
  21. Dim user
  22. loginUser = Request.ServerVariables("LOGON_USER")
  23. domainAndUser = Split(loginUser, "\")
  24. If IsArray(domainAndUser) Then
  25. GetUserName = domainAndUser(UBound(domainAndUser))
  26. Else
  27. GetUserName = loginUser
  28. End If
  29. End Function
  30. %>
  31. <%
  32. Dim WinNTSysInfo 'Getting object
  33. Dim strComputerName(1) 'Computer name
  34. DIM L_PAGEDESCRIPTION_TEXT
  35. L_PAGEDESCRIPTION_TEXT = GetLocString("diskmsg.dll", "40420005", "")
  36. Dim L_HELP_TEXT
  37. L_HELP_TEXT = GetLocString("diskmsg.dll", "40420006", "")
  38. DIM L_PAGETITLE_TEXT
  39. DIM L_WINCLIENT_ERROR
  40. L_WINCLIENT_ERROR = GetLocString("diskmsg.dll", "C0420001", "")
  41. Set WinNTSysInfo = CreateObject("WinNTSystemInfo")
  42. strComputerName(0) = WinNTSysInfo.ComputerName
  43. L_PAGETITLE_TEXT = GetLocString("diskmsg.dll", "40420000", strComputerName )
  44. DIM L_ERRMSG_TITLE
  45. DIM L_ERRMSG_PROMPT
  46. L_ERRMSG_TITLE = GetLocString("tserver.dll", "40420007", "")
  47. L_ERRMSG_PROMPT = GetLocString("tserver.dll", "40420006", strComputerName)
  48. ServePage
  49. %>
  50. <%
  51. Function ServeContent()
  52. %>
  53. <script language="JavaScript">
  54. function ValidatePage()
  55. {
  56. return true;
  57. }
  58. function Init()
  59. {
  60. }
  61. function SetData()
  62. {
  63. }
  64. </script>
  65. <%
  66. If ( IsIE() AND InStr( Request.ServerVariables("HTTP_USER_AGENT"), "Windows")) Then
  67. %>
  68. <script language="VBScript">
  69. sub window_onLoad()
  70. on error resume next
  71. Err.Clear
  72. If not "<%Response.Write(GetServerName())%>" = "" Then
  73. srvName = "<%Response.Write(GetServerName()) %>"
  74. Else
  75. srvName = Document.location.hostname
  76. End If
  77. Dim objMsTsc
  78. objMsTsc = Document.all("MsTsc")
  79. If ( Err.Number <> 0 ) Then
  80. Else
  81. Document.all.MsTsc.Server = srvName
  82. Document.all.MsTsc.UserName = "<%=GetUserName()%>"
  83. If Document.all.MsTsc.SecuredSettingsEnabled Then
  84. Document.all.MsTsc.SecuredSettings.StartProgram = "mmc diskmgmt.msc"
  85. Document.all.MsTsc.SecuredSettings.WorkDir = "%windir%\system32"
  86. Else
  87. msgbox "Cannot access this program in the current browser zone"
  88. End If
  89. Document.all.MsTsc.Connect()
  90. End If
  91. end sub
  92. sub MsTsc_OnDisconnected(disconnectCode)
  93. if not disconnectCode = 2 then
  94. msgbox "<%Response.Write(L_ERRMSG_PROMPT) %>", , "<%Response.Write(L_ERRMSG_TITLE) %>"
  95. end if
  96. Window.History.back()
  97. end sub
  98. </script>
  99. <%
  100. End If
  101. %>
  102. <center>
  103. <table>
  104. <%If CONST_OSNAME_XPE = GetServerOSName() Then%>
  105. <tr width='100%' align=left>
  106. <td><small><%=L_HELP_TEXT%></small></td>
  107. </tr>
  108. <%Else%>
  109. <tr width='100%' align=left>
  110. <td><small><%=L_PAGEDESCRIPTION_TEXT%></small></td>
  111. </tr>
  112. <%End If%>
  113. </table>
  114. <table>
  115. <tr>
  116. <td align=center>
  117. <%
  118. If ( IsIE() AND InStr( Request.ServerVariables("HTTP_USER_AGENT"), "Windows")) Then
  119. %>
  120. <OBJECT language="vbscript" ID="MsTsc"
  121. CLASSID="CLSID:9059f30f-4eb1-4bd2-9fdc-36f43a218f4a"
  122. codebase="<%=SAI_GetTSClientCodeBase()%>"
  123. <%
  124. Dim resWidth
  125. resWidth = Request.QueryString("rW")
  126. If resWidth < 200 or resWidth > 1600 Then
  127. resWidth = 800
  128. End If
  129. Response.Write("WIDTH="+CStr(resWidth)+" ")
  130. Dim resHeight
  131. resHeight = Request.QueryString("rH")
  132. If resHeight < 200 or resHeight > 1200 Then
  133. resHeight = 600
  134. End If
  135. Response.Write("HEIGHT="+CStr(resHeight) + " " )
  136. %>
  137. </OBJECT>
  138. <%
  139. End If
  140. %>
  141. </td>
  142. </tr>
  143. </table>
  144. </center>
  145. <%
  146. End Function
  147. %>
  148. <%
  149. Sub ServePage
  150. %>
  151. <HTML>
  152. <head>
  153. <meta http-equiv="Content-Type" content="text/html; charset=<%=GetCharSet()%>">
  154. <TITLE><%=L_PAGETITLE_TEXT%></TITLE>
  155. <LINK REL="stylesheet" TYPE="text/css" HREF="<%=m_VirtualRoot%>style/mssastyles.css">
  156. <SCRIPT LANGUAGE="JavaScript" SRC="<%=m_VirtualRoot%>sh_page.js"></SCRIPT>
  157. </HEAD>
  158. <BODY marginWidth ="0" marginHeight="0" onDragDrop="return false;" topmargin="0" LEFTMARGIN="0" oncontextmenu="//return false;">
  159. <%
  160. NASServeStatusBar
  161. ServeTabBar
  162. Dim bIsSupported
  163. bIsSupported = false
  164. '
  165. ' The Terminal Server ActiveX control is only supported on Windows Clients
  166. ' running Internet Explorer.
  167. '
  168. If IsIE() Then
  169. If InStr( Request.ServerVariables("HTTP_USER_AGENT"), "Windows") Then
  170. bIsSupported = true
  171. End If
  172. End If
  173. If ( bIsSupported ) Then
  174. ServeContent
  175. Else
  176. Response.Write("<br><blockquote>")
  177. Response.Write("<H2>"+Server.HTMLEncode(L_WINCLIENT_ERROR)+"</H2>")
  178. Response.Write("</blockquote>")
  179. End If
  180. %>
  181. </BODY>
  182. </HTML>
  183. <%
  184. End Sub
  185. %>