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

  1. ' ***
  2. ' *** --------------------------------------------------------------------------
  3. ' *** Filename:        GetStarted.vbs
  4. ' *** --------------------------------------------------------------------------
  5. ' *** Description:    Code for the Getting Started HTA
  6. ' *** --------------------------------------------------------------------------
  7. ' *** Version:        1.0
  8. ' *** Notes:        
  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 global variables and constants
  22. ' ~~~ 
  23. Const GSKEY            = "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SCTRunGettingStarted"            
  24. ' ~~~ GSKEY            = "": Do Not Show Getting Started at Startup, "<hta path/file>": Run Getting Started at Startup
  25.  
  26. Const SRPKEY            = "HKLM\SOFTWARE\Policies\Microsoft\Windows\Safer\CodeIdentifiers\PolicyScope"        
  27. ' ~~~ SRPKEY           = 0: SRP for All Users (Installed default), 1: Skip Administrators
  28.  
  29. Const WelcomeLogonKEY        = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\LogonType"             
  30. ' ~~~ WelcomeLogonKey      = 0: Classic CAD Mode, 1: Welcome Screen
  31.  
  32. Const WelcomeOffCompKEY1   = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\ShutdownWithoutLogon"    
  33. ' ~~~ WelcomeOffCompKEY1   = 0: Disable Turn off Computer, 1: Enable Turn off Computer (default)
  34.  
  35. Const WelcomeOffCompKEY2   = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system\shutdownwithoutlogon"    
  36. ' ~~~ WelcomeOffCompKEY2   = 0: Disable Shutdown, 1: Enable Shutdown (default)
  37.  
  38. Const LastLogonKEY        = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system\dontdisplaylastusername" 
  39. ' ~~~ LastLogonKEY         = 0: Display last username (default), 1: Don't display last username
  40.  
  41. CONST NoLMHashKEY       = "HKLM\SYSTEM\CurrentControlSet\Control\Lsa\NoLMHash"
  42. ' ~~~ NoLMHashKEY       = 0: LMHash used (default), 1: Don't store passwords using LMHash
  43.  
  44. Const NoAcctCacheKEY        = "HKLM\SYSTEM\CurrentControlSet\Control\Lsa\DisableDomainCreds"                     
  45. ' ~~~ NoAcctCacheKEY       = 0: Enable storage (default), 1: Disable storage
  46.  
  47. Const DelRoamingCacheKEY   = "HKLM\SOFTWARE\Policies\Microsoft\Windows\System\DeleteRoamingCache"                
  48. ' ~~~ DelRoamingCacheKEY   = 0: Do not delete roaming profiles (default), 1: Delete them
  49.  
  50. Const ProfileErrActionKEY  = "HKLM\SOFTWARE\Policies\Microsoft\Windows\System\ProfileErrorAction"                
  51. ' ~~~ ProfileErrActionKEY  = 0: Allow logon without roaming profile (default), 1: Don't allow this
  52.  
  53. Const Excel70KEY           = "HKLM\SOFTWARE\Classes\Excel.Sheet.5\BrowserFlags"                
  54. Const Excel2000KEY         = "HKLM\SOFTWARE\Classes\Excel.Sheet.8\BrowserFlags"                
  55. Const Word70KEY            = "HKLM\SOFTWARE\Classes\Word.Document.6\BrowserFlags"                
  56. Const Word2000KEY          = "HKLM\SOFTWARE\Classes\Word.Document.8\BrowserFlags"                
  57. Const Project98KEY         = "HKLM\SOFTWARE\Classes\MSProject.Project.8\BrowserFlags"                
  58. Const PowerPoint2000KEY    = "HKLM\SOFTWARE\Classes\PowerPoint.Show.8\BrowserFlags"                
  59. ' ~~~ Office KEYs          = 9 (Excel7) or 8 (all else): Prevent opening documents within IE, Removed: Allow opening documents within IE
  60.  
  61. Dim sAppDir, sCurrentUser, oWelcome, bShowAtStartup, bExpand, iSRPScope, bDomainMember, iWDPcmdver
  62. Dim s1, s2, s3, s4, s5, s6, s7, s8, srp
  63. Dim sGroupName
  64.  
  65. ' ***
  66. ' *** --------------------------------------------------------------------------
  67. ' *** Name:        PreChecks
  68. ' *** --------------------------------------------------------------------------
  69. ' *** Purpose:        This function is started before the HTA is visible,
  70. ' ***             to perform several important checks and routines.
  71. ' *** --------------------------------------------------------------------------
  72. ' ***
  73. Sub PreChecks
  74.     ' ~~~ Ignore errors when resizing the HTA
  75.     On Error Resume Next
  76.  
  77.     ' ~~~ Force Window size to the full screen less a five percent border
  78.     window.resizeTo screen.width*.9, screen.height*.9
  79.     window.moveTo    screen.width*.05, screen.height*.05
  80.  
  81.     bExpand     = False
  82.     bProcessing = True
  83. End Sub
  84.  
  85. ' ***
  86. ' *** --------------------------------------------------------------------------
  87. ' *** Name:        Init
  88. ' *** --------------------------------------------------------------------------
  89. ' *** Purpose:        This function is initiated by Main, which is called by 
  90. ' ***             OnLoad
  91. ' *** --------------------------------------------------------------------------
  92. ' ***
  93. Sub Init
  94.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  95.  
  96.     ' ~~~create Welcome object and set it
  97.     sCurrentUser = oNetwork.UserName
  98.     Set oWelcome = New Welcome
  99.     oWelcome.User = sCurrentUser
  100.  
  101.     ' ~~~ Load prechecks into the UI and update the UI
  102.  
  103.     bDomainMember = DomainMember()
  104.     sAppDir       = GetRootFolder
  105.  
  106.     Call LoadStartup
  107.     Call LoadSRP
  108.     Call UpdateStartup
  109.     Call UpdateSRP
  110.     Call UpdateWelcome
  111.     Call BodyDisable(False) 
  112.     Call UpdateWDP
  113. End Sub
  114.  
  115. ' ***
  116. ' *** --------------------------------------------------------------------------
  117. ' *** Name:        Load
  118. ' *** --------------------------------------------------------------------------
  119. ' *** Purpose:        
  120. ' *** --------------------------------------------------------------------------
  121. ' ***
  122. Sub Load
  123.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  124. End Sub
  125.  
  126. ' ------------------------------------------------------------------------------
  127. ' Name:            LoadStartup()
  128. ' ------------------------------------------------------------------------------
  129. ' Purpose:        
  130. ' ------------------------------------------------------------------------------
  131. Sub LoadStartup()
  132.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  133.  
  134.     bShowAtStartup = False
  135.     If RegRead(GSKEY) <> "" Then bShowAtStartup = True
  136. End Sub
  137.  
  138. ' ------------------------------------------------------------------------------
  139. ' Name:            UpdateStartup()
  140. ' ------------------------------------------------------------------------------
  141. ' Purpose:        
  142. ' ------------------------------------------------------------------------------
  143. Sub UpdateStartup()
  144.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  145.  
  146.     If bShowAtStartup Then
  147.         Startup.src = "graphics/chkbox-1.gif"
  148.     Else
  149.         Startup.src = "graphics/chkbox-0.gif"
  150.     End If
  151. End Sub
  152.  
  153. ' ------------------------------------------------------------------------------
  154. ' Name:            ClickStartup()
  155. ' ------------------------------------------------------------------------------
  156. ' Purpose:        
  157. ' ------------------------------------------------------------------------------
  158. Sub ClickStartup()
  159.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  160.  
  161.     bShowAtStartup = NOT bShowAtStartup
  162.     UpdateStartup
  163.  
  164.     If bShowAtStartup Then
  165.         RegWrite GSKEY, Chr(34) & sAppDir & "\GetStarted.hta" & Chr(34), "REG_SZ"
  166.     Else
  167.         RegDelete(GSKEY)
  168.     End If
  169. End Sub
  170.  
  171. ' ***
  172. ' *** --------------------------------------------------------------------------
  173. ' *** Name:        LoadSRP
  174. ' *** --------------------------------------------------------------------------
  175. ' *** Purpose:         
  176. ' *** --------------------------------------------------------------------------
  177. ' ***
  178. Sub LoadSRP
  179.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  180.  
  181.     ' ~~~ SRPKEY;  0 = SRP for All Users (Installed default), 1 = Skip Administrators
  182.     iSRPScope = RegRead(SRPKEY)
  183. End Sub
  184.  
  185. ' ***
  186. ' *** --------------------------------------------------------------------------
  187. ' *** Name:        UpdateSRP
  188. ' *** --------------------------------------------------------------------------
  189. ' *** Purpose:         
  190. ' *** --------------------------------------------------------------------------
  191. ' ***
  192. Sub UpdateSRP()
  193.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  194.  
  195.     If iSRPScope <> 0 Then 
  196.         srpAdmin.style.display = "block"
  197.         srpAdmin2.style.display = "block"
  198.     End If
  199. End Sub
  200.  
  201.  
  202. ' ***
  203. ' *** --------------------------------------------------------------------------
  204. ' *** Name:        UpdateWelcome
  205. ' *** --------------------------------------------------------------------------
  206. ' *** Purpose:         
  207. ' *** --------------------------------------------------------------------------
  208. ' ***
  209. Sub UpdateWelcome()
  210. '    If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  211.  
  212.     ' ~~~ Set the checkbox for Prevent account name from being saved in CAD
  213.     chkLastLogon.checked = RegRead(LastLogonKEY)
  214.  
  215.     ' ~~~ Set the checkbox for using LMHash
  216.     chkNoLMHash.checked = RegRead(NoLMHashKEY)
  217.  
  218.     ' ~~~ Set the checkbox for Caching .NET Passports
  219.     chkNoAcctCache.checked = RegRead(NoAcctCacheKEY)
  220.  
  221.     
  222.     ' ~~~ Set the checkbox for ACL's in C:
  223.     chkPreventWindir.checked = GetAceStatus( Left( oShell.ExpandEnvironmentStrings("%WINDIR%"), 3))
  224.     
  225.     ' ~~~ Set the checkbox for Delete Roaming Profile Cache
  226.     chkDelRoamingCache.checked = RegRead(DelRoamingCacheKEY)
  227.  
  228.     ' ~~~ Set the checkbox for logon only if roaming profile available
  229.     chkProfileErrAction.checked = RegRead(ProfileErrActionKEY)
  230.  
  231.     ' ~~~ Set the Remove Shutdown/Turn off computer checkbox
  232.     If RegRead(WelcomeOffCompKEY1) = 0 and RegRead(WelcomeOffCompKEY2) = 0 Then
  233.         chkWelcomeOffComp.checked = True
  234.     Else
  235.         chkWelcomeOffComp.checked = False
  236.     End If        
  237.  
  238.     ' ~~~ Set the Prevent Office documents from opening in IE checkbox
  239.     chkOfficeIE.checked = CheckOfficeIE
  240.  
  241.     If NOT bDomainMember Then
  242.         ' ~~~ If this is a workgroup computer, set several checkboxes and info
  243.  
  244.         ' ~~~ Set the Use Welcome logon screen checkbox
  245.         chkWelcomeLogon.checked = RegRead(WelcomeLogonKEY)
  246.  
  247.         If oWelcome.IsLocal Then
  248.             ' ~~~ If the current user is local indicate the current state of it on the Welcome screen
  249.             welcomeUser.innerHTML = "<B>" & sCurrentUser & "</B>"
  250.             chkWelcomeRemAcct.checked = oWelcome.IsDisabled
  251.         Else
  252.             ' ~~~ If the current user is not local remove the option to remove them from the Welcome screen
  253.             trWelcomeRemAcct.style.display = "none"
  254.             chkWelcomeRemAcct.style.display = "none"
  255.         End If
  256.  
  257.     Else
  258.         ' ~~~ If this is a domain computer, turn off the Welcome related checkboxes
  259.         trWelcomeLogon.style.display = "none"
  260.         chkWelcomeLogon.style.display = "none"
  261.         trWelcomeRemAcct.style.display = "none"
  262.         chkWelcomeRemAcct.style.display = "none"
  263.         
  264.         ' ~~~ Domain computer - turn off the password test button and text.
  265.         Q11.style.display = "none"
  266.         pStep2b.style.display = "none"
  267.         Step2PassTest.style.display = "none"
  268.     End If
  269. End Sub
  270.  
  271. ' ***
  272. ' *** --------------------------------------------------------------------------
  273. ' *** Name:        PassPolicyCheck
  274. ' *** --------------------------------------------------------------------------
  275. ' *** Purpose:        Ensure password policy not in place to impact PassChecks
  276. ' *** --------------------------------------------------------------------------
  277. ' ***
  278. Function PassPolicyCheck
  279.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  280.  
  281.     Dim oMachine, oUser, Passwords, Password
  282.     PassPolicyCheck = False
  283.  
  284.     ' ~~~ Initialize constants
  285.     CONST EX_USER   = "SCTTestx"
  286.     CONST EX_PASS   = "Testing12345a~!a"
  287.  
  288.     ' ~~~ Initialize variables and create a test account
  289.     Set oMachine = GetObject("WinNT://" & sComputer)
  290.     Set oUser    = oMachine.Create("user", EX_USER)
  291.     oUser.SetPassword EX_PASS
  292.     oUser.SetInfo
  293.  
  294.     ' ~~~ Establish the passwords we'll run this account through
  295.     Passwords = Array("Password!123B-", "password!567A-")
  296.  
  297.     ' ~~~ Ignore errors resulting from failed password changes
  298.     On Error Resume Next
  299.  
  300.     For each Password in Passwords
  301.         ' ~~~ Change the password and change it back
  302.         oUser.ChangePassword EX_PASS, Password
  303.         Err.Clear
  304.         oUser.changePassword Password, EX_PASS
  305.     Next
  306.  
  307.     ' ~~~ If we can change the password back to the beginning after all of this, then there is no Password Policy to interfere
  308.     If err.number = 0 Then PassPolicyCheck = True
  309.  
  310.     ' ~~~ Delete the test account
  311.     Set oUser    = Nothing
  312.     oMachine.Delete "user", EX_USER
  313.     Set oMachine = Nothing
  314. End Function
  315.  
  316.  
  317. ' ***
  318. ' *** --------------------------------------------------------------------------
  319. ' *** Name:        PassChecks
  320. ' *** --------------------------------------------------------------------------
  321. ' *** Purpose:        Test local admin account for several weak passwords
  322. ' *** --------------------------------------------------------------------------
  323. ' ***
  324. Sub PassChecks
  325.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  326.  
  327.     Dim oUser, Passwords, Password
  328.     CONST TEMP_PASS = "Testing12345a~!"
  329.  
  330.     ' ~~~ If this is a Domain account then do not do password checks
  331.     If NOT oWelcome.IsLocal Then 
  332.         MsgBox L_DomainNote_Text, vbInformation, L_DomainTitle_TEXT
  333.         Exit Sub
  334.     End If
  335.  
  336.     ' ~~~ Check that no Password Policy is in place... or the checks below will cause problems for this admin account
  337.     If NOT PassPolicyCheck() Then 
  338.         MsgBox L_PassPolicy_TEXT, vbInformation, L_PassTitle_TEXT
  339.         Exit Sub
  340.     End If
  341.  
  342.     ' ~~~ Initialize variables
  343.     Set oUser    = GetObject("WinNT://" & sComputer & "/" & sCurrentUser & ", user")
  344.     Passwords    = Array("", sCurrentUser, "Password", "password", oNetwork.ComputerName)
  345.  
  346.     ' ~~~ Ignore errors resulting from failed password changes
  347.     On Error Resume Next
  348.  
  349.     ' ~~~ So as not to change the password and not be able to change it back
  350.     For each Password in Passwords
  351.  
  352.         ' ~~~ Attempt to change the password
  353.         Err.Clear
  354.         oUser.ChangePassword Password, TEMP_PASS
  355.  
  356.         ' ~~~ If the password change was successful (i.e. no error), change it back and provide warning
  357.         If err.number = 0 Then 
  358.             oUser.changePassword TEMP_PASS, Password
  359.             MsgBox L_PassWarn_TEXT, vbCritical, L_PassWarnTitle_TEXT
  360.             Exit Sub
  361.         End If
  362.     Next
  363.  
  364.     ' ~~~ Didn't find the password
  365.     MsgBox L_PassNote_TEXT, vbInformation, L_PassTitle_TEXT
  366.     Set oUser = Nothing
  367. End Sub
  368.  
  369. ' ***
  370. ' *** ------------------------------------------------------------------------------
  371. ' *** Name:            UpdateWDP()
  372. ' *** ------------------------------------------------------------------------------
  373. ' *** Purpose:        
  374. ' *** ------------------------------------------------------------------------------
  375. ' ***
  376. Sub UpdateWDP()
  377.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  378.  
  379.     ' ~~~ Set the WDP.cmd version #
  380.     iWDPcmdVer = 4
  381.  
  382.     ' ~~~ Learn how WDP is currently configured
  383.     Dim oDiskProtect
  384.     Set oDiskProtect = New DiskProtect
  385.  
  386.     ' ~~~ If the Overlay hasn't been created yet, and the Toolkit can't see space for a Protection Partition, then the prereqs have not been done yet.    
  387.     If Not(oDiskProtect.OverlayCreated) Then
  388.         If oDiskProtect.CalcOVSize = 0 Then
  389.             wdpPrereq.style.display = "inline"
  390.             Step1Text.style.display = "block"
  391.         Else
  392.             wdpDisabled.style.display = "inline"
  393.         End If
  394.     ' ~~~ If the Overlay has been created, indicate if WDP is on or off
  395.     Else
  396.         If oDiskProtect.Enabled Then
  397.             wdpEnabled.style.display = "inline"
  398.         Else
  399.             wdpDisabled.style.display = "inline"
  400.         End If
  401.     End If
  402.     wdpQuery.style.display = "none"
  403. End Sub
  404.  
  405. ' ***
  406. ' *** ------------------------------------------------------------------------------
  407. ' *** Name:            ClickLastLogon()
  408. ' *** ------------------------------------------------------------------------------
  409. ' *** Purpose:        Remove last username from the CTRL-ALT-DEL logon dialog or not
  410. ' *** ------------------------------------------------------------------------------
  411. ' ***
  412. Sub ClickLastLogon
  413.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  414.  
  415.     ' ~~~ LastLogonKEY;  0 = Display last username (default), 1 = Don't display last username
  416.  
  417.     If chkLastLogon.checked Then
  418.         RegWrite LastLogonKEY, 1, "REG_DWORD"
  419.     Else
  420.         RegWrite LastLogonKEY, 0, "REG_DWORD"
  421.     End If        
  422. End Sub
  423.  
  424. ' ***
  425. ' *** ------------------------------------------------------------------------------
  426. ' *** Name:            ClickNoLMHash()
  427. ' *** ------------------------------------------------------------------------------
  428. ' *** Purpose:        Prevent storing passwords using LMHash
  429. ' *** ------------------------------------------------------------------------------
  430. ' ***
  431. Sub ClickNoLMHash
  432.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  433.  
  434.     ' ~~~ NoLMHashKEY; 0 = Store LMHash passwords (default), 1 = Disable use of LMHash values for password storage
  435.  
  436.     If chkNoLMHash.checked Then
  437.         RegWrite NoLMHashKEY, 1, "REG_DWORD"
  438.     Else
  439.         RegWrite NoLMHashKEY, 0, "REG_DWORD"
  440.     End If        
  441. End Sub
  442.  
  443. ' ***
  444. ' *** ------------------------------------------------------------------------------
  445. ' *** Name:            ClickNoAcctCache()
  446. ' *** ------------------------------------------------------------------------------
  447. ' *** Purpose:        Prevent caching of .NET Passport accounts in user profiles or not
  448. ' *** ------------------------------------------------------------------------------
  449. ' ***
  450. Sub ClickNoAcctCache
  451.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  452.  
  453.     ' ~~~ NoAcctCacheKEY; 0 = Enable storage (default), 1 = Disable storage
  454.  
  455.     If chkNoAcctCache.checked Then
  456.         RegWrite NoAcctCacheKEY, 1, "REG_DWORD"
  457.     Else
  458.         RegWrite NoAcctCacheKEY, 0, "REG_DWORD"
  459.     End If        
  460. End Sub
  461.  
  462. ' ***
  463. ' *** ------------------------------------------------------------------------------
  464. ' *** Name:            ClickPreventWindir()
  465. ' *** ------------------------------------------------------------------------------
  466. ' *** Purpose:        Prevent creation of files/Folders in root directory
  467. ' *** ------------------------------------------------------------------------------
  468. ' ***
  469. Sub ClickPreventWindir
  470.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  471.     
  472.     Dim sDrivename
  473.     
  474.     sDrivename = Left( oShell.ExpandEnvironmentStrings("%WINDIR%"), 3)
  475.     
  476.     If chkPreventWindir.Checked Then 
  477.         Call AddAce( sDrivename )
  478.     Else
  479.         Call RemoveAce(sDrivename)
  480.     End If
  481.     
  482. End Sub    
  483.  
  484. ' ***
  485. ' *** ------------------------------------------------------------------------------
  486. ' *** Name:            ClickDelRoamingCache()
  487. ' *** ------------------------------------------------------------------------------
  488. ' *** Purpose:        Delete local copies of roaming user profiles
  489. ' *** ------------------------------------------------------------------------------
  490. ' ***
  491. Sub ClickDelRoamingCache
  492.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  493.  
  494.     ' ~~~ DelRoamingCacheKEY; 0 = do not delete roaming profiles (default), 1 = delete them
  495.  
  496.     If chkDelRoamingCache.checked Then
  497.         RegWrite DelRoamingCacheKEY, 1, "REG_DWORD"
  498.     Else
  499.         RegWrite DelRoamingCacheKEY, 0, "REG_DWORD"
  500.     End If        
  501. End Sub
  502.  
  503. ' ***
  504. ' *** ------------------------------------------------------------------------------
  505. ' *** Name:            ClickProfileErrAction()
  506. ' *** ------------------------------------------------------------------------------
  507. ' *** Purpose:        Delete local copies of roaming user profiles
  508. ' *** ------------------------------------------------------------------------------
  509. ' ***
  510. Sub ClickProfileErrAction
  511.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  512.  
  513.     ' ~~~ ProfileErrActionKEY; 0 = allow logon without roaming profile (default), 1 = don't allow this
  514.  
  515.     If chkProfileErrAction.checked Then
  516.         RegWrite ProfileErrActionKEY, 1, "REG_DWORD"
  517.     Else
  518.         RegWrite ProfileErrActionKEY, 0, "REG_DWORD"
  519.     End If        
  520. End Sub
  521.  
  522. ' ***
  523. ' *** ------------------------------------------------------------------------------
  524. ' *** Name:            ClickWelcomeLogon()
  525. ' *** ------------------------------------------------------------------------------
  526. ' *** Purpose:        Use the Welcome Logon Screen or not
  527. ' *** ------------------------------------------------------------------------------
  528. ' ***
  529. Sub ClickWelcomeLogon
  530.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  531.  
  532.     ' ~~~ WelcomeLogonKEY; 0 = Classic CAD Mode, 1 = Welcome Screen
  533.  
  534.     If chkWelcomeLogon.checked Then
  535.         RegWrite WelcomeLogonKEY, 1, "REG_DWORD"
  536.     Else
  537.         RegWrite WelcomeLogonKEY, 0, "REG_DWORD"
  538.     End If        
  539. End Sub
  540.  
  541. ' ***
  542. ' *** ------------------------------------------------------------------------------
  543. ' *** Name:            ClickWelcomeOffComp()
  544. ' *** ------------------------------------------------------------------------------
  545. ' *** Purpose:        Disable 'Turn off Computer' or not
  546. ' *** ------------------------------------------------------------------------------
  547. ' ***
  548. Sub ClickWelcomeOffComp
  549.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  550.  
  551.     ' ~~~ WelcomeOffCompKEY1; 0 = Disable Turn off Computer, 1 = Enable Turn off Computer (default)
  552.     ' ~~~ WelcomeOffCompKEY2; 0 = Disable Shutdown, 1 = Enable Shutdown (default)
  553.  
  554.     If chkWelcomeOffComp.checked Then
  555.         RegWrite WelcomeOffCompKEY1, 0, "REG_DWORD"
  556.         RegWrite WelcomeOffCompKEY2, 0, "REG_DWORD"
  557.     Else
  558.         RegWrite WelcomeOffCompKEY1, 1, "REG_DWORD"
  559.         RegWrite WelcomeOffCompKEY2, 1, "REG_DWORD"
  560.     End If        
  561. End Sub
  562.  
  563. ' ***
  564. ' *** ------------------------------------------------------------------------------
  565. ' *** Name:            ClickOfficeIE()
  566. ' *** ------------------------------------------------------------------------------
  567. ' *** Purpose:        Prevent Office documents from opening in Internet Explorer
  568. ' ***               See KB 162059 for more information.
  569. ' *** ------------------------------------------------------------------------------
  570. ' ***
  571. Sub ClickOfficeIE
  572.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  573.  
  574.     If chkOfficeIE.checked Then
  575.         RegWrite Excel70KEY,        9, "REG_DWORD"
  576.         RegWrite Excel2000KEY,      8, "REG_DWORD"
  577.         RegWrite Word70KEY,         8, "REG_DWORD"
  578.         RegWrite Word2000KEY,       8, "REG_DWORD"
  579.         RegWrite Project98KEY,      8, "REG_DWORD"
  580.         RegWrite PowerPoint2000KEY, 8, "REG_DWORD"
  581.     Else
  582.         RegDelete(Excel70KEY)
  583.         RegDelete(Excel2000KEY)
  584.         RegDelete(Word70KEY)
  585.         RegDelete(Word2000KEY)
  586.         RegDelete(Project98KEY)
  587.         RegDelete(PowerPoint2000KEY)
  588.     End If
  589. End Sub
  590.  
  591. ' ***
  592. ' *** ------------------------------------------------------------------------------
  593. ' *** Name:            CheckOfficeIE()
  594. ' *** ------------------------------------------------------------------------------
  595. ' *** Purpose:        Determine if all OfficeIE settings are in place.
  596. ' *** ------------------------------------------------------------------------------
  597. ' ***
  598. Function CheckOfficeIE
  599.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  600.  
  601.     CheckOfficeIE = False
  602.  
  603.     If RegRead(Excel70KEY) = 9 and RegRead(Excel2000KEY) = 8 and RegRead(Word70KEY) = 8 and RegRead(Word2000KEY) = 8 and RegRead(Project98KEY) = 8 and RegRead(PowerPoint2000KEY) = 8 Then
  604.         CheckOfficeIE = True
  605.     End If
  606. End Function
  607.  
  608. ' ***
  609. ' *** ------------------------------------------------------------------------------
  610. ' *** Name:            ClickWelcomeRemAcct()
  611. ' *** ------------------------------------------------------------------------------
  612. ' *** Purpose:        
  613. ' *** ------------------------------------------------------------------------------
  614. ' ***
  615. Sub ClickWelcomeRemAcct
  616.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  617.  
  618.     If chkWelcomeRemAcct.checked Then
  619.         oWelcome.Disable
  620.         if LCase(sCurrentUser) <> LCase( GetAdminName() ) Then DisableAdministrator
  621.     Else
  622.         oWelcome.Enable
  623.     End If
  624.  
  625. End Sub
  626.  
  627. ' ***
  628. ' *** ------------------------------------------------------------------------------
  629. ' *** Name:            DisableAdministrator()
  630. ' *** ------------------------------------------------------------------------------
  631. ' *** Purpose:        
  632. ' *** ------------------------------------------------------------------------------
  633. ' ***
  634. Sub DisableAdministrator
  635.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  636.  
  637.     Dim oWelcomeAdmin
  638.  
  639.     ' ~~~ Create Welcome object, set it, and disable it
  640.     Set oWelcomeAdmin = New Welcome
  641.     oWelcomeAdmin.User = GetAdminName()
  642.     oWelcomeAdmin.Disable
  643.     
  644.     Set oWelcomeAdmin = Nothing
  645. End Sub
  646.  
  647. ' ***
  648. ' *** ------------------------------------------------------------------------------
  649. ' *** Name:            ResText(res)
  650. ' *** ------------------------------------------------------------------------------
  651. ' *** Purpose:        
  652. ' *** ------------------------------------------------------------------------------
  653. ' ***
  654. Function ResText(res)
  655.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  656.     ResText = document.all(res).innerHTML
  657. End Function
  658.  
  659. ' ***
  660. ' *** ------------------------------------------------------------------------------
  661. ' *** Name:            Light(objBtn, bOn)
  662. ' *** ------------------------------------------------------------------------------
  663. ' *** Purpose:        This sub is executed to highlight the common buttons 
  664. ' *** ------------------------------------------------------------------------------
  665. ' ***
  666. Sub Light(objBtn, bOn)
  667.     On Error Resume Next
  668.  
  669.     If bOn Then
  670.         objBtn.filters.Light.Clear
  671.         objBtn.filters.Light.AddAmbient 150,150,255,100
  672.         objBtn.filters.Light.AddAmbient 255,255,255,20
  673.         objBtn.filters.Light.Enabled = true
  674.         objBtn.style.borderStyle = "outset" 
  675.     Else
  676.         objBtn.filters.Light.Enabled = false
  677.         objBtn.style.borderStyle = "solid" 
  678.     End If
  679. End Sub
  680.  
  681. ' ***
  682. ' *** ------------------------------------------------------------------------------
  683. ' *** Name:            HTAKeyDown()
  684. ' *** ------------------------------------------------------------------------------
  685. ' *** Purpose:        This subroutine is executed whenever tool specific key is pressed
  686. ' *** ------------------------------------------------------------------------------
  687. ' ***
  688. Sub HTAKeyDown()
  689.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  690. End Sub
  691.  
  692. ' ***
  693. ' *** ------------------------------------------------------------------------------
  694. ' *** Name:            ButtonOver()
  695. ' *** ------------------------------------------------------------------------------
  696. ' *** Purpose:        
  697. ' *** ------------------------------------------------------------------------------
  698. ' ***
  699. Sub ButtonOver()
  700.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  701.  
  702.     If Window.event.srcElement.className = "down" Then Exit Sub
  703.     If Window.event.srcElement.className = "text" Then Exit Sub
  704.     window.event.srcElement.style.borderStyle = "inset"
  705.     window.event.srcElement.style.borderColor = "lightblue"
  706. End Sub
  707.  
  708. ' ***
  709. ' *** ------------------------------------------------------------------------------
  710. ' *** Name:            ButtonLeave()
  711. ' *** ------------------------------------------------------------------------------
  712. ' *** Purpose:        
  713. ' *** ------------------------------------------------------------------------------
  714. ' ***
  715. Sub ButtonLeave()
  716.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  717.  
  718.     window.event.srcElement.style.borderStyle = "solid"
  719.     window.event.srcElement.style.borderColor = "royalblue"
  720. End Sub
  721.  
  722. ' ***
  723. ' *** ------------------------------------------------------------------------------
  724. ' *** Name:            ButtonClick()
  725. ' *** ------------------------------------------------------------------------------
  726. ' *** Purpose:        
  727. ' *** ------------------------------------------------------------------------------
  728. ' ***
  729. Sub ButtonClick(oNext, oDown, bScroll)
  730.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  731.  
  732.     Dim iOffsetTop, iClientHeight, i
  733.  
  734.     If oNext.style.display = "none" Then
  735.         oNext.style.display = "block"
  736.         oDown.style.display = "none"
  737.  
  738.         If bScroll Then
  739.             ' ~~~ If necessary, scroll the screen to ensure the selected step is viewable
  740.             iClientHeight = oBody.offsetHeight
  741.             iOffsetTop = oNext.nextSibling.offsetTop - oBody.scrollTop
  742.     
  743.             If (iOffsetTop > iClientHeight) Then
  744.                 For i = 1 to iOffsetTop - iClientHeight Step 5
  745.                     window.scrollBy 0, 5
  746.                 Next
  747.                 window.scrollBy 0, 20
  748.             End If
  749.         End If
  750.     Else
  751.         oNext.style.display = "none"
  752.         oDown.style.display = "inline"
  753.     End If
  754. End Sub
  755.  
  756. ' ***
  757. ' *** ------------------------------------------------------------------------------
  758. ' *** Name:            ExpandAll
  759. ' *** ------------------------------------------------------------------------------
  760. ' *** Purpose:        
  761. ' *** ------------------------------------------------------------------------------
  762. ' ***
  763. Sub ExpandAll
  764.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  765.  
  766.     bProcessing = True
  767.  
  768.     bExpand = Not bExpand
  769.  
  770.     If bExpand Then
  771.         expand.innerHTML = ResText("resCollapse")
  772.         Step1Text.style.display = "none"
  773.         Step2Text.style.display = "none"
  774.         Step3Text.style.display = "none"
  775.         Step4Text.style.display = "none"
  776.         Step5Text.style.display = "none"
  777.         Step6Text.style.display = "none"
  778.         Step7Text.style.display = "none"
  779.         Step8Text.style.display = "none"
  780.         If srpAdmin.style.display <> "none" Then
  781.             srpAdmin2.style.display = "none"
  782.             ButtonClick srpAdmin2, dsrpAdmin, False
  783.         End If
  784.     Else
  785.         expand.innerHTML = ResText("resExpand")
  786.         Step1Text.style.display = "block"
  787.         Step2Text.style.display = "block"
  788.         Step3Text.style.display = "block"
  789.         Step4Text.style.display = "block"
  790.         Step5Text.style.display = "block"
  791.         Step6Text.style.display = "block"
  792.         Step7Text.style.display = "block"
  793.         Step8Text.style.display = "block"
  794.         If srpAdmin.style.display <> "none" Then
  795.             srpAdmin2.style.display = "block"
  796.             ButtonClick srpAdmin2, dsrpAdmin, False
  797.         End If
  798.     End If
  799.     
  800.     ButtonClick Step8Text, dStep8, False
  801.     ButtonClick Step7Text, dStep7, False
  802.     ButtonClick Step6Text, dStep6, False
  803.     ButtonClick Step5Text, dStep5, False
  804.     ButtonClick Step4Text, dStep4, False
  805.     ButtonClick Step3Text, dStep3, False
  806.     ButtonClick Step2Text, dStep2, False
  807.     ButtonClick Step1Text, dStep1, False
  808.  
  809.     window.scrollTo 0, 0
  810.  
  811.     bProcessing = False
  812. End Sub
  813.  
  814. ' ***
  815. ' *** ------------------------------------------------------------------------------
  816. ' *** Name:            PrintPage
  817. ' *** ------------------------------------------------------------------------------
  818. ' *** Purpose:        Expand all steps, print the page, then put the steps back
  819. ' *** ------------------------------------------------------------------------------
  820. ' ***
  821. Sub PrintPage
  822.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  823.     bProcessing = True
  824.  
  825.     ' ~~~ Capture the current state of each step and warning    
  826.     s1 = Step1Text.style.display
  827.     s2 = Step2Text.style.display
  828.     s3 = Step3Text.style.display
  829.     s4 = Step4Text.style.display
  830.     s5 = Step5Text.style.display
  831.     s6 = Step6Text.style.display
  832.     s7 = Step7Text.style.display
  833.     s8 = Step8Text.style.display
  834.     srp = srpAdmin2.style.display
  835.  
  836.     ' ~~~ Expand all of the states
  837.     Step1Text.style.display = "block"
  838.     Step2Text.style.display = "block"
  839.     Step3Text.style.display = "block"
  840.     Step4Text.style.display = "block"
  841.     Step5Text.style.display = "block"
  842.     Step6Text.style.display = "block"
  843.     Step7Text.style.display = "block"
  844.     Step8Text.style.display = "block"
  845.     If srpAdmin.style.display <> "none" Then srpAdmin2.style.display = "block"
  846.  
  847.     Window.print    
  848.  
  849.     ' ~~~ Put the states back to where they began
  850.     Step1Text.style.display = s1
  851.     Step2Text.style.display = s2
  852.     Step3Text.style.display = s3
  853.     Step4Text.style.display = s4
  854.     Step5Text.style.display = s5
  855.     Step6Text.style.display = s6
  856.     Step7Text.style.display = s7
  857.     Step8Text.style.display = s8
  858.     If srpAdmin.style.display <> "none" Then srpAdmin2.style.display = srp
  859.  
  860.     bProcessing = False
  861. End Sub
  862.  
  863. ' ***
  864. ' *** ------------------------------------------------------------------------------
  865. ' *** Name:            Run(sRun)
  866. ' *** ------------------------------------------------------------------------------
  867. ' *** Purpose:        
  868. ' *** ------------------------------------------------------------------------------
  869. ' ***
  870. Sub Run(sRun)
  871.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  872.  
  873.     bProcessing = True
  874.  
  875.     Select Case sRun
  876.         Case "ProfileMgr"        Call oShell.Run(Chr(34) & sAppDir & "\ProfileMgr.hta" & Chr(34),    1, False)
  877.         Case "Restrict"            Call oShell.Run(Chr(34) & sAppDir & "\Restrict.hta" & Chr(34),        1, False)
  878.         Case "DiskProtect"        
  879.             ' ~~~ Need to ensure our wdPQuery has finished before allowing DiskProtect.hta to open
  880.             If wdpQuery.style.display = "none" Then 
  881.                         Call oShell.Run(Chr(34) & sAppDir & "\DiskProtect.hta" & Chr(34),    1, False)
  882.             End If
  883.         Case "Accessibility"        Call oShell.Run(Chr(34) & sAppDir & "\Accessibility.hta" & Chr(34),    1, False)
  884.          Case "Logoff"            Call oShell.Run("Logoff.exe",                        7, False)
  885.         Case "DiskMgmt"            Call oShell.Run("Diskmgmt.msc",                        1, False)
  886.         Case "PassTest"                PassChecks
  887.         Case "Help"                ShowHelp
  888.         Case "Cmd"                Call oShell.Run(Chr(34) & sAppDir & "\Scripts\Command-line Here.cmd" & Chr(34) & " " & Chr(34) & sAppDir & "\Scripts" & Chr(34), 1, False)
  889.         Case "User"                
  890.             If Not bDomainMember Then
  891.                 Call oShell.Run("CONTROL NUSRMGR.CPL", 1, False)
  892.             Else
  893.                 Call oShell.Run("LUSRMGR.MSC", 1, False)
  894.             End If
  895.         Case "Handbook"            
  896.             On Error Resume Next
  897.             Err.Clear
  898.             Call oShell.Run(Chr(34) & sAppDir & "\Shared Computer Toolkit Handbook.pdf" & Chr(34), 1, False)
  899.             If Err.number <> 0 Then
  900.                 If MsgBox(ResText("resNoPDF"), vbYesNo + vbCritical, ResText("resNoPDFTitle")) = vbYes Then
  901.                     Call oShell.Run(ResText("resPDFwebsite"), 1, False)
  902.                 End If
  903.             End If
  904.     End Select
  905.  
  906.     bProcessing = False
  907. End Sub
  908.  
  909. ' ***
  910. ' *** ------------------------------------------------------------------------------
  911. ' *** Name:            GetAdminName()
  912. ' *** ------------------------------------------------------------------------------
  913. ' *** Purpose:        Returns the localized name of the administrator 
  914. ' ***            by using the SID
  915. ' *** ------------------------------------------------------------------------------
  916. ' ***
  917. Function GetAdminName()
  918.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  919.     
  920.     Dim colItems, objItem
  921.     
  922.     Set colItems = oWMIService.ExecQuery _
  923.         ("Select * from Win32_UserAccount Where LocalAccount = True")
  924.     
  925.     For Each objItem in colItems 
  926.         If (Right(objItem.SID,4) = "-500") Then
  927.             GetAdminName = objItem.Name
  928.             Exit For
  929.         End If
  930.     Next
  931.     
  932.     Set colItems = Nothing
  933.                 
  934. End Function
  935.  
  936. ' ***
  937. ' *** ------------------------------------------------------------------------------
  938. ' *** Name:            RemoveAce(sDriveID)
  939. ' *** ------------------------------------------------------------------------------
  940. ' *** Purpose:        Removes the ACL from C:
  941. ' *** ------------------------------------------------------------------------------
  942. ' ***
  943. Function RemoveAce(sDriveID)
  944.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  945.     Dim sec, sd, Dacl, ace, oGroup,bAceExists
  946.         
  947.     ' ~~~ Flags: Specifies Inheritance
  948.     Const ADS_ACEFLAG_INHERIT_ACE = &h2
  949.     ' ~~~ Permission Type: Allow
  950.     Const ADS_ACETYPE_ACCESS_ALLOWED = &h0
  951.     
  952.     bAceExists = 0
  953.  
  954.     Set sec = CreateObject("ADsSecurityUtility")
  955.     Set sd = sec.GetSecurityDescriptor(sDriveID,1,1)
  956.     Set Dacl = sd.DiscretionaryAcl
  957.     For Each ace in Dacl
  958.         If (Mid(ace.Trustee,InStrRev(ace.Trustee,"\")+1) = sGroupName) Then
  959.             If(ace.AceType = ADS_ACETYPE_ACCESS_ALLOWED )Then
  960.                 ace.accessmask = (ace.accessmask OR 6)
  961.                 bAceExists = 1
  962.                 Exit For
  963.             End If
  964.         End If
  965.     Next
  966.     
  967.     If NOT bAceExists Then        
  968.         ' ~~~ Add a new ACE so Users group does not have create file/folder permission
  969.         Set ace = CreateObject ("AccessControlEntry")
  970.         ace.Trustee = "S-1-5-32-545"
  971.         ace.AccessMask = &h6
  972.         ace.AceType = ADS_ACETYPE_ACCESS_ALLOWED 
  973.         ace.AceFlags = ADS_ACEFLAG_INHERIT_ACE
  974.         dacl.addAce ace
  975.     End If
  976.     
  977.     sd.DiscretionaryAcl = dacl
  978.     sec.SetSecurityDescriptor sDriveID,1,sd,1
  979.     
  980.     Set ace  = Nothing
  981.     Set sec  = Nothing
  982.     Set sd   = Nothing
  983.     Set Dacl = Nothing
  984.     
  985. End Function
  986.  
  987. ' ***
  988. ' *** ------------------------------------------------------------------------------
  989. ' *** Name:            AddAce(sDriveID)
  990. ' *** ------------------------------------------------------------------------------
  991. ' *** Purpose:        Add's an ACL to C: for denying create file/folder access
  992. ' *** ------------------------------------------------------------------------------
  993. ' ***
  994. Function AddAce(sDriveID)
  995.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  996.     
  997.     Dim sec, sd, Dacl, ace,aceTemp,colGroups, oGroup
  998.     
  999.     ' ~~~ Permission Type: Allow
  1000.     Const ADS_ACETYPE_ACCESS_ALLOWED = &h0
  1001.     
  1002.     Set sec = CreateObject("ADsSecurityUtility")
  1003.     Set sd = sec.GetSecurityDescriptor(sDriveID,1,1)
  1004.     Set Dacl = sd.DiscretionaryAcl
  1005.     
  1006.     Set colGroups = Nothing
  1007.  
  1008.     For Each ace in Dacl
  1009.         If (Mid(ace.Trustee,InStrRev(ace.Trustee,"\")+1) = sGroupName) Then
  1010.             If(ace.AceType = ADS_ACETYPE_ACCESS_ALLOWED )Then
  1011.                 If (ace.accessmask AND 6) <> 0 then
  1012.                     set aceTemp = ace
  1013.                     aceTemp.accessmask = ace.accessmask AND 16777209
  1014.                     dacl.removeAce ace
  1015.                     sd.DiscretionaryAcl = dacl
  1016.                     sec.SetSecurityDescriptor sDriveID,1,sd,1
  1017.                     If (aceTemp.accessmask AND 1048575) <> 0 Then
  1018.                         dacl.AddAce aceTemp
  1019.                         sd.DiscretionaryAcl = dacl
  1020.                         sec.SetSecurityDescriptor sDriveID,1,sd,1
  1021.                     End If
  1022.                 End If
  1023.             End if
  1024.         End if
  1025.     Next
  1026.     
  1027.     Set ace  = Nothing
  1028.     Set sec  = Nothing
  1029.     Set sd   = Nothing
  1030.     Set Dacl = Nothing
  1031.  
  1032. End Function
  1033.  
  1034. ' ***
  1035. ' *** ------------------------------------------------------------------------------
  1036. ' *** Name:            GetAceStatus(sDriveID)
  1037. ' *** ------------------------------------------------------------------------------
  1038. ' *** Purpose:            Returns 1 If ACL is set for C: else returns 0 
  1039. ' *** ------------------------------------------------------------------------------
  1040. ' ***
  1041. Function GetAceStatus(sDriveID)
  1042.     If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
  1043.     
  1044.     Dim sec,sd, Dacl, ace,colGroups, oGroup, objSID 
  1045.     Dim bCreateFolder,bCreateFile
  1046.     GetAceStatus = 0
  1047.     bCreateFile = False
  1048.     bCreateFolder = False
  1049.  
  1050.     ' ~~~ Permission Type: Allow
  1051.     Const ADS_ACETYPE_ACCESS_ALLOWED = &h0
  1052.     
  1053.     Set sec = CreateObject("ADsSecurityUtility")
  1054.     Set sd = sec.GetSecurityDescriptor(sDriveID,1,1)
  1055.     Set Dacl = sd.DiscretionaryAcl
  1056.     
  1057.     Set objSID = oWMIService.Get("Win32_SID='" & "S-1-5-32-545" & "'")
  1058.     sGroupName = objSID.AccountName
  1059.     Set objSID = Nothing
  1060.  
  1061.     For Each ace in Dacl
  1062.         If (Mid(ace.Trustee,InStrRev(ace.Trustee,"\")+1) = sGroupName) Then
  1063.             If(ace.AceType = ADS_ACETYPE_ACCESS_ALLOWED )Then
  1064.                 If ((ace.accessmask AND 2) = 2 ) Then bCreateFile = True
  1065.                   If ((ace.accessmask AND 4) = 4 ) Then bCreateFolder = True
  1066.             End if
  1067.         End if
  1068.     Next
  1069.     
  1070.     If (bCreateFile = False) and (bCreateFolder = False) then
  1071.         GetAceStatus = 1
  1072.     End if
  1073.     Set ace  = Nothing
  1074.     Set sec  = Nothing
  1075.     Set sd   = Nothing
  1076.     Set Dacl = Nothing
  1077.  
  1078. End Function