百度首页 | 百度空间
 
查看文章
 
检测注册表中的ProgID信息
2008年07月25日 星期五 下午 06:26

'例如输入wscript.shell就可以查询

'要用到regtool.ocx,请下载http://www.haiyangtop.net/regtool.ocx,用前请regsvr32   regtool.ocx

' 我们需要这个对象来访问注册表!
set wshshell = CreateObject("WScript.Shell")
    '我们需要这个自定义对象列举子键,确定你安装了这个com对象
set registry = CreateObject("regtool.tob")
     '我们需要这个对象创建一份文本文件
' 输出调查结果:
set fs = CreateObject("Scripting.FileSystemObject")
name = InputBox("Type in the ProgID of the Object you are interestedin!")
keyA = "HKCR\" & name & "\"
' 检查这个对象是否注册
objectname = ReadKey(keyA, ok)
if not ok then
MsgBox name & " was not found."
WScript.Quit
end if
' 创建一个记录文件:
outputfile = "C:\OBJECT.TXT"
set output = fs.CreateTextFile(outputfile, true)
Print name & ": " & objectname
' 找出当前版本
curver = ReadKey(keyA & "CurVer\", ok)
clsid = ReadKey(keyA & "CLSID\", ok)
keyB = "HKCR\CLSID\" & clsid & "\"
physfile = ReadKey(keyB & "InprocServer32\", ok)
vidpid = ReadKey(keyB & "VersionIndependentProgID\", ok)
typelib = ReadKey(keyB & "TypeLib\", ok)
Print "Generic ProgID: " & vidpid
Print "Physical File: " & physfile
Print "File Version Information: " & GetVersion(physfile)
Print "Current Version: " & curver
Print "Class-ID: " & clsid
Print "TypeLibrary ClassID: " & typelib
keyC = "HKCR\Component Categories\"
Print "Kind of Object:"
cats = ReadKey(keyB & "Implemented Categories\", ok)
if ok then
set categories = registry.RegEnum(keyB _
& "Implemented Categories\")
for each cat in categories
catKey = keyC & cat & "\"
if KeyExists(catKey) then
set entries = registry.ListChildNames(catKey)
for each entry in entries
if entry<>"" then Print ReadKey(catKey _
& entry, ok)
next
else
Print "Category information is missing!"
end if
next
else
Print "No Category Information"
end if
cats = ReadKey(keyB & "Required Categories\", ok)
if ok then
set categories = registry.RegEnum(keyB _
& "Required Categories\")
for each cat in categories
catKey = keyC & cat & "\"
if KeyExists(catKey) then
set entries = registry.ListChildNames(catKey)
for each entry in entries
if entry<>"" then Print ReadKey(catKey _
& entry, ok)
next
else
Print "Category information is missing!"
end if
next
else
Print "No Required Categories"
end if
keyD = "HKCR\TypeLib\" & typelib & "\"
if typelib="" then
Print "No TypeLib available. Use physical file " _
& "and search application folder."
else
set typelibs = registry.RegEnum(keyD)
for each typelib in typelibs
if typelib<>"" then Print "TypeLib Version " _
& typelib & ": " & ReadKey(keyD & typelib _
& "\0\win32\", ok)
next
end if
' 关闭记录并且显示
output.close
wshshell.run outputfile
function KeyExists(key)
on error resume next
check = wshshell.RegRead(key)
if not err.Number=0 then
KeyExists = false
else
KeyExists = true
end if
end function
function ReadKey(key, status)
on error resume next
ReadKey = wshshell.RegRead(key)
if not err.Number=0 then
value=""
err.clear
status=false
else
status=true
end if
end function
sub Print(text)
'写信息到记录文件
output.WriteLine text
end sub
function GetVersion(path)
on error resume next
GetVersion = fs.GetFileVersion(path)
if not err=0 then
err.clear
GetVersion = -1
end if
end function


类别:每天一例 | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码:
 

     

©2008 Baidu