Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


Vbsript Registry Default Value Type Query

  • Please log in to reply
No replies to this topic

#1 PropagandaPanda


  • Malware Response Team
  • 10,433 posts
  • Gender:Male
  • Local time:10:43 AM

Posted 23 January 2009 - 05:11 PM


I am writting a script that involves quering the registry.

I am using this function to query the value types:
Function ReadTheRegistryValueType (Hive, Path, Value)
IF Hive = "HKLM" then
	oReg.EnumValues Hkey_Local_Machine, Path, arrRegistryValueNames, arrRegistryValueTypes
	oReg.EnumValues Hkey_Current_User, Path, arrRegistryValueNames, arrRegistryValueTypes
End If 'Which Hive
IF IsArray(arrRegistryValueNames) then

	For i=0 To UBound(arrRegistryValueNames)
		IF arrRegistryValueNames(i) = Value then
		Select Case arrRegistryValueTypes(i)
		Case 1
			RegistryValueType = "String"
		Case 2
			RegistryValueType = "String"
		Case 3
			RegistryValueType = "Binary"
		Case 4
			RegistryValueType = "DWORD"
		Case 7
			RegistryValueType = "MultiString"
		Case Else
			RegistryValueType = "ERROR"
	End Select 
		End If 'Value found under key
	Next 'For i=0 To UBound(arrValueNames)
End If 'Is arrary
End Function 'IsRegistryValueTypeStringValue
Perhaps not the most effective way, but it works.

It works for the default value too. However, if the default value is the only under the key, it is not listed under the array, thus it fails.

Is there another way to query the default value type?

Thanks for any input.

With Regards,
The Panda

BC AdBot (Login to Remove)


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users