On WinXP (there is no other Windows in my VMWare Player :) you can do it with Ruby in the next way:
require 'win32/registry'
Win32::Registry::HKEY_CLASSES_ROOT.open( 'CLSID{083863F1-70DE-11d0-BD40-00A0C911CE86}\Instance' ) do |reg| reg.each_key do |key| val = reg.open(key) puts val['FriendlyName'] end end
But what about extended information, aah? I'm talking about script which shows additional data such as CLSID and codec location. With IronRuby it can be done so easy.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | require 'mscorlib'
require 'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
require 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
Application = System::Windows::Forms::Application
Button = System::Windows::Forms::Button
ColumnHeader = System::Windows::Forms::ColumnHeader
DockStyle = System::Windows::Forms::DockStyle
Font = System::Drawing::Font
FontStyle = System::Drawing::FontStyle
Form = System::Windows::Forms::Form
FormBorderStyle = System::Windows::Forms::FormBorderStyle
FormStartPosition = System::Windows::Forms::FormStartPosition
Icon = System::Drawing::Icon
Label = System::Windows::Forms::Label
ListView = System::Windows::Forms::ListView
MainMenu = System::Windows::Forms::MainMenu
MenuItem = System::Windows::Forms::MenuItem
MessageBox = System::Windows::Forms::MessageBox
MessageBoxBittons = System::Windows::Forms::MessageBoxButtons
MessageBoxIcon = System::Windows::Forms::MessageBoxIcon
PictureBox = System::Windows::Forms::PictureBox
PictureBoxSizeMode = System::Windows::Forms::PictureBoxSizeMode
Point = System::Drawing::Point
Registry = Microsoft::Win32::Registry
Shortcut = System::Windows::Forms::Shortcut
Size = System::Drawing::Size
SortOrder = System::Windows::Forms::SortOrder
StatusBar = System::Windows::Forms::StatusBar
View = System::Windows::Forms::View
class Frm < Form
def initialize
#this path keeps codecs CLSIDs and names
@reg = 'CLSID\{083863F1-70DE-11d0-BD40-00A0C911CE86}\Instance'
self.InitializeComponent()
end
def InitializeComponent()
@mnuMain = MainMenu.new()
@mnuFile = MenuItem.new()
@mnuScan = MenuItem.new()
@mnuExit = MenuItem.new()
@mnuView = MenuItem.new()
@mnuSBar = MenuItem.new()
@mnuHelp = MenuItem.new()
@mnuInfo = MenuItem.new()
@lvCodec = ListView.new()
@chNames = ColumnHeader.new()
@chClsid = ColumnHeader.new()
@chItems = ColumnHeader.new()
@sbCount = StatusBar.new()
#
#mnuMain
#
[@mnuFile, @mnuView, @mnuHelp].each {|item| @mnuMain.MenuItems.Add item}
#
#mnuFile
#
[@mnuScan, @mnuExit].each {|item| @mnuFile.MenuItems.Add item}
@mnuFile.Text = '&File'
#
#mnuScan
#
@mnuScan.Shortcut = Shortcut.F5
@mnuScan.Text = '&Scan...'
@mnuScan.Click {|sender, e| mnuScan_Click(sender, e)}
#
#mnuExit
#
@mnuExit.Shortcut = Shortcut.CtrlX
@mnuExit.Text = 'E&xit'
@mnuExit.Click {|sender, e| mnuExit_Click(sender, e)}
#
#mnuView
#
@mnuView.MenuItems.Add @mnuSBar
@mnuView.Text = '&View'
#
#mnuSBar
#
@mnuSBar.Checked = true
@mnuSBar.Text = '&Show Status Bar'
@mnuSBar.Click {|sender, e| mnuSBar_Click(sender, e)}
#
#mnuHelp
#
@mnuHelp.MenuItems.Add @mnuInfo
@mnuHelp.Text = '&Help'
#
#mnuInfo
#
@mnuInfo.Text = 'About'
@mnuInfo.Click {|sender, e| mnuInfo_Click(sender, e)}
#
#lvCodec
#
@lvCodec.AllowColumnReorder = true
[@chNames, @chClsid, @chItems].each {|item| @lvCodec.Columns.Add item}
@lvCodec.Dock = DockStyle.Fill
@lvCodec.FullRowSelect = true
@lvCodec.GridLines = true
@lvCodec.MultiSelect = false
@lvCodec.Sorting = SortOrder.Ascending
@lvCodec.View = View.Details
#
#chNames
#
@chNames.Text = 'Name'
@chNames.Width = 183
#
#chClsid
#
@chClsid.Text = 'CLSID'
@chClsid.Width = 239
#
#chItems
#
@chItems.Text = 'Module'
@chItems.Width = 250
#
#sbCount
#
@sbCount.SizingGrip = false
#
#Frm
#
self.ClientSize = Size.new(573, 217)
[@lvCodec, @sbCount].each {|item| self.Controls.Add item}
self.Menu = @mnuMain
self.StartPosition = FormStartPosition.CenterScreen
self.Text = 'Codecs'
self.Load {|sender, e| frmMain_Load(sender, e)}
end
def mnuScan_Click(sender, e)
#clear before each scanning
@lvCodec.Items.Clear()
#loading info
rk = Registry.ClassesRoot
rk.OpenSubKey(@reg).GetSubKeyNames().each do |sub|
#name(s) of codec(s)
item = @lvCodec.Items.Add(rk.OpenSubKey(@reg + '\\' + sub).GetValue('FriendlyName'))
#CLSID
item.SubItems.Add(sub)
#looking for module(s) of codec(s)
item.SubItems.Add(rk.OpenSubKey('CLSID\\' + sub + '\\InprocServer32').GetValue(''))
end
#totaly
@sbCount.Text = @lvCodec.Items.Count.ToString() + ' item(s)'
end
def mnuExit_Click(sender, e)
Application.exit
end
def mnuSBar_Click(sender, e)
bln =! @mnuSBar.Checked
@mnuSBar.Checked = bln
@sbCount.Visible = bln
end
def mnuInfo_Click(sender, e)
FrmA.new().ShowDialog()
end
def frmMain_Load(sender, e)
@sbCount.Text = '0 item(s)'
end
end
class FrmA < Form
def initialize
self.InitializeComponent()
end
def InitializeComponent()
@pbImage = PictureBox.new()
@lblName = Label.new()
@lblCopy = Label.new()
@btnExit = Button.new()
#
#pbImage
#
@pbImage.Location = Point.new(16, 16)
@pbImage.Size = Size.new(32, 32)
@pbImage.SizeMode = PictureBoxSizeMode.StretchImage
#
#lblName
#
@lblName.Font = Font.new('Microsoft Sans Serif', 9, FontStyle.Bold)
@lblName.Location = Point.new(53, 19)
@lblName.Size = Size.new(360, 18)
@lblName.Text = 'Codecs v1.00'
#
#lblCopy
#
@lblCopy.Location = Point.new(55, 37)
@lblCopy.Size = Size.new(360, 23)
@lblCopy.Text = '(C) 2012 Grigori Zakharov gregzakh@gmail.com'
#
#btnExit
#
@btnExit.Location = Point.new(135, 67)
@btnExit.Text = 'OK'
#
#FrmA
#
self.AcceptButton = @btnExit
self.CancelButton = @btnExit
self.ClientSize = Size.new(350, 110)
[@pbImage, @lblName, @lblCopy, @btnExit].each {|item| self.Controls.Add item}
self.ControlBox = false
self.FormBorderStyle = FormBorderStyle.FixedSingle
self.ShowInTaskbar = false
self.StartPosition = FormStartPosition.CenterParent
self.Text = 'About...'
self.Load {|sender, e| frmAbout_Load(sender, e)}
end
def frmAbout_Load(sender, e)
begin
icon = Icon
@pbImage.Image = self.icon.ToBitmap()
rescue Exception => e
MessageBox.Show(e.Message, self.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop)
end
end
end
Application.enable_visual_styles
Application.run Frm.new()
|