Muokkaa

Jaa


Mapping a Registry Data Type to a WMI Data Type

The application must create the properties with a data type that maps to the registry data type. You do not need to specify the registry data type in the methods that create, get, or set registry values. However, the input parameter that contains the value must be in the correct WMI data type. For example, if an application receives REG_DWORD data from the registry, the class that receives the data must include a Uint32 property.

The following table lists the mapping between registry and WMI data types used in the StdRegProv methods.

Registry data type WMI data type
REG_BINARY uint8 array
An array of values that do not exceed 255 or hex FF. For example, the following Visual Basic Script code creates an array that fits this data type.
BinArray = Array(&H01, &Ha2)
The StdRegProv class method SetBinaryValue requires the REG_BINARY data type.
REG_DWORD uint32, sint32 or Visual Basic integer
A single 32-bit value. The StdRegProv class methods GetDWORDValue and SetDWORDValue require the REG_DWORD data type.
REG_SZ string
The StdRegProv class method SetStringValue requires the REG_SZ data type.
REG_QWORD uint64.
A single 64-bit value. The StdRegProv class methods GetQWORDValue and SetQWORDValue require the REG_QWORD data type.
REG_EXPAND_SZ string
Expanded strings are special strings that represent system environment variables. For example, the following VBScript code creates a string that represents the HKEY_LOCAL_USER environment variable TEMP.
TEMP = "%USERPROFILE\LocalSettings\Temp%"
The StdRegProv class method SetExpandedStringValue requires the REG_EXPAND_SZ data type.
REG_MULTI_SZ string array
The Multistring data type contains multiple strings. For example, the following VBScript code creates an array that fits this data type.
MultiValue = Array("first", "second", "third")
The StdRegProv class method SetMultiStringValue requires the REG_MULTI_SZ data type.
REG_RESOURCE_LIST As appropriate. For more information, see Describing a Resource for the Registry.

Defining Classes for the System Registry Provider