WMI registry StdRegProv

Source: Internet
Author: User
StdRegProv is a subclass of the WMI namespace root \ DEFAULT. It has 16 methods.

The StdRegProv class contains methods related to the system registry. These methods are available:

Verify User Access

Create, enumerate, and delete registry entries

Create, enumerate, and delete key values

Read, modify, and delete data

 

 

Parameters

HDefKey

Specifies an optional parameter for the root key that contains the sSubKeyName path. The default value is HKEY_LOCAL_MACHINE (0x80000002 ). The following constants are defined in Winreg. h:

HKEY_CLASSES_ROOT (0x80000000)

HKEY_CURRENT_USER (0x80000001)

HKEY_LOCAL_MACHINE (0x80000002)

HKEY_USERS (0x80000003)

HKEY_CURRENT_CONFIG (0x80000005)

HKEY_DYN_DATA (0x80000006)

Among them, HKEY_DYN_DATA is only a reasonable Root Key for Windows 95 and Windows 98 computers.

Create, delete, and enumerate

Uint32CreateKey([In] uint32 hDefKey, [in] string sSubKeyName );

The CreateKey method creates a subitem on the specified Root Key.

SSubKeyName contains the items to be created.

The CreateKey method creates all non-existing sub-items in the path. For example, if MyKey and MySubKey do not exist in the following path, CreateKey creates these two items:

HKEY_LOCAL_MACHINE \ SOFTWARE \ MyKey \ MySubKey

Uint32DeleteKey([In] uint32 hDefKey, [in] string sSubKeyName );

The DeleteKey method deletes a subitem from the specified Root Key.

SSubKeyName contains the items to be deleted.

Uint32EnumKey([In] uint32 hDefKey, [in] string sSubKeyName, [out] string sNames );

The EnumKey method is used to enumerate subitems of a path.

SSubKeyName specifies the path of the sub-item to be enumerated.

SNames contains an array of subitem strings.

Uint32EnumValues([In] uint32 hDefKey, [in] string sSubKeyName, [out] string sNames, [out] sint32 iTypes );

The EnumValues method is used to enumerate the key values of a subitem.

SSubKeyName specifies the path containing the key value to be enumerated.

SNames contains an array of key value names. The elements of this array correspond directly to those of iTypes.

ITypes contains an array of data value types (integers ). You can use these types to determine which Get method to call. For example, if the data value type is REG_SZ, you should call GetStringValue to retrieve the key value data. The element of this array is directly associated with the element of sNames. The following data type constants are defined in Winnt. h:

REG_SZ (1)

REG_EXPAND_SZ (2)

REG_BINARY (3)

REG_DWORD (4)

REG_MULTI_SZ (7)

Uint32DeleteValue([In] uint32 hDefKey, [in] string sSubKeyName, [in] string sValueName );

The DeleteValue method deletes a key value from a specified subitem.

SSubKeyName indicates an item that contains the key value to be deleted.

SValueName specifies the name of the key value to be deleted from the subitem. Specify an empty string to delete the default key value (the default key value is not deleted, and its data is set to "(the value is not set )"

Modify and read

Uint32SetDWORDValue([In] uint32 hDefKey, [in] string sSubKeyName, [in] string sValueName, [in] uint32 uValue );

The SetDWORDValue method sets data for the key value of the data type REG_DWORD.

SSubKeyName specifies the item that contains the key value to be set.

SValueName specifies the key value name of the data to be set. You can specify an existing key value (update) or a new key value (create ). Specify an empty string to set the data of the default key value.

UValue specifies a dual-word data.

Uint32GetDWORDValue([In] uint32 hDefKey, [in] string sSubKeyName, [in] string sValueName, [out] uint32 uValue );

The GetDWORDValue method returns data when the data type is REG_DWORD.

SSubKeyName specifies the path containing the key value.

SValueName specifies the key value name of the data to be retrieved. Specify an empty string to obtain the default key value.

UValue contains the DWORD data of the key value.

Uint32SetStringValue([In] uint32 hDefKey, [in] string sSubKeyName, [in] string sValueName, [in] string sValue );

The SetStringValue method sets a value for the key value of the Data Type REG_MULTI_SZ.

SSubKeyName specifies the item that contains the key value to be set.

SValueName specifies the key value name of the data to be set. You can specify an existing key value (update) or a new key value (create ). Specify an empty string to set the data of the default key value.

SValue specifies a string of data.

Uint32GetStringValue([In] uint32 hDefKey, [in] string sSubKeyName, [in] string sValueName, [out] string sValue );

The GetStringValue method returns data for the key value of the Data Type REG_SZ.

SSubKeyName specifies the path containing the key value.

SValueName specifies the key value name of the data to be retrieved. Specify an empty string to obtain the default key value.

SValue contains the string data of the key value.

Uint32SetMultiStringValue([In] uint32 hDefKey, [in] string sSubKeyName, [in] string sValueName, [in] string sValue );

The SetMultiStringValue method sets data for the key value of the Data Type REG_MULTI_SZ. If successful, the SetMultiStringValue method returns a uint32 value of 0; if any error occurs, it is another value.

SSubKeyName specifies the item that contains the key value to be set.

SValueName specifies the key value name of the data to be set. You can specify an existing key value (update) or a new key value (create ). Specify an empty string to set the data of the default key value.

SValue specifies an array of string data.

Uint32GetMultiStringValue([In] uint32 hDefKey, [in] string sSubKeyName, [in] string sValueName, [out] string sValue );

The GetMultiStringValue method returns data for the key value of the Data Type REG_MULTI_SZ. If the call succeeds, the GetMultiStringValue method returns a uint32 value of 0. If an error occurs, other values are returned.

SSubKeyName specifies the path containing the key value.

SValueName specifies the key value name of the data to be retrieved. Specify an empty string to obtain the default key value.

SValue contains a string data array of key values.

Uint32SetExpandedStringValue([In] uint32 hDefKey, [in] string sSubKeyName, [in] string sValueName, [in] string sValue );

The SetExpandedStringValue method sets data for the key value of the Data Type REG_EXPAND_SZ. If the call succeeds, the SetExpandedStringValue method returns a uint32 value of 0. If an error occurs, other values are returned.

SSubKeyName specifies the item that contains the key value to be set.

SValueName specifies the key value name of the data to be set. You can specify an existing key value (update) or a new key value (create ). Specify an empty string to set the data of the default key value.

SValue specifies an extended string data. The specified environment variable in the string must exist, so that the string can be extended only when you call GetExpandedStringValue.

Uint32GetExpandedStringValue([In] uint32 hDefKey, [in] string sSubKeyName, [in] string sValueName, [out] string sValue );

The GetExpandedStringValue method returns data for the key value of the Data Type REG_EXPAND_SZ.

SSubKeyName specifies the path containing the key value.

SValueName specifies the key value name of the data to be retrieved. Specify an empty string to obtain the default key value.

SValue contains string data of the extended key value. The string can be extended only when the environment variable (for example, % Path %) is defined.

Uint32SetBinaryValue([In] uint32 hDefKey, [in] string sSubKeyName, [in] string sValueName, [in] uint8 uValue );

The SetBinaryValue method sets data for the key value of the Data Type REG_BINARY. If The call succeeds, The SetBinaryValue method returns a uint32 value of 0. If an error occurs, other values are returned.

SSubKeyName specifies the item that contains the key value to be set.

SValueName specifies the key value name of the data to be set. You can specify an existing key value (update) or a new key value (create ). Specify an empty string to set the data of the default key value.

UValue specifies an array of binary data.

Uint32GetBinaryValue([In] uint32 hDefKey, [in] string sSubKeyName, [in] string sValueName, [out] uint8 uValue );

The GetBinaryValue method returns data for the key value of the Data Type REG_BINARY. If The call succeeds, The GetBinaryValue method returns a uint32 value of 0. If an error occurs, other values are returned.

SSubKeyName specifies the path containing the key value.

SValueName specifies the key value name of the data to be retrieved. Specify an empty string to obtain the default key value.

UValue contains a binary byte array.

Verify access permissions

Uint32CheckAccess([In] uint32 hDefKey, [in] string sSubKeyName, [in] uint32 uRequired, [out] boolean bGranted );

The CheckAccess method verifies that the user has the specified permissions. If successful, this method returns a uint32 value of 0; if an error occurs, other values are returned.

SSubKeyName contains the subitem to Verify access permissions.

URequired specifies an optional parameter for access permissions to be verified. You can add these values to verify multiple access permissions. The default value is 3. The following access limits are defined in Winnt. h:

KEY_QUERY_VALUE (0x0001)

KEY_SET_VALUE (0x0002)

KEY_CREATE_SUB_KEY (0x0004)

KEY_ENUMERATE_SUB_KEYS (0x0008)

KEY_NOTIFY (0x0010)

KEY_CREATE_LINK (0x0020)

DELETE (0x00010000)

READ_CONTROL (0x00020000)

WRITE_DAC (0x00040000)

WRITE_OWNER (0x00080000)

BGranted

If the user has the specified access permission, this parameter is True. Otherwise, the parameter is False.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.