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.

184 lines
5.6 KiB

  1. <%@ LANGUAGE="VBSCRIPT"%>
  2. <%Response.Expires = 0%>
  3. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><HEAD>
  4. <META HTTP-EQUIV="Content-Type"
  5. CONTENT="text/html; CHARSET=iso-8859-1">
  6. <META NAME="GENERATOR"
  7. CONTENT="Microsoft Frontpage 2.0">
  8. <HEAD>
  9. <TITLE>Set HostName Page</TITLE>
  10. <%
  11. Dim strStatus
  12. Dim strHostName
  13. Dim objSaHelper
  14. Dim objTaskContext
  15. Dim objAS
  16. Dim rc
  17. Dim objLocMgr
  18. Dim varReplacementStrings
  19. Dim strUnknownErrorText
  20. Dim strRebootErrorText
  21. Dim strShuttingDownText
  22. Const UNKNOWN_ERROR_TEXT = "&H40020004"
  23. Const REBOOT_ERROR_TEXT = "&H4002000E"
  24. Const SHUTTINGDOWN_TEXT = "&H40020011"
  25. On Error Resume Next
  26. Err.Clear
  27. Set objLocMgr = Server.CreateObject("ServerAppliance.LocalizationManager")
  28. If Err.number = 0 Then
  29. strUnknownErrorText = objLocMgr.GetString("salocaluimsg.dll",UNKNOWN_ERROR_TEXT,varReplacementStrings)
  30. strRebootErrorText = objLocMgr.GetString("salocaluimsg.dll",REBOOT_ERROR_TEXT,varReplacementStrings)
  31. strShuttingDownText = objLocMgr.GetString("salocaluimsg.dll",SHUTTINGDOWN_TEXT,varReplacementStrings)
  32. Set objLocMgr = Nothing
  33. End If
  34. If strUnknownErrorText = "" Then
  35. strUnknownErrorText = "Encountered problem in setting host name. The change has been canceled."
  36. End If
  37. If strRebootErrorText = "" Then
  38. strRebootErrorText = "Changing host name requires reboot. Do you want to continue?"
  39. End If
  40. Err.Clear
  41. Const strMethodName = "ShutdownAppliance"
  42. strHostName = Session("Hostname_Hostname")
  43. Set objSaHelper = Server.CreateObject("ServerAppliance.SAHelper")
  44. If Err.Number <> 0 Then
  45. strStatus = strUnknownErrorText
  46. Else
  47. objSaHelper.HostName = strHostName
  48. If Err.Number <> 0 Then
  49. strStatus = strUnknownErrorText
  50. Else
  51. Set objTaskContext = CreateObject("Taskctx.TaskContext")
  52. If Err.Number <> 0 Then
  53. strStatus = strRebootErrorText
  54. Else
  55. Set objAS = CreateObject("Appsrvcs.ApplianceServices")
  56. If Err.Number <> 0 Then
  57. strStatus = strRebootErrorText
  58. Set objTaskContext = Nothing
  59. Else
  60. objTaskContext.SetParameter "Method Name", strMethodName
  61. objTaskContext.SetParameter "SleepDuration", 1000
  62. objTaskContext.SetParameter "PowerOff", "0"
  63. If Err.Number <> 0 Then
  64. strStatus = strRebootErrorText
  65. Set objAS = Nothing
  66. Set objTaskContext = Nothing
  67. Else
  68. objAS.Initialize()
  69. If Err.Number <> 0 Then
  70. strStatus = strRebootErrorText
  71. Set objAS = Nothing
  72. Set objTaskContext = Nothing
  73. Else
  74. rc = objAS.ExecuteTaskAsync("ApplianceShutdownTask", objTaskContext)
  75. If Err.Number <> 0 Then
  76. strStatus = strRebootErrorText
  77. Else
  78. strStatus = "Success"
  79. End If
  80. Set objAS = Nothing
  81. Set objTaskContext = Nothing
  82. End If
  83. End If
  84. End If
  85. End If
  86. End If
  87. End If
  88. Set objSaHelper = Nothing
  89. %>
  90. <SCRIPT LANGUAGE="VBScript">
  91. <!--
  92. public iIdleTimeOut
  93. Sub window_onload()
  94. Dim objKeypad
  95. Set objKeypad = CreateObject("Ldm.SAKeypadController")
  96. objKeypad.Setkey 0,0,FALSE
  97. objKeypad.Setkey 1,0,FALSE
  98. objKeypad.Setkey 2,0,FALSE
  99. objKeypad.Setkey 3,0,FALSE
  100. objKeypad.Setkey 4,27,FALSE
  101. objKeypad.Setkey 5,13,FALSE
  102. Set objKeypad = Nothing
  103. If "<%=strStatus%>" <> "Success" Then
  104. stateText.style.display = "none"
  105. logo.style.display = "none"
  106. state.style.display = "none"
  107. errorText.style.display =""
  108. iIdleTimeOut = window.SetTimeOut("IdleHandler()",300000)
  109. End If
  110. End Sub
  111. Sub keydown()
  112. If "<%=strStatus%>" <> "Success" Then
  113. If window.event.keycode = 13 or window.event.keycode = 27 Then
  114. window.navigate "localui_tasks.asp"
  115. End If
  116. window.clearTimeOut(iIdleTimeOut)
  117. iIdleTimeOut = window.SetTimeOut("IdleHandler()",300000)
  118. End If
  119. End Sub
  120. Sub IdleHandler()
  121. window.navigate "localui_main.asp"
  122. End Sub
  123. -->
  124. </SCRIPT>
  125. </HEAD>
  126. <body RIGHTMARGIN=0 LEFTMARGIN=0 onkeydown="keydown">
  127. <A id="errorText" STYLE="position:absolute; top:0; left:0; font-size:10; font-family=arial; display=none;"
  128. OnKeyDown="keydown()">
  129. <%=strStatus%>
  130. </A>
  131. <A id="stateText" STYLE="position:absolute; top:36; left:0; font-size:10; font-family=arial;">
  132. <%=strShuttingDownText%>
  133. </A>
  134. <IMG id="logo" STYLE="position:absolute; top:0; left=0;" SRC="localui_salogo.bmp"
  135. BORDER=0>
  136. <IMG id="state" STYLE="position:absolute; top:48; left=0;"
  137. SRC="localui_shutting_down.bmp" BORDER=0>
  138. </body>
  139. </html>