home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2006 May / PCpro_2006_05.ISO / files / free_security / msshared / Shared_Computer_Toolkit_ENU.msi / FileInclude011 < prev    next >
Encoding:
Text (UTF-16)  |  2005-09-02  |  76.9 KB  |  1,061 lines

  1. ' ***
  2. ' *** --------------------------------------------------------------------------
  3. ' *** Filename:        DiskProtect.vbs
  4. ' *** --------------------------------------------------------------------------
  5. ' *** Description:    Code for the Windows Disk Protection HTA
  6. ' *** --------------------------------------------------------------------------
  7. ' *** Version:        1.0
  8. ' *** Notes:        Used by DiskProtect.hta
  9. ' *** --------------------------------------------------------------------------
  10. ' *** Copyright (C) Microsoft Corporation 2005, All Rights Reserved
  11. ' *** --------------------------------------------------------------------------
  12. ' ***
  13.  
  14. ' ~~~ 
  15. ' ~~~ Force variables to be declared and turn off script error messages unless in DEBUG mode
  16. ' ~~~ 
  17. Option Explicit
  18. If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  19.  
  20. ' ~~~
  21. ' ~~~ Declare variables
  22. ' ~~~
  23. Dim oDiskProtect, iWDPcmdVer
  24. Dim AVscriptPath,OtherscriptPath
  25. Dim strActionMessage, sRootFolder
  26. Dim oOS, colOperatingSystems, iInstallTime, iLastBootUpTime
  27. Dim sUpperFilter, iLocalDateTime, oLog, bBlackList, bWhiteList
  28. Dim arrTempArray, i, arrUpperFilters()
  29.  
  30. ' ***
  31. ' *** ---------------------------------------------------------------------------
  32. ' *** Name:            Init()
  33. ' *** ---------------------------------------------------------------------------
  34. ' *** Purpose:        This function is executed before Load.
  35. ' *** ---------------------------------------------------------------------------
  36. ' ***
  37. Sub Init()
  38.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  39.     Dim iOverlayTime
  40.  
  41.     iWDPcmdVer = 1
  42.  
  43.     ' ~~~ Create objects
  44.     Set oDiskProtect = New DiskProtect
  45.     Set oLog         = New Logging
  46.     sRootFolder       = GetRootFolder
  47.  
  48.     ' ~~~ Initiate logging & bind the logging object to the restrictions object
  49.     Call oLog.Open(sRootFolder & "\log\DiskProtect.hta.log")
  50.     Call oLog.Write("DiskProtect.hta : Started")
  51.     oDiskProtect.Logging = oLog
  52.  
  53.     ' ~~~ Check reboot key before trying to run tool
  54.  
  55.     Set colOperatingSystems = oWMIService.ExecQuery _
  56.         ("Select * from Win32_OperatingSystem")
  57.     For Each oOS in colOperatingSystems
  58.         iLastBootUpTime = oOS.LastBootUpTime
  59.         iLocalDateTime = oOS.LocalDateTime
  60.     Next
  61.  
  62.     iInstallTime = RegRead(TOOLKITKEY & "SCTInstallTime")
  63.     iOverlayTime = RegRead(TOOLKITKEY & "SCTOverlayTime")
  64.  
  65.     ' ~~~ Check UpperFilter registry key to ensure no other Disk Protection Software is installed
  66.     ' ~~~ Read and record UpperFilters key in SCT registry
  67.     oDiskProtect.GetStashUpperFilterKey()
  68.  
  69.     On Error Resume Next
  70.  
  71.     ' ~~~ Check only if Ewf not in UpperFilter
  72.     If (InStr(UCase(sUpperFilter),","&"EWF"&",") < 1) or IsNull(sUpperFilter) Then
  73.  
  74.         ' ~~~ Set to Ewf if NUll
  75.         If IsNull(sUpperFilter) Then
  76.             ReDim Preserve arrUpperFilters(0)
  77.             arrUpperFilters(0) = "Ewf"
  78.  
  79.             ' ~~~ Writes to UpperFilters key
  80.             oDiskProtect.WriteUpperFilterKey()
  81.  
  82.             ' ~~~ Read and record UpperFilters key in SCT registry
  83.             oDiskProtect.GetStashUpperFilterKey()
  84.  
  85.             ' ~~~ Registry modified... prompt for Restart
  86.             If MsgBox(document.all("resRebootMessage").innerHTML, vbYesNo + vbCritical, sTitle) = vbYes Then
  87.                 bProcessing = False
  88.                 call Self.Close
  89.                 oDiskProtect.Reboot
  90.                 TerminateHTA()
  91.                 Exit Sub
  92.             Else
  93.                 bProcessing = False
  94.                 call Self.Close
  95.                 TerminateHTA()
  96.                 Exit Sub    
  97.             End If
  98.         Else
  99.             ' ~~~ Black List Check
  100.             Call oDiskProtect.UpperFilterCheck("BlackList")
  101.  
  102.             If bBlackList Then
  103.                 ' ~~~ Warn of Blacklist hit... Exit!
  104.                 msgbox vbCrlf & document.all("resDiskProtectionSoftware1").innerHTML & vbCrlf & document.all("resDiskProtectionSoftware2").innerHTML,vbOKOnly + vbInformation, sTitle
  105.                 bProcessing = False
  106.                 call Self.Close
  107.                 TerminateHTA()
  108.                 Exit Sub
  109.             Else
  110.                 ' ~~~ White List Check
  111.                 Call oDiskProtect.UpperFilterCheck("WhiteList")
  112.  
  113.                 If bWhiteList Then
  114.                     ' ~~~ Proceed with setting UpperFilters
  115.                     arrTempArray = Split(sUpperFilter, ",")
  116.                     For i = LBound(arrTempArray) to UBound(arrTempArray)
  117.                         ReDim Preserve arrUpperFilters(i)  
  118.                         arrUpperFilters(i) = arrTempArray(i+1)
  119.                     Next
  120.  
  121.                     ReDim Preserve arrUpperFilters(i-2)
  122.                     arrUpperFilters(i-2) = "Ewf"
  123.  
  124.                     ' ~~~ Writes to UpperFilters key
  125.                     oDiskProtect.WriteUpperFilterKey()
  126.  
  127.                     ' ~~~ Read and record UpperFilters key in SCT registry
  128.                     oDiskProtect.GetStashUpperFilterKey()
  129.  
  130.                     ' ~~~ Registry modified... prompt for Restart
  131.                     If MsgBox(document.all("resRebootMessage").innerHTML, vbYesNo + vbCritical, sTitle) = vbYes Then
  132.                         bProcessing = False
  133.                         call Self.Close
  134.                         oDiskProtect.Reboot
  135.                         TerminateHTA()
  136.                         Exit Sub
  137.                     Else
  138.                         bProcessing = False
  139.                         call Self.Close
  140.                         TerminateHTA()
  141.                         Exit Sub    
  142.                     End If
  143.                 Else
  144.                     Dim bPrompt
  145.                     bPrompt = False
  146.                     
  147.                     ' ~~~ Only warns of Gray UpperFilters if DEBUG                    
  148.                     If DEBUG then
  149.                         If MsgBox(vbCrlf & document.all("resUpperFilterGray1").innerHTML & vbCrlf & document.all("resUpperFilterGray2").innerHTML & vbCrlf & vbCrlf & document.all("resUpperFilterGray3").innerHTML, vbYesNo + vbInformation, sTitle) = vbYes Then
  150.                             bPrompt = True
  151.                         End If
  152.                     End If
  153.  
  154.                     If Not(DEBUG) or bPrompt Then   
  155.                         ' ~~~ Proceed with setting Gray UpperFilters
  156.                         arrTempArray = Split(sUpperFilter, ",")
  157.                         For i = LBound(arrTempArray) to UBound(arrTempArray)
  158.                              ReDim Preserve arrUpperFilters(i)  
  159.                             arrUpperFilters(i) = arrTempArray(i+1)
  160.                         Next
  161.  
  162.                         ReDim Preserve arrUpperFilters(i-2)
  163.                         arrUpperFilters(i-2) = "Ewf"
  164.     
  165.                         ' ~~~ Writes to UpperFilters key
  166.                         oDiskProtect.WriteUpperFilterKey()
  167.  
  168.                         ' ~~~ Read and record UpperFilters key in SCT registry
  169.                         oDiskProtect.GetStashUpperFilterKey()
  170.  
  171.                         ' ~~~ Registry modified... prompt for Restart
  172.                         If MsgBox(document.all("resRebootMessage").innerHTML, vbYesNo + vbCritical, sTitle) = vbYes Then
  173.                             bProcessing = False
  174.                             call Self.Close
  175.                             oDiskProtect.Reboot
  176.                             TerminateHTA()
  177.                             Exit Sub
  178.                         Else
  179.                             bProcessing = False
  180.                             call Self.Close
  181.                             TerminateHTA()
  182.                             Exit Sub    
  183.                         End If
  184.                     Else
  185.                         bProcessing = False
  186.                         call Self.Close
  187.                         TerminateHTA()
  188.                         Exit Sub        
  189.                     End If    
  190.                 End If
  191.             End If
  192.         
  193.         End If
  194.     On Error Goto 0
  195.     End If    
  196.  
  197.     If iInstallTime > iLastBootUpTime Then
  198.         If MsgBox(document.all("resRebootMessage").innerHTML, vbYesNo + vbCritical, sTitle) = vbYes Then
  199.             bProcessing = False
  200.             call Self.Close
  201.             oDiskProtect.Reboot
  202.             TerminateHTA()
  203.             Exit Sub
  204.         Else
  205.             bProcessing = False
  206.             call Self.Close
  207.             TerminateHTA()
  208.             Exit Sub
  209.         End If
  210.     End If
  211.  
  212.     If iOverlayTime > iLastBootUpTime Then
  213.         If MsgBox(document.all("resRebootMessageOV").innerHTML, vbYesNo + vbCritical, sTitle) = vbYes Then
  214.             bProcessing = False
  215.             call Self.Close
  216.             oDiskProtect.Reboot
  217.             TerminateHTA()
  218.             Exit Sub
  219.         Else
  220.             bProcessing = False
  221.             call Self.Close
  222.             TerminateHTA()
  223.             Exit Sub
  224.         End If
  225.     End If
  226.  
  227.     If Not(oDiskProtect.OverlayCreated) and oDiskProtect.CalcOVSize = 0 and oDiskProtect.ForceOverlaySize = 0 Then
  228.         If MsgBox (document.all("resNoOverlaySupport").innerHTML, vbYesNo + vbCritical, sTitle) = vbYes Then
  229.             Call oShell.Run("diskmgmt.msc",0,False)            
  230.         End If
  231.         bProcessing = False
  232.         call Self.Close
  233.         TerminateHTA()
  234.         Exit Sub
  235.     End If
  236.     
  237.     ' ~~~ If AU is enabled enable our WU
  238.  
  239.     Select Case RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\AUOptions")
  240.         Case "4"
  241.             oDiskProtect.WindowsUpdateScript = True
  242.         Case "3"
  243.             oDiskProtect.WindowsUpdateScript = True
  244.         Case "2"
  245.             oDiskProtect.WindowsUpdateScript = True
  246.         Case "1"
  247.             oDiskProtect.WindowsUpdateScript = False
  248.     End Select
  249.  
  250. End Sub
  251.  
  252. ' *** 
  253. ' *** ------------------------------------------------------------------------------
  254. ' *** Name:            Load()
  255. ' *** ------------------------------------------------------------------------------
  256. ' *** Purpose:        This subroutine is executed before a wizard page is displayed
  257. ' *** ------------------------------------------------------------------------------
  258. ' *** 
  259. Sub Load()
  260.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  261.  
  262.     ' ~~~ Unhide the two drop downs
  263.     document.all("ddSchedule1").style.visibility = "visible"
  264.     document.all("ddSchedule2").style.visibility = "visible"
  265.  
  266.     ' ~~~ Call the sub to enable body 
  267.     Call BodyDisable(False) 
  268.     
  269.     ' ~~~ Call the sub to format the time
  270.     Call FormatScheduleTime()
  271.     
  272.     document.all("rActCommit").title = document.all("lblPendingAction2").innerHTML
  273.  
  274.     ' ~~~ Default pending changes action is undo
  275.     document.all("rActUndo").checked = True
  276.  
  277.     ' ~~~ Make radios reflect real status
  278.     If oDiskProtect.Enabled Then
  279.         document.all("radEnable").checked   = True
  280.         document.all("spStatus").innerHTML  = document.all("lblStatusEnabled").innerHTML
  281.         document.all("spEnable").innerHTML  = document.all("resRebootAction3").innerHTML
  282.         document.all("spDisable").innerHTML = document.all("resRebootAction4").innerHTML
  283.         Call DisableSection2(False)
  284.         Call DisableSection3(True)
  285.     Else
  286.         document.all("radDisable").checked   = True
  287.         document.all("spStatus").innerHTML  = document.all("lblStatusDisabled").innerHTML
  288.         document.all("spEnable").innerHTML  = document.all("resRebootAction1").innerHTML
  289.         document.all("spDisable").innerHTML = document.all("resRebootAction2").innerHTML
  290.         Call DisableSection2(True)
  291.         Call DisableSection3(True)
  292.     End If
  293.     
  294.     ' ~~~ Make radios reflect real pending changes state
  295.     Select Case oDiskProtect.BootCommand
  296.         Case "SET_LEVEL"
  297.             document.all("rActUndo").checked = True
  298.         Case "COMMIT"
  299.             document.all("rActCommit").checked = True
  300.         Case "NO_CMD"
  301.             document.all("rActRetain2").checked = True
  302.         Case "ENABLE"
  303.             document.all("radEnable").checked   = True
  304.             document.all("radDisable").checked   = False
  305.             document.all("rActUndo").checked = True
  306.         Case "DISABLE"
  307.             document.all("radEnable").checked   = False    
  308.             document.all("radDisable").checked   = True
  309.             document.all("rActUndo").checked = True
  310.     End Select
  311.  
  312.     If oDiskProtect.BootCommand = "NO_CMD" and Right(RegRead("HKLM\System\CurrentControlSet\Services\WDPOperations\parameters\Application"),7) = "restore" Then
  313.     document.all("rActRetain1").checked = True
  314.     End If
  315.  
  316.     ' ~~~ Default settings for windows update
  317.  
  318.     If oDiskProtect.WindowsUpdateScript Then
  319.         document.all("rDPWinUpEnabled").checked = True
  320.     Else
  321.         document.all("rDPWinUpDisabled").checked = True
  322.     End If
  323.  
  324.     If RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\AUOptions") = "" Then
  325.         document.all("rDPWinUpEnabled").checked = False
  326.         document.all("rDPWinUpDisabled").checked = False
  327.     End If
  328.  
  329.     document.all("ddSchedule1").value            = oDiskProtect.CriticalUpdateDay
  330.     document.all("ddSchedule2").value            = oDiskProtect.CriticalUpdateTime            
  331.     document.all("txtAntiVirusScript").value    = GetFileName(oDiskProtect.AVUpdateScript)
  332.     document.all("txtOtherScript").value        = GetFileName(oDiskProtect.OtherUpdateScript)
  333.     
  334.     If document.all("radEnable").checked Then 
  335.         document.all("radEnable").focus()
  336.     Else
  337.         document.all("radDisable").focus()
  338.     End If
  339. End Sub
  340.  
  341. ' *** 
  342. ' *** ------------------------------------------------------------------------------
  343. ' *** Name:            Validate()
  344. ' *** ------------------------------------------------------------------------------
  345. ' *** Purpose:        This function is executed before a wizard page is exited
  346. ' ***                 If this function returns false. The page does not exit.
  347. ' *** ------------------------------------------------------------------------------
  348. ' *** 
  349. Function Validate()
  350.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  351.     Validate = validateUpdates()
  352.     If Validate = True Then
  353.         Validate = IsHibernationenabled()
  354.     End If
  355.     If Validate = True Then
  356.         Validate = IsSystemBootSame()
  357.     End If
  358. End Function
  359.  
  360. ' *** 
  361. ' *** ------------------------------------------------------------------------------
  362. ' *** Name:            Action()
  363. ' *** ------------------------------------------------------------------------------
  364. ' *** Purpose:        This subroutine performs the actual functionality of the tool
  365. ' *** ------------------------------------------------------------------------------
  366. ' *** 
  367. Sub Action()
  368.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  369.     ToggleClose(True)
  370.     Dim bReboot, bWDPReBoot
  371.  
  372.     bProcessing = True
  373.  
  374.     ' ~~~ To change the cursor to wait icon
  375.     Call BodyDisable(True)
  376.     
  377.     ' ~~~ Set the default message
  378.     strActionMessage =  document.all("resActionNone").innerHTML
  379.     bReboot = False
  380.     bWDPReBoot = False
  381.  
  382.     ' ~~~ -------------------------
  383.     ' ~~~ If we are going to enable
  384.     ' ~~~ -------------------------
  385.     If Not(oDiskProtect.Enabled) and GetRadio("dpReboot")="Enable" Then
  386.         
  387.         strActionMessage = document.all("resBlank").innerHTML
  388.         oDiskProtect.Enable                
  389.  
  390.         ' ~~~ Check for Overlay
  391.         If oDiskProtect.OverlaySize() = 0 then
  392.             bReboot = False
  393.  
  394.             ' ~~~ Set message
  395.             strActionMessage =  document.all("resNoOverlay").innerHTML
  396.         Else
  397.             ' ~~~ Set message
  398.             strActionMessage = document.all("resActionEnable").innerHTML
  399.  
  400.             ' ~~~ Turn on critical updates
  401.             If document.all("rDPWinUpEnabled").checked = True Then
  402.                 oDiskProtect.WindowsUpdateScript = True
  403.             Else
  404.                 oDiskProtect.WindowsUpdateScript = False
  405.             End If
  406.             oDiskProtect.AVUpdateScript      = AVscriptPath & document.all("txtAntiVirusScript").value
  407.             oDiskProtect.OtherUpdateScript   = OtherscriptPath & document.all("txtOtherScript").value
  408.             oDiskProtect.CriticalUpdateDay   = document.all("ddSchedule1").value
  409.             oDiskProtect.CriticalUpdateTime  = document.all("ddSchedule2").value
  410.             Call oDiskProtect.EnableCriticalUpdates()
  411.             bWDPReBoot = Showmodaldialog("WDPOn.hta","","dialogWidth:30;dialogHeight:18;Center:Yes;help:No;Resizable:No;")
  412.             bProcessing = False
  413.             call Self.Close()
  414.             If bWDPReBoot Then
  415.                 oDiskProtect.Reboot
  416.                 TerminateHTA()
  417.             End If
  418.             Exit Sub
  419.         End IF
  420.     End If
  421.  
  422.     ' ~~~ --------------------------
  423.     ' ~~~ If we are going to disable
  424.     ' ~~~ --------------------------
  425.     If oDiskProtect.Enabled and GetRadio("dpReboot")="Disable" Then
  426.         strActionMessage = document.all("resActionDisable").innerHTML
  427.         bReboot = True
  428.         oDiskProtect.Disable        
  429.  
  430.         ' ~~~ Turn off critical updates
  431.         Call oDiskProtect.DisableCriticalUpdates()
  432.     End If
  433.  
  434.     If oDiskProtect.BootCommand = "ENABLE" and GetRadio("dpReboot")="Disable" Then
  435.         strActionMessage = document.all("resActionAlreadyOff").innerHTML
  436.         bReboot = False
  437.         oDiskProtect.Disable        
  438.  
  439.         ' ~~~ Turn off critical updates
  440.         Call oDiskProtect.DisableCriticalUpdates()
  441.     End If
  442.  
  443.     ' ~~~ -----------------------------------------
  444.     ' ~~~ If enabled and leaving on, process action
  445.     ' ~~~ -----------------------------------------
  446.     If oDiskProtect.Enabled and GetRadio("dpReboot")="Enable" Then
  447.         Select Case GetRadio("dpAction")
  448.             Case "Undo"
  449.                 If oDiskProtect.BootCommand <> "SET_LEVEL" Then
  450.                     strActionMessage = document.all("resPendingAction1").innerHTML
  451.                     bReboot = False
  452.                     oDiskProtect.UndoChanges
  453.                 End If
  454.             Case "Commit"
  455.                 If oDiskProtect.BootCommand <> "COMMIT" Then
  456.                     strActionMessage = document.all("resPendingAction2").innerHTML
  457.                     bReboot = False
  458.                     oDiskProtect.Commit
  459.                     If document.all("rDPWinUpEnabled").checked = True Then
  460.                         oDiskProtect.WindowsUpdateScript = True
  461.                     Else
  462.                         oDiskProtect.WindowsUpdateScript = False
  463.                     End If
  464.                     oDiskProtect.AVUpdateScript      = AVscriptPath & document.all("txtAntiVirusScript").value
  465.                     oDiskProtect.OtherUpdateScript   = OtherscriptPath & document.all("txtOtherScript").value
  466.                     oDiskProtect.CriticalUpdateDay   = document.all("ddSchedule1").value
  467.                     oDiskProtect.CriticalUpdateTime  = document.all("ddSchedule2").value
  468.                     Call oDiskProtect.EnableCriticalUpdates()
  469.                 End If
  470.             Case "Retain1"
  471.                 strActionMessage = document.all("resPendingAction3").innerHTML
  472.                 bReboot = False
  473.                 oDiskProtect.RetainChanges(True)    
  474.             Case "Retain2"
  475.                 strActionMessage = document.all("resPendingAction4").innerHTML
  476.                 bReboot = False
  477.                 oDiskProtect.RetainChanges(False)
  478.         End Select            
  479.     End If            
  480.  
  481.     ' ~~~ To change the cursor to wait icon
  482.     Call BodyDisable(False)
  483.  
  484.     ' ~~~ --------------------------------------
  485.     ' ~~~ Display restart message if appropriate
  486.     ' ~~~ --------------------------------------
  487.     If bReboot Then
  488.         If MsgBox(strActionMessage & document.all("resRebootMessage2").innerHTML, vbYesNo + vbInformation, sTitle) = vbYes Then
  489.             bProcessing = False
  490.             call Self.Close
  491.             oDiskProtect.Reboot
  492.             Exit Sub
  493.         End If
  494.     Else 
  495.         MsgBox strActionMessage,vbOKOnly+vbInformation,sTitle
  496.     End If
  497.  
  498.     bProcessing = False
  499. End Sub
  500.  
  501. ' *** 
  502. ' *** ------------------------------------------------------------------------------
  503. ' *** Name:            DisableSection2(bDisabled)
  504. ' *** ------------------------------------------------------------------------------
  505. ' *** Purpose:        Enables or disables sections of the screen
  506. ' *** ------------------------------------------------------------------------------
  507. ' *** 
  508. Sub DisableSection2(bDisabled)
  509.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  510.     document.all("rActUndo").Disabled         = bDisabled
  511.     document.all("rActCommit").Disabled       = bDisabled
  512.     document.all("rActRetain1").Disabled      = bDisabled
  513.     document.all("rActRetain2").Disabled      = bDisabled
  514.  
  515.     ' ~~~ Change the class
  516.     If bDisabled Then
  517.         document.all("tdPendingChange").className = "groupentrydisabled"
  518.     Else
  519.         document.all("tdPendingChange").className = "groupentry"
  520.     End If
  521. End Sub
  522.  
  523. ' *** 
  524. ' *** ------------------------------------------------------------------------------
  525. ' *** Name:            DisableSection3(bDisabled)
  526. ' *** ------------------------------------------------------------------------------
  527. ' *** Purpose:        Enables or disables sections of the screen
  528. ' *** ------------------------------------------------------------------------------
  529. ' *** 
  530. Sub DisableSection3(bDisabled)
  531.     ddSchedule1.Disabled        = bDisabled
  532.     ddSchedule2.Disabled        = bDisabled
  533.     rDPWinUpEnabled.Disabled    = bDisabled
  534.     rDPWinUpDisabled.Disabled    = bDisabled
  535.     txtAntiVirusScript.Disabled    = bDisabled
  536.     btnAntiVirusScript.Disabled    = bDisabled
  537.     txtOtherScript.Disabled        = bDisabled
  538.     btnOtherScript.Disabled        = bDisabled
  539.  
  540.     ' ~~~ Change the class
  541.     If bDisabled Then
  542.         SetGreyHoverMessage()
  543.     End If
  544. End Sub
  545.  
  546. ' *** 
  547. ' *** ------------------------------------------------------------------------------
  548. ' *** Name:            EnableDisableClick()
  549. ' *** ------------------------------------------------------------------------------
  550. ' *** Purpose:        Called when the disk protection status radio button is clicked
  551. ' *** ------------------------------------------------------------------------------
  552. ' *** 
  553. Sub EnableDisableClick()
  554.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  555.     If document.all("spStatus").innerHTML = document.all("lblStatusEnabled").innerHTML Then
  556.         If GetRadio("dpReboot")="Disable" Then
  557.             document.all("rActUndo").checked = True
  558.             Call DisableSection2(True)
  559.             Call DisableSection3(True)
  560.         Else
  561.             Call DisableSection2(False)
  562.             If GetRadio("dpAction")="Commit" Then
  563.                 Call DisableSection3(False)
  564.             Else
  565.                 Call DisableSection3(True)
  566.             End If
  567.         End If
  568.     Else
  569.         If GetRadio("dpReboot")="Enable" Then
  570.             Call DisableSection3(False)
  571.             Call CheckVirusSoftware
  572.         Else
  573.             Call DisableSection3(True)
  574.         End If            
  575.     End If
  576. End Sub
  577.  
  578. ' *** 
  579. ' *** ------------------------------------------------------------------------------
  580. ' *** Name:            BrowseForFileAV(txtControl)
  581. ' *** ------------------------------------------------------------------------------
  582. ' *** Purpose:        Called when the Browse for Anti virus is clicked
  583. ' *** ------------------------------------------------------------------------------
  584. ' *** 
  585. Sub BrowseForFileAV(txtControl)
  586.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  587.     Dim oDialog
  588.     Dim intResult
  589.     ' ~~~ Create common dialog object and set options
  590.     Set oDialog = CreateObject("UserAccounts.CommonDialog")
  591.     oDialog.Filter = "Script Files (*.vbs; *.js; *.wsf)|*.vbs;*.js;*.wsf|Batch Files (*.cmd; *.bat)|*.cmd;*.bat|All Files (*.*)|*.*"
  592.     oDialog.FilterIndex = 1
  593.     oDialog.InitialDir  = ".\scripts\update"
  594.  
  595.     ' ~~~ Show dialog
  596.     intResult = oDialog.ShowOpen
  597.     if intResult <> 0 Then
  598.         AVscriptPath = GetFilePath(oDialog.FileName)
  599.         ' ~~~ Populate text field
  600.         document.all(txtControl).value = GetFileName(oDialog.FileName)
  601.     End If
  602. End Sub
  603.  
  604. ' *** 
  605. ' *** ------------------------------------------------------------------------------
  606. ' *** Name:            BrowseForFileOther(txtControl)
  607. ' *** ------------------------------------------------------------------------------
  608. ' *** Purpose:        Called when the Browse for Other updates is clicked
  609. ' *** ------------------------------------------------------------------------------
  610. ' *** 
  611. Sub BrowseForFileOther(txtControl)
  612.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  613.     Dim oDialog
  614.     Dim intResult
  615.     ' ~~~ Create common dialog object and set options
  616.     Set oDialog            = CreateObject("UserAccounts.CommonDialog")
  617.     oDialog.Filter        = "Script Files (*.vbs; *.js; *.wsf)|*.vbs;*.js;*.wsf|Batch Files (*.cmd; *.bat)|*.cmd;*.bat|All Files (*.*)|*.*"
  618.     oDialog.FilterIndex = 1
  619.     oDialog.InitialDir  = ".\scripts\update"
  620.  
  621.     ' ~~~ Show dialog
  622.     intResult = oDialog.ShowOpen
  623.     if intResult <> 0 Then
  624.         OtherscriptPath = GetFilePath(oDialog.FileName)
  625.         ' ~~~ Populate text field
  626.         document.all(txtControl).value = GetFileName(oDialog.FileName)
  627.     End If
  628. End Sub
  629.  
  630. ' *** 
  631. ' *** ------------------------------------------------------------------------------
  632. ' *** Name:            GetFileName(file)
  633. ' *** ------------------------------------------------------------------------------
  634. ' *** Purpose:        Returns the file name from the full filename with path
  635. ' *** ------------------------------------------------------------------------------
  636. ' *** 
  637. private Function GetFileName(file)
  638.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  639.     Dim arrFile
  640.     Dim iupper
  641.     if file <> "" Then
  642.         arrFile = Split(file , "\") 
  643.         iupper = UBound(arrFile) 
  644.         GetFileName = arrFile(iupper)
  645.     End If
  646. End Function
  647.  
  648. ' *** 
  649. ' *** ------------------------------------------------------------------------------
  650. ' *** Name:            GetFilePath(file)
  651. ' *** ------------------------------------------------------------------------------
  652. ' *** Purpose:        Returns the filepath from the full filename with path
  653. ' *** ------------------------------------------------------------------------------
  654. ' *** 
  655.  
  656. private Function GetFilePath(file)
  657.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  658.     Dim arrFile
  659.     Dim FileName
  660.     Dim path,iupper,total,length
  661.  
  662.     if file <> "" Then
  663.         arrFile = Split(file , "\") 
  664.         iupper = UBound(arrFile) 
  665.         FileName = arrFile(iupper)
  666.         total = len(file)
  667.         length = len(Filename)
  668.         GetFilePath = left(file,total-length)
  669.     End If
  670. End Function
  671.  
  672. ' *** 
  673. ' *** ------------------------------------------------------------------------------
  674. ' *** Name:            CheckVirusSoftware
  675. ' *** ------------------------------------------------------------------------------
  676. ' *** Purpose:        validates the update scripts
  677. ' *** ------------------------------------------------------------------------------
  678. ' *** 
  679. private Function CheckVirusSoftware
  680.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  681.  
  682.     Dim sVersion, sRegpath, sScriptname, sRegVersion, sProductName, bAVInstalled
  683.     
  684.     Dim oXml, avXml, oProduct, oProdChildNode 
  685.     
  686.     bAVInstalled = False
  687.         
  688.     If document.all("txtAntiVirusScript").value = "" then
  689.     
  690.     ' ~~~ Checks for different software can be done in many ways... currently done by looking for service
  691.     ' ~~~ Might modify after other versions are investigated.
  692.     
  693.         AVscriptPath = GetRootFolder & "\scripts\update\"
  694.  
  695.         avXml = GetRootFolder & "\xml\AntiVirusUpdates.xml"
  696.         
  697.         Set oXml = CreateObject("MSXML2.DomDocument")
  698.         
  699.         Call oXml.Load(avXml)
  700.         
  701.         If oXml.parseError.errorCode = 0 Then
  702.             ' ~~~ Loop through each of the AV products 
  703.             For Each oProduct in oXml.getElementsByTagName("Product")
  704.                 ' ~~~ Get the values of each product
  705.                 For Each oProdChildNode in oProduct.ChildNodes
  706.                     Select Case oProdChildNode.NodeName 
  707.                         Case "Name"
  708.                             sProductName = oProdChildNode.Text
  709.                         Case "Version"
  710.                             sVersion = oProdChildNode.Text
  711.                         Case "RegKey"
  712.                             sRegpath = oProdChildNode.Text
  713.                         Case "UpdateScriptname"
  714.                             sScriptName = oProdChildNode.Text
  715.                     End Select
  716.                 Next
  717.                 
  718.                 ' ~~~ Get the AV version from registry
  719.                 sRegVersion = Left(RegRead(sRegpath),4)
  720.                 
  721.                 ' ~~~ If the registry exists for the product then proceed
  722.                 If sRegVersion <> "" Then
  723.                     ' ~~~ Compare the versions in registry and XML file  
  724.                     If Instr(sRegVersion, sVersion) = 1 Then
  725.                         If Msgbox(sProductName & " " & resAVSoftwareDetected.innerHTML & vbCrlf & resSpecifyAVScript.innerHTML,vbYesNo + vbCritical, sTitle) = vbYes Then
  726.                             document.all("txtAntiVirusScript").value = GetFileName(AVscriptPath & "\" & sScriptName)
  727.                         End If
  728.                     End If
  729.                     bAVInstalled = True
  730.                 End If
  731.             Next
  732.         End If
  733.  
  734.         If bAVInstalled = False then
  735.             AVscriptPath = ""
  736.             Msgbox document.all("resNoAVSoftwareDetected").innerHTML & vbCrlf & document.all("resNoAVSoftwareAction").innerHTML, vbOkOnly + vbCritical, sTitle
  737.         End If
  738.     End If
  739. End Function
  740.  
  741. ' *** 
  742. ' *** ------------------------------------------------------------------------------
  743. ' *** Name:            validateUpdates()
  744. ' *** ------------------------------------------------------------------------------
  745. ' *** Purpose:        validates the update scripts
  746. ' *** ------------------------------------------------------------------------------
  747. ' *** 
  748. private Function validateUpdates()
  749.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  750.     
  751.     validateUpdates = true
  752.     If document.all("txtAntiVirusScript").value = "" Then
  753.         AVscriptPath = ""
  754.     Else
  755.         If RegRead(TOOLKITKEY & "AVUpdateScript") <> "" and AVscriptPath = "" then AVscriptPath = GetFilePath(RegRead(TOOLKITKEY & "AVUpdateScript"))
  756.         If (oFso.FileExists(AVscriptPath & document.all("txtAntiVirusScript").value) <> true) Then
  757.             If (oFso.FileExists(document.all("txtAntiVirusScript").value) <> true) Then
  758.                 validateUpdates = false
  759.                 MsgBox document.all("resValidAntivirusScript").innerHTML,16, sTitle
  760.                 document.all("txtAntiVirusScript").value = ""
  761.                 Exit Function
  762.             Else 
  763.                 validateUpdates = true
  764.                 AVscriptPath = ""
  765.             End If
  766.         End If
  767.     End If 
  768.     If document.all("txtOtherScript").value = "" Then
  769.         OtherscriptPath = ""
  770.         Exit Function
  771.     Else 
  772.         If RegRead(TOOLKITKEY & "OtherUpdateScript") <> "" and OtherscriptPath = "" then OtherscriptPath = GetFilePath(RegRead(TOOLKITKEY & "OtherUpdateScript"))
  773.         If (oFso.FileExists(OtherscriptPath & document.all("txtOtherScript").value) <> true) Then
  774.             If (oFso.FileExists(document.all("txtOtherScript").value) <> true) Then
  775.                 validateUpdates = false
  776.                 MsgBox document.all("resValidOtherScript").innerHTML,16, sTitle
  777.                 document.all("txtOtherScript").value = ""
  778.                 Exit Function
  779.             Else
  780.                 validateUpdates = true
  781.                 OtherscriptPath = ""
  782.             End If
  783.         End If
  784.     End If 
  785. End Function
  786.  
  787. ' *** 
  788. ' *** ------------------------------------------------------------------------------
  789. ' *** Name:            TextClick(sId)
  790. ' *** ------------------------------------------------------------------------------
  791. ' *** Purpose:        Enables or Disables the Corresponding option next to the 
  792. ' ***                text that is being clicked
  793. ' *** ------------------------------------------------------------------------------
  794. ' *** 
  795. Sub TextClick(sId)
  796.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  797.     Select Case sId
  798.         Case "spEnable"
  799.             document.all("radEnable").checked = True
  800.             EnableDisableClick()
  801.         Case "spDisable"
  802.             document.all("radDisable").checked = True
  803.             EnableDisableClick()
  804.         Case "spActUndo"
  805.             If document.all("tdPendingChange").classname = "groupentry" Then
  806.                 document.all("rActUndo").checked = True
  807.                 EnableDisableClick()
  808.             End If
  809.         Case "spActCommit"
  810.             If document.all("tdPendingChange").classname = "groupentry" Then
  811.                 document.all("rActCommit").checked = True
  812.                 EnableDisableClick()
  813.             End If
  814.         Case "spActRetain1"
  815.             If document.all("tdPendingChange").classname = "groupentry" Then
  816.                 document.all("rActRetain1").checked = True
  817.                 EnableDisableClick()
  818.             End If
  819.         Case "spActRetain2"
  820.             If document.all("tdPendingChange").classname = "groupentry" Then
  821.                 document.all("rActRetain2").checked = True
  822.                 EnableDisableClick()
  823.             End If
  824.         Case "spWinUPEnabled"
  825.             If Not document.all("rDPWinUpEnabled").disabled Then
  826.                 document.all("rDPWinUpEnabled").checked = True
  827.             End If
  828.         Case "spWinUPDisabled"
  829.             If Not document.all("rDPWinUpDisabled").disabled Then
  830.                 document.all("rDPWinUpDisabled").checked = True
  831.             End If
  832.     End Select
  833. End Sub
  834.  
  835. ' *** 
  836. ' *** ------------------------------------------------------------------------------
  837. ' *** Name:            TextDisplay(sOptId)
  838. ' *** ------------------------------------------------------------------------------
  839. ' *** Purpose:        Sets the text to be displayed in the pop-up when mouse is 
  840. ' ***                hovered over controls.
  841. ' *** ------------------------------------------------------------------------------
  842. ' *** 
  843. Sub TextDisplay(sOptId)
  844.  
  845.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  846.     Select Case sOptId
  847.         Case "spEnable"
  848.             ' ~~~ Check the text displayed next to the radio
  849.             If document.all("spEnable").innerHTML = document.all("resRebootAction1").innerHTML Then
  850.                 document.all("spEnable").title =  document.all("lblRebootAction1").innerHTML
  851.             Else
  852.                 document.all("spEnable").title = document.all("lblRebootAction3").innerHTML
  853.             End If
  854.         Case "spDisable"
  855.             If document.all("spDisable").innerHTML = document.all("resRebootAction2").innerHTML Then
  856.                 document.all("spDisable").title = document.all("lblRebootAction2").innerHTML
  857.             Else
  858.                 document.all("spDisable").title = document.all("lblRebootAction4").innerHTML
  859.             End If
  860.         Case "tdPendingChange"
  861.             If document.all("tdPendingChange").classname = "groupentry" Then
  862.                 document.all("rActUndo").title = document.all("lblPendingAction1").innerHTML
  863.                 document.all("rActCommit").title = document.all("lblPendingAction2").innerHTML
  864.                 document.all("rActRetain1").title = document.all("lblPendingAction3").innerHTML
  865.                 document.all("rActRetain2").title = document.all("lblPendingAction4").innerHTML
  866.                 document.all("spActUndo").title = document.all("lblPendingAction1").innerHTML
  867.                 document.all("spActCommit").title = document.all("lblPendingAction2").innerHTML
  868.                 document.all("spActRetain1").title = document.all("lblPendingAction3").innerHTML
  869.                 document.all("spActRetain2").title = document.all("lblPendingAction4").innerHTML
  870.             Else
  871.                 document.all("rActUndo").title = document.all("lblPendingAction1grey").innerHTML
  872.                 document.all("rActCommit").title = document.all("lblPendingAction2grey").innerHTML
  873.                 document.all("rActRetain1").title = document.all("lblPendingAction3grey").innerHTML
  874.                 document.all("rActRetain2").title = document.all("lblPendingAction4grey").innerHTML
  875.                 document.all("spActUndo").title = document.all("lblPendingAction1grey").innerHTML
  876.                 document.all("spActCommit").title = document.all("lblPendingAction2grey").innerHTML
  877.                 document.all("spActRetain1").title = document.all("lblPendingAction3grey").innerHTML
  878.                 document.all("spActRetain2").title = document.all("lblPendingAction4grey").innerHTML
  879.             End If
  880.         Case "txtAntiVirusScript" , "btnAntiVirusScript"
  881.             If Not document.all("txtAntiVirusScript").disabled Then
  882.                 document.all("txtAntiVirusScript").title = document.all("lblAVScriptTxt").innerHTML
  883.             End If
  884.             If Not document.all("btnAntiVirusScript").disabled Then 
  885.                 document.all("btnAntiVirusScript").title = document.all("lblAVScriptBtn").innerHTML
  886.             End If
  887.             
  888.         Case "txtOtherScript" , "btnOtherScript"
  889.             If Not document.all("txtOtherScript").disabled Then
  890.                 document.all("txtOtherScript").title = document.all("lblUpdateScriptTxt").innerHTML
  891.             End If            
  892.             If Not document.all("btnOtherScript").disabled Then
  893.                 document.all("btnOtherScript").title = document.all("lblUpdateScriptBtn").innerHTML
  894.             End If
  895.             
  896.         Case "spWinUPEnabled"
  897.             If Not document.all("rDPWinUpEnabled").disabled Then
  898.                 document.all("spWinUPEnabled").title = document.all("lblWinUPEnabled").innerHTML
  899.             End If
  900.         Case "spWinUPDisabled"
  901.             If Not document.all("rDPWinUpDisabled").disabled Then
  902.                 document.all("spWinUPDisabled").title = document.all("lblWinUPDisabled").innerHTML
  903.             End If
  904.             
  905.     End Select
  906. End Sub
  907.  
  908. ' *** 
  909. ' *** ------------------------------------------------------------------------------
  910. ' *** Name:            IsSystemBootSame()
  911. ' *** ------------------------------------------------------------------------------
  912. ' *** Purpose:        Returns True if System and Boot Partitions are the same
  913. ' *** ------------------------------------------------------------------------------
  914. ' *** 
  915. Private Function IsSystemBootSame()
  916.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  917.     IsSystemBootSame = True
  918.     If  (document.all("radEnable").checked = True) and (oDiskProtect.SystemBootSame() = False) and Not(oDiskProtect.Enabled) Then
  919.         msgbox document.all("resSystemBootNotSame").innerHTML,vbOKOnly + vbInformation, sTitle
  920.         IsSystemBootSame = True
  921.     End If 
  922. End Function
  923.  
  924. ' *** 
  925. ' *** ------------------------------------------------------------------------------
  926. ' *** Name:            IsHibernationenabled()
  927. ' *** ------------------------------------------------------------------------------
  928. ' *** Purpose:        Returns true if hibernation is enabled else returns false
  929. ' *** ------------------------------------------------------------------------------
  930. ' *** 
  931. Private Function IsHibernationenabled()
  932.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  933.     IsHibernationenabled = True
  934.     If  (document.all("radEnable").checked = True) and (oDiskProtect.GetHibernation() = True) and Not(oDiskProtect.Enabled) Then
  935.         If (msgbox(document.all("resHibernationWDPWarning").innerHTML,vbYesNo+vbInformation, sTitle) <> vbYes) Then
  936.             IsHibernationenabled = False
  937.         End If                    
  938.     End If 
  939. End Function
  940.  
  941. ' *** 
  942. ' *** ------------------------------------------------------------------------------
  943. ' *** Name:         ToggleClose(bToggle)
  944. ' *** ------------------------------------------------------------------------------
  945. ' *** Purpose:      This subroutine is executed to toggle the Finish button.
  946. ' *** ------------------------------------------------------------------------------
  947. ' *** 
  948.  
  949. Sub ToggleClose(bToggle)
  950.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  951.         If bToggle = True Then
  952.             btnFinish.disabled = True
  953.             btnFinish.style.cursor = "auto"
  954.         Else
  955.             btnFinish.disabled = False
  956.             btnFinish.style.cursor = "hand"
  957.         End If
  958. End Sub
  959.  
  960. ' *** 
  961. ' *** ------------------------------------------------------------------------------
  962. ' *** Name:            HTAKeyDown()
  963. ' *** ------------------------------------------------------------------------------
  964. ' *** Purpose:        This is the handler function for tool specific key controls
  965. ' *** ------------------------------------------------------------------------------
  966. ' *** 
  967. Sub HTAKeyDown()
  968.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0    
  969. End Sub
  970.  
  971. ' *** 
  972. ' *** ------------------------------------------------------------------------------
  973. ' *** Name:            WDPRestart()
  974. ' *** ------------------------------------------------------------------------------
  975. ' *** Purpose:        This is called from the WDPOn.HTA. This functions restarts
  976. ' ***                the system.
  977. ' *** ------------------------------------------------------------------------------
  978. ' *** 
  979. Sub WDPRestart()
  980.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0    
  981.     ' ~~~ To restart the system if yes is clicked in the WDPOn.hta
  982.     window.returnvalue = True
  983.     Self.Close()
  984. End Sub
  985.  
  986. ' *** 
  987. ' *** ------------------------------------------------------------------------------
  988. ' *** Name:            SetGreyHoverMessage()
  989. ' *** ------------------------------------------------------------------------------
  990. ' *** Purpose:        This method sets the disabled hover messages for the
  991. ' ***                controls.
  992. ' *** ------------------------------------------------------------------------------
  993. ' *** 
  994. Sub SetGreyHoverMessage()
  995.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0    
  996.     ' ~~~ Set disabled hover message for the controls
  997.     document.all("txtAntiVirusScript").title = document.all("lblAVScriptgrey").innerHTML
  998.     document.all("btnAntiVirusScript").title = document.all("lblAVScriptgrey").innerHTML
  999.     document.all("txtOtherScript").title = document.all("lblUpdateScriptgrey").innerHTML
  1000.     document.all("btnOtherScript").title = document.all("lblUpdateScriptgrey").innerHTML
  1001.     document.all("spWinUPEnabled").title = document.all("lblWinUPEnabledgrey").innerHTML
  1002.     document.all("spWinUPDisabled").title = document.all("lblWinUPDisabledgrey").innerHTML
  1003. End Sub
  1004.  
  1005. ' *** 
  1006. ' *** ------------------------------------------------------------------------------
  1007. ' *** Name:            FormatScheduleTime()
  1008. ' *** ------------------------------------------------------------------------------
  1009. ' *** Purpose:        This is method executed to format the time according 
  1010. ' ***                to regional settings.
  1011. ' *** ------------------------------------------------------------------------------
  1012. ' *** 
  1013. Sub FormatScheduleTime()
  1014.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0    
  1015.     
  1016.     Dim colOptions, oOption, sTime, iPos, sTimeSeparator 
  1017.     
  1018.     CONST vbLongTime = 3
  1019.     
  1020.     sTimeSeparator = ":"
  1021.     
  1022.     Set colOptions = ddSchedule2.Options
  1023.     
  1024.     For Each oOption in colOptions 
  1025.         sTime = FormatDateTime(oOption.Text,vbLongTime)
  1026.         If len(sTime) > 8 and InStr(1, sTime, sTimeSeparator) > 0 Then    
  1027.             If sTimeSeparator <> " " Then
  1028.                 iPos = InStrRev(sTime, sTimeSeparator)
  1029.             Else
  1030.                 iPos = InStrRev(sTime, sTimeSeparator)
  1031.                 iPos = InStrRev(sTime, sTimeSeparator, iPos-1)
  1032.             End If
  1033.             sTime =  Left(sTime, iPos-1) & Mid(sTime, iPos+len(sTimeSeparator)+2 ) 
  1034.         Else
  1035.             If len(sTime) <= 8 and InStr(1, sTime, sTimeSeparator) > 0 Then    
  1036.                 iPos = InStrRev(sTime, sTimeSeparator)
  1037.                 sTime =  Left(sTime, iPos-1) 
  1038.             End If
  1039.         End If
  1040.         
  1041.         ' ~~~ Set the formatted time if proper
  1042.         If len(sTime) <= 12 then oOption.Text = sTime
  1043.     Next 
  1044. End Sub
  1045.  
  1046. ' ***
  1047. ' *** ------------------------------------------------------------------------------
  1048. ' *** Name:            HTAUnLoad()
  1049. ' *** ------------------------------------------------------------------------------
  1050. ' *** Purpose:        This method unloads all the objects 
  1051. ' ***            created within the scope of the HTA
  1052. ' *** ------------------------------------------------------------------------------
  1053. ' ***
  1054. Sub HTAUnLoad()
  1055.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  1056.     
  1057.     Set oDiskProtect = Nothing
  1058.     Set oLog      = Nothing 
  1059.     
  1060. End Sub
  1061.