UncleFather » 26 май 2009 10:47, Вт
Продолжение:
Код: Выделить всё
'**********************************************************************
'* Routine: CreateString
'**********************************************************************
Sub CreateString(Line)
Dim ColEntries,Entry,strValueName,strValue
Set ColEntries = objRegExp.Execute(Line)
For Each Entry in ColEntries
strValueName = Mid(Entry.SubMatches(0),2,Len(Trim(Entry.Submatches(0)))-4)
strValue = Mid(Entry.SubMatches(1),1,Len(Trim(Entry.Submatches(1)))-1)
objRegistry.SetStringValue objDictionary(strKey),strKeyPath,strValueName,strValue
Next
End Sub
'**********************************************************************
'* Routine: CreateBinary
'**********************************************************************
Sub CreateBinary(Line)
Dim arrValue(),ColEntries,Entry,strValueName,arrHexValue,i,HexVal
Set ColEntries = objRegExp.Execute(Line)
For Each Entry in ColEntries
strValueName = Mid(Entry.SubMatches(0),2,Len(Trim(Entry.Submatches(0)))-7)
'Use the split function to create an array so that each hex value can be
'appended with an &h value in the next For Each statement
arrHexValue = Split(Trim(Entry.SubMatches(1)),",")
'Declare a dynamic array to hold the properly formatted hex values to
'be passed to the WMI SetBinaryValue method.
i=0
For Each HexVal in arrHexValue
Redim Preserve arrValue(i)
arrValue(i) = "&h" & HexVal
i=i + 1
Next
objRegistry.SetBinaryValue objDictionary(strKey),strKeyPath,strValueName,arrValue
Redim arrValue(0)
Next
End Sub
'**********************************************************************
'* Routine: CreateDWORD
'**********************************************************************
Sub CreateDWORD(Line)
Dim ColEntries,Entry,strValueName,intValue
Set ColEntries = objRegExp.Execute(Line)
For Each Entry in ColEntries
strValueName = Mid(Entry.Submatches(0),2,Len(Trim(Entry.Submatches(0)))-9)
'Convert the hex value that will be passed to the WMI
'SetDWORDValue method, to a decimal data type
intValue = CInt("&h" & Trim(Entry.SubMatches(1)))
objRegistry.SetDWORDValue objDictionary(strKey),strKeyPath,strValueName,intValue
Next
End Sub
'**********************************************************************
'* Routine: CreateExpString
'**********************************************************************
Sub CreateExpString(Line)
Dim arrValue(),ColEntries,Entry,strValueName,strValueFirstLine
Dim strValueMiddleLines,strValueLastLine,strExpandableString,HexVal
Dim strExpandableStringFormatted,arrItems
Set ColEntries = objRegExp.Execute(Line)
For Each Entry in ColEntries
strValueName = Mid(Entry.SubMatches(0),2,Len(Trim(Entry.Submatches(0)))-10)
strValueFirstLine = Trim(Entry.SubMatches(1))
Next
'Read another line to test for data that might belong to an expandable string entry
strLine = objTextStream.ReadLine
Продолжение:[code]
'**********************************************************************
'* Routine: CreateString
'**********************************************************************
Sub CreateString(Line)
Dim ColEntries,Entry,strValueName,strValue
Set ColEntries = objRegExp.Execute(Line)
For Each Entry in ColEntries
strValueName = Mid(Entry.SubMatches(0),2,Len(Trim(Entry.Submatches(0)))-4)
strValue = Mid(Entry.SubMatches(1),1,Len(Trim(Entry.Submatches(1)))-1)
objRegistry.SetStringValue objDictionary(strKey),strKeyPath,strValueName,strValue
Next
End Sub
'**********************************************************************
'* Routine: CreateBinary
'**********************************************************************
Sub CreateBinary(Line)
Dim arrValue(),ColEntries,Entry,strValueName,arrHexValue,i,HexVal
Set ColEntries = objRegExp.Execute(Line)
For Each Entry in ColEntries
strValueName = Mid(Entry.SubMatches(0),2,Len(Trim(Entry.Submatches(0)))-7)
'Use the split function to create an array so that each hex value can be
'appended with an &h value in the next For Each statement
arrHexValue = Split(Trim(Entry.SubMatches(1)),",")
'Declare a dynamic array to hold the properly formatted hex values to
'be passed to the WMI SetBinaryValue method.
i=0
For Each HexVal in arrHexValue
Redim Preserve arrValue(i)
arrValue(i) = "&h" & HexVal
i=i + 1
Next
objRegistry.SetBinaryValue objDictionary(strKey),strKeyPath,strValueName,arrValue
Redim arrValue(0)
Next
End Sub
'**********************************************************************
'* Routine: CreateDWORD
'**********************************************************************
Sub CreateDWORD(Line)
Dim ColEntries,Entry,strValueName,intValue
Set ColEntries = objRegExp.Execute(Line)
For Each Entry in ColEntries
strValueName = Mid(Entry.Submatches(0),2,Len(Trim(Entry.Submatches(0)))-9)
'Convert the hex value that will be passed to the WMI
'SetDWORDValue method, to a decimal data type
intValue = CInt("&h" & Trim(Entry.SubMatches(1)))
objRegistry.SetDWORDValue objDictionary(strKey),strKeyPath,strValueName,intValue
Next
End Sub
'**********************************************************************
'* Routine: CreateExpString
'**********************************************************************
Sub CreateExpString(Line)
Dim arrValue(),ColEntries,Entry,strValueName,strValueFirstLine
Dim strValueMiddleLines,strValueLastLine,strExpandableString,HexVal
Dim strExpandableStringFormatted,arrItems
Set ColEntries = objRegExp.Execute(Line)
For Each Entry in ColEntries
strValueName = Mid(Entry.SubMatches(0),2,Len(Trim(Entry.Submatches(0)))-10)
strValueFirstLine = Trim(Entry.SubMatches(1))
Next
'Read another line to test for data that might belong to an expandable string entry
strLine = objTextStream.ReadLine[/code]