home *** CD-ROM | disk | FTP | other *** search
Wrap
<html> <!-- ' ------------------------------------------------------------------------------ ' Filename: CheckWDP.hta ' ------------------------------------------------------------------------------ ' Description: Runs if Windows Disk Protection is On to show status. ' Does not open if Getting Started is set to auto Run. ' ------------------------------------------------------------------------------ ' Version: 1.0 ' Notes: ' ------------------------------------------------------------------------------ ' Copyright (C) Microsoft Corporation 2005, All Rights Reserved ' ------------------------------------------------------------------------------ --> <script id="Common" language="VBScript" src="include/Common.vbs"></script> <script id="libHTA" language="VBScript" src="include/libHTA.vbs"></script> <script id="clsDiskProtect" language="VBScript" src="include/clsDiskProtect.vbs"></script> <script language="VBScript"> Option Explicit On Error Resume Next Const GSKEY = "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SCTRunGettingStarted" ' ~~~ GSKEY = "": Do Not Show Getting Started at Startup, "<hta path/file>": Run Getting Started at Startup Dim oDiskProtect, sAppDir, iTimer, colProcesses, oProcess, strTemp, iCount, iWDPcmdver, iErr, sAppName Dim L_appWidth_Number, L_appHeight_Number iErr = 0 iTimer = 0 sAppName = "CheckWDP.hta" ' ~~~ Set the application size and position L_appWidth_Number = 280 L_appHeight_Number = 120 Window.ResizeTo L_appWidth_Number, L_appHeight_Number If err.number <> 0 Then iErr = 1 Window.MoveTo Screen.availWidth-(L_appWidth_Number + 20), Screen.availHeight-(L_appHeight_Number+20) If err.number <> 0 Then iErr = 1 If iErr = 0 Then Setup Else Window.Close End If ' ~~~ ' ~~~ Determine if the UI should show at all... ' ~~~ Sub Setup() On Error Resume Next ' ~~~ Initialize objects InitialiseAllObjects() 'InitialiseAllObjects True If IsAppRunning Then Window.Close Exit Sub End If ' ~~~ If Getting Started is set to start automatically, close If IsNull(RegRead(GSKEY)) and IsAdministrator(True) Then ' ~~~ Set the WDP.CMD tool version number for CheckWDP.hta iWDPcmdVer = 3 Set oDiskProtect = New DiskProtect ' ~~~ If Disk Protection is not on, close If Not oDiskProtect.Enabled Then Window.Close Exit Sub End If Else Window.Close Exit Sub End If End Sub ' ~~~ ' ~~~ Display the Windows Disk Protection Restart Action ' ~~~ Sub WDPAction() On Error Resume Next Set oDiskProtect = Nothing Set oDiskProtect = New DiskProtect ' ~~~ If Disk Protection is not on, quit If NOT oDiskProtect.Enabled Then WDPQuit End If Select Case oDiskProtect.BootCommand Case "SET_LEVEL" spStatus.InnerHTML = resClear.InnerHTML Case "COMMIT" spStatus.InnerHTML = resSave.InnerHTML Case "NO_CMD" If Right(RegRead("HKLM\System\CurrentControlSet\Services\WDPOperations\parameters\Application"),7) = "restore" Then spStatus.InnerHTML = resRetain1.InnerHTML Else spStatus.InnerHTML = resRetain2.InnerHTML End If Case "DISABLE" spStatus.InnerHTML = resOff.InnerHTML Case Else WDPQuit End Select End Sub ' ~~~ ' ~~~ Start a loop to watch Windows Disk Protection status every 20 seconds ' ~~~ Sub WDPChecks() On Error Resume Next WDPAction iTimer = SetInterval("WDPAction", 10000, "VBScript") End Sub ' ~~~ ' ~~~ Open the Windows Disk Protection tool ' ~~~ Sub WDPQuit() On Error Resume Next clearInterval iTimer Window.Close TerminateHTA End Sub ' ~~~ ' ~~~ Open the Windows Disk Protection tool ' ~~~ Sub OpenWDP() On Error Resume Next sAppDir = "" sAppDir = RegRead(TOOLKITKEY & "TargetDir") oShell.Run Chr(34) & sAppDir & "DiskProtect.hta" & Chr(34), 1, True WDPAction End Sub Function IsAppRunning() IsAppRunning = False Dim iCount, colProcesses, oProcess iCount = 0 Set colProcesses = oWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name='MSHTA.EXE'") For Each oProcess in colProcesses If Left(Right(LCase(oProcess.CommandLine), len(sAppName) + 2), len(sAppName)) = LCase(sAppName) Then iCount = iCount + 1 If iCount > 1 Then IsAppRunning = True Exit Function End If End If Next End Function </Script> <head> <META http-equiv="Content-Type" content="text/html; charset=utf-8" > <title id=Title>Disk Protection Is On</title> <style type="text/css"> body { margin: 0px; padding: 4px; overflow: hidden; font-family: arial; font-size: 12px; } p { margin: 0px; padding: 0px; } br { margin: 0px; padding: 0px; } button { font-size: 12px; } </style> <hta:application ID="oImagine" APPLICATIONNAME="CheckWDP" BORDER="Normal" CAPTION="Yes" ICON="graphics/DiskProtect.ico" INNERBORDER="Yes" MAXIMIZEBUTTON="no" MINIMIZEBUTTON="Yes" SCROLL="no" SELECTION="no" SHOWINTASKBAR="Yes" SINGLEINSTANCE="Yes" SYSMENU="Yes" VERSION="1.0" WINDOWSTATE="normal"/> <!-- settings and resources --> <div id="settings" style="display:none"> <p id=resClear><b>Clear Changes with each restart</b>.</p> <p id=resSave><b>Save Changes with the next restart</b>.</p> <p id=resRetain1><b>Retain Changes for one restart</b>.</p> <p id=resRetain2><b>Retain Changes</b> indefinitely.</p> <p id=resOff><b>Turn Off</b> with the next restart.</p> </div> </head> <body ID=oBody onload="WDPChecks()" onstop="WDPQuit()"> <p id=pOn>Windows Disk Protection is <b>On</b> and configured to <span id=spStatus></span></p> <BR> <CENTER><BUTTON ID=btnWDP style="width:80%;" TITLE="Starts the Windows Disk Protection tool" onclick="OpenWDP()">Open Windows Disk Protection</BUTTON></CENTER> </body> </html>