generated some WMI managed classes using the downloadable extensions for
vs2003 from mircrosoft downloads; wrote some test code to enumerate the
physicall processors and it works a treat, but a question..
The code fails with the error that:
"Additional information: COM object that has been separated from its
underlying RCW can not be used." if I make a call to pc.Count before
iterating though the objects.
Dim d As New ROOT.CIMV2.Proc essor
Dim pc As ROOT.CIMV2.Proc essor.Processor Collection
pc = d.GetInstances( )
Console.WriteLi ne(pc.Count()) 'PUT THIS LINE HERE AND IT FAILS
For Each d In pc
Console.WriteLi ne(d.Name)
Next
Console.WriteLi ne(pc.Count()) 'MOVE THE Count() Call to HERE and it works
------------------
I find this bizare as the underlying class impliments
System.Collecti ons.IEnumerator so it's not like its a forward only recordset
or anything.. can someone shed some insight for my learning?
The full generated code is below for the namespace for reference should
anyone be that die-hard but I imagine you can answer my question without
looking at it..
cheers,
ewart.
Imports System
Imports System.Componen tModel
Imports System.Manageme nt
Imports System.Collecti ons
Imports System.Globaliz ation
Imports System.Componen tModel.Design.S erialization
Imports System.Reflecti on
Namespace ROOT.CIMV2
'Functions ShouldSerialize <PropertyName > are functions used by VS property
browser to check if a particular property has to be serialized. These
functions are added for all ValueType properties ( properties of type Int32,
BOOL etc.. which cannot be set to null). These functions use
Is<PropertyName >Null function. These functions are also used in the
TypeConerter implementation for the properties to check for NULL value
of property so that an empty value can be shown in Property browser in case
of Drag and Drop in Visual studio.
'Functions Is<PropertyName >Null() are used to check if a property is NULL.
'Functions Reset<PropertyN ame> are added for Nullable Read/Write properties.
These functions are used by VS designer in property browser to set a
property to NULL.
'Every property added to the class for WMI property has attributes set to
define its behavior in Visual Studio designer and also to define a
TypeConverter to be used.
'Datetime conversion functions ToDateTime and ToDmtfDateTime are added to
the class to convert DMTF datetime to System.DateTime and vice-versa.
'An Early Bound class generated for the WMI class.Win32_Pro cessor
Public Class Processor
Inherits System.Componen tModel.Componen t
'Private property to hold the WMI namespace in which the class resides.
Private Shared CreatedWmiNames pace As String = "ROOT\CIMV2 "
'Private property to hold the name of WMI class which created this class.
Private Shared CreatedClassNam e As String = "Win32_Processo r"
'Private member variable to hold the ManagementScope which is used by the
various methods.
Private Shared statMgmtScope As System.Manageme nt.ManagementSc ope = Nothing
Private PrivateSystemPr operties As ManagementSyste mProperties
'Underlying lateBound WMI object.
Private PrivateLateBoun dObject As System.Manageme nt.ManagementOb ject
'Member variable to store the 'automatic commit' behavior for the class.
Private AutoCommitProp As Boolean = true
'Private variable to hold the embedded property representing the instance.
Private embeddedObj As System.Manageme nt.ManagementBa seObject
'The current WMI object used
Private curObj As System.Manageme nt.ManagementBa seObject
'Flag to indicate if the instance is an embedded object.
Private isEmbedded As Boolean = false
'Below are different overloads of constructors to initialize an instance of
the class with a WMI object.
Public Sub New()
Me.New(CType(No thing,System.Ma nagement.Manage mentScope),
CType(Nothing,S ystem.Managemen t.ManagementPat h),
CType(Nothing,S ystem.Managemen t.ObjectGetOpti ons))
End Sub
Public Sub New(ByVal keyDeviceID As String)
Me.New(CType(No thing,System.Ma nagement.Manage mentScope), CType(New
System.Manageme nt.ManagementPa th(Processor.Co nstructPath(key DeviceID)),Syst e
m.Management.Ma nagementPath),
CType(Nothing,S ystem.Managemen t.ObjectGetOpti ons))
End Sub
Public Sub New(ByVal mgmtScope As System.Manageme nt.ManagementSc ope, ByVal
keyDeviceID As String)
Me.New(CType(mg mtScope,System. Management.Mana gementScope), CType(New
System.Manageme nt.ManagementPa th(Processor.Co nstructPath(key DeviceID)),Syst e
m.Management.Ma nagementPath),
CType(Nothing,S ystem.Managemen t.ObjectGetOpti ons))
End Sub
Public Sub New(ByVal path As System.Manageme nt.ManagementPa th, ByVal
getOptions As System.Manageme nt.ObjectGetOpt ions)
Me.New(CType(No thing,System.Ma nagement.Manage mentScope),
CType(path,Syst em.Management.M anagementPath),
CType(getOption s,System.Manage ment.ObjectGetO ptions))
End Sub
Public Sub New(ByVal mgmtScope As System.Manageme nt.ManagementSc ope, ByVal
path As System.Manageme nt.ManagementPa th)
Me.New(CType(mg mtScope,System. Management.Mana gementScope),
CType(path,Syst em.Management.M anagementPath),
CType(Nothing,S ystem.Managemen t.ObjectGetOpti ons))
End Sub
Public Sub New(ByVal path As System.Manageme nt.ManagementPa th)
Me.New(CType(No thing,System.Ma nagement.Manage mentScope),
CType(path,Syst em.Management.M anagementPath),
CType(Nothing,S ystem.Managemen t.ObjectGetOpti ons))
End Sub
Public Sub New(ByVal mgmtScope As System.Manageme nt.ManagementSc ope, ByVal
path As System.Manageme nt.ManagementPa th, ByVal getOptions As
System.Manageme nt.ObjectGetOpt ions)
MyBase.New
If (Not (path) Is Nothing) Then
If (CheckIfProperC lass(mgmtScope, path, getOptions) <> true) Then
Throw New System.Argument Exception("Clas s name does not match.")
End If
End If
PrivateLateBoun dObject = New System.Manageme nt.ManagementOb ject(mgmtScope,
path, getOptions)
PrivateSystemPr operties = New
ManagementSyste mProperties(Pri vateLateBoundOb ject)
curObj = PrivateLateBoun dObject
End Sub
Public Sub New(ByVal theObject As System.Manageme nt.ManagementOb ject)
MyBase.New
If (CheckIfProperC lass(theObject) = true) Then
PrivateLateBoun dObject = theObject
PrivateSystemPr operties = New
ManagementSyste mProperties(Pri vateLateBoundOb ject)
curObj = PrivateLateBoun dObject
Else
Throw New System.Argument Exception("Clas s name does not match.")
End If
End Sub
Public Sub New(ByVal theObject As System.Manageme nt.ManagementBa seObject)
MyBase.New
If (CheckIfProperC lass(theObject) = true) Then
embeddedObj = theObject
PrivateSystemPr operties = New ManagementSyste mProperties(the Object)
curObj = embeddedObj
isEmbedded = true
Else
Throw New System.Argument Exception("Clas s name does not match.")
End If
End Sub
'Property returns the namespace of the WMI class.
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property OriginatingName space As String
Get
Return "ROOT\CIMV2 "
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property ManagementClass Name As String
Get
Dim strRet As String = CreatedClassNam e
If (Not (curObj) Is Nothing) Then
If (Not (curObj.ClassPa th) Is Nothing) Then
strRet = CType(curObj("_ _CLASS"),String )
If ((strRet Is Nothing) _
OrElse (strRet Is System.String.E mpty)) Then
strRet = CreatedClassNam e
End If
End If
End If
Return strRet
End Get
End Property
'Property pointing to an embedded object to get System properties of the WMI
object.
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property SystemPropertie s As ManagementSyste mProperties
Get
Return PrivateSystemPr operties
End Get
End Property
'Property returning the underlying lateBound object.
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property LateBoundObject As
System.Manageme nt.ManagementBa seObject
Get
Return curObj
End Get
End Property
'ManagementScop e of the object.
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public Property Scope As System.Manageme nt.ManagementSc ope
Get
If (isEmbedded = false) Then
Return PrivateLateBoun dObject.Scope
Else
Return Nothing
End If
End Get
Set
If (isEmbedded = false) Then
PrivateLateBoun dObject.Scope = value
End If
End Set
End Property
'Property to show the commit behavior for the WMI object. If true, WMI
object will be automatically saved after each property modification.(i e.
Put() is called after modification of a property).
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public Property AutoCommit As Boolean
Get
Return AutoCommitProp
End Get
Set
AutoCommitProp = value
End Set
End Property
'The ManagementPath of the underlying WMI object.
<Browsable(true )> _
Public Property Path As System.Manageme nt.ManagementPa th
Get
If (isEmbedded = false) Then
Return PrivateLateBoun dObject.Path
Else
Return Nothing
End If
End Get
Set
If (isEmbedded = false) Then
If (CheckIfProperC lass(Nothing, value, Nothing) <> true) Then
Throw New System.Argument Exception("Clas s name does not match.")
End If
PrivateLateBoun dObject.Path = value
End If
End Set
End Property
'Public static scope property which is used by the various methods.
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public Shared Property StaticScope As System.Manageme nt.ManagementSc ope
Get
Return statMgmtScope
End Get
Set
statMgmtScope = value
End Set
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsAddressWidthN ull As Boolean
Get
If (curObj("Addres sWidth") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Pr ocessor address width in bits."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property AddressWidth As System.UInt16
Get
If (curObj("Addres sWidth") Is Nothing) Then
Return System.Convert. ToUInt16(0)
End If
Return CType(curObj("A ddressWidth"),S ystem.UInt16)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsArchitectureN ull As Boolean
Get
If (curObj("Archit ecture") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e Architecture property specifies the processor architecture
used by this platf"& _
"orm. It returns one of the following
"&Microsoft.Vis ualBasic.ChrW(9 )&Microsoft.Vis ualBasic.ChrW(9 )&"integer
values:"&Micros oft.VisualBasic .ChrW(10)&"0 - x86
"&Microsoft.Vis ualBasic.ChrW(1 0)&"1 - MIPS
"&Microsoft.Vis ualBasic.ChrW(1 0)&"2 - Al"& _
"pha "&Microsoft.Vis ualBasic.ChrW(1 0)&"3 - PowerPC
"&Microsoft.Vis ualBasic.ChrW(1 0)&"6 - ia64 "), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property Architecture As ArchitectureVal ues
Get
If (curObj("Archit ecture") Is Nothing) Then
Return CType(System.Co nvert.ToInt32(0 ),ArchitectureV alues)
End If
Return CType(Convert.T oInt32(curObj(" Architecture")) ,ArchitectureVa lues)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsAvailabilityN ull As Boolean
Get
If (curObj("Availa bility") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e availability and status of the device. For example, the
Availability propert"& _
"y indicates that the device is running and has full power (value=3), or is
in a "& _
"warning (4), test (5), degraded (10) or power save state (values 13-15 and
17). "& _
"Regarding the power saving states, these are defined as follows: Value 13
(""Powe"& _
"r Save - Unknown"") indicates that the device is known to be in a power
save mode"& _
", but its exact status in this mode is unknown; 14 (""Power Save - Low
Power Mode"& _
""") indicates that the device is in a power save state but still
functioning, and"& _
" may exhibit degraded performance; 15 (""Power Save - Standby"") describes
that th"& _
"e device is not functioning but could be brought to full power 'quickly';
and va"& _
"lue 17 (""Power Save - Warning"") indicates that the device is in a warning
state,"& _
" though also in a power save mode."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property Availability As AvailabilityVal ues
Get
If (curObj("Availa bility") Is Nothing) Then
Return CType(System.Co nvert.ToInt32(0 ),AvailabilityV alues)
End If
Return CType(Convert.T oInt32(curObj(" Availability")) ,AvailabilityVa lues)
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e Caption property is a short textual description (one-line
string) of the obje"& _
"ct.")> _
Public ReadOnly Property Caption As String
Get
Return CType(curObj("C aption"),String )
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsConfigManager ErrorCodeNull As Boolean
Get
If (curObj("Config ManagerErrorCod e") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("In dicates the Win32 Configuration Manager error code. The
following values may b"& _
"e returned:
"&Microsoft.Vis ualBasic.ChrW(1 0)&"0"&Microsof t.VisualBasic.C hrW(9)&"This
device is working properly.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"1"&Microsof t.VisualBasic.C hrW(9)&"This
device is not configured"& _
" correctly.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"2"&Microsof t.VisualBasic.C hrW(9)&"Windows
cannot load the driver for this device.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"3"&Microsof t.VisualBasic.C hrW(9)&"The
driver for"& _
" this device might be corrupted, or your system may be running low on
memory or "& _
"other resources.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"4"&Microsof t.VisualBasic.C hrW(9)&"This
device is not working properly. One of its drivers or y"& _
"our registry might be corrupted.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"5"&Microsof t.VisualBasic.C hrW(9)&"The
driver for this device needs a resource "& _
"that Windows cannot manage.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"6"&Microsof t.VisualBasic.C hrW(9)&"The boot
configuration for this device conflicts "& _
"with other devices.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"7"&Microsof t.VisualBasic.C hrW(9)&"Cannot
filter.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"8"&Microsof t.VisualBasic.C hrW(9)&"The
driver loader for the device is mis"& _
"sing.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"9"&Microsof t.VisualBasic.C hrW(9)&"This
device is not working properly because the controlling firmware is"& _
" reporting the resources for the device incorrectly.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"10"&Microso ft.VisualBasic. ChrW(9)&"This
device cannot star"& _
"t.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"11"&Microso ft.VisualBasic. ChrW(9)&"This
device failed.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"12"&Microso ft.VisualBasic. ChrW(9)&"This
device cannot find enough free resources tha"& _
"t it can use.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"13"&Microso ft.VisualBasic. ChrW(9)&"Window s
cannot verify this device's resources.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"14"&Microso ft.VisualBasic. ChrW(9)&"This
device"& _
" cannot work properly until you restart your computer.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"15"&Microso ft.VisualBasic. ChrW(9)&"This
device is not wo"& _
"rking properly because there is probably a re-enumeration problem.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"16"&Microso ft.VisualBasic. ChrW(9)&"Window s
c"& _
"annot identify all the resources this device uses.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"17"&Microso ft.VisualBasic. ChrW(9)&"This
device is asking for"& _
" an unknown resource type.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"18"&Microso ft.VisualBasic. ChrW(9)&"Reinst a
ll the drivers for this device.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"19"&Microso ft.VisualBasic. ChrW(9)&"Your
r"& _
"egistry might be corrupted.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"20"&Microso ft.VisualBasic. ChrW(9)&"Failur e
using the VxD loader.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"21"&Microso ft.VisualBasic. ChrW(9)&"System
failure"& _
": Try changing the driver for this device. If that does not work, see your
hardw"& _
"are documentation. Windows is removing this device.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"22"&Microso ft.VisualBasic. ChrW(9)&"This
device is disabled."& _
"
"&Microsoft.Vis ualBasic.ChrW(1 0)&"23"&Microso ft.VisualBasic. ChrW(9)&"System
failure: Try changing the driver for this device. If that doesn't wo"& _
"rk, see your hardware documentation.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"24"&Microso ft.VisualBasic. ChrW(9)&"This
device is not present, is not work"& _
"ing properly, or does not have all its drivers installed.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"25"&Microso ft.VisualBasic. ChrW(9)&"Window s
is still s"& _
"etting up this device.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"26"&Microso ft.VisualBasic. ChrW(9)&"Window s
is still setting up this device.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"27"&Microso ft.VisualBasic. ChrW(9)&"This
dev"& _
"ice does not have valid log configuration.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"28"&Microso ft.VisualBasic. ChrW(9)&"The
drivers for this device are n"& _
"ot installed.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"29"&Microso ft.VisualBasic. ChrW(9)&"This
device is disabled because the firmware of the device did"& _
" not give it the required resources.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"30"&Microso ft.VisualBasic. ChrW(9)&"This
device is using an Interrupt Reque"& _
"st (IRQ) resource that another device is using.
"&Microsoft.Vis ualBasic.ChrW(1 0)&"31"&Microso ft.VisualBasic. ChrW(9)&"This
device is not working p"& _
"roperly because Windows cannot load the drivers required for this
device."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property ConfigManagerEr rorCode As
ConfigManagerEr rorCodeValues
Get
If (curObj("Config ManagerErrorCod e") Is Nothing) Then
Return CType(System.Co nvert.ToInt64(0 ),ConfigManager ErrorCodeValues )
End If
Return
CType(Convert.T oInt64(curObj(" ConfigManagerEr rorCode")),Conf igManagerErrorC o
deValues)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsConfigManager UserConfigNull As Boolean
Get
If (curObj("Config ManagerUserConf ig") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("In dicates whether the device is using a user-defined
configuration." ), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property ConfigManagerUs erConfig As Boolean
Get
If (curObj("Config ManagerUserConf ig") Is Nothing) Then
Return System.Convert. ToBoolean(0)
End If
Return CType(curObj("C onfigManagerUse rConfig"),Boole an)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsCpuStatusNull As Boolean
Get
If (curObj("CpuSta tus") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e CpuStatus property specifies the current status of the
processor. Changes in "& _
"status arise from processor usage, not the physical condition of the
processor."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property CpuStatus As CpuStatusValues
Get
If (curObj("CpuSta tus") Is Nothing) Then
Return CType(System.Co nvert.ToInt32(0 ),CpuStatusValu es)
End If
Return CType(Convert.T oInt32(curObj(" CpuStatus")),Cp uStatusValues)
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Cr eationClassName indicates the name of the class or the
subclass used in the cre"& _
"ation of an instance. When used with the other key properties of this
class, thi"& _
"s property allows all instances of this class and its subclasses to be
uniquely "& _
"identified .")> _
Public ReadOnly Property CreationClassNa me As String
Get
Return CType(curObj("C reationClassNam e"),String)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsCurrentClockS peedNull As Boolean
Get
If (curObj("Curren tClockSpeed") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e current speed (in MHz) of this processor."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property CurrentClockSpe ed As System.UInt32
Get
If (curObj("Curren tClockSpeed") Is Nothing) Then
Return System.Convert. ToUInt32(0)
End If
Return CType(curObj("C urrentClockSpee d"),System.UInt 32)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsCurrentVoltag eNull As Boolean
Get
If (curObj("Curren tVoltage") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e CurrentVoltage specifies the voltage of the processor. Bits
0-6 of the field "& _
"contain the processor's current voltage times 10. This value is only set
when SM"& _
"BIOS designates a voltage value. For specific values, see
VoltageCaps."&M icrosoft.Visual Basic.ChrW(10)& "Example: "& _
"field value for a processor voltage of 1.8 volts would be 92h = 80h + (1.8
x 10)"& _
" = 80h + 18 = 80h + 12h."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property CurrentVoltage As System.UInt16
Get
If (curObj("Curren tVoltage") Is Nothing) Then
Return System.Convert. ToUInt16(0)
End If
Return CType(curObj("C urrentVoltage") ,System.UInt16)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsDataWidthNull As Boolean
Get
If (curObj("DataWi dth") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Pr ocessor data width in bits."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property DataWidth As System.UInt16
Get
If (curObj("DataWi dth") Is Nothing) Then
Return System.Convert. ToUInt16(0)
End If
Return CType(curObj("D ataWidth"),Syst em.UInt16)
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e Description property provides a textual description of the
object. ")> _
Public ReadOnly Property Description As String
Get
Return CType(curObj("D escription"),St ring)
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e DeviceID property contains a string uniquely identifying
the processor with o"& _
"ther devices on the system.")> _
Public ReadOnly Property DeviceID As String
Get
Return CType(curObj("D eviceID"),Strin g)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsErrorClearedN ull As Boolean
Get
If (curObj("ErrorC leared") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Er rorCleared is a boolean property indicating that the error
reported in LastErro"& _
"rCode property is now cleared."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property ErrorCleared As Boolean
Get
If (curObj("ErrorC leared") Is Nothing) Then
Return System.Convert. ToBoolean(0)
End If
Return CType(curObj("E rrorCleared"),B oolean)
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Er rorDescription is a free-form string supplying more
information about the error"& _
" recorded in LastErrorCode property, and information on any corrective
actions t"& _
"hat may be taken.")> _
Public ReadOnly Property ErrorDescriptio n As String
Get
Return CType(curObj("E rrorDescription "),String)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsExtClockNull As Boolean
Get
If (curObj("ExtClo ck") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e ExtClock property specifies the external clock frequency.
If the frequency is"& _
" unknown this property is set to null."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property ExtClock As System.UInt32
Get
If (curObj("ExtClo ck") Is Nothing) Then
Return System.Convert. ToUInt32(0)
End If
Return CType(curObj("E xtClock"),Syste m.UInt32)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsFamilyNull As Boolean
Get
If (curObj("Family ") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e processor family type. For example, values include
""Pentium(R ) processor with"& _
" MMX(TM) technology"" (14) and ""68040"" (96)."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property Family As FamilyValues
Get
If (curObj("Family ") Is Nothing) Then
Return CType(System.Co nvert.ToInt32(0 ),FamilyValues)
End If
Return CType(Convert.T oInt32(curObj(" Family")),Famil yValues)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsInstallDateNu ll As Boolean
Get
If (curObj("Instal lDate") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e InstallDate property is datetime value indicating when the
object was install"& _
"ed. A lack of a value does not indicate that the object is not
installed."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property InstallDate As Date
Get
If (Not (curObj("Instal lDate")) Is Nothing) Then
Return ToDateTime(CTyp e(curObj("Insta llDate"),String ))
Else
Return System.DateTime .MinValue
End If
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsL2CacheSizeNu ll As Boolean
Get
If (curObj("L2Cach eSize") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e L2CacheSize property specifies the size of the processor's
Level 2 cache. A L"& _
"evel 2 cache is an external memory area that has a faster access times than
the "& _
"main RAM memory."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property L2CacheSize As System.UInt32
Get
If (curObj("L2Cach eSize") Is Nothing) Then
Return System.Convert. ToUInt32(0)
End If
Return CType(curObj("L 2CacheSize"),Sy stem.UInt32)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsL2CacheSpeedN ull As Boolean
Get
If (curObj("L2Cach eSpeed") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e L2CacheSpeed property specifies the clockspeed of the
processor's Level 2 cac"& _
"he. A Level 2 cache is an external memory area that has a faster access
times th"& _
"an the main RAM memory."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property L2CacheSpeed As System.UInt32
Get
If (curObj("L2Cach eSpeed") Is Nothing) Then
Return System.Convert. ToUInt32(0)
End If
Return CType(curObj("L 2CacheSpeed"),S ystem.UInt32)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsLastErrorCode Null As Boolean
Get
If (curObj("LastEr rorCode") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("La stErrorCode captures the last error code reported by the
logical device."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property LastErrorCode As System.UInt32
Get
If (curObj("LastEr rorCode") Is Nothing) Then
Return System.Convert. ToUInt32(0)
End If
Return CType(curObj("L astErrorCode"), System.UInt32)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsLevelNull As Boolean
Get
If (curObj("Level" ) Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e Level property further defines the processor type. The
value depends on the "& _
"architectu re of the processor."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property Level As System.UInt16
Get
If (curObj("Level" ) Is Nothing) Then
Return System.Convert. ToUInt16(0)
End If
Return CType(curObj("L evel"),System.U Int16)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsLoadPercentag eNull As Boolean
Get
If (curObj("LoadPe rcentage") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e LoadPercentage property specifies each processor's load cap
acity averaged ove"& _
"r the last second. The term 'processor loading' refers to the total
computing bu"& _
"rden each processor carries at one time."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property LoadPercentage As System.UInt16
Get
If (curObj("LoadPe rcentage") Is Nothing) Then
Return System.Convert. ToUInt16(0)
End If
Return CType(curObj("L oadPercentage") ,System.UInt16)
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e Manufacturer property specifies the name of the processor's
manufacturer."& Microsoft.Visua lBasic.ChrW(10) &"Exa"& _
"mple: GenuineSilicon" )> _
Public ReadOnly Property Manufacturer As String
Get
Return CType(curObj("M anufacturer"),S tring)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsMaxClockSpeed Null As Boolean
Get
If (curObj("MaxClo ckSpeed") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e maximum speed (in MHz) of this processor."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property MaxClockSpeed As System.UInt32
Get
If (curObj("MaxClo ckSpeed") Is Nothing) Then
Return System.Convert. ToUInt32(0)
End If
Return CType(curObj("M axClockSpeed"), System.UInt32)
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e Name property defines the label by which the object is
known. When subclassed"& _
", the Name property can be overridden to be a Key property.")> _
Public ReadOnly Property Name As String
Get
Return CType(curObj("N ame"),String)
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("A string describing the processor family type - used when the
family property is "& _
"set to 1 (""Other""). This string should be set to NULL when the family
property i"& _
"s any value other than 1.")> _
Public ReadOnly Property OtherFamilyDesc ription As String
Get
Return CType(curObj("O therFamilyDescr iption"),String )
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("In dicates the Win32 Plug and Play device ID of the logical
device. Example: *PNP"& _
"030b")> _
Public ReadOnly Property PNPDeviceID As String
Get
Return CType(curObj("P NPDeviceID"),St ring)
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("In dicates the specific power-related capabilities of the
logical device. The arra"& _
"y values, 0=""Unknown"" , 1=""Not Supported"" and 2=""Disabled" " are
self-explanatory. "& _
"The value, 3=""Enabled"" indicates that the power management features are
currentl"& _
"y enabled but the exact feature set is unknown or the information is
unavailable"& _
". ""Power Saving Modes Entered Automatically"" (4) describes that a device
can cha"& _
"nge its power state based on usage or other criteria. ""Power State
Settable"" (5)"& _
" indicates that the SetPowerState method is supported. ""Power Cycling
Supported"""& _
" (6) indicates that the SetPowerState method can be invoked with the
PowerState "& _
"input variable set to 5 (""Power Cycle""). ""Timed Power On Supported"" (7)
indicate"& _
"s that the SetPowerState method can be invoked with the PowerState input
variabl"& _
"e set to 5 (""Power Cycle"") and the Time parameter set to a specific date
and tim"& _
"e, or interval, for power-on.")> _
Public ReadOnly Property PowerManagement Capabilities As
PowerManagement CapabilitiesVal ues()
Get
Dim arrEnumVals As System.Array =
CType(curObj("P owerManagementC apabilities"),S ystem.Array)
Dim enumToRet() As PowerManagement CapabilitiesVal ues = New
PowerManagement CapabilitiesVal ues((arrEnumVal s.Length) - 1) {}
Dim counter As Int32 = 0
counter = 0
Do While (counter < arrEnumVals.Len gth)
enumToRet(count er) =
CType(System.Co nvert.ToInt32(a rrEnumVals.GetV alue(counter)), PowerManagement C
apabilitiesValu es)
counter = (counter + 1)
Loop
Return enumToRet
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsPowerManageme ntSupportedNull As Boolean
Get
If (curObj("PowerM anagementSuppor ted") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Bo olean indicating that the Device can be power managed - ie,
put into a power sa"& _
"ve state. This boolean does not indicate that power management features are
curr"& _
"ently enabled, or if enabled, what features are supported. Refer to the
PowerMan"& _
"agementCapabil ities array for this information. If this boolean is false,
the in"& _
"teger value 1, for the string, ""Not Supported"", should be the only entry
in the "& _
"PowerManagemen tCapabilities array."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property PowerManagement Supported As Boolean
Get
If (curObj("PowerM anagementSuppor ted") Is Nothing) Then
Return System.Convert. ToBoolean(0)
End If
Return CType(curObj("P owerManagementS upported"),Bool ean)
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e ProcessorId property contains processor-specific
information that describes t"& _
"he processor's features. For x86 class CPUs, the field's format depends on
the p"& _
"rocessor's support of the CPUID instruction. If the instruction is
supported, th"& _
"e ProcessorId property contains two DWORD-formatted values. The first
(offsets 0"& _
"8h-0Bh) is the EAX value returned by a CPUID instruction with input EAX set
to 1"& _
". The second (offsets 0Ch-0Fh) is the EDX value returned by that
instruction. On"& _
"ly the first two bytes of the ProcessorID property are significant (all
others a"& _
"re set to 0) and contain (in WORD-format) the contents of the DX register
at CPU"& _
" reset.")> _
Public ReadOnly Property ProcessorId As String
Get
Return CType(curObj("P rocessorId"),St ring)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsProcessorType Null As Boolean
Get
If (curObj("Proces sorType") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e ProcessorType property specifies the processor's primary
function."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property ProcessorType As ProcessorTypeVa lues
Get
If (curObj("Proces sorType") Is Nothing) Then
Return CType(System.Co nvert.ToInt32(0 ),ProcessorType Values)
End If
Return CType(Convert.T oInt32(curObj(" ProcessorType") ),ProcessorType Values)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsRevisionNull As Boolean
Get
If (curObj("Revisi on") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e Revision property specifies the system's
architecture-dependent revision leve"& _
"l. The meaning of this value depends on the architecture of the processor.
It co"& _
"ntains the same values as the ""Version"" member, but in a numerical
format."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property Revision As System.UInt16
Get
If (curObj("Revisi on") Is Nothing) Then
Return System.Convert. ToUInt16(0)
End If
Return CType(curObj("R evision"),Syste m.UInt16)
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("A free form string describing the role of the processor - for
example, ""Central P"& _
"rocessor"" ' or ""Math Processor""")> _
Public ReadOnly Property Role As String
Get
Return CType(curObj("R ole"),String)
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e SocketDesignati on property contains the type of chip socket
used on the circu"& _
"it."&Microsoft .VisualBasic.Ch rW(10)&"Example : J202")> _
Public ReadOnly Property SocketDesignati on As String
Get
Return CType(curObj("S ocketDesignatio n"),String)
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e Status property is a string indicating the current status
of the object. Vari"& _
"ous operational and non-operational statuses can be defined. Operational
statuse"& _
"s are ""OK"", ""Degraded" " and ""Pred Fail"". ""Pred Fail"" indicates that
an element ma"& _
"y be functioning properly but predicting a failure in the near future. An
exampl"& _
"e is a SMART-enabled hard drive. Non-operational statuses can also be
specified."& _
" These are ""Error"", ""Starting" ", ""Stopping" " and ""Service"" . The
latter, ""Service"" ,"& _
" could apply during mirror-resilvering of a disk, reload of a user
permissions l"& _
"ist, or other administrative work. Not all such work is on-line, yet the
managed"& _
" element is neither ""OK"" nor in one of the other states.")> _
Public ReadOnly Property Status As String
Get
Return CType(curObj("S tatus"),String)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsStatusInfoNul l As Boolean
Get
If (curObj("Status Info") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("St atusInfo is a string indicating whether the logical device is
in an enabled (va"& _
"lue = 3), disabled (value = 4) or some other (1) or unknown (2) state. If
this p"& _
"roperty does not apply to the logical device, the value, 5 (""Not
Applicable""), s"& _
"hould be used."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property StatusInfo As StatusInfoValue s
Get
If (curObj("Status Info") Is Nothing) Then
Return CType(System.Co nvert.ToInt32(0 ),StatusInfoVal ues)
End If
Return CType(Convert.T oInt32(curObj(" StatusInfo")),S tatusInfoValues )
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("St epping is a free-form string indicating the revision level of
the processor wit"& _
"hin the processor family.")> _
Public ReadOnly Property Stepping As String
Get
Return CType(curObj("S tepping"),Strin g)
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e scoping System's CreationClassNa me.")> _
Public ReadOnly Property SystemCreationC lassName As String
Get
Return CType(curObj("S ystemCreationCl assName"),Strin g)
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e scoping System's Name.")> _
Public ReadOnly Property SystemName As String
Get
Return CType(curObj("S ystemName"),Str ing)
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("A globally unique identifier for the processor. This identifier
may only be uniq"& _
"ue within a processor family.")> _
Public ReadOnly Property UniqueId As String
Get
Return CType(curObj("U niqueId"),Strin g)
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsUpgradeMethod Null As Boolean
Get
If (curObj("Upgrad eMethod") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("CP U socket information including data on how this Processor can
be upgraded (if u"& _
"pgrades are supported). This property is an integer enumeration."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property UpgradeMethod As UpgradeMethodVa lues
Get
If (curObj("Upgrad eMethod") Is Nothing) Then
Return CType(System.Co nvert.ToInt32(0 ),UpgradeMethod Values)
End If
Return CType(Convert.T oInt32(curObj(" UpgradeMethod") ),UpgradeMethod Values)
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e Version property specifies an architecture-dependent
processor revision numbe"& _
"r. Note: This member is not used in Windows
95."&Microsoft. VisualBasic.Chr W(10)&"Example: Model 2, Stepping 12.")> _
Public ReadOnly Property Version As String
Get
Return CType(curObj("V ersion"),String )
End Get
End Property
<Browsable(fals e), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden)> _
Public ReadOnly Property IsVoltageCapsNu ll As Boolean
Get
If (curObj("Voltag eCaps") Is Nothing) Then
Return true
Else
Return false
End If
End Get
End Property
<Browsable(true ), _
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Hidden), _
Description("Th e VoltageCaps property specifies the voltage capabilities of
the processor. Bit"& _
"s 0-3 of the field represent specific voltages that the processor socket
can acc"& _
"ept. All other bits should be set to zero. The socket is configurable if
multipl"& _
"e bits are being set. For a range of voltages see CurrentVoltage. If the
propert"& _
"y is NULL, then the voltage capabilities are unknown."), _
TypeConverter(G etType(WMIValue TypeConverter)) > _
Public ReadOnly Property VoltageCaps As VoltageCapsValu es
Get
If (curObj("Voltag eCaps") Is Nothing) Then
Return CType(System.Co nvert.ToInt32(0 ),VoltageCapsVa lues)
End If
Return CType(Convert.T oInt32(curObj(" VoltageCaps")), VoltageCapsValu es)
End Get
End Property
Private Overloads Function CheckIfProperCl ass(ByVal mgmtScope As
System.Manageme nt.ManagementSc ope, ByVal path As
System.Manageme nt.ManagementPa th, ByVal OptionsParam As
System.Manageme nt.ObjectGetOpt ions) As Boolean
If ((Not (path) Is Nothing) _
AndAlso (System.String. Compare(path.Cl assName, ManagementClass Name, true,
CultureInfo.Inv ariantCulture) = 0)) Then
Return true
Else
Return CheckIfProperCl ass(New System.Manageme nt.ManagementOb ject(mgmtScope,
path, OptionsParam))
End If
End Function
Private Overloads Function CheckIfProperCl ass(ByVal theObj As
System.Manageme nt.ManagementBa seObject) As Boolean
If ((Not (theObj) Is Nothing) _
AndAlso (System.String. Compare(CType(t heObj("__CLASS" ),String),
ManagementClass Name, true, CultureInfo.Inv ariantCulture) = 0)) Then
Return true
Else
Dim parentClasses As System.Array =
CType(theObj("_ _DERIVATION"),S ystem.Array)
If (Not (parentClasses) Is Nothing) Then
Dim count As Int32 = 0
count = 0
Do While (count < parentClasses.L ength)
If (System.String. Compare(CType(p arentClasses.Ge tValue(count),S tring),
ManagementClass Name, true, CultureInfo.Inv ariantCulture) = 0) Then
Return true
End If
count = (count + 1)
Loop
End If
End If
Return false
End Function
Private Function ShouldSerialize AddressWidth() As Boolean
If (IsAddressWidth Null = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize Architecture() As Boolean
If (IsArchitecture Null = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize Availability() As Boolean
If (IsAvailability Null = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize ConfigManagerEr rorCode() As Boolean
If (IsConfigManage rErrorCodeNull = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize ConfigManagerUs erConfig() As Boolean
If (IsConfigManage rUserConfigNull = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize CpuStatus() As Boolean
If (IsCpuStatusNul l = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize CurrentClockSpe ed() As Boolean
If (IsCurrentClock SpeedNull = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize CurrentVoltage( ) As Boolean
If (IsCurrentVolta geNull = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize DataWidth() As Boolean
If (IsDataWidthNul l = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize ErrorCleared() As Boolean
If (IsErrorCleared Null = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize ExtClock() As Boolean
If (IsExtClockNull = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize Family() As Boolean
If (IsFamilyNull = false) Then
Return true
End If
Return false
End Function
'Converts a given datetime in DMTF format to System.DateTime object.
Shared Function ToDateTime(ByVa l dmtfDate As String) As Date
Dim year As Integer = System.DateTime .MinValue.Year
Dim month As Integer = System.DateTime .MinValue.Month
Dim day As Integer = System.DateTime .MinValue.Day
Dim hour As Integer = System.DateTime .MinValue.Hour
Dim minute As Integer = System.DateTime .MinValue.Minut e
Dim second As Integer = System.DateTime .MinValue.Secon d
Dim ticks As Long = 0
Dim dmtf As String = dmtfDate
Dim datetime As Date = System.DateTime .MinValue
Dim tempString As String = System.String.E mpty
If (dmtf Is Nothing) Then
Throw New System.Argument OutOfRangeExcep tion
End If
If (dmtf.Length = 0) Then
Throw New System.Argument OutOfRangeExcep tion
End If
If (dmtf.Length <> 25) Then
Throw New System.Argument OutOfRangeExcep tion
End If
Try
tempString = dmtf.Substring( 0, 4)
If ("****" <> tempString) Then
year = System.Int32.Pa rse(tempString)
End If
tempString = dmtf.Substring( 4, 2)
If ("**" <> tempString) Then
month = System.Int32.Pa rse(tempString)
End If
tempString = dmtf.Substring( 6, 2)
If ("**" <> tempString) Then
day = System.Int32.Pa rse(tempString)
End If
tempString = dmtf.Substring( 8, 2)
If ("**" <> tempString) Then
hour = System.Int32.Pa rse(tempString)
End If
tempString = dmtf.Substring( 10, 2)
If ("**" <> tempString) Then
minute = System.Int32.Pa rse(tempString)
End If
tempString = dmtf.Substring( 12, 2)
If ("**" <> tempString) Then
second = System.Int32.Pa rse(tempString)
End If
tempString = dmtf.Substring( 15, 6)
If ("******" <> tempString) Then
ticks = (System.Int64.P arse(tempString ) _
* (System.TimeSpa n.TicksPerMilli second / 1000))
End If
If ((((((((year < 0) _
OrElse (month < 0)) _
OrElse (day < 0)) _
OrElse (hour < 0)) _
OrElse (minute < 0)) _
OrElse (minute < 0)) _
OrElse (second < 0)) _
OrElse (ticks < 0)) Then
Throw New System.Argument OutOfRangeExcep tion
End If
Catch e As System.Exceptio n
e = e
Throw New System.Argument OutOfRangeExcep tion
End Try
datetime = New Date(year, month, day, hour, minute, second, 0)
datetime = datetime.AddTic ks(ticks)
Dim tickOffset As System.TimeSpan =
System.TimeZone .CurrentTimeZon e.GetUtcOffset( datetime)
Dim UTCOffset As Integer = 0
Dim OffsetToBeAdjus ted As Long = 0
Dim OffsetMins As Long = (tickOffset.Tic ks / System.TimeSpan .TicksPerMinute )
tempString = dmtf.Substring( 22, 3)
If (tempString <> "***") Then
tempString = dmtf.Substring( 21, 4)
Try
UTCOffset = System.Int32.Pa rse(tempString)
Catch e As System.Exceptio n
e = e
Throw New System.Argument OutOfRangeExcep tion
End Try
OffsetToBeAdjus ted = (OffsetMins - UTCOffset)
datetime = datetime.AddMin utes(OffsetToBe Adjusted)
End If
Return datetime
End Function
'Converts a given System.DateTime object to DMTF datetime format.
Shared Function ToDmtfDateTime( ByVal [date] As Date) As String
Dim utcString As String = System.String.E mpty
Dim tickOffset As System.TimeSpan =
System.TimeZone .CurrentTimeZon e.GetUtcOffset([date])
Dim OffsetMins As Long = (tickOffset.Tic ks / System.TimeSpan .TicksPerMinute )
If (System.Math.Ab s(OffsetMins) > 999) Then
[date] = [date].ToUniversalTim e
utcString = "+000"
Else
If (tickOffset.Tic ks >= 0) Then
utcString = ("+" + (tickOffset.Tic ks /
System.TimeSpan .TicksPerMinute ).ToString.PadL eft(3,
Microsoft.Visua lBasic.ChrW(48) ))
Else
Dim strTemp As String = OffsetMins.ToSt ring
utcString = ("-" + strTemp.Substri ng(1, (strTemp.Length - 1)).PadLeft(3,
Microsoft.Visua lBasic.ChrW(48) ))
End If
End If
Dim dmtfDateTime As String = [date].Year.ToString. PadLeft(4,
Microsoft.Visua lBasic.ChrW(48) )
dmtfDateTime = (dmtfDateTime + [date].Month.ToString .PadLeft(2,
Microsoft.Visua lBasic.ChrW(48) ))
dmtfDateTime = (dmtfDateTime + [date].Day.ToString.P adLeft(2,
Microsoft.Visua lBasic.ChrW(48) ))
dmtfDateTime = (dmtfDateTime + [date].Hour.ToString. PadLeft(2,
Microsoft.Visua lBasic.ChrW(48) ))
dmtfDateTime = (dmtfDateTime + [date].Minute.ToStrin g.PadLeft(2,
Microsoft.Visua lBasic.ChrW(48) ))
dmtfDateTime = (dmtfDateTime + [date].Second.ToStrin g.PadLeft(2,
Microsoft.Visua lBasic.ChrW(48) ))
dmtfDateTime = (dmtfDateTime + ".")
Dim dtTemp As Date = New Date([date].Year, [date].Month, [date].Day,
[date].Hour, [date].Minute, [date].Second, 0)
Dim microsec As Long = ((([date].Ticks - dtTemp.Ticks) _
* 1000) _
/ System.TimeSpan .TicksPerMillis econd)
Dim strMicrosec As String = microsec.ToStri ng
If (strMicrosec.Le ngth > 6) Then
strMicrosec = strMicrosec.Sub string(0, 6)
End If
dmtfDateTime = (dmtfDateTime + strMicrosec.Pad Left(6,
Microsoft.Visua lBasic.ChrW(48) ))
dmtfDateTime = (dmtfDateTime + utcString)
Return dmtfDateTime
End Function
Private Function ShouldSerialize InstallDate() As Boolean
If (IsInstallDateN ull = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize L2CacheSize() As Boolean
If (IsL2CacheSizeN ull = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize L2CacheSpeed() As Boolean
If (IsL2CacheSpeed Null = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize LastErrorCode() As Boolean
If (IsLastErrorCod eNull = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize Level() As Boolean
If (IsLevelNull = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize LoadPercentage( ) As Boolean
If (IsLoadPercenta geNull = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize MaxClockSpeed() As Boolean
If (IsMaxClockSpee dNull = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize PowerManagement Supported() As Boolean
If (IsPowerManagem entSupportedNul l = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize ProcessorType() As Boolean
If (IsProcessorTyp eNull = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize Revision() As Boolean
If (IsRevisionNull = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize StatusInfo() As Boolean
If (IsStatusInfoNu ll = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize UpgradeMethod() As Boolean
If (IsUpgradeMetho dNull = false) Then
Return true
End If
Return false
End Function
Private Function ShouldSerialize VoltageCaps() As Boolean
If (IsVoltageCapsN ull = false) Then
Return true
End If
Return false
End Function
<Browsable(true )> _
Public Sub CommitObject()
If (isEmbedded = false) Then
PrivateLateBoun dObject.Put
End If
End Sub
Private Shared Function ConstructPath(B yVal keyDeviceID As String) As String
Dim strPath As String = "ROOT\CIMV2:Win 32_Processor"
strPath = (strPath _
+ (".DeviceID= " _
+ ("""" _
+ (keyDeviceID + """"))))
Return strPath
End Function
'Different overloads of GetInstances() help in enumerating instances of the
WMI class.
Public Overloads Shared Function GetInstances() As ProcessorCollec tion
Return GetInstances(CT ype(Nothing,Sys tem.Management. ManagementScope ),
CType(Nothing,S ystem.Managemen t.EnumerationOp tions))
End Function
Public Overloads Shared Function GetInstances(By Val condition As String) As
ProcessorCollec tion
Return GetInstances(No thing, condition, Nothing)
End Function
Public Overloads Shared Function GetInstances(By Val selectedPropert ies() As
System.String ) As ProcessorCollec tion
Return GetInstances(No thing, Nothing, selectedPropert ies)
End Function
Public Overloads Shared Function GetInstances(By Val condition As String,
ByVal selectedPropert ies() As System.String ) As ProcessorCollec tion
Return GetInstances(No thing, condition, selectedPropert ies)
End Function
Public Overloads Shared Function GetInstances(By Val mgmtScope As
System.Manageme nt.ManagementSc ope, ByVal enumOptions As
System.Manageme nt.EnumerationO ptions) As ProcessorCollec tion
If (mgmtScope Is Nothing) Then
If (statMgmtScope Is Nothing) Then
mgmtScope = New System.Manageme nt.ManagementSc ope
mgmtScope.Path. NamespacePath = "root\CIMV2 "
Else
mgmtScope = statMgmtScope
End If
End If
Dim pathObj As System.Manageme nt.ManagementPa th = New
System.Manageme nt.ManagementPa th
pathObj.ClassNa me = "Win32_Processo r"
pathObj.Namespa cePath = "root\CIMV2 "
Dim clsObject As System.Manageme nt.ManagementCl ass = New
System.Manageme nt.ManagementCl ass(mgmtScope, pathObj, Nothing)
If (enumOptions Is Nothing) Then
enumOptions = New System.Manageme nt.EnumerationO ptions
enumOptions.Ens ureLocatable = true
End If
Return New ProcessorCollec tion(clsObject. GetInstances(en umOptions))
End Function
Public Overloads Shared Function GetInstances(By Val mgmtScope As
System.Manageme nt.ManagementSc ope, ByVal condition As String) As
ProcessorCollec tion
Return GetInstances(mg mtScope, condition, Nothing)
End Function
Public Overloads Shared Function GetInstances(By Val mgmtScope As
System.Manageme nt.ManagementSc ope, ByVal selectedPropert ies() As
System.String ) As ProcessorCollec tion
Return GetInstances(mg mtScope, Nothing, selectedPropert ies)
End Function
Public Overloads Shared Function GetInstances(By Val mgmtScope As
System.Manageme nt.ManagementSc ope, ByVal condition As String, ByVal
selectedPropert ies() As System.String ) As ProcessorCollec tion
If (mgmtScope Is Nothing) Then
If (statMgmtScope Is Nothing) Then
mgmtScope = New System.Manageme nt.ManagementSc ope
mgmtScope.Path. NamespacePath = "root\CIMV2 "
Else
mgmtScope = statMgmtScope
End If
End If
Dim ObjectSearcher As System.Manageme nt.ManagementOb jectSearcher = New
System.Manageme nt.ManagementOb jectSearcher(mg mtScope, New
SelectQuery("Wi n32_Processor", condition, selectedPropert ies))
Dim enumOptions As System.Manageme nt.EnumerationO ptions = New
System.Manageme nt.EnumerationO ptions
enumOptions.Ens ureLocatable = true
ObjectSearcher. Options = enumOptions
Return New ProcessorCollec tion(ObjectSear cher.Get)
End Function
<Browsable(true )> _
Public Shared Function CreateInstance( ) As Processor
Dim mgmtScope As System.Manageme nt.ManagementSc ope = Nothing
If (statMgmtScope Is Nothing) Then
mgmtScope = New System.Manageme nt.ManagementSc ope
mgmtScope.Path. NamespacePath = CreatedWmiNames pace
Else
mgmtScope = statMgmtScope
End If
Dim mgmtPath As System.Manageme nt.ManagementPa th = New
System.Manageme nt.ManagementPa th(CreatedClass Name)
Return New Processor(New System.Manageme nt.ManagementCl ass(mgmtScope,
mgmtPath, Nothing).Create Instance)
End Function
<Browsable(true )> _
Public Sub Delete()
PrivateLateBoun dObject.Delete
End Sub
Public Function Reset() As System.UInt32
If (isEmbedded = false) Then
Dim inParams As System.Manageme nt.ManagementBa seObject = Nothing
Dim outParams As System.Manageme nt.ManagementBa seObject =
PrivateLateBoun dObject.InvokeM ethod("Reset", inParams, Nothing)
Return System.Convert. ToUInt32(outPar ams.Properties( "ReturnValue"). Value)
Else
Return System.Convert. ToUInt32(0)
End If
End Function
Public Function SetPowerState(B yVal PowerState As System.UInt16, ByVal Time
As Date) As System.UInt32
If (isEmbedded = false) Then
Dim inParams As System.Manageme nt.ManagementBa seObject = Nothing
inParams = PrivateLateBoun dObject.GetMeth odParameters("S etPowerState")
inParams("Power State") = PowerState
inParams("Time" ) = ToDmtfDateTime( CType(Time,Date ))
Dim outParams As System.Manageme nt.ManagementBa seObject =
PrivateLateBoun dObject.InvokeM ethod("SetPower State", inParams, Nothing)
Return System.Convert. ToUInt32(outPar ams.Properties( "ReturnValue"). Value)
Else
Return System.Convert. ToUInt32(0)
End If
End Function
Public Enum ArchitectureVal ues As Integer
x86 = 0
MIPS = 1
Alpha = 2
PowerPC = 3
ia64 = 6
End Enum
Public Enum AvailabilityVal ues As Integer
Other = 1
Unknown = 2
Running_Full_Po wer = 3
Warning = 4
In_Test = 5
Not_Applicable = 6
Power_Off = 7
Off_Line = 8
Off_Duty = 9
Degraded = 10
Not_Installed = 11
Install_Error = 12
Power_Save_Unkn own = 13
Power_Save_Low_ Power_Mode = 14
Power_Save_Stan dby = 15
Power_Cycle = 16
Power_Save_Warn ing = 17
Paused = 18
Not_Ready = 19
Not_Configured = 20
Quiesced = 21
INVALID_ENUM_VA LUE = 0
End Enum
Public Enum ConfigManagerEr rorCodeValues As Long
This_device_is_ working_properl y_ = 0
This_device_is_ not_configured_ correctly_ = 1
Windows_cannot_ load_the_driver _for_this_devic e_ = 2
The_driver_for_ this_device_mig ht_be_corrupted _or_your_system _may_be_running _
low_on_memory_o r_other_resourc es_ = 3
This_device_is_ not_working_pro perly_One_of_it s_drivers_or_yo ur_registry_mig h
t_be_corrupted_ = 4
The_driver_for_ this_device_nee ds_a_resource_t hat_Windows_can not_manage_ = 5
The_boot_config uration_for_thi s_device_confli cts_with_other_ devices_ = 6
Cannot_filter_ = 7
The_driver_load er_for_the_devi ce_is_missing_ = 8
This_device_is_ not_working_pro perly_because_t he_controlling_ firmware_is_rep o
rting_the_resou rces_for_the_de vice_incorrectl y_ = 9
This_device_can not_start_ = 10
This_device_fai led_ = 11
This_device_can not_find_enough _free_resources _that_it_can_us e_ = 12
Windows_cannot_ verify_this_dev ice_s_resources _ = 13
This_device_can not_work_proper ly_until_you_re start_your_comp uter_ = 14
This_device_is_ not_working_pro perly_because_t here_is_probabl y_a_re_enumerat i
on_problem_ = 15
Windows_cannot_ identify_all_th e_resources_thi s_device_uses_ = 16
This_device_is_ asking_for_an_u nknown_resource _type_ = 17
Reinstall_the_d rivers_for_this _device_ = 18
Failure_using_t he_VxD_loader_ = 19
Your_registry_m ight_be_corrupt ed_ = 20
System_failure_ Try_changing_th e_driver_for_th is_device_If_th at_does_not_wor k
_see_your_hardw are_documentati on_Windows_is_r emoving_this_de vice_ = 21
This_device_is_ disabled_ = 22
System_failure_ Try_changing_th e_driver_for_th is_device_If_th at_doesn_t_work _
see_your_hardwa re_documentatio n_ = 23
This_device_is_ not_present_is_ not_working_pro perly_or_does_n ot_have_all_its _
drivers_install ed_ = 24
Windows_is_stil l_setting_up_th is_device_ = 25
Windows_is_stil l_setting_up_th is_device_0 = 26
This_device_doe s_not_have_vali d_log_configura tion_ = 27
The_drivers_for _this_device_ar e_not_installed _ = 28
This_device_is_ disabled_becaus e_the_firmware_ of_the_device_d id_not_give_it_ t
he_required_res ources_ = 29
This_device_is_ using_an_Interr upt_Request_IRQ _resource_that_ another_device_ i
s_using_ = 30
This_device_is_ not_working_pro perly_because_W indows_cannot_l oad_the_drivers _
required_for_th is_device_ = 31
End Enum
Public Enum CpuStatusValues As Integer
Unknown
CPU_Enabled
CPU_Disabled_by _User_via_BIOS_ Setup
CPU_Disabled_By _BIOS_POST_Erro r_
CPU_is_Idle
Reserved
Reserved0
Other
End Enum
Public Enum FamilyValues As Integer
Other = 1
Unknown = 2
Val_8086 = 3
Val_80286 = 4
Val_80386 = 5
Val_80486 = 6
Val_8087 = 7
Val_80287 = 8
Val_80387 = 9
Val_80487 = 10
Pentium_Family = 11
Pentium_Pro = 12
Pentium_II = 13
Pentium_MMX = 14
Celeron = 15
Pentium_II_Xeon = 16
Pentium_III = 17
M1_Family = 18
M2_Family = 19
K5_Family = 25
K6_Family = 26
K6_2 = 27
K6_III = 28
Athlon = 29
Power_PC_Family = 32
Power_PC_601 = 33
Power_PC_603 = 34
Power_PC_603_ = 35
Power_PC_604 = 36
Alpha_Family = 48
MIPS_Family = 64
SPARC_Family = 80
Val_68040 = 96
Val_68xxx_Famil y = 97
Val_68000 = 98
Val_68010 = 99
Val_68020 = 100
Val_68030 = 101
Hobbit_Family = 112
Weitek = 128
PA_RISC_Family = 144
V30_Family = 160
Pentium_III_Xeo n = 176
AS400_Family = 180
IBM390_Family = 200
i860 = 250
i960 = 251
SH_3 = 260
SH_4 = 261
ARM = 280
StrongARM = 281
Val_6x86 = 300
MediaGX = 301
MII = 302
WinChip = 320
INVALID_ENUM_VA LUE = 0
End Enum
Public Enum PowerManagement CapabilitiesVal ues As Integer
Unknown
Not_Supported
Disabled
Enabled
Power_Saving_Mo des_Entered_Aut omatically
Power_State_Set table
Power_Cycling_S upported
Timed_Power_On_ Supported
End Enum
Public Enum ProcessorTypeVa lues As Integer
Other = 1
Unknown = 2
Central_Process or = 3
Math_Processor = 4
DSP_Processor = 5
Video_Processor = 6
INVALID_ENUM_VA LUE = 0
End Enum
Public Enum StatusInfoValue s As Integer
Other = 1
Unknown = 2
Enabled = 3
Disabled = 4
Not_Applicable = 5
INVALID_ENUM_VA LUE = 0
End Enum
Public Enum UpgradeMethodVa lues As Integer
Other = 1
Unknown = 2
Daughter_Board = 3
ZIF_Socket = 4
Replacement_Pig gy_Back = 5
None = 6
LIF_Socket = 7
Slot_1 = 8
Slot_2 = 9
Val_370_Pin_Soc ket = 10
Slot_A = 11
Slot_M = 12
INVALID_ENUM_VA LUE = 0
End Enum
Public Enum VoltageCapsValu es As Integer
Val_5 = 1
Val_3_3 = 2
Val_2_9 = 4
End Enum
'Enumerator implementation for enumerating instances of the class.
Public Class ProcessorCollec tion
Inherits Object
Implements ICollection
Private ObjectCollectio n As ManagementObjec tCollection
Public Sub New(ByVal objCollection As ManagementObjec tCollection)
MyBase.New
ObjectCollectio n = objCollection
End Sub
Public ReadOnly Property Count As Integer Implements
System.Collecti ons.ICollection .Count
Get
Return ObjectCollectio n.Count
End Get
End Property
Public ReadOnly Property IsSynchronized As Boolean Implements
System.Collecti ons.ICollection .IsSynchronized
Get
Return ObjectCollectio n.IsSynchronize d
End Get
End Property
Public ReadOnly Property SyncRoot As Object Implements
System.Collecti ons.ICollection .SyncRoot
Get
Return Me
End Get
End Property
Public Sub CopyTo(ByVal array As System.Array, ByVal index As Integer)
Implements System.Collecti ons.ICollection .CopyTo
ObjectCollectio n.CopyTo(array, index)
Dim nCtr As Integer
nCtr = 0
Do While (nCtr < array.Length)
array.SetValue( New
Processor(CType (array.GetValue (nCtr),System.M anagement.Manag ementObject)),
nCtr)
nCtr = (nCtr + 1)
Loop
End Sub
Public Function GetEnumerator() As System.Collecti ons.IEnumerator Implements
System.Collecti ons.IEnumerable .GetEnumerator
Return New ProcessorEnumer ator(ObjectColl ection.GetEnume rator)
End Function
Public Class ProcessorEnumer ator
Inherits Object
Implements System.Collecti ons.IEnumerator
Private ObjectEnumerato r As
ManagementObjec tCollection.Man agementObjectEn umerator
Public Sub New(ByVal objEnum As
ManagementObjec tCollection.Man agementObjectEn umerator)
MyBase.New
ObjectEnumerato r = objEnum
End Sub
Public ReadOnly Property Current As Object Implements
System.Collecti ons.IEnumerator .Current
Get
Return New
Processor(CType (ObjectEnumerat or.Current,Syst em.Management.M anagementObject )
)
End Get
End Property
Public Function MoveNext() As Boolean Implements
System.Collecti ons.IEnumerator .MoveNext
Return ObjectEnumerato r.MoveNext
End Function
Public Sub Reset() Implements System.Collecti ons.IEnumerator .Reset
ObjectEnumerato r.Reset
End Sub
End Class
End Class
'TypeConverter to handle null values for ValueType properties
Public Class WMIValueTypeCon verter
Inherits TypeConverter
Private baseConverter As TypeConverter
Public Sub New(ByVal baseType As System.Type)
MyBase.New
baseConverter = TypeDescriptor. GetConverter(ba seType)
End Sub
Public Overloads Overrides Function CanConvertFrom( ByVal context As
System.Componen tModel.ITypeDes criptorContext, ByVal srcType As System.Type)
As Boolean
Return baseConverter.C anConvertFrom(c ontext, srcType)
End Function
Public Overloads Overrides Function CanConvertTo(By Val context As
System.Componen tModel.ITypeDes criptorContext, ByVal destinationType As
System.Type) As Boolean
Return baseConverter.C anConvertTo(con text, destinationType )
End Function
Public Overloads Overrides Function ConvertFrom(ByV al context As
System.Componen tModel.ITypeDes criptorContext, ByVal culture As
System.Globaliz ation.CultureIn fo, ByVal value As Object) As Object
Return baseConverter.C onvertFrom(cont ext, culture, value)
End Function
Public Overloads Overrides Function CreateInstance( ByVal context As
System.Componen tModel.ITypeDes criptorContext, ByVal dictionary As
System.Collecti ons.IDictionary ) As Object
Return baseConverter.C reateInstance(c ontext, dictionary)
End Function
Public Overloads Overrides Function GetCreateInstan ceSupported(ByV al context
As System.Componen tModel.ITypeDes criptorContext) As Boolean
Return baseConverter.G etCreateInstanc eSupported(cont ext)
End Function
Public Overloads Overrides Function GetProperties(B yVal context As
System.Componen tModel.ITypeDes criptorContext, ByVal value As Object, ByVal
attributeVar() As System.Attribut e) As PropertyDescrip torCollection
Return baseConverter.G etProperties(co ntext, value, attributeVar)
End Function
Public Overloads Overrides Function GetPropertiesSu pported(ByVal context As
System.Componen tModel.ITypeDes criptorContext) As Boolean
Return baseConverter.G etPropertiesSup ported(context)
End Function
Public Overloads Overrides Function GetStandardValu es(ByVal context As
System.Componen tModel.ITypeDes criptorContext) As
System.Componen tModel.TypeConv erter.StandardV aluesCollection
Return baseConverter.G etStandardValue s(context)
End Function
Public Overloads Overrides Function GetStandardValu esExclusive(ByV al context
As System.Componen tModel.ITypeDes criptorContext) As Boolean
Return baseConverter.G etStandardValue sExclusive(cont ext)
End Function
Public Overloads Overrides Function GetStandardValu esSupported(ByV al context
As System.Componen tModel.ITypeDes criptorContext) As Boolean
Return baseConverter.G etStandardValue sSupported(cont ext)
End Function
Public Overloads Overrides Function ConvertTo(ByVal context As
System.Componen tModel.ITypeDes criptorContext, ByVal culture As
System.Globaliz ation.CultureIn fo, ByVal value As Object, ByVal
destinationType As System.Type) As Object
If (Not (context) Is Nothing) Then
If (context.Proper tyDescriptor.Sh ouldSerializeVa lue(context.Ins tance) =
false) Then
Return ""
End If
End If
Return baseConverter.C onvertTo(contex t, culture, value, destinationType )
End Function
End Class
'Embedded class to represent WMI system Properties.
<TypeConverter( GetType(System. ComponentModel. ExpandableObjec tConverter))> _
Public Class ManagementSyste mProperties
Private PrivateLateBoun dObject As System.Manageme nt.ManagementBa seObject
Public Sub New(ByVal ManagedObject As
System.Manageme nt.ManagementBa seObject)
MyBase.New
PrivateLateBoun dObject= ManagedObject
End Sub
<Browsable(true )> _
Public ReadOnly Property GENUS As Integer
Get
Return CType(PrivateLa teBoundObject(" __GENUS"),Integ er)
End Get
End Property
<Browsable(true )> _
Public ReadOnly Property [CLASS] As String
Get
Return CType(PrivateLa teBoundObject(" __CLASS"),Strin g)
End Get
End Property
<Browsable(true )> _
Public ReadOnly Property SUPERCLASS As String
Get
Return CType(PrivateLa teBoundObject(" __SUPERCLASS"), String)
End Get
End Property
<Browsable(true )> _
Public ReadOnly Property DYNASTY As String
Get
Return CType(PrivateLa teBoundObject(" __DYNASTY"),Str ing)
End Get
End Property
<Browsable(true )> _
Public ReadOnly Property RELPATH As String
Get
Return CType(PrivateLa teBoundObject(" __RELPATH"),Str ing)
End Get
End Property
<Browsable(true )> _
Public ReadOnly Property PROPERTY_COUNT As Integer
Get
Return CType(PrivateLa teBoundObject(" __PROPERTY_COUN T"),Integer)
End Get
End Property
<Browsable(true )> _
Public ReadOnly Property DERIVATION As String()
Get
Return CType(PrivateLa teBoundObject(" __DERIVATION"), String())
End Get
End Property
<Browsable(true )> _
Public ReadOnly Property SERVER As String
Get
Return CType(PrivateLa teBoundObject(" __SERVER"),Stri ng)
End Get
End Property
<Browsable(true )> _
Public ReadOnly Property [NAMESPACE] As String
Get
Return CType(PrivateLa teBoundObject(" __NAMESPACE"),S tring)
End Get
End Property
<Browsable(true )> _
Public ReadOnly Property PATH As String
Get
Return CType(PrivateLa teBoundObject(" __PATH"),String )
End Get
End Property
End Class
End Class
End Namespace