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.

207 lines
7.0 KiB

  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <% '-------------------------------------------------------------------------
  4. ' Shutdown_shutdownConfirm.asp: Shutdown the server appliance.
  5. '
  6. 'Copyright (c) Microsoft Corporation. All rights reserved.
  7. '
  8. ' Date Description
  9. ' 02-Jan-2001 Created date
  10. ' 23-Mar-2001 Modified date
  11. '-------------------------------------------------------------------------
  12. %>
  13. <!--#include virtual="/admin/inc_framework.asp"-->
  14. <!-- #include file="loc_Shutdown_msg.asp" -->
  15. <!-- #include file="inc_Shutdown.asp" -->
  16. <%
  17. '-------------------------------------------------------------------------
  18. 'Global Variables
  19. '-------------------------------------------------------------------------
  20. Dim page 'Variable that receives the output page object when
  21. 'creating a page
  22. Call SA_CreatePage(L_SHUTDOWNPAGE_TITLE_TEXT,"images/critical_error.gif",PT_PROPERTY,page)
  23. Call SA_ShowPage(page)
  24. '-------------------------------------------------------------------------
  25. 'Function: OnInitPage()
  26. 'Description: Called to signal first time processing for this page.
  27. ' Use this method to do first time initialization tasks
  28. 'Input Variables: PageIn,EventArg
  29. 'Output Variables: PageIn,EventArg
  30. 'Returns: True/False
  31. 'Global Variables: None
  32. '-------------------------------------------------------------------------
  33. Public Function OnInitPage(ByRef PageIn,ByRef EventArg)
  34. Call SA_TraceOut("shutdown_shutdownConfirm.asp", "OnInitPage")
  35. OnInitPage=TRUE
  36. End Function
  37. '-------------------------------------------------------------------------
  38. 'Function: OnServePropertyPage()
  39. 'Description: Called when the page needs to be served.Use this
  40. ' method to serve content
  41. 'Input Variables: PageIn,EventArg
  42. 'Output Variables: PageIn,EventArg
  43. 'Returns: True/False
  44. 'Global Variables: L_SHUTDOWNCONFIRM_MESSAGE_TEXT,L_SHUTDOWNCONFIRM_MESSAGECONTD_TEXT
  45. '-------------------------------------------------------------------------
  46. Public Function OnServePropertyPage(ByRef PageIn,ByRef EventArg)
  47. Call SA_TraceOut("shutdown_shutdownConfirm.asp", "OnServePropertyPage")
  48. 'Serve the client side script
  49. Call ServeCommonJavaScript()
  50. %>
  51. <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 CLASS="TasksBody">
  52. <TR>
  53. <TD CLASS="TasksBody">
  54. <%=L_SHUTDOWNCONFIRM_MESSAGE_TEXT%>
  55. </TD>
  56. </TR>
  57. <TR>
  58. <TD CLASS="TasksBody">
  59. <%=L_SHUTDOWNCONFIRM_MESSAGECONTD_TEXT%>
  60. </TD>
  61. </TR>
  62. </TABLE>
  63. <%
  64. OnServePropertyPage=TRUE
  65. End Function
  66. '-------------------------------------------------------------------------
  67. 'Function: OnPostBackPage()
  68. 'Description: Called to signal that the page has been posted-back.
  69. 'Input Variables: PageIn,EventArg
  70. 'Output Variables: PageIn,EventArg
  71. 'Returns: True/False
  72. 'Global Variables: None
  73. '-------------------------------------------------------------------------
  74. Public Function OnPostBackPage(ByRef PageIn,ByRef EventArg)
  75. Call SA_TraceOut("shutdown_shutdownConfirm.asp", "OnPostBackPage")
  76. OnPostBackPage=TRUE
  77. End Function
  78. '-------------------------------------------------------------------------
  79. 'Function: OnSubmitPage()
  80. 'Description: Called when the page has been submitted for processing.
  81. ' Use this method to process the submit request.
  82. 'Input Variables: PageIn,EventArg
  83. 'Output Variables: PageIn,EventArg
  84. 'Returns: True/False
  85. 'Global Variables: None
  86. '-------------------------------------------------------------------------
  87. Public Function OnSubmitPage(ByRef PageIn,ByRef EventArg)
  88. Call SA_TraceOut("shutdown_shutdownConfirm.asp", "OnSubmitPage")
  89. 'shutdown function returns true if shutdown is successed else
  90. ' it returns false if shutdown is failed
  91. OnSubmitPage=blnShutdownAppliance()
  92. End Function
  93. '-------------------------------------------------------------------------
  94. 'Function: OnClosePage()
  95. 'Description: Called when the page is about to be closed.Use this method
  96. ' to perform clean-up processing
  97. 'Input Variables: PageIn,EventArg
  98. 'Output Variables: PageIn,EventArg
  99. 'Returns: True/False
  100. 'Global Variables: None
  101. '-------------------------------------------------------------------------
  102. Public Function OnClosePage(ByRef PageIn,ByRef EventArg)
  103. Call SA_TraceOut("shutdown_shutdownConfirm.asp", "OnClosePage")
  104. OnClosePage=TRUE
  105. End Function
  106. '---------------------------------------------------------------------
  107. ' Function name: ServeCommonJavaScript()
  108. ' Description: Common Javascript function to be included
  109. ' Input Variables: None
  110. ' Output Variables: None
  111. ' Return Values: None
  112. ' Global Variables: None
  113. '---------------------------------------------------------------------
  114. Function ServeCommonJavaScript()
  115. Call SA_TraceOut("shutdown_shutdownConfirm.asp", "ServeCommonJavaScript")
  116. %>
  117. <script language="JavaScript" src="<%=m_VirtualRoot%>inc_global.js">
  118. </script>
  119. <script language="JavaScript">
  120. function Init()
  121. {
  122. return true;
  123. }
  124. function ValidatePage()
  125. {
  126. return true;
  127. }
  128. function SetData()
  129. {
  130. return true;
  131. }
  132. </script>
  133. <%End Function%>
  134. <%
  135. '-------------------------------------------------------------------------
  136. 'Function name: blnShutdownAppliance
  137. 'Description: To Shutdown the Serverappliance
  138. 'Input Variables: None
  139. 'Output Variables: None
  140. 'Returns: None
  141. 'Global Variables: In:L_(*)-Localized Strings
  142. '-------------------------------------------------------------------------
  143. Function blnShutdownAppliance()
  144. Err.Clear
  145. On Error Resume Next
  146. Const CONST_SHUTDOWNPRIVILEGE = "SeShutdownPrivilege"
  147. Dim ErrNum ' to hold error number
  148. Call SA_TraceOut("shutdown_shutdownConfirm.asp", "blnShutdownAppliance")
  149. 'Assigning to false
  150. blnShutdownAppliance=FALSE
  151. Dim objSAHelper
  152. Dim bModifiedPrivilege
  153. bModifiedPrivilege = FALSE
  154. 'Create SAHelper object
  155. Set objSAHelper = Server.CreateObject("ServerAppliance.SAHelper")
  156. if err.number <> 0 Then
  157. SA_TraceOut "Create object failed for SAHelper object", err.description
  158. else
  159. 'enable shutdown privilege
  160. bModifiedPrivilege = objSAHelper.SAModifyUserPrivilege(CONST_SHUTDOWNPRIVILEGE, TRUE)
  161. if err.number <> 0 Then
  162. SA_TraceOut "Enable privilege failed", err.description
  163. end if
  164. end if
  165. 'shutdown requested
  166. If ( ExecuteShutdownTask("1") ) Then
  167. ErrNum = Err.Number
  168. Err.Clear
  169. Call SA_ServeRestartingPage("Shutdown", SA_DEFAULT, SA_DEFAULT, SA_DEFAULT, SA_DEFAULT, SA_DEFAULT )
  170. End If
  171. if ( bModifiedPrivilege ) then
  172. 'revert back to disabled state
  173. bModifiedPrivilege = objSAHelper.SAModifyUserPrivilege(CONST_SHUTDOWNPRIVILEGE, FALSE)
  174. if err.number <> 0 Then
  175. SA_TraceOut "Disable privilege failed", err.description
  176. end if
  177. end if
  178. set objSAHelper = Nothing
  179. If ErrNum <> 0 Then
  180. Call SA_SetErrMsg(L_ERRORINSHUTDOWN_ERRORMESSAGE)
  181. Exit Function
  182. End If
  183. blnShutdownAppliance=TRUE
  184. End Function
  185. %>