Registry Provider::CreateRegKey


Creates a new registry key (based on a given machine, root key, and subkey). Used by Microsoft® Provisioning Framework (MPF).

CreateRegKey is a wrapper for the Microsoft® Win32® API function RegCreateKeyEx.

XML Input Schema

The following code fragment shows the format for sending data to this procedure. For more information on individual elements and attributes, see the Elements and Attributes table.

<executeData>1..1
  <regKey>1..1
	<machine>1..1
	<name>1..1</name>
	</machine>
	<rootkey>1..1
	<name>1..1</name>
	</rootkey> 
	<subkey>1..1
	<name>1..1</name>
	</subkey>
  </regKey>
</executeData>

XML Output Schema

CreateRegKey does not return data.

Elements and Attributes

The following table describes the XML elements and attributes. Unless otherwise indicated, the data type is string.

Element Description, relationships, and attributes
executeData Description:
Encapsulates the procedure's input data.

Child:
regKey (minOccurs="1" maxOccurs="1")

machine Description:
Machine for the new key. The following sample code illustrates the use of machine.
<machine>
  <name>BOB1</name>
</machine> 

Parent:
regKey

Child:
name (minOccurs="1" maxOccurs="1")

name Description:
Name of the machine, root key, or subkey for the new key.

Parents:
machine, rootkey, subkey

regKey Description:
Encapsulates information about the new key. The following sample code illustrates the use of regKey.
<regKey>
  <machine>
	<name>BOB1</name>
  </machine>
  <rootkey>
	<name>HKEY_LOCAL_MACHINE</name>
  </rootkey>
  <subkey>
	<name>SOFTWARE\Microsoft\Active Setup\TestCreateKey</name>
  </subkey>
</regKey>

Parent:
executeData

Children:
machine (minOccurs="1" maxOccurs="1")
rootkey (minOccurs="1" maxOccurs="1")
subkey (minOccurs="1" maxOccurs="1")

rootkey Description:
Root key for the new key. The following sample code illustrates the use of rootkey.
<rootkey>
  <name>HKEY_LOCAL_MACHINE</name>
</rootkey>

Parent:
regKey

Child:
name (minOccurs="1" maxOccurs="1")

subkey Description:
Subkey for the new key. The following sample code illustrates the use of subkey.
<subkey>
  <name>SOFTWARE\Microsoft\Active Setup</name>
</subkey> 

Parent:
regKey

Child:
name (minOccurs="1" maxOccurs="1")

Remarks

The key created by CreateRegKey has no values. To set key values for the new key, use SetRegValue.

The new key cannot be a direct child of \HKEY_USERS or \HKEY_LOCAL_MACHINE. However, it can reside in subkeys of \HKEY_USERS or \HKEY_LOCAL_MACHINE.

See Also

CreateRegKeyWithSecurity, Registry Provider


Up Top of Page
© 1999-2002 Microsoft Corporation. All rights reserved.