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.

262 lines
7.8 KiB

  1. <% '==================================================
  2. ' Microsoft Server Appliance Kit
  3. ' Shares Site Implementation
  4. ' Copyright (c) Microsoft Corporation. All rights reserved.
  5. '================================================== %>
  6. <!-- #include file="sh_page.asp" -->
  7. <!-- #include file="sh_statusbar.asp" -->
  8. <%
  9. Const CONST_VIRTUALROOT = "SOFTWARE\Microsoft\ServerAppliance\ElementManager"
  10. '
  11. ' Override the virtual root. For the Shares site, all content is located in the root directory.
  12. m_VirtualRoot = "/"
  13. '--------------------------------------------------------------------------------------
  14. '
  15. ' This is the localized text section
  16. '
  17. '--------------------------------------------------------------------------------------
  18. Dim L_PAGETITLE_TEXT
  19. L_PAGETITLE_TEXT = GetLocString("httpsh.dll", "40300001", "")
  20. Dim L_PAGETITLE_NOTE_PART_1
  21. L_PAGETITLE_NOTE_PART_1 = GetLocString("httpsh.dll", "40300005", "")
  22. Dim L_PAGETITLE_NOTE_PART_2
  23. L_PAGETITLE_NOTE_PART_2 = GetLocString("httpsh.dll", "40300006", "")
  24. Dim L_ADMINISTER_TEXT
  25. 'L_ADMINISTER_TEXT = "Administer this server appliance"
  26. L_ADMINISTER_TEXT = GetLocString("httpsh.dll", "40300002", "")
  27. DIM L_NOSHARESAVAILABLE_ERRORMESSAGE
  28. L_NOSHARESAVAILABLE_ERRORMESSAGE = GetLocString("foldermsg.dll", "&HC03A001A", "")
  29. '--------------------------------------------------------------------------------------
  30. '
  31. ' Here are the registry locations for the admin web site port information
  32. '
  33. '--------------------------------------------------------------------------------------
  34. Const CONST_ADMINPORTPATH = "SOFTWARE\Microsoft\ServerAppliance\WebFramework"
  35. Const CONST_ADMINPORT = "AdminPort"
  36. Const CONST_SSLADMINPORT = "SSLAdminPort"
  37. '--------------------------------------------------------------------------------------
  38. Dim strServerName
  39. Dim WinNTSysInfo
  40. Set WinNTSysInfo = CreateObject("WinNTSystemInfo")
  41. strServerName = UCASE( WinNTSysInfo.ComputerName )
  42. Dim objElements
  43. Dim objItem
  44. Dim G_objRegistry
  45. Dim G_iAdminPort
  46. Dim G_iSSLAdminPort
  47. Dim G_sAdminURL
  48. Dim G_sLogoURL
  49. Dim G_sIconPath
  50. 'Getting registry conection
  51. Set G_objRegistry = RegConnection()
  52. G_iAdminPort = GetRegKeyValue(G_objRegistry, CONST_ADMINPORTPATH, CONST_ADMINPORT, CONST_DWORD)
  53. If (G_iAdminPort = "") Or Not IsNumeric(G_iAdminPort) Then
  54. G_iAdminPort = 8099 'Assigning it to default if we don't have one
  55. End If
  56. 'XPE only has one website, Admin SSL port is the same as the Shares SSL port
  57. If CONST_OSNAME_XPE = GetServerOSName() Then
  58. G_iSSLAdminPort = GetAdminSiteSSLPort()
  59. Else
  60. G_iSSLAdminPort = GetRegKeyValue(G_objRegistry, CONST_ADMINPORTPATH, CONST_SSLADMINPORT, CONST_DWORD)
  61. End If
  62. If (G_iSSLAdminPort = "") Or Not IsNumeric(G_iSSLAdminPort) Then
  63. G_iSSLAdminPort = 0 'Assigning it to default if we don't have one
  64. End If
  65. 'Start of Output - here is the status/branding bar
  66. Call ServeStatusBar(False, "", "")
  67. %>
  68. <!-- Copyright (c) Microsoft Corporation. All rights reserved.-->
  69. <html>
  70. <head>
  71. <meta HTTP-EQUIV="Refresh" CONTENT="60">
  72. <TITLE><%=L_PAGETITLE_TEXT%></TITLE>
  73. </head>
  74. <body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
  75. <table width='100%' cellspacing=0 cellpadding=0 border=0>
  76. <tr width='100%'>
  77. <td valign=top width='30%' nowrap class='PageBodyIndent'>
  78. <%
  79. Set objElements = GetElements("SharesLogo")
  80. For Each objItem in objElements
  81. G_sIconPath = objItem.GetProperty("ElementGraphic")
  82. If CONST_OSNAME_XPE = GetServerOSName() Then
  83. 'Get rid of "../" from the path if it's XPE
  84. G_sIconPath = mid(G_sIconPath, 4)
  85. End If
  86. If ( 0 < Len(Trim(G_sIconPath)) ) Then
  87. response.write("<IMG src='"+G_sIconPath+"' border=0>")
  88. End If
  89. Exit For
  90. Next
  91. %>
  92. <br><BR><BR>
  93. <%
  94. If (0 < G_iSSLAdminPort) Then
  95. G_sAdminURL = "https://" & strServerName & ":" & cstr(G_iSSLAdminPort) & GetAdminSiteVirtualRoot()
  96. ElseIf (0 < G_iAdminPort) Then
  97. G_sAdminURL = "https://" & strServerName+":" & cstr(G_iAdminPort) & GetAdminSiteVirtualRoot()
  98. Else
  99. G_sAdminURL = "https://" & strServerName + GetAdminSiteVirtualRoot()
  100. End If
  101. If CONST_OSNAME_XPE = GetServerOSName() Then
  102. G_sAdminURL = G_sAdminURL & "Admin/"
  103. End If
  104. If ("" <> G_sAdminURL) Then
  105. response.write("<a class='SharesPageLinkText' HREF='"+G_sAdminURL+"'>"+Server.HTMLEncode(L_ADMINISTER_TEXT)+"</a><br><br>")
  106. End If
  107. %>
  108. </td>
  109. <td valign=top class='PageBodyIndent'><br>
  110. <div class='SharesPageHeader'><%=L_PAGETITLE_TEXT%></div>
  111. <%
  112. response.write("<div class='TasksPageTitleDescription'>"+Server.HTMLEncode(L_PAGETITLE_NOTE_PART_1)+"")
  113. response.write("<a HREF='"+G_sAdminURL+"'>"+Server.HTMLEncode(L_ADMINISTER_TEXT)+"</a>")
  114. response.write(Server.HTMLEncode(L_PAGETITLE_NOTE_PART_2)+"</div><br>")
  115. '--------------------------------------------------------------------------------------
  116. '
  117. ' Here we are getting the list of shares that was saved by the shares area page
  118. '
  119. '--------------------------------------------------------------------------------------
  120. Err.Clear
  121. On Error Resume Next
  122. Dim oFileSystemObject
  123. Dim oFile
  124. Dim sSharesFolder
  125. Dim sShareName
  126. Dim bWroteShare
  127. Dim strHref
  128. Set oFileSystemObject = Server.CreateObject("Scripting.FileSystemObject")
  129. 'sSharesFolder = oFileSystemObject.GetSpecialFolder(0).Drive & "\inetpub\shares"
  130. sSharesFolder = GetSharesFolder()
  131. 'We need to open the file in Unicode read mode to deal with DBCS languages
  132. Set oFile = oFileSystemObject.OpenTextFile( sSharesFolder + "\SharesList.txt", 1, False, -2)
  133. bWroteShare = False
  134. If (0 = Err.number) Then
  135. Do While oFile.AtEndOfStream <> True
  136. sShareName = oFile.Readline
  137. response.write("<div class='SharesPageLinkText'>")
  138. If CONST_OSNAME_XPE = GetServerOSName() Then
  139. 'If it's a non-secure request, we add "http", otherwise add "https" to the URL
  140. If Request.ServerVariables("SERVER_PORT_SECURE") = 0 Then
  141. strHref = "https://" & Request.ServerVariables("Server_name") & ":" & Request.ServerVariables("SERVER_PORT") & "/" & Server.HTMLEncode(sShareName)
  142. Else
  143. strHref = "https://" & Request.ServerVariables("Server_name") & ":" & Request.ServerVariables("SERVER_PORT") & "/" & Server.HTMLEncode(sShareName)
  144. End If
  145. response.write("<a class='SharesPageLinkText' href="""+ strHref +""">"+Server.HTMLEncode(sShareName)+"</a></div>"+vbCrLf)
  146. Else
  147. response.write("<a class='SharesPageLinkText' href="""+Server.HTMLEncode(sShareName)+""">"+Server.HTMLEncode(sShareName)+"</a></div>"+vbCrLf)
  148. End If
  149. bWroteShare = True
  150. Loop
  151. End If
  152. If Not bWroteShare Then
  153. response.write("<div class='SharesPageText'>"+Server.HTMLEncode(L_NOSHARESAVAILABLE_ERRORMESSAGE)+"</div>")
  154. End If
  155. %>
  156. </td></tr></table>
  157. </body>
  158. </html>
  159. <%
  160. Function GetAdminSiteVirtualRoot()
  161. GetAdminSiteVirtualRoot = "/admin/"
  162. End Function
  163. Function GetAdminSiteSSLPort()
  164. On Error Resume Next
  165. Err.Clear
  166. Dim strSitename
  167. Dim objService
  168. Dim objWebsite
  169. Dim strObjPath
  170. strSitename = GetCurrentWebsiteName()
  171. strObjPath = GetIISWMIProviderClassName("IIs_WebServerSetting") & ".Name=" & chr(34) & strSitename & chr(34)
  172. Set objService = GetWMIConnection(CONST_WMI_IIS_NAMESPACE)
  173. Set objWebsite = objService.get(strObjPath)
  174. If IsIIS60Installed() Then
  175. GetAdminSiteSSLPort = objWebsite.SecureBindings(0).Port
  176. 'SSL Portnumber stored in WMI has a ":" at the end which we need to get rid of
  177. GetAdminSiteSSLPort = Left(GetAdminSiteSSLPort, len(GetAdminSiteSSLPort)-1)
  178. Else
  179. Dim strIPArr
  180. strIPArr=split(objWebsite.SecureBindings(0),":")
  181. GetAdminSiteSSLPort = strIPArr(1)
  182. End If
  183. If Err.number <> 0 Then
  184. SA_TraceOut "default.asp", "GetAdminSiteSSLPort(): Error " & Err.Description
  185. ' Give the default value
  186. GetAdminSiteSSLPort = "8098"
  187. End If
  188. End Function
  189. %>