' ' Author: tlviewer@yahoo.com ' script: EnumTypeLibs.vbs ' Description: enum the TypeLibs from the HKCR ' keywords: typelib dump enum clsid hive wbem ' ' Date : 06/21/03 ' option explicit dim machine, HKCR, hkey, key, Reg machine = "." HKCR = &H80000000 hkey = HKCR key = "TypeLib" 'on error resume next Set Reg = GetObject( _ "winmgmts:{impersonationLevel=impersonate}!\\" _ & machine & "\root\default:StdRegProv") ' returns an array containing names of subkeys ' under key dim subkeys, rtn, EnumKey dim subkeys1, subkeys2 rtn = Reg.EnumKey(hkey, key, subkeys) if rtn = 0 then EnumKey = subkeys else err.raise vbObjectError + rtn, "RegistryProvider: ", _ "Error returned attempting to enumerate keys under " _ & key & ": " & rtn wscript.quit 1 end if wscript.echo "key count=", ubound(EnumKey) ' HKEY_CLASSES_ROOT\TypeLib\{0A055C02-BABE-4480-BB7B-A8EC723CE9C0}\1.0\0\win32 dim i, j, pos, vallib, valpath ' loop over the GUID values for all registered TypeLibs for i = 0 to ubound(EnumKey) 'wscript.echo EnumKey(i) rtn = Reg.EnumKey(hkey, key & "\" & EnumKey(i), subkeys1) 'wscript.echo typename(subkeys1), " count=", ubound(subkeys1) ' a few typelibs are empty GUID's with no subkey collections, skip them if not typename(subkeys1) = "Null" then ' loop over the versions for j= 0 to ubound(subkeys1) ' sanity check: version must be a decimal value containing a decimal point! pos = instr(subkeys1(j),".") if pos < 1 then exit for ' /* end sanity check */ ' subkeys2(0) is the language code rtn = Reg.EnumKey(hkey, key & "\" & EnumKey(i) & "\" & subkeys1(j), subkeys2) if typename(subkeys2) = "Null" then wscript.echo "corrupt: no language code at ", EnumKey(i) exit for end if 'Reg.GetStringValue hkey, _ ' key & "\" & EnumKey(i) & "\" & subkeys1(0) & "\" & subkeys2(0)& "\" & "win32" , Null, val ' valib is the library name Reg.GetStringValue hkey, _ key & "\" & EnumKey(i) & "\" & subkeys1(j) , Null, vallib Reg.GetStringValue hkey, _ key & "\" & EnumKey(i) & "\" & subkeys1(j) & "\" & subkeys2(0)& "\" & "win32" , Null, valpath if not typename(valpath) = "Null" then WScript.Echo "[" & vallib & "] ", EnumKey(i)," ", valpath end if next else WScript.echo "null ", EnumKey(i) end if next