By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,870 Members | 1,189 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,870 IT Pros & Developers. It's quick & easy.

enumate processors with WMI managed classes

P: n/a
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.Processor
Dim pc As ROOT.CIMV2.Processor.ProcessorCollection
pc = d.GetInstances()

Console.WriteLine(pc.Count()) 'PUT THIS LINE HERE AND IT FAILS

For Each d In pc
Console.WriteLine(d.Name)
Next
Console.WriteLine(pc.Count()) 'MOVE THE Count() Call to HERE and it works

------------------

I find this bizare as the underlying class impliments
System.Collections.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.ComponentModel

Imports System.Management

Imports System.Collections

Imports System.Globalization

Imports System.ComponentModel.Design.Serialization

Imports System.Reflection

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
TypeCon�erter 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<PropertyName> 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_Processor

Public Class Processor

Inherits System.ComponentModel.Component
'Private property to hold the WMI namespace in which the class resides.

Private Shared CreatedWmiNamespace As String = "ROOT\CIMV2"
'Private property to hold the name of WMI class which created this class.

Private Shared CreatedClassName As String = "Win32_Processor"
'Private member variable to hold the ManagementScope which is used by the
various methods.

Private Shared statMgmtScope As System.Management.ManagementScope = Nothing
Private PrivateSystemProperties As ManagementSystemProperties
'Underlying lateBound WMI object.

Private PrivateLateBoundObject As System.Management.ManagementObject
'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.Management.ManagementBaseObject
'The current WMI object used

Private curObj As System.Management.ManagementBaseObject
'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(Nothing,System.Management.ManagementS cope),
CType(Nothing,System.Management.ManagementPath),
CType(Nothing,System.Management.ObjectGetOptions))

End Sub
Public Sub New(ByVal keyDeviceID As String)

Me.New(CType(Nothing,System.Management.ManagementS cope), CType(New
System.Management.ManagementPath(Processor.Constru ctPath(keyDeviceID)),Syste
m.Management.ManagementPath),
CType(Nothing,System.Management.ObjectGetOptions))

End Sub
Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal
keyDeviceID As String)

Me.New(CType(mgmtScope,System.Management.Managemen tScope), CType(New
System.Management.ManagementPath(Processor.Constru ctPath(keyDeviceID)),Syste
m.Management.ManagementPath),
CType(Nothing,System.Management.ObjectGetOptions))

End Sub
Public Sub New(ByVal path As System.Management.ManagementPath, ByVal
getOptions As System.Management.ObjectGetOptions)

Me.New(CType(Nothing,System.Management.ManagementS cope),
CType(path,System.Management.ManagementPath),
CType(getOptions,System.Management.ObjectGetOption s))

End Sub
Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal
path As System.Management.ManagementPath)

Me.New(CType(mgmtScope,System.Management.Managemen tScope),
CType(path,System.Management.ManagementPath),
CType(Nothing,System.Management.ObjectGetOptions))

End Sub
Public Sub New(ByVal path As System.Management.ManagementPath)

Me.New(CType(Nothing,System.Management.ManagementS cope),
CType(path,System.Management.ManagementPath),
CType(Nothing,System.Management.ObjectGetOptions))

End Sub
Public Sub New(ByVal mgmtScope As System.Management.ManagementScope, ByVal
path As System.Management.ManagementPath, ByVal getOptions As
System.Management.ObjectGetOptions)

MyBase.New

If (Not (path) Is Nothing) Then

If (CheckIfProperClass(mgmtScope, path, getOptions) <> true) Then

Throw New System.ArgumentException("Class name does not match.")

End If

End If

PrivateLateBoundObject = New System.Management.ManagementObject(mgmtScope,
path, getOptions)

PrivateSystemProperties = New
ManagementSystemProperties(PrivateLateBoundObject)

curObj = PrivateLateBoundObject

End Sub
Public Sub New(ByVal theObject As System.Management.ManagementObject)

MyBase.New

If (CheckIfProperClass(theObject) = true) Then

PrivateLateBoundObject = theObject

PrivateSystemProperties = New
ManagementSystemProperties(PrivateLateBoundObject)

curObj = PrivateLateBoundObject

Else

Throw New System.ArgumentException("Class name does not match.")

End If

End Sub
Public Sub New(ByVal theObject As System.Management.ManagementBaseObject)

MyBase.New

If (CheckIfProperClass(theObject) = true) Then

embeddedObj = theObject

PrivateSystemProperties = New ManagementSystemProperties(theObject)

curObj = embeddedObj

isEmbedded = true

Else

Throw New System.ArgumentException("Class name does not match.")

End If

End Sub
'Property returns the namespace of the WMI class.

<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property OriginatingNamespace As String

Get

Return "ROOT\CIMV2"

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property ManagementClassName As String

Get

Dim strRet As String = CreatedClassName

If (Not (curObj) Is Nothing) Then

If (Not (curObj.ClassPath) Is Nothing) Then

strRet = CType(curObj("__CLASS"),String)

If ((strRet Is Nothing) _

OrElse (strRet Is System.String.Empty)) Then

strRet = CreatedClassName

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), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property SystemProperties As ManagementSystemProperties

Get

Return PrivateSystemProperties

End Get

End Property
'Property returning the underlying lateBound object.

<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property LateBoundObject As
System.Management.ManagementBaseObject

Get

Return curObj

End Get

End Property
'ManagementScope of the object.

<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public Property Scope As System.Management.ManagementScope

Get

If (isEmbedded = false) Then

Return PrivateLateBoundObject.Scope

Else

Return Nothing

End If

End Get

Set

If (isEmbedded = false) Then

PrivateLateBoundObject.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.(ie.
Put() is called after modification of a property).

<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.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.Management.ManagementPath

Get

If (isEmbedded = false) Then

Return PrivateLateBoundObject.Path

Else

Return Nothing

End If

End Get

Set

If (isEmbedded = false) Then

If (CheckIfProperClass(Nothing, value, Nothing) <> true) Then

Throw New System.ArgumentException("Class name does not match.")

End If

PrivateLateBoundObject.Path = value

End If

End Set

End Property
'Public static scope property which is used by the various methods.

<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public Shared Property StaticScope As System.Management.ManagementScope

Get

Return statMgmtScope

End Get

Set

statMgmtScope = value

End Set

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsAddressWidthNull As Boolean

Get

If (curObj("AddressWidth") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("Processor address width in bits."), _

TypeConverter(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property AddressWidth As System.UInt16

Get

If (curObj("AddressWidth") Is Nothing) Then

Return System.Convert.ToUInt16(0)

End If

Return CType(curObj("AddressWidth"),System.UInt16)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsArchitectureNull As Boolean

Get

If (curObj("Architecture") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The Architecture property specifies the processor architecture
used by this platf"& _

"orm. It returns one of the following
"&Microsoft.VisualBasic.ChrW(9)&Microsoft.VisualBa sic.ChrW(9)&"integer
values:"&Microsoft.VisualBasic.ChrW(10)&"0 - x86
"&Microsoft.VisualBasic.ChrW(10)&"1 - MIPS
"&Microsoft.VisualBasic.ChrW(10)&"2 - Al"& _

"pha "&Microsoft.VisualBasic.ChrW(10)&"3 - PowerPC
"&Microsoft.VisualBasic.ChrW(10)&"6 - ia64 "), _

TypeConverter(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property Architecture As ArchitectureValues

Get

If (curObj("Architecture") Is Nothing) Then

Return CType(System.Convert.ToInt32(0),ArchitectureValues )

End If

Return CType(Convert.ToInt32(curObj("Architecture")),Arch itectureValues)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsAvailabilityNull As Boolean

Get

If (curObj("Availability") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The 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(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property Availability As AvailabilityValues

Get

If (curObj("Availability") Is Nothing) Then

Return CType(System.Convert.ToInt32(0),AvailabilityValues )

End If

Return CType(Convert.ToInt32(curObj("Availability")),Avai labilityValues)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The Caption property is a short textual description (one-line
string) of the obje"& _

"ct.")> _

Public ReadOnly Property Caption As String

Get

Return CType(curObj("Caption"),String)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsConfigManagerErrorCodeNull As Boolean

Get

If (curObj("ConfigManagerErrorCode") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("Indicates the Win32 Configuration Manager error code. The
following values may b"& _

"e returned:
"&Microsoft.VisualBasic.ChrW(10)&"0"&Microsoft.Vis ualBasic.ChrW(9)&"This
device is working properly.
"&Microsoft.VisualBasic.ChrW(10)&"1"&Microsoft.Vis ualBasic.ChrW(9)&"This
device is not configured"& _

" correctly.
"&Microsoft.VisualBasic.ChrW(10)&"2"&Microsoft.Vis ualBasic.ChrW(9)&"Windows
cannot load the driver for this device.
"&Microsoft.VisualBasic.ChrW(10)&"3"&Microsoft.Vis ualBasic.ChrW(9)&"The
driver for"& _

" this device might be corrupted, or your system may be running low on
memory or "& _

"other resources.
"&Microsoft.VisualBasic.ChrW(10)&"4"&Microsoft.Vis ualBasic.ChrW(9)&"This
device is not working properly. One of its drivers or y"& _

"our registry might be corrupted.
"&Microsoft.VisualBasic.ChrW(10)&"5"&Microsoft.Vis ualBasic.ChrW(9)&"The
driver for this device needs a resource "& _

"that Windows cannot manage.
"&Microsoft.VisualBasic.ChrW(10)&"6"&Microsoft.Vis ualBasic.ChrW(9)&"The boot
configuration for this device conflicts "& _

"with other devices.
"&Microsoft.VisualBasic.ChrW(10)&"7"&Microsoft.Vis ualBasic.ChrW(9)&"Cannot
filter.
"&Microsoft.VisualBasic.ChrW(10)&"8"&Microsoft.Vis ualBasic.ChrW(9)&"The
driver loader for the device is mis"& _

"sing.
"&Microsoft.VisualBasic.ChrW(10)&"9"&Microsoft.Vis ualBasic.ChrW(9)&"This
device is not working properly because the controlling firmware is"& _

" reporting the resources for the device incorrectly.
"&Microsoft.VisualBasic.ChrW(10)&"10"&Microsoft.Vi sualBasic.ChrW(9)&"This
device cannot star"& _

"t.
"&Microsoft.VisualBasic.ChrW(10)&"11"&Microsoft.Vi sualBasic.ChrW(9)&"This
device failed.
"&Microsoft.VisualBasic.ChrW(10)&"12"&Microsoft.Vi sualBasic.ChrW(9)&"This
device cannot find enough free resources tha"& _

"t it can use.
"&Microsoft.VisualBasic.ChrW(10)&"13"&Microsoft.Vi sualBasic.ChrW(9)&"Windows
cannot verify this device's resources.
"&Microsoft.VisualBasic.ChrW(10)&"14"&Microsoft.Vi sualBasic.ChrW(9)&"This
device"& _

" cannot work properly until you restart your computer.
"&Microsoft.VisualBasic.ChrW(10)&"15"&Microsoft.Vi sualBasic.ChrW(9)&"This
device is not wo"& _

"rking properly because there is probably a re-enumeration problem.
"&Microsoft.VisualBasic.ChrW(10)&"16"&Microsoft.Vi sualBasic.ChrW(9)&"Windows
c"& _

"annot identify all the resources this device uses.
"&Microsoft.VisualBasic.ChrW(10)&"17"&Microsoft.Vi sualBasic.ChrW(9)&"This
device is asking for"& _

" an unknown resource type.
"&Microsoft.VisualBasic.ChrW(10)&"18"&Microsoft.Vi sualBasic.ChrW(9)&"Reinsta
ll the drivers for this device.
"&Microsoft.VisualBasic.ChrW(10)&"19"&Microsoft.Vi sualBasic.ChrW(9)&"Your
r"& _

"egistry might be corrupted.
"&Microsoft.VisualBasic.ChrW(10)&"20"&Microsoft.Vi sualBasic.ChrW(9)&"Failure
using the VxD loader.
"&Microsoft.VisualBasic.ChrW(10)&"21"&Microsoft.Vi sualBasic.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.VisualBasic.ChrW(10)&"22"&Microsoft.Vi sualBasic.ChrW(9)&"This
device is disabled."& _

"
"&Microsoft.VisualBasic.ChrW(10)&"23"&Microsoft.Vi sualBasic.ChrW(9)&"System
failure: Try changing the driver for this device. If that doesn't wo"& _

"rk, see your hardware documentation.
"&Microsoft.VisualBasic.ChrW(10)&"24"&Microsoft.Vi sualBasic.ChrW(9)&"This
device is not present, is not work"& _

"ing properly, or does not have all its drivers installed.
"&Microsoft.VisualBasic.ChrW(10)&"25"&Microsoft.Vi sualBasic.ChrW(9)&"Windows
is still s"& _

"etting up this device.
"&Microsoft.VisualBasic.ChrW(10)&"26"&Microsoft.Vi sualBasic.ChrW(9)&"Windows
is still setting up this device.
"&Microsoft.VisualBasic.ChrW(10)&"27"&Microsoft.Vi sualBasic.ChrW(9)&"This
dev"& _

"ice does not have valid log configuration.
"&Microsoft.VisualBasic.ChrW(10)&"28"&Microsoft.Vi sualBasic.ChrW(9)&"The
drivers for this device are n"& _

"ot installed.
"&Microsoft.VisualBasic.ChrW(10)&"29"&Microsoft.Vi sualBasic.ChrW(9)&"This
device is disabled because the firmware of the device did"& _

" not give it the required resources.
"&Microsoft.VisualBasic.ChrW(10)&"30"&Microsoft.Vi sualBasic.ChrW(9)&"This
device is using an Interrupt Reque"& _

"st (IRQ) resource that another device is using.
"&Microsoft.VisualBasic.ChrW(10)&"31"&Microsoft.Vi sualBasic.ChrW(9)&"This
device is not working p"& _

"roperly because Windows cannot load the drivers required for this
device."), _

TypeConverter(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property ConfigManagerErrorCode As
ConfigManagerErrorCodeValues

Get

If (curObj("ConfigManagerErrorCode") Is Nothing) Then

Return CType(System.Convert.ToInt64(0),ConfigManagerError CodeValues)

End If

Return
CType(Convert.ToInt64(curObj("ConfigManagerErrorCo de")),ConfigManagerErrorCo
deValues)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsConfigManagerUserConfigNull As Boolean

Get

If (curObj("ConfigManagerUserConfig") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("Indicates whether the device is using a user-defined
configuration."), _

TypeConverter(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property ConfigManagerUserConfig As Boolean

Get

If (curObj("ConfigManagerUserConfig") Is Nothing) Then

Return System.Convert.ToBoolean(0)

End If

Return CType(curObj("ConfigManagerUserConfig"),Boolean)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsCpuStatusNull As Boolean

Get

If (curObj("CpuStatus") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The CpuStatus property specifies the current status of the
processor. Changes in "& _

"status arise from processor usage, not the physical condition of the
processor."), _

TypeConverter(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property CpuStatus As CpuStatusValues

Get

If (curObj("CpuStatus") Is Nothing) Then

Return CType(System.Convert.ToInt32(0),CpuStatusValues)

End If

Return CType(Convert.ToInt32(curObj("CpuStatus")),CpuStat usValues)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("CreationClassName 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 CreationClassName As String

Get

Return CType(curObj("CreationClassName"),String)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsCurrentClockSpeedNull As Boolean

Get

If (curObj("CurrentClockSpeed") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The current speed (in MHz) of this processor."), _

TypeConverter(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property CurrentClockSpeed As System.UInt32

Get

If (curObj("CurrentClockSpeed") Is Nothing) Then

Return System.Convert.ToUInt32(0)

End If

Return CType(curObj("CurrentClockSpeed"),System.UInt32)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsCurrentVoltageNull As Boolean

Get

If (curObj("CurrentVoltage") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The 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."&Microsoft.VisualBasic.ChrW(10)&"Exam ple: "& _

"field value for a processor voltage of 1.8 volts would be 92h = 80h + (1.8
x 10)"& _

" = 80h + 18 = 80h + 12h."), _

TypeConverter(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property CurrentVoltage As System.UInt16

Get

If (curObj("CurrentVoltage") Is Nothing) Then

Return System.Convert.ToUInt16(0)

End If

Return CType(curObj("CurrentVoltage"),System.UInt16)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsDataWidthNull As Boolean

Get

If (curObj("DataWidth") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("Processor data width in bits."), _

TypeConverter(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property DataWidth As System.UInt16

Get

If (curObj("DataWidth") Is Nothing) Then

Return System.Convert.ToUInt16(0)

End If

Return CType(curObj("DataWidth"),System.UInt16)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The Description property provides a textual description of the
object. ")> _

Public ReadOnly Property Description As String

Get

Return CType(curObj("Description"),String)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The 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("DeviceID"),String)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsErrorClearedNull As Boolean

Get

If (curObj("ErrorCleared") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("ErrorCleared is a boolean property indicating that the error
reported in LastErro"& _

"rCode property is now cleared."), _

TypeConverter(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property ErrorCleared As Boolean

Get

If (curObj("ErrorCleared") Is Nothing) Then

Return System.Convert.ToBoolean(0)

End If

Return CType(curObj("ErrorCleared"),Boolean)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("ErrorDescription 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 ErrorDescription As String

Get

Return CType(curObj("ErrorDescription"),String)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsExtClockNull As Boolean

Get

If (curObj("ExtClock") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The ExtClock property specifies the external clock frequency.
If the frequency is"& _

" unknown this property is set to null."), _

TypeConverter(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property ExtClock As System.UInt32

Get

If (curObj("ExtClock") Is Nothing) Then

Return System.Convert.ToUInt32(0)

End If

Return CType(curObj("ExtClock"),System.UInt32)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.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), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The processor family type. For example, values include
""Pentium(R) processor with"& _

" MMX(TM) technology"" (14) and ""68040"" (96)."), _

TypeConverter(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property Family As FamilyValues

Get

If (curObj("Family") Is Nothing) Then

Return CType(System.Convert.ToInt32(0),FamilyValues)

End If

Return CType(Convert.ToInt32(curObj("Family")),FamilyValu es)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsInstallDateNull As Boolean

Get

If (curObj("InstallDate") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The 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(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property InstallDate As Date

Get

If (Not (curObj("InstallDate")) Is Nothing) Then

Return ToDateTime(CType(curObj("InstallDate"),String))

Else

Return System.DateTime.MinValue

End If

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsL2CacheSizeNull As Boolean

Get

If (curObj("L2CacheSize") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The 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(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property L2CacheSize As System.UInt32

Get

If (curObj("L2CacheSize") Is Nothing) Then

Return System.Convert.ToUInt32(0)

End If

Return CType(curObj("L2CacheSize"),System.UInt32)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsL2CacheSpeedNull As Boolean

Get

If (curObj("L2CacheSpeed") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The 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(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property L2CacheSpeed As System.UInt32

Get

If (curObj("L2CacheSpeed") Is Nothing) Then

Return System.Convert.ToUInt32(0)

End If

Return CType(curObj("L2CacheSpeed"),System.UInt32)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsLastErrorCodeNull As Boolean

Get

If (curObj("LastErrorCode") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("LastErrorCode captures the last error code reported by the
logical device."), _

TypeConverter(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property LastErrorCode As System.UInt32

Get

If (curObj("LastErrorCode") Is Nothing) Then

Return System.Convert.ToUInt32(0)

End If

Return CType(curObj("LastErrorCode"),System.UInt32)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.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), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The Level property further defines the processor type. The
value depends on the "& _

"architecture of the processor."), _

TypeConverter(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property Level As System.UInt16

Get

If (curObj("Level") Is Nothing) Then

Return System.Convert.ToUInt16(0)

End If

Return CType(curObj("Level"),System.UInt16)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsLoadPercentageNull As Boolean

Get

If (curObj("LoadPercentage") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The 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(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property LoadPercentage As System.UInt16

Get

If (curObj("LoadPercentage") Is Nothing) Then

Return System.Convert.ToUInt16(0)

End If

Return CType(curObj("LoadPercentage"),System.UInt16)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The Manufacturer property specifies the name of the processor's
manufacturer."&Microsoft.VisualBasic.ChrW(10)&"Exa "& _

"mple: GenuineSilicon")> _

Public ReadOnly Property Manufacturer As String

Get

Return CType(curObj("Manufacturer"),String)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsMaxClockSpeedNull As Boolean

Get

If (curObj("MaxClockSpeed") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The maximum speed (in MHz) of this processor."), _

TypeConverter(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property MaxClockSpeed As System.UInt32

Get

If (curObj("MaxClockSpeed") Is Nothing) Then

Return System.Convert.ToUInt32(0)

End If

Return CType(curObj("MaxClockSpeed"),System.UInt32)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The 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("Name"),String)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.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 OtherFamilyDescription As String

Get

Return CType(curObj("OtherFamilyDescription"),String)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("Indicates the Win32 Plug and Play device ID of the logical
device. Example: *PNP"& _

"030b")> _

Public ReadOnly Property PNPDeviceID As String

Get

Return CType(curObj("PNPDeviceID"),String)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("Indicates 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 PowerManagementCapabilities As
PowerManagementCapabilitiesValues()

Get

Dim arrEnumVals As System.Array =
CType(curObj("PowerManagementCapabilities"),System .Array)

Dim enumToRet() As PowerManagementCapabilitiesValues = New
PowerManagementCapabilitiesValues((arrEnumVals.Len gth) - 1) {}

Dim counter As Int32 = 0

counter = 0

Do While (counter < arrEnumVals.Length)

enumToRet(counter) =
CType(System.Convert.ToInt32(arrEnumVals.GetValue( counter)),PowerManagementC
apabilitiesValues)

counter = (counter + 1)

Loop

Return enumToRet

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsPowerManagementSupportedNull As Boolean

Get

If (curObj("PowerManagementSupported") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("Boolean 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"& _

"agementCapabilities 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 "& _

"PowerManagementCapabilities array."), _

TypeConverter(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property PowerManagementSupported As Boolean

Get

If (curObj("PowerManagementSupported") Is Nothing) Then

Return System.Convert.ToBoolean(0)

End If

Return CType(curObj("PowerManagementSupported"),Boolean)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The 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("ProcessorId"),String)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsProcessorTypeNull As Boolean

Get

If (curObj("ProcessorType") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The ProcessorType property specifies the processor's primary
function."), _

TypeConverter(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property ProcessorType As ProcessorTypeValues

Get

If (curObj("ProcessorType") Is Nothing) Then

Return CType(System.Convert.ToInt32(0),ProcessorTypeValue s)

End If

Return CType(Convert.ToInt32(curObj("ProcessorType")),Pro cessorTypeValues)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsRevisionNull As Boolean

Get

If (curObj("Revision") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The 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(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property Revision As System.UInt16

Get

If (curObj("Revision") Is Nothing) Then

Return System.Convert.ToUInt16(0)

End If

Return CType(curObj("Revision"),System.UInt16)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.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("Role"),String)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The SocketDesignation property contains the type of chip socket
used on the circu"& _

"it."&Microsoft.VisualBasic.ChrW(10)&"Example: J202")> _

Public ReadOnly Property SocketDesignation As String

Get

Return CType(curObj("SocketDesignation"),String)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The 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("Status"),String)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsStatusInfoNull As Boolean

Get

If (curObj("StatusInfo") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("StatusInfo 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(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property StatusInfo As StatusInfoValues

Get

If (curObj("StatusInfo") Is Nothing) Then

Return CType(System.Convert.ToInt32(0),StatusInfoValues)

End If

Return CType(Convert.ToInt32(curObj("StatusInfo")),Status InfoValues)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("Stepping 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("Stepping"),String)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The scoping System's CreationClassName.")> _

Public ReadOnly Property SystemCreationClassName As String

Get

Return CType(curObj("SystemCreationClassName"),String)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The scoping System's Name.")> _

Public ReadOnly Property SystemName As String

Get

Return CType(curObj("SystemName"),String)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.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("UniqueId"),String)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsUpgradeMethodNull As Boolean

Get

If (curObj("UpgradeMethod") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("CPU socket information including data on how this Processor can
be upgraded (if u"& _

"pgrades are supported). This property is an integer enumeration."), _

TypeConverter(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property UpgradeMethod As UpgradeMethodValues

Get

If (curObj("UpgradeMethod") Is Nothing) Then

Return CType(System.Convert.ToInt32(0),UpgradeMethodValue s)

End If

Return CType(Convert.ToInt32(curObj("UpgradeMethod")),Upg radeMethodValues)

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The Version property specifies an architecture-dependent
processor revision numbe"& _

"r. Note: This member is not used in Windows
95."&Microsoft.VisualBasic.ChrW(10)&"Example: Model 2, Stepping 12.")> _

Public ReadOnly Property Version As String

Get

Return CType(curObj("Version"),String)

End Get

End Property
<Browsable(false), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden)> _

Public ReadOnly Property IsVoltageCapsNull As Boolean

Get

If (curObj("VoltageCaps") Is Nothing) Then

Return true

Else

Return false

End If

End Get

End Property
<Browsable(true), _

DesignerSerializationVisibility(DesignerSerializat ionVisibility.Hidden), _

Description("The 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(GetType(WMIValueTypeConverter))> _

Public ReadOnly Property VoltageCaps As VoltageCapsValues

Get

If (curObj("VoltageCaps") Is Nothing) Then

Return CType(System.Convert.ToInt32(0),VoltageCapsValues)

End If

Return CType(Convert.ToInt32(curObj("VoltageCaps")),Volta geCapsValues)

End Get

End Property
Private Overloads Function CheckIfProperClass(ByVal mgmtScope As
System.Management.ManagementScope, ByVal path As
System.Management.ManagementPath, ByVal OptionsParam As
System.Management.ObjectGetOptions) As Boolean

If ((Not (path) Is Nothing) _

AndAlso (System.String.Compare(path.ClassName, ManagementClassName, true,
CultureInfo.InvariantCulture) = 0)) Then

Return true

Else

Return CheckIfProperClass(New System.Management.ManagementObject(mgmtScope,
path, OptionsParam))

End If

End Function
Private Overloads Function CheckIfProperClass(ByVal theObj As
System.Management.ManagementBaseObject) As Boolean

If ((Not (theObj) Is Nothing) _

AndAlso (System.String.Compare(CType(theObj("__CLASS"),Str ing),
ManagementClassName, true, CultureInfo.InvariantCulture) = 0)) Then

Return true

Else

Dim parentClasses As System.Array =
CType(theObj("__DERIVATION"),System.Array)

If (Not (parentClasses) Is Nothing) Then

Dim count As Int32 = 0

count = 0

Do While (count < parentClasses.Length)

If (System.String.Compare(CType(parentClasses.GetValu e(count),String),
ManagementClassName, true, CultureInfo.InvariantCulture) = 0) Then

Return true

End If

count = (count + 1)

Loop

End If

End If

Return false

End Function
Private Function ShouldSerializeAddressWidth() As Boolean

If (IsAddressWidthNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeArchitecture() As Boolean

If (IsArchitectureNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeAvailability() As Boolean

If (IsAvailabilityNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeConfigManagerErrorCode() As Boolean

If (IsConfigManagerErrorCodeNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeConfigManagerUserConfig() As Boolean

If (IsConfigManagerUserConfigNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeCpuStatus() As Boolean

If (IsCpuStatusNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeCurrentClockSpeed() As Boolean

If (IsCurrentClockSpeedNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeCurrentVoltage() As Boolean

If (IsCurrentVoltageNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeDataWidth() As Boolean

If (IsDataWidthNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeErrorCleared() As Boolean

If (IsErrorClearedNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeExtClock() As Boolean

If (IsExtClockNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeFamily() 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(ByVal 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.Minute

Dim second As Integer = System.DateTime.MinValue.Second

Dim ticks As Long = 0

Dim dmtf As String = dmtfDate

Dim datetime As Date = System.DateTime.MinValue

Dim tempString As String = System.String.Empty

If (dmtf Is Nothing) Then

Throw New System.ArgumentOutOfRangeException

End If

If (dmtf.Length = 0) Then

Throw New System.ArgumentOutOfRangeException

End If

If (dmtf.Length <> 25) Then

Throw New System.ArgumentOutOfRangeException

End If

Try

tempString = dmtf.Substring(0, 4)

If ("****" <> tempString) Then

year = System.Int32.Parse(tempString)

End If

tempString = dmtf.Substring(4, 2)

If ("**" <> tempString) Then

month = System.Int32.Parse(tempString)

End If

tempString = dmtf.Substring(6, 2)

If ("**" <> tempString) Then

day = System.Int32.Parse(tempString)

End If

tempString = dmtf.Substring(8, 2)

If ("**" <> tempString) Then

hour = System.Int32.Parse(tempString)

End If

tempString = dmtf.Substring(10, 2)

If ("**" <> tempString) Then

minute = System.Int32.Parse(tempString)

End If

tempString = dmtf.Substring(12, 2)

If ("**" <> tempString) Then

second = System.Int32.Parse(tempString)

End If

tempString = dmtf.Substring(15, 6)

If ("******" <> tempString) Then

ticks = (System.Int64.Parse(tempString) _

* (System.TimeSpan.TicksPerMillisecond / 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.ArgumentOutOfRangeException

End If

Catch e As System.Exception

e = e

Throw New System.ArgumentOutOfRangeException

End Try

datetime = New Date(year, month, day, hour, minute, second, 0)

datetime = datetime.AddTicks(ticks)

Dim tickOffset As System.TimeSpan =
System.TimeZone.CurrentTimeZone.GetUtcOffset(datet ime)

Dim UTCOffset As Integer = 0

Dim OffsetToBeAdjusted As Long = 0

Dim OffsetMins As Long = (tickOffset.Ticks / System.TimeSpan.TicksPerMinute)

tempString = dmtf.Substring(22, 3)

If (tempString <> "***") Then

tempString = dmtf.Substring(21, 4)

Try

UTCOffset = System.Int32.Parse(tempString)

Catch e As System.Exception

e = e

Throw New System.ArgumentOutOfRangeException

End Try

OffsetToBeAdjusted = (OffsetMins - UTCOffset)

datetime = datetime.AddMinutes(OffsetToBeAdjusted)

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.Empty

Dim tickOffset As System.TimeSpan =
System.TimeZone.CurrentTimeZone.GetUtcOffset([date])

Dim OffsetMins As Long = (tickOffset.Ticks / System.TimeSpan.TicksPerMinute)

If (System.Math.Abs(OffsetMins) > 999) Then

[date] = [date].ToUniversalTime

utcString = "+000"

Else

If (tickOffset.Ticks >= 0) Then

utcString = ("+" + (tickOffset.Ticks /
System.TimeSpan.TicksPerMinute).ToString.PadLeft(3 ,
Microsoft.VisualBasic.ChrW(48)))

Else

Dim strTemp As String = OffsetMins.ToString

utcString = ("-" + strTemp.Substring(1, (strTemp.Length - 1)).PadLeft(3,
Microsoft.VisualBasic.ChrW(48)))

End If

End If

Dim dmtfDateTime As String = [date].Year.ToString.PadLeft(4,
Microsoft.VisualBasic.ChrW(48))

dmtfDateTime = (dmtfDateTime + [date].Month.ToString.PadLeft(2,
Microsoft.VisualBasic.ChrW(48)))

dmtfDateTime = (dmtfDateTime + [date].Day.ToString.PadLeft(2,
Microsoft.VisualBasic.ChrW(48)))

dmtfDateTime = (dmtfDateTime + [date].Hour.ToString.PadLeft(2,
Microsoft.VisualBasic.ChrW(48)))

dmtfDateTime = (dmtfDateTime + [date].Minute.ToString.PadLeft(2,
Microsoft.VisualBasic.ChrW(48)))

dmtfDateTime = (dmtfDateTime + [date].Second.ToString.PadLeft(2,
Microsoft.VisualBasic.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.TicksPerMillisecond)

Dim strMicrosec As String = microsec.ToString

If (strMicrosec.Length > 6) Then

strMicrosec = strMicrosec.Substring(0, 6)

End If

dmtfDateTime = (dmtfDateTime + strMicrosec.PadLeft(6,
Microsoft.VisualBasic.ChrW(48)))

dmtfDateTime = (dmtfDateTime + utcString)

Return dmtfDateTime

End Function
Private Function ShouldSerializeInstallDate() As Boolean

If (IsInstallDateNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeL2CacheSize() As Boolean

If (IsL2CacheSizeNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeL2CacheSpeed() As Boolean

If (IsL2CacheSpeedNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeLastErrorCode() As Boolean

If (IsLastErrorCodeNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeLevel() As Boolean

If (IsLevelNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeLoadPercentage() As Boolean

If (IsLoadPercentageNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeMaxClockSpeed() As Boolean

If (IsMaxClockSpeedNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializePowerManagementSupported() As Boolean

If (IsPowerManagementSupportedNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeProcessorType() As Boolean

If (IsProcessorTypeNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeRevision() As Boolean

If (IsRevisionNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeStatusInfo() As Boolean

If (IsStatusInfoNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeUpgradeMethod() As Boolean

If (IsUpgradeMethodNull = false) Then

Return true

End If

Return false

End Function
Private Function ShouldSerializeVoltageCaps() As Boolean

If (IsVoltageCapsNull = false) Then

Return true

End If

Return false

End Function
<Browsable(true)> _

Public Sub CommitObject()

If (isEmbedded = false) Then

PrivateLateBoundObject.Put

End If

End Sub
Private Shared Function ConstructPath(ByVal keyDeviceID As String) As String

Dim strPath As String = "ROOT\CIMV2:Win32_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 ProcessorCollection

Return GetInstances(CType(Nothing,System.Management.Manag ementScope),
CType(Nothing,System.Management.EnumerationOptions ))

End Function
Public Overloads Shared Function GetInstances(ByVal condition As String) As
ProcessorCollection

Return GetInstances(Nothing, condition, Nothing)

End Function
Public Overloads Shared Function GetInstances(ByVal selectedProperties() As
System.String ) As ProcessorCollection

Return GetInstances(Nothing, Nothing, selectedProperties)

End Function
Public Overloads Shared Function GetInstances(ByVal condition As String,
ByVal selectedProperties() As System.String ) As ProcessorCollection

Return GetInstances(Nothing, condition, selectedProperties)

End Function
Public Overloads Shared Function GetInstances(ByVal mgmtScope As
System.Management.ManagementScope, ByVal enumOptions As
System.Management.EnumerationOptions) As ProcessorCollection

If (mgmtScope Is Nothing) Then

If (statMgmtScope Is Nothing) Then

mgmtScope = New System.Management.ManagementScope

mgmtScope.Path.NamespacePath = "root\CIMV2"

Else

mgmtScope = statMgmtScope

End If

End If

Dim pathObj As System.Management.ManagementPath = New
System.Management.ManagementPath

pathObj.ClassName = "Win32_Processor"

pathObj.NamespacePath = "root\CIMV2"

Dim clsObject As System.Management.ManagementClass = New
System.Management.ManagementClass(mgmtScope, pathObj, Nothing)

If (enumOptions Is Nothing) Then

enumOptions = New System.Management.EnumerationOptions

enumOptions.EnsureLocatable = true

End If

Return New ProcessorCollection(clsObject.GetInstances(enumOpt ions))

End Function
Public Overloads Shared Function GetInstances(ByVal mgmtScope As
System.Management.ManagementScope, ByVal condition As String) As
ProcessorCollection

Return GetInstances(mgmtScope, condition, Nothing)

End Function
Public Overloads Shared Function GetInstances(ByVal mgmtScope As
System.Management.ManagementScope, ByVal selectedProperties() As
System.String ) As ProcessorCollection

Return GetInstances(mgmtScope, Nothing, selectedProperties)

End Function
Public Overloads Shared Function GetInstances(ByVal mgmtScope As
System.Management.ManagementScope, ByVal condition As String, ByVal
selectedProperties() As System.String ) As ProcessorCollection

If (mgmtScope Is Nothing) Then

If (statMgmtScope Is Nothing) Then

mgmtScope = New System.Management.ManagementScope

mgmtScope.Path.NamespacePath = "root\CIMV2"

Else

mgmtScope = statMgmtScope

End If

End If

Dim ObjectSearcher As System.Management.ManagementObjectSearcher = New
System.Management.ManagementObjectSearcher(mgmtSco pe, New
SelectQuery("Win32_Processor", condition, selectedProperties))

Dim enumOptions As System.Management.EnumerationOptions = New
System.Management.EnumerationOptions

enumOptions.EnsureLocatable = true

ObjectSearcher.Options = enumOptions

Return New ProcessorCollection(ObjectSearcher.Get)

End Function
<Browsable(true)> _

Public Shared Function CreateInstance() As Processor

Dim mgmtScope As System.Management.ManagementScope = Nothing

If (statMgmtScope Is Nothing) Then

mgmtScope = New System.Management.ManagementScope

mgmtScope.Path.NamespacePath = CreatedWmiNamespace

Else

mgmtScope = statMgmtScope

End If

Dim mgmtPath As System.Management.ManagementPath = New
System.Management.ManagementPath(CreatedClassName)

Return New Processor(New System.Management.ManagementClass(mgmtScope,
mgmtPath, Nothing).CreateInstance)

End Function
<Browsable(true)> _

Public Sub Delete()

PrivateLateBoundObject.Delete

End Sub
Public Function Reset() As System.UInt32

If (isEmbedded = false) Then

Dim inParams As System.Management.ManagementBaseObject = Nothing

Dim outParams As System.Management.ManagementBaseObject =
PrivateLateBoundObject.InvokeMethod("Reset", inParams, Nothing)

Return System.Convert.ToUInt32(outParams.Properties("Retu rnValue").Value)

Else

Return System.Convert.ToUInt32(0)

End If

End Function
Public Function SetPowerState(ByVal PowerState As System.UInt16, ByVal Time
As Date) As System.UInt32

If (isEmbedded = false) Then

Dim inParams As System.Management.ManagementBaseObject = Nothing

inParams = PrivateLateBoundObject.GetMethodParameters("SetPow erState")

inParams("PowerState") = PowerState

inParams("Time") = ToDmtfDateTime(CType(Time,Date))

Dim outParams As System.Management.ManagementBaseObject =
PrivateLateBoundObject.InvokeMethod("SetPowerState ", inParams, Nothing)

Return System.Convert.ToUInt32(outParams.Properties("Retu rnValue").Value)

Else

Return System.Convert.ToUInt32(0)

End If

End Function
Public Enum ArchitectureValues As Integer
x86 = 0
MIPS = 1
Alpha = 2
PowerPC = 3
ia64 = 6

End Enum
Public Enum AvailabilityValues As Integer
Other = 1
Unknown = 2
Running_Full_Power = 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_Unknown = 13
Power_Save_Low_Power_Mode = 14
Power_Save_Standby = 15
Power_Cycle = 16
Power_Save_Warning = 17
Paused = 18
Not_Ready = 19
Not_Configured = 20
Quiesced = 21
INVALID_ENUM_VALUE = 0

End Enum
Public Enum ConfigManagerErrorCodeValues As Long
This_device_is_working_properly_ = 0
This_device_is_not_configured_correctly_ = 1
Windows_cannot_load_the_driver_for_this_device_ = 2
The_driver_for_this_device_might_be_corrupted_or_y our_system_may_be_running_
low_on_memory_or_other_resources_ = 3
This_device_is_not_working_properly_One_of_its_dri vers_or_your_registry_migh
t_be_corrupted_ = 4
The_driver_for_this_device_needs_a_resource_that_W indows_cannot_manage_ = 5
The_boot_configuration_for_this_device_conflicts_w ith_other_devices_ = 6
Cannot_filter_ = 7
The_driver_loader_for_the_device_is_missing_ = 8
This_device_is_not_working_properly_because_the_co ntrolling_firmware_is_repo
rting_the_resources_for_the_device_incorrectly_ = 9
This_device_cannot_start_ = 10
This_device_failed_ = 11
This_device_cannot_find_enough_free_resources_that _it_can_use_ = 12
Windows_cannot_verify_this_device_s_resources_ = 13
This_device_cannot_work_properly_until_you_restart _your_computer_ = 14
This_device_is_not_working_properly_because_there_ is_probably_a_re_enumerati
on_problem_ = 15
Windows_cannot_identify_all_the_resources_this_dev ice_uses_ = 16
This_device_is_asking_for_an_unknown_resource_type _ = 17
Reinstall_the_drivers_for_this_device_ = 18
Failure_using_the_VxD_loader_ = 19
Your_registry_might_be_corrupted_ = 20
System_failure_Try_changing_the_driver_for_this_de vice_If_that_does_not_work
_see_your_hardware_documentation_Windows_is_removi ng_this_device_ = 21
This_device_is_disabled_ = 22
System_failure_Try_changing_the_driver_for_this_de vice_If_that_doesn_t_work_
see_your_hardware_documentation_ = 23
This_device_is_not_present_is_not_working_properly _or_does_not_have_all_its_
drivers_installed_ = 24
Windows_is_still_setting_up_this_device_ = 25
Windows_is_still_setting_up_this_device_0 = 26
This_device_does_not_have_valid_log_configuration_ = 27
The_drivers_for_this_device_are_not_installed_ = 28
This_device_is_disabled_because_the_firmware_of_th e_device_did_not_give_it_t
he_required_resources_ = 29
This_device_is_using_an_Interrupt_Request_IRQ_reso urce_that_another_device_i
s_using_ = 30
This_device_is_not_working_properly_because_Window s_cannot_load_the_drivers_
required_for_this_device_ = 31

End Enum
Public Enum CpuStatusValues As Integer
Unknown
CPU_Enabled
CPU_Disabled_by_User_via_BIOS_Setup
CPU_Disabled_By_BIOS_POST_Error_
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_Family = 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_Xeon = 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_VALUE = 0

End Enum
Public Enum PowerManagementCapabilitiesValues As Integer
Unknown
Not_Supported
Disabled
Enabled
Power_Saving_Modes_Entered_Automatically
Power_State_Settable
Power_Cycling_Supported
Timed_Power_On_Supported

End Enum
Public Enum ProcessorTypeValues As Integer
Other = 1
Unknown = 2
Central_Processor = 3
Math_Processor = 4
DSP_Processor = 5
Video_Processor = 6
INVALID_ENUM_VALUE = 0

End Enum
Public Enum StatusInfoValues As Integer
Other = 1
Unknown = 2
Enabled = 3
Disabled = 4
Not_Applicable = 5
INVALID_ENUM_VALUE = 0

End Enum
Public Enum UpgradeMethodValues As Integer
Other = 1
Unknown = 2
Daughter_Board = 3
ZIF_Socket = 4
Replacement_Piggy_Back = 5
None = 6
LIF_Socket = 7
Slot_1 = 8
Slot_2 = 9
Val_370_Pin_Socket = 10
Slot_A = 11
Slot_M = 12
INVALID_ENUM_VALUE = 0

End Enum
Public Enum VoltageCapsValues 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 ProcessorCollection

Inherits Object

Implements ICollection
Private ObjectCollection As ManagementObjectCollection
Public Sub New(ByVal objCollection As ManagementObjectCollection)

MyBase.New

ObjectCollection = objCollection

End Sub
Public ReadOnly Property Count As Integer Implements
System.Collections.ICollection.Count

Get

Return ObjectCollection.Count

End Get

End Property
Public ReadOnly Property IsSynchronized As Boolean Implements
System.Collections.ICollection.IsSynchronized

Get

Return ObjectCollection.IsSynchronized

End Get

End Property
Public ReadOnly Property SyncRoot As Object Implements
System.Collections.ICollection.SyncRoot

Get

Return Me

End Get

End Property
Public Sub CopyTo(ByVal array As System.Array, ByVal index As Integer)
Implements System.Collections.ICollection.CopyTo

ObjectCollection.CopyTo(array, index)

Dim nCtr As Integer

nCtr = 0

Do While (nCtr < array.Length)

array.SetValue(New
Processor(CType(array.GetValue(nCtr),System.Manage ment.ManagementObject)),
nCtr)

nCtr = (nCtr + 1)

Loop

End Sub
Public Function GetEnumerator() As System.Collections.IEnumerator Implements
System.Collections.IEnumerable.GetEnumerator

Return New ProcessorEnumerator(ObjectCollection.GetEnumerator )

End Function
Public Class ProcessorEnumerator

Inherits Object

Implements System.Collections.IEnumerator
Private ObjectEnumerator As
ManagementObjectCollection.ManagementObjectEnumera tor
Public Sub New(ByVal objEnum As
ManagementObjectCollection.ManagementObjectEnumera tor)

MyBase.New

ObjectEnumerator = objEnum

End Sub
Public ReadOnly Property Current As Object Implements
System.Collections.IEnumerator.Current

Get

Return New
Processor(CType(ObjectEnumerator.Current,System.Ma nagement.ManagementObject)
)

End Get

End Property
Public Function MoveNext() As Boolean Implements
System.Collections.IEnumerator.MoveNext

Return ObjectEnumerator.MoveNext

End Function
Public Sub Reset() Implements System.Collections.IEnumerator.Reset

ObjectEnumerator.Reset

End Sub

End Class

End Class
'TypeConverter to handle null values for ValueType properties

Public Class WMIValueTypeConverter

Inherits TypeConverter
Private baseConverter As TypeConverter
Public Sub New(ByVal baseType As System.Type)

MyBase.New

baseConverter = TypeDescriptor.GetConverter(baseType)

End Sub
Public Overloads Overrides Function CanConvertFrom(ByVal context As
System.ComponentModel.ITypeDescriptorContext, ByVal srcType As System.Type)
As Boolean

Return baseConverter.CanConvertFrom(context, srcType)

End Function
Public Overloads Overrides Function CanConvertTo(ByVal context As
System.ComponentModel.ITypeDescriptorContext, ByVal destinationType As
System.Type) As Boolean

Return baseConverter.CanConvertTo(context, destinationType)

End Function
Public Overloads Overrides Function ConvertFrom(ByVal context As
System.ComponentModel.ITypeDescriptorContext, ByVal culture As
System.Globalization.CultureInfo, ByVal value As Object) As Object

Return baseConverter.ConvertFrom(context, culture, value)

End Function
Public Overloads Overrides Function CreateInstance(ByVal context As
System.ComponentModel.ITypeDescriptorContext, ByVal dictionary As
System.Collections.IDictionary) As Object

Return baseConverter.CreateInstance(context, dictionary)

End Function
Public Overloads Overrides Function GetCreateInstanceSupported(ByVal context
As System.ComponentModel.ITypeDescriptorContext) As Boolean

Return baseConverter.GetCreateInstanceSupported(context)

End Function
Public Overloads Overrides Function GetProperties(ByVal context As
System.ComponentModel.ITypeDescriptorContext, ByVal value As Object, ByVal
attributeVar() As System.Attribute) As PropertyDescriptorCollection

Return baseConverter.GetProperties(context, value, attributeVar)

End Function
Public Overloads Overrides Function GetPropertiesSupported(ByVal context As
System.ComponentModel.ITypeDescriptorContext) As Boolean

Return baseConverter.GetPropertiesSupported(context)

End Function
Public Overloads Overrides Function GetStandardValues(ByVal context As
System.ComponentModel.ITypeDescriptorContext) As
System.ComponentModel.TypeConverter.StandardValues Collection

Return baseConverter.GetStandardValues(context)

End Function
Public Overloads Overrides Function GetStandardValuesExclusive(ByVal context
As System.ComponentModel.ITypeDescriptorContext) As Boolean

Return baseConverter.GetStandardValuesExclusive(context)

End Function
Public Overloads Overrides Function GetStandardValuesSupported(ByVal context
As System.ComponentModel.ITypeDescriptorContext) As Boolean

Return baseConverter.GetStandardValuesSupported(context)

End Function
Public Overloads Overrides Function ConvertTo(ByVal context As
System.ComponentModel.ITypeDescriptorContext, ByVal culture As
System.Globalization.CultureInfo, ByVal value As Object, ByVal
destinationType As System.Type) As Object

If (Not (context) Is Nothing) Then

If (context.PropertyDescriptor.ShouldSerializeValue(c ontext.Instance) =
false) Then

Return ""

End If

End If

Return baseConverter.ConvertTo(context, culture, value, destinationType)

End Function

End Class
'Embedded class to represent WMI system Properties.

<TypeConverter(GetType(System.ComponentModel.Expan dableObjectConverter))> _

Public Class ManagementSystemProperties
Private PrivateLateBoundObject As System.Management.ManagementBaseObject
Public Sub New(ByVal ManagedObject As
System.Management.ManagementBaseObject)

MyBase.New

PrivateLateBoundObject= ManagedObject

End Sub
<Browsable(true)> _

Public ReadOnly Property GENUS As Integer

Get

Return CType(PrivateLateBoundObject("__GENUS"),Integer)

End Get

End Property
<Browsable(true)> _

Public ReadOnly Property [CLASS] As String

Get

Return CType(PrivateLateBoundObject("__CLASS"),String)

End Get

End Property
<Browsable(true)> _

Public ReadOnly Property SUPERCLASS As String

Get

Return CType(PrivateLateBoundObject("__SUPERCLASS"),Strin g)

End Get

End Property
<Browsable(true)> _

Public ReadOnly Property DYNASTY As String

Get

Return CType(PrivateLateBoundObject("__DYNASTY"),String)

End Get

End Property
<Browsable(true)> _

Public ReadOnly Property RELPATH As String

Get

Return CType(PrivateLateBoundObject("__RELPATH"),String)

End Get

End Property
<Browsable(true)> _

Public ReadOnly Property PROPERTY_COUNT As Integer

Get

Return CType(PrivateLateBoundObject("__PROPERTY_COUNT"),I nteger)

End Get

End Property
<Browsable(true)> _

Public ReadOnly Property DERIVATION As String()

Get

Return CType(PrivateLateBoundObject("__DERIVATION"),Strin g())

End Get

End Property
<Browsable(true)> _

Public ReadOnly Property SERVER As String

Get

Return CType(PrivateLateBoundObject("__SERVER"),String)

End Get

End Property
<Browsable(true)> _

Public ReadOnly Property [NAMESPACE] As String

Get

Return CType(PrivateLateBoundObject("__NAMESPACE"),String )

End Get

End Property
<Browsable(true)> _

Public ReadOnly Property PATH As String

Get

Return CType(PrivateLateBoundObject("__PATH"),String)

End Get

End Property

End Class

End Class

End Namespace
Nov 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.