CInstance class (instance.h)

[The CInstance class is part of the WMI Provider Framework which is now considered in final state, and no further development, enhancements, or updates will be available for non-security related issues affecting these libraries. The MI APIs should be used for all new development.]

The CInstance class is used to retrieve and update the values of properties defined for the instances supported by the WMI Provider Framework. The CInstance class also provides access to the provider framework's implementation of the CInstance interface.

It is not expected that provider writers will need to derive from this class. Use Provider::CreateNewInstance to create an instance of this class.

CInstance has these types of members:

Method Description
Commit Returns the current instance to WMI.
Getbool Retrieves a Boolean property.
GetByte Retrieves a BYTE-compatible property.
GetCHString Retrieves a string property.
GetClassObjectInterface Returns an IWbemClassObject interface pointer.
GetDateTime Returns a datetime property.
GetDOUBLE Retrieves a DOUBLE property.
GetDWORD Retrieves a DWORD property.
GetEmbeddedObject Retrieves an embedded CInstance property.
GetMethodContext Returns a pointer to a MethodContext object.
GetStatus Determines whether a property exists and, if so, determines its type.
GetStringArray Retrieves a property that represents an array of strings.
GetTimeSpan Retrieves a property that represents a WMI time span.
GetVariant Retrieves a VARIANT property.
GetWBEMINT16 Retrieves a 16-bit integer property.
GetWBEMINT64 Overloaded. Retrieves a 64-bit integer property.
GetWCHAR Retrieves a WCHAR property.
GetWORD Retrieves a WORD property.
IsNull Determines if the value of a particular property is NULL.
Setbool Sets a Boolean property.
SetByte Sets a BYTE property.
SetCharSplat Overloaded. Sets a string property.
SetCHString Overloaded. Sets a string property.
SetDateTime Sets a datetime property.
SetDOUBLE Sets a DOUBLE property.
SetDWORD Sets a DWORD property.
SetEmbeddedObject Sets an embedded CInstance property.
SetNull Sets a property to NULL.
SetStringArray Sets a property that represents an array of strings.
SetTimeSpan Sets a property that represents a time span.
SetVariant Sets a VARIANT property.
SetWBEMINT16 Sets a 16-bit integer property.
SetWBEMINT64 Overloaded. Sets a 64-bit integer property.
SetWCHARSplat Sets a WCHAR string property.
SetWORD Sets a WORD property.

Methods

The CInstance class has these methods.

 
CInstance::Commit

The Commit method returns the current instance to WMI.
CInstance::Getbool

The Getbool method retrieves a Boolean property.
CInstance::GetByte

The GetByte method retrieves a BYTE-compatible property.
CInstance::GetCHString

The GetCHString method retrieves a string property.
CInstance::GetClassObjectInterface

The GetClassObjectInterface method returns an IWbemClassObject interface pointer.
CInstance::GetDateTime

The GetDateTime method returns a datetime property.
CInstance::GetDOUBLE

The GetDOUBLE method retrieves a DOUBLE property.
CInstance::GetDWORD

The GetDWORD method retrieves a DWORD property.
CInstance::GetEmbeddedObject

The GetEmbeddedObject method retrieves a pointer to an embedded CInstance object. The pointer can be used to get and set properties of that embedded object.
CInstance::GetMethodContext

The GetMethodContext method returns a pointer to a MethodContext object.
CInstance::GetStatus

The GetStatus method determines whether a property exists and, if so, determines its type.
CInstance::GetStringArray

The GetStringArray method retrieves a property that represents an array of strings.
CInstance::GetTimeSpan

The GetTimeSpan method retrieves a property that represents a WMI time span.
CInstance::GetVariant

The GetVariant method retrieves a VARIANT property.
CInstance::GetWBEMINT16

The GetWBEMINT16 method retrieves a 16-bit integer property.
CInstance::GetWBEMINT64

The GetWBEMINT64 method retrieves a 64-bit integer property. (overload 1/3)
CInstance::GetWBEMINT64

The GetWBEMINT64 method retrieves a 64-bit integer property. (overload 3/3)
CInstance::GetWBEMINT64

The GetWBEMINT64 method retrieves a 64-bit integer property. (overload 2/3)
CInstance::GetWCHAR

The GetWCHAR method retrieves a WCHAR string property.
CInstance::GetWORD

The GetWORD method retrieves a WORD property.
CInstance::IsNull

The IsNull method determines if the value of a particular property is NULL.
CInstance::Setbool

The Setbool method sets a Boolean property.
CInstance::SetByte

The SetByte method sets a BYTE property.
CInstance::SetCharSplat

The SetCharSplat(LPCWSTR, DWORD) method sets a string.
CInstance::SetCharSplat

The SetCharSplat(LPCWSTR, LPCSTR) method sets a string property.
CInstance::SetCharSplat

The SetCharSplat(LPCWSTR, LPCWSTR) method sets a string property.
CInstance::SetCHString

The SetCHString(LPCWSTR, const CHString&) method sets a string property. (overload 2/2)
CInstance::SetCHString

The SetCHString(LPCWSTR, LPCSTR) method sets a string property.
CInstance::SetCHString

The SetCHString(LPCWSTR, const CHString&) method sets a string property. (overload 1/2)
CInstance::SetDateTime

The SetDateTime method sets a datetime property.
CInstance::SetDOUBLE

CInstance::SetDOUBLE method
CInstance::SetDWORD

The SetDWORD method sets a DWORD property.
CInstance::SetEmbeddedObject

The SetEmbeddedObject method sets an embedded CInstance property.
CInstance::SetNull

The SetNull method sets a property to NULL.
CInstance::SetStringArray

The SetStringArray method sets a property that represents an array of strings.
CInstance::SetTimeSpan

The SetTimeSpan method sets a property that represents a time span.
CInstance::SetVariant

The SetVariant method sets a VARIANT property.
CInstance::SetWBEMINT16

The SetWBEMINT16 method sets a 16-bit integer property.
CInstance::SetWBEMINT64

The SetWBEMINT64(LPCWSTR, const LONGLONG&) method sets a 64-bit integer value. (overload 3/3)
CInstance::SetWBEMINT64

The SetWBEMINT64(LPCWSTR, const LONGLONG&) method sets a 64-bit integer value. (overload 1/3)
CInstance::SetWBEMINT64

The SetWBEMINT64(LPCWSTR, const LONGLONG&) method sets a 64-bit integer value. (overload 2/3)
CInstance::SetWCHARSplat

The SetWCHARSplat method sets a string property.
CInstance::SetWORD

The SetWORD method sets a WORD property.

Remarks

The destructor for this class is CInstance::~CInstance.

Methods of the CInstance class are used to retrieve and set property values. Property data types are defined using CIM data types which can be seen in a .mof file. When querying or setting a property value using CInstance methods, it is necessary to use a method that is compatible with the property's CIM data type. The following table lists CIM data types and the permissible CInstance get or set methods for accessing a property of that data type.

CIM data type CInstance Get/Set method types
string

CHString

VARIANT

WCHAR

CharSplat

sint8 VARIANT
uint8 BYTE
sint16 WBEMINT16

VARIANT

uint16 WORD

DWORD

VARIANT

sint32 WORD

DWORD

VARIANT

uint32 WORD

DWORD

VARIANT

sint64

CHString

VARIANT

WBEMINT64

WCHAR

uint64

CHString

VARIANT

WBEMINT64

WCHAR

real32 VARIANT
real64

CHString

DOUBLE

VARIANT

char16 VARIANT
DateTime

CHString

DateTime

VARIANT

WCHAR

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header instance.h (include FwCommon.h)