home *** CD-ROM | disk | FTP | other *** search
Wrap
' *** ' *** ------------------------------------------------------------------------------ ' *** Filename: Common.vbs ' *** ------------------------------------------------------------------------------ ' *** Description: The Shared Computer Toolkit for Windows XP Common file for HTA ' *** and Wsf functions ' *** ------------------------------------------------------------------------------ ' *** Version: 1.0 ' *** Notes: ' *** ------------------------------------------------------------------------------ ' *** Copyright (C) Microsoft Corporation 2005, All Rights Reserved ' *** ------------------------------------------------------------------------------ ' *** ' ~~~ ' ~~~ Force variables to be declared ' ~~~ Option Explicit ' ~~~ ------------------------------------------------------ ' ~~~ Build number ' ~~~ ------------------------------------------------------ Const BUILDNUMBER = "106" ' ~~~ ------------------------------------------------------ ' ~~~ URL for WGA check ' ~~~ ------------------------------------------------------ Const WGACHECKURL = "http://go.microsoft.com/fwlink/?LinkId=51033" ' ~~~ ------------------------------------------------------ ' ~~~ Title and Message Box text ' ~~~ ' ~~~ Tagged accordingly for localization ' ~~~ ' ~~~ ------------------------------------------------------ ' ~~~ ' ~~~ Declare global variables ' ~~~ Dim L_sToolkitTitle_TEXT, L_sAdminErrorMsg_TEXT Dim sCommonValidate, L_sCommonValidate1_TEXT, L_sCommonValidate2_TEXT, L_sTitleValidate_TEXT Dim L_PassTitle_TEXT, L_PassPolicy_TEXT, L_PassNote_TEXT, L_PassWarnTitle_TEXT, L_PassWarn_TEXT, L_DomainTitle_TEXT, L_DomainNote_TEXT Dim L_WDPblocked_TEXT, L_WDPblockedTitle_TEXT Dim L_sManageTitle_TEXT, L_sRestrictTitle_TEXT, L_sProtectDrives_TEXT Dim L_sLogOffLink_TEXT, L_sBeforeUnloadWarning_TEXT, L_sSafeModeErrorMsg_TEXT Dim L_sScriptingEngineFailure_TEXT, L_sWINNTFailure_TEXT, L_sWMIFailure_TEXT Const LANGCODE = "ENU" L_sToolkitTitle_TEXT = "Shared Computer Toolkit Version 1.0" L_sAdminErrorMsg_TEXT = "You have to be an administrator to use this tool." L_sSafeModeErrorMsg_TEXT = "This tool does not run while running in Safe Mode." ' ~~~ Used in Common.vbs L_sCommonValidate1_TEXT = "To use this tool, please take a moment to validate your genuine Microsoft Windows installation." L_sCommonValidate2_TEXT = "Validation assures that you are running an authentic and fully-licensed copy of Windows." sCommonValidate = L_sCommonValidate1_TEXT & Chr(13) & Chr(10) & Chr(10) & L_sCommonValidate2_TEXT L_sTitleValidate_TEXT = "Validation Required" ' ~~~ Used in Getting Started for the password test. L_PassTitle_TEXT = "Password Test Passed" L_PassPolicy_TEXT = "This computer has a password policy in place to help ensure strong passwords. Password test passed." L_PassNote_TEXT = "Could not guess the password on this account. Password test passed." L_PassWarnTitle_TEXT = "Password Test Failed - Security Warning" L_PassWarn_TEXT = "This account has an easily guessable password. The Toolkit administrator account should have a strong password. Change the password of this account before the computer is made available to others." L_DomainTitle_TEXT = "No Password Test for Domain Accounts" L_DomainNote_TEXT = "Password test is not performed on domain accounts." ' ~~~ Used by clsDiskProtect.vbs for script blocking error conditions L_WDPblockedTitle_TEXT = "Windows Disk Protection Script Blocked" L_WDPblocked_TEXT = "Allow WDP.CMD to execute through the script blocking tool and then click OK." ' ~~~ Used in UserAccounts.vbs for title. L_sManageTitle_TEXT = "Select an Account to Manage" L_sRestrictTitle_TEXT = "Select a Profile to Restrict" ' ~~~ Used in SelectDrives.hta for title L_sProtectDrives_TEXT = "Select Drives to Restrict" ' ~~~ Used in clsRestrictions.vbs L_sLogOffLink_TEXT = "- Log Off -" ' ~~~ Used in libHTA.vbs L_sBeforeUnloadWarning_TEXT = "Processing is underway - closing the tool now is not recommended. Click Ok to close the tool, or Cancel to continue processing." ' ~~~ Used in Common.vbs L_sScriptingEngineFailure_TEXT = "Windows Scripting might be missing or damaged... the Toolkit will not function properly. The following web page will help you fix this error: http://support.microsoft.com/kb/905288" L_sWINNTFailure_TEXT = "Unable to create the WinNT object... the Toolkit will not function properly." L_sWMIFailure_TEXT = "WMI might be missing or damaged... the Toolkit will not function properly. The following web page will help you fix this error: http://support.microsoft.com/kb/905287" ' ~~~ Declare common variables and constants Dim oShell, oNetwork, oWMIService, oFso, oWmiReg, oAccounts, sComputer Const TOOLKITKEY = "HKLM\Software\Microsoft\Shared Computer Toolkit\" Const HKEY_CURRENT_USER = &H80000001 Const HKEY_LOCAL_MACHINE = &H80000002 Const HKEY_USERS = &H80000003 ' ~~~ ------------------------------------------------------------------------------ ' ~~~ Description: DEBUG = True turns VBScript error messages on ' ~~~ DEBUG = False turns VBScript error messages off ' ~~~ ------------------------------------------------------------------------------ Dim DEBUG ' ~~~ DEBUG is set using registry value in Main() of libHTA.vbs DEBUG = False ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: CheckWGA() ' *** ------------------------------------------------------------------------------ ' *** Purpose: Runtime check for previously validated Windows ' *** messagebox:True Windows pop up message for hta ' *** messagebox:False script commandline message ' *** ------------------------------------------------------------------------------ ' *** Function CheckWGA(messagebox) Dim oLegit, strMsg, iResult ' ~~~ Turn on error checking to see if we can open LegitCheckControl.LegitCheck On Error Resume Next iResult = 2 Err.Clear Set oLegit = CreateObject("LegitCheckControl.LegitCheck") If Err.Number = 0 Then iResult = oLegit.LegitCheck Else Err.Clear End If ' ~~~ Turn off error handling - so we see any errors in the remainder of the script On Error Goto 0 If iResult <> 0 Then if messagebox = True Then MsgBox sCommonValidate, vbCritical, L_sTitleValidate_TEXT Else strMsg = sCommonValidate wscript.echo strMsg End If Call oShell.Run (WGACHECKURL) CheckWGA = False Else ' ~~~ Passed WGA check CheckWGA = True End If Set oLegit = Nothing End Function ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: IsAppRunning(AppName) ' *** ------------------------------------------------------------------------------ ' *** Purpose: This function checks the application status ' *** If the application is opened returns true else false ' *** ------------------------------------------------------------------------------ ' *** Function IsAppRunning(AppName) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim applen,strComputer,colProcesses,oProcess applen = len(AppName) strComputer = "." IsAppRunning = False Set colProcesses = oWMIService.ExecQuery _ ("SELECT * FROM Win32_Process WHERE Name='MSHTA.EXE'") For Each oProcess in colProcesses ' ~~~ Get the application name If AppName = left(Right(oProcess.CommandLine,applen+2),applen) Then IsAppRunning = True Exit Function End If Next End Function ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: InitialiseAllObjects() ' *** ------------------------------------------------------------------------------ ' *** Purpose: This function Initialises all the objects required ' *** ------------------------------------------------------------------------------ ' *** Sub InitialiseAllObjects() Dim bScriptEngineFailure, bWMIFailure, bWINNTFailure ' ~~~ Turn on error handling On Error Resume Next bScriptEngineFailure = False bWMIFailure = False bWINNTFailure = False ' ~~~ Create objects Set oShell = createobject("wscript.shell") If TypeName(oShell) <> "IWshShell3" Then bScriptEngineFailure = True Set oNetwork = CreateObject("Wscript.Network") If TypeName(oNetwork) <> "IWshNetwork2" Then bScriptEngineFailure = True Set oFso = CreateObject("Scripting.FileSystemObject") If TypeName(oFso) <> "FileSystemObject" Then bScriptEngineFailure = True sComputer = oNetwork.ComputerName Set oAccounts = GetObject("WinNT://" & sComputer & "") If TypeName(oAccounts) <> "Object" Then bWINNTFailure = True Set oWmiReg = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & "." & "\root\default:StdRegProv") If TypeName(oWmiReg) <> "SWbemObjectEx" Then bWMIFailure = True Set oWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2") If TypeName(oWMIService) <> "SWbemServicesEx" Then bWMIFailure = True If bScriptEngineFailure Then MsgBox L_sScriptingEngineFailure_TEXT, vbOKOnly + vbCritical, L_sToolkitTitle_TEXT call Self.Close Exit Sub End If If bWINNTFailure Then MsgBox L_sWINNTFailure_TEXT, vbOKOnly + vbCritical, L_sToolkitTitle_TEXT call Self.Close Exit Sub End If If bWMIFailure Then MsgBox L_sWMIFailure_TEXT, vbOKOnly + vbCritical, L_sToolkitTitle_TEXT call Self.Close Exit Sub End If On Error Goto 0 End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: UnLoadObjects() ' *** ------------------------------------------------------------------------------ ' *** Purpose: This function Uninitialises all the objects ' *** ------------------------------------------------------------------------------ ' *** Function UnLoadObjects() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Set oShell = Nothing Set oNetwork = Nothing Set oWMIService = Nothing Set oFso = Nothing Set oWmiReg = Nothing End Function ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: DomainMember() ' *** ------------------------------------------------------------------------------ ' *** Purpose: Determines if machine is a member of a Windows Domain ' *** ------------------------------------------------------------------------------ ' *** Function DomainMember() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim oComputer, oComputers Set oComputers = oWMIService.ExecQuery("Select DomainRole from Win32_ComputerSystem") For Each oComputer in oComputers If oComputer.DomainRole=1 Then DomainMember = True Else DomainMember = False End If Next End Function ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: IsAdministrator() ' *** ------------------------------------------------------------------------------ ' *** Purpose: Determines if the user is an administrator ' *** ------------------------------------------------------------------------------ ' *** Function IsAdministrator(bMessagebox) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim strKeyPath, bIsAdmin CONST KEY_SET_VALUE = &H0002 ' ~~~ Now check for error strKeyPath = Right((TOOLKITKEY),(Len(TOOLKITKEY) - 5)) oWmiReg.CheckAccess HKEY_LOCAL_MACHINE, strKeyPath, KEY_SET_VALUE, bIsAdmin ' ~~~ Display message If Not(bIsAdmin) Then If bMessagebox Then Call MsgBox(L_sAdminErrorMsg_TEXT, vbOKOnly + vbCritical, L_sToolkitTitle_TEXT) Else Wscript.echo L_sAdminErrorMsg_TEXT End If End If ' ~~~ Return setting IsAdministrator = bIsAdmin ' ~~~ Turn off error handling On Error Goto 0 End Function ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: InSafeMode() ' *** ------------------------------------------------------------------------------ ' *** Purpose: Determines if XP is in Safe Mode ' *** ------------------------------------------------------------------------------ ' *** Function InSafeMode(bMessagebox) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim bInSafeMode bInSafeMode = False ' ~~~ Create shell, attempt registry write, destroy shell If RegRead("HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Option\OptionValue") <> "" then bInSafeMode = True ' ~~~ Display message If bInSafeMode Then If bMessagebox Then Call MsgBox(L_sSafeModeErrorMsg_TEXT, vbOKOnly + vbCritical, L_sToolkitTitle_TEXT) Else Wscript.echo L_sSafeModeErrorMsg_TEXT End If End If ' ~~~ Return setting InSafeMode = bInSafeMode ' ~~~ Turn off error handling On Error Goto 0 End Function ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: RegDelete(sRegKey) ' *** ------------------------------------------------------------------------------ ' *** Purpose: Deletes a registry key. Deals with non-existent keys. ' *** ------------------------------------------------------------------------------ ' *** Function RegDelete(sRegKey) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 ' ~~~ Turn on error 'handling' On Error Resume Next ' ~~~ Attempt to delete key Call oShell.RegDelete(sRegKey) ' ~~~ If error, key does not exist, clear error If err.number <> 0 Then err.Clear ' ~~~ Turn off error handling On Error Goto 0 End Function ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: RegRead(strRegKeypath ) ' *** ------------------------------------------------------------------------------ ' *** Purpose: Reads a registry key using WMI. Deals with non-existent keys. ' *** ----------------------------------------------------------------------------- ' *** Function RegRead(strRegKeypath) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim sRegHive, sRegPath, sRegKey, iReturn Dim strValue, strNoValue, iCharStart, iCharEnd, arrValues, strTempValue iCharStart = InStr(strRegKeypath,"\") ' ~~~ Get HKLM\HKCU\HKU sRegHive = Left( strRegKeypath , iCharStart-1) iCharEnd = InStrRev(strRegKeypath,"\") ' ~~~ Store the registry key for which the value has to be read sRegKey = Right( strRegKeypath , Len(strRegKeypath) - iCharEnd) ' ~~~ Store the registry path sRegPath = Mid( strRegKeypath, iCharStart+1 , iCharEnd - iCharStart-1 ) Select Case sRegHive Case "HKLM", "HKEY_LOCAL_MACHINE" ' ~~~ Read from registry oWmiReg.GetDWORDValue HKEY_LOCAL_MACHINE,sRegPath,sRegKey,strValue If IsNull(strValue) then oWmiReg.GetStringValue HKEY_LOCAL_MACHINE,sRegPath,sRegKey,strValue If IsNull(strValue) then oWmiReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,sRegPath,sRegKey,strValue If IsNull(strValue) then iReturn = oWmiReg.GetMultiStringValue(HKEY_LOCAL_MACHINE,sRegPath,sRegKey,arrValues) If (iReturn = 0) And (Err.Number = 0) Then For Each strTempValue In arrValues strValue = strValue & "," & strTempValue Next strValue = strValue & "," If strValue = "," then strValue = NULL Else strValue = NULL End If End If Case "HKCU", "HKEY_CURRENT_USER" ' ~~~ Read from registry oWmiReg.GetDWORDValue HKEY_CURRENT_USER,sRegPath,sRegKey,strValue If IsNull(strValue) then oWmiReg.GetStringValue HKEY_CURRENT_USER,sRegPath,sRegKey,strValue If IsNull(strValue) then oWmiReg.GetExpandedStringValue HKEY_CURRENT_USER,sRegPath,sRegKey,strValue Case "HKU", "HKEY_USERS" ' ~~~ Read from registry oWmiReg.GetDWORDValue HKEY_USERS,sRegPath,sRegKey,strValue If IsNull(strValue) then oWmiReg.GetStringValue HKEY_USERS,sRegPath,sRegKey,strValue If IsNull(strValue) then oWmiReg.GetExpandedStringValue HKEY_USERS,sRegPath,sRegKey,strValue End Select ' ~~~ Return Result RegRead = strValue End Function ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: RegWrite(sRegKey, sValue, sType) ' *** ------------------------------------------------------------------------------ ' *** Purpose: Writes a registry key using WMI ' *** ------------------------------------------------------------------------------ ' *** Function RegWrite(sRegKey, sValue, sType) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim sRegHive, iCharStart, sRegKeyPath, sRegKeyName, iCharEnd, iReturn ' ~~~ Turn on error 'handling' On Error Resume Next iReturn = 0 iCharStart = InStr(sRegKey, "\") ' ~~~ Get HKLM\HKCU\HKU sRegHive = Left( sRegKey , iCharStart-1 ) iCharEnd = InStrRev( sRegKey, "\") ' ~~~ Store the reg key for which the value has to be updated sRegKeyName = Right( sRegKey, Len( sRegKey) - iCharEnd ) ' ~~~ Store the registry path of the key sRegKeyPath = Mid( sRegKey , iCharStart+1 , iCharEnd - iCharStart-1 ) Select Case sType Case "REG_SZ" If sRegHive = "HKLM" OR sRegHive = "HKEY_LOCAL_MACHINE" Then iReturn = oWmiReg.SetStringValue( HKEY_LOCAL_MACHINE, sRegKeyPath , sRegKeyName , sValue ) If iReturn <> 0 Then oWmiReg.CreateKey HKEY_LOCAL_MACHINE, sRegKeyPath oWmiReg.SetStringValue HKEY_LOCAL_MACHINE, sRegKeyPath , sRegKeyName , sValue End If ElseIf sRegHive = "HKCU" OR sRegHive = "HKEY_CURRENT_USER" Then iReturn = oWmiReg.SetStringValue( HKEY_CURRENT_USER, sRegKeyPath , sRegKeyName , sValue) If iReturn <> 0 Then oWmiReg.CreateKey HKEY_CURRENT_USER, sRegKeyPath oWmiReg.SetStringValue HKEY_CURRENT_USER, sRegKeyPath , sRegKeyName , sValue End If ElseIf sRegHive = "HKU" OR sRegHive = "HKEY_USERS" Then iReturn = oWmiReg.SetStringValue( HKEY_USERS, sRegKeyPath , sRegKeyName , sValue ) If iReturn <> 0 Then oWmiReg.CreateKey HKEY_USERS, sRegKeyPath oWmiReg.SetStringValue HKEY_USERS, sRegKeyPath , sRegKeyName , sValue End If End If Case "REG_MULTI_SZ" If sRegHive = "HKLM" OR sRegHive = "HKEY_LOCAL_MACHINE" Then iReturn = oWmiReg.SetMultiStringValue( HKEY_LOCAL_MACHINE, sRegKeyPath , sRegKeyName , sValue ) If iReturn <> 0 Then oWmiReg.CreateKey HKEY_LOCAL_MACHINE, sRegKeyPath oWmiReg.SetMultiStringValue HKEY_LOCAL_MACHINE, sRegKeyPath , sRegKeyName , sValue End If ElseIf sRegHive = "HKCU" OR sRegHive = "HKEY_CURRENT_USER" Then iReturn = oWmiReg.SetMultiStringValue( HKEY_CURRENT_USER, sRegKeyPath , sRegKeyName , sValue) If iReturn <> 0 Then oWmiReg.CreateKey HKEY_CURRENT_USER, sRegKeyPath oWmiReg.SetMultiStringValue HKEY_CURRENT_USER, sRegKeyPath , sRegKeyName , sValue End If ElseIf sRegHive = "HKU" OR sRegHive = "HKEY_USERS" Then iReturn = oWmiReg.SetMultiStringValue( HKEY_USERS, sRegKeyPath , sRegKeyName , sValue ) If iReturn <> 0 Then oWmiReg.CreateKey HKEY_USERS, sRegKeyPath oWmiReg.SetMultiStringValue HKEY_USERS, sRegKeyPath , sRegKeyName , sValue End If End If Case "REG_EXPAND_SZ" If sRegHive = "HKLM" OR sRegHive = "HKEY_LOCAL_MACHINE" Then iReturn = oWmiReg.SetExpandedStringValue( HKEY_LOCAL_MACHINE, sRegKeyPath , sRegKeyName , sValue) If iReturn <> 0 Then oWmiReg.CreateKey HKEY_LOCAL_MACHINE, sRegKeyPath oWmiReg.SetExpandedStringValue HKEY_LOCAL_MACHINE, sRegKeyPath , sRegKeyName , sValue End If ElseIf sRegHive = "HKCU" OR sRegHive = "HKEY_CURRENT_USER" Then iReturn = oWmiReg.SetExpandedStringValue( HKEY_CURRENT_USER, sRegKeyPath , sRegKeyName , sValue ) If iReturn <> 0 Then oWmiReg.CreateKey HKEY_CURRENT_USER, sRegKeyPath oWmiReg.SetExpandedStringValue HKEY_CURRENT_USER, sRegKeyPath , sRegKeyName , sValue End If ElseIf sRegHive = "HKU" OR sRegHive = "HKEY_USERS" Then iReturn = oWmiReg.SetExpandedStringValue( HKEY_USERS, sRegKeyPath , sRegKeyName , sValue ) If iReturn <> 0 Then oWmiReg.CreateKey HKEY_USERS, sRegKeyPath oWmiReg.SetExpandedStringValue HKEY_USERS, sRegKeyPath , sRegKeyName , sValue End If End If Case "REG_DWORD" If Not(IsNumeric(sValue)) Then sValue="0" If sRegHive = "HKLM" OR sRegHive = "HKEY_LOCAL_MACHINE" Then iReturn = oWmiReg.SetDWORDValue( HKEY_LOCAL_MACHINE, sRegKeyPath , sRegKeyName , Int(sValue) ) If iReturn <> 0 Then oWmiReg.CreateKey HKEY_LOCAL_MACHINE, sRegKeyPath oWmiReg.SetDWORDValue HKEY_LOCAL_MACHINE, sRegKeyPath , sRegKeyName , Int(sValue) End If ElseIf sRegHive = "HKCU" OR sRegHive = "HKEY_CURRENT_USER" Then iReturn = oWmiReg.SetDWORDValue( HKEY_CURRENT_USER, sRegKeyPath , sRegKeyName , Int(sValue) ) If iReturn <> 0 Then oWmiReg.CreateKey HKEY_CURRENT_USER, sRegKeyPath oWmiReg.SetDWORDValue HKEY_CURRENT_USER, sRegKeyPath , sRegKeyName , Int(sValue) End If ElseIf sRegHive = "HKU" OR sRegHive = "HKEY_USERS" Then iReturn = oWmiReg.SetDWORDValue( HKEY_USERS, sRegKeyPath , sRegKeyName , Int(sValue)) If iReturn <> 0 Then oWmiReg.CreateKey HKEY_USERS, sRegKeyPath oWmiReg.SetDWORDValue HKEY_USERS, sRegKeyPath , sRegKeyName , Int(sValue) End If End If Case "REG_BINARY" If sRegHive = "HKLM" OR sRegHive = "HKEY_LOCAL_MACHINE" Then iReturn = oWmiReg.SetBinaryValue( HKEY_LOCAL_MACHINE, sRegKeyPath , sRegKeyName , sValue ) If iReturn <> 0 Then oWmiReg.CreateKey HKEY_LOCAL_MACHINE, sRegKeyPath oWmiReg.SetBinaryValue HKEY_LOCAL_MACHINE, sRegKeyPath , sRegKeyName , sValue End If ElseIf sRegHive = "HKCU" OR sRegHive = "HKEY_CURRENT_USER" Then iReturn = oWmiReg.SetBinaryValue( HKEY_CURRENT_USER, sRegKeyPath , sRegKeyName , sValue ) If iReturn <> 0 Then oWmiReg.CreateKey HKEY_CURRENT_USER, sRegKeyPath oWmiReg.SetBinaryValue HKEY_CURRENT_USER, sRegKeyPath , sRegKeyName , sValue End If ElseIf sRegHive = "HKU" OR sRegHive = "HKEY_USERS" Then iReturn = oWmiReg.SetBinaryValue( HKEY_USERS, sRegKeyPath , sRegKeyName , sValue) If iReturn <> 0 Then oWmiReg.CreateKey HKEY_USERS, sRegKeyPath oWmiReg.SetBinaryValue HKEY_USERS, sRegKeyPath , sRegKeyName , sValue End If End If End Select End Function