MTDumpToRegistry Method (MTNVS collection)

             

 

Stores the contents of a MTNVS collection in the Registry.

 

Syntax

object.MTDumpToRegistry RootKey, SubKey, [Options]

The MTDumpToRegistry method syntax has these parts:

Part

Description

object

An object expression that evaluates to an object in the Applies To list.

RootKey

An expression drawn from the pinvRegistryKeyConstants enumeration, as described in Settings. This value gives the root key of the registry entry to load.

SubKey

A string expression, indicating a subkey found below the root given in RootKey.

Options

An optional expression drawn from the pinvRegistryOptions enumeration, as described in Settings.

 

Settings

The settings for RootKey are:

Setting

Description

pinvHKEY_CLASSES_ROOT

Store into a subkey of HKEY_CLASSES_ROOT.

pinvHKEY_CURRENT_USER

 Store into a subkey of HKEY_CURRENT_USER.

pinvHKEY_LOCAL_MACHINE

Store into a subkey of HKEY_LOCAL_MACHINE.

pinvHKEY_USERS

Store into a subkey of HKEY_USERS.

pinvHKEY_PERFORMANCE_DATA

Store into a subkey of HKEY_PERFORMANCE_DATA.

pinvHKEY_CURRENT_CONFIG

Store into a subkey of HKEY_CURRENT_CONFIG.

pinvHKEY_DYN_DATA

Store into a subkey of HKEY_DYN_DATA.

 

The settings for Options are:

Setting

Description

pinvNoOptions

Values contained in the collection are stored in the specified key, if it exists; or if the specified key does not exist, it is created. This is the default.

pinvDoNotCreate

Values contained in the collection are stored in the specified key, if it exists. If the specified key does not exist, it is an error.

pinvKeyMustNotExist

If the specified key already exists, it is an error. If the specified key does not exist, it is created, and the values contained in the collection are stored in it.

 

Remarks

Depending on your operating system, not all the given root keys may exist in the Registry.

If one of the MTNVS in the collection has an empty Name string, it is stored in the key’s default registry value.

A MTNV whose data type is numeric is converted to a 32-bit integer and stored as type REG_DWORD. If it cannot be converted to a 32-bit integer, it is an error.

A MTNV of any other type is converted to a string and stored as type REG_SZ. If it cannot be converted to a string, it is an error.

The MTDumpToRegistry and MTLoadFromRegistry methods are not entirely symmetrical. MTLoadFromRegistry supports registry type REG_EXPAND_SZ but MTDumpToRegistry does not. MTLoadFromRegistry supports recursive loading of an entire registry tree in one operation but MTDumpToRegistry does not.

MTDumpToRegistry is marked hidden in the type library. To see this method in an object browser, you may need to select the browser’s “Show Hidden Members” option.

 

Trappable Errors

In addition to generic errors (such as Out of Memory), the following errors may occur:

Error

Description

pseINVALIDOPTIONS

The options argument contains invalid or inconsistent settings.

pseOPENINGREGKEY

A Windows API error occurred when the PISDK attempted to open the specified registry key. To find out more about the error, examine Err.Description.

pseREGKEYEXISTS

The options argument specifies pinvKeyMustNotExist, but the specified registry key exists.

Enabling Operational Intelligence