Skip navigation

Scripting Solutions Table

Table 1 for Web: Registry.pll Function




Closes a previously opened Registry given the handle obtained from RegConnectRegistry(), RegOpenKey(), or RegOpenKeyEx().

RegConnectRegistry($machine, $hkey, $handle)

Obtains a handle (connection) to a remote Registry hive. The computer name and hive to connect to are contained in $machine and $hkey respectively. The handle to the new connection is returned in $handle.

RegCreateKey($hkey, $subkey, $handle)

Creates $subkey under $hkey. Returns a handle to the newly created key in $handle.

RegDeleteKey($hkey, $subkey)

Deletes $subkey under $hkey. All values under $subkey are also removed, but not subkeys.

RegDeleteValue($hkey, $valname)

Deletes $valname under $hkey.

RegEnumKey($hkey, $idx, $subkeyname)

Enumerates the subkeys of $hkey. $idx is the index of the desired subkey (0, 1, 2, etc.); $subkeyname is the returned subkey name.

RegEnumValue($hkey, $idx, $name, $reserved, $type, $value)

Enumerates the values of $hkey using a similar protocol to that of RegEnumKey() for $idx. Returns the value in $value and its type in $type.


Forces all outstanding changes to be written to the Registry pointed to by the $hkey handle.

RegOpenKey($hkey, $subkey, $handle)

Opens $subkey in the Registry pointed to by the $hkey handle and returns a new handle, $handle, to the newly opened subkey.

RegOpenKeyEx($hkey, $subkey, RESERVED, SAM, $handle)

Same as RegOpenKey() with two additional parameters: RESERVED, which is always the null value (expressed &NULL), and SAM, or access mode. Valid access modes are defined in (a Perl header file) in the C:\Perl\lib directory. Examples include: KEY_READ, KEY_WRITE, and KEY_ALL_ACCESS. These modes are actually macros so we express them like a subroutine call in the parameter list (e.g., &KEY_ALL_ACCESS). See lines 28-30 in

RegQueryInfoKey($hkey, $class, $classsz, $reserved, $numsubkeys, $maxsubkey, $maxclass, $values, $maxvalname, $maxvaldata, $secdesclen, $lastwritetime);

Retrieves the attributes of the key pointed to by the $hkey handle.

RegQueryValue($hkey, $valuename, $data);

Retrieves the value of $valuename under $hkey. Returns the results in $data.

RegRestoreKey($hkey, $filename \[, $flags\])

Restores the contents of $filename to $hkey.

RegSaveKey($hkey, $filename)

Saves the contents of $hkey in $filename. Subkeys of $hkey are also saved.

RegSetValueEx($hkey, $valname, $reserved, $type, $data)

Sets the value $valname under $hkey to $data. $type identifies the Registry data type (e.g., REG_SZ). $reserved is always the null value (expressed &NULL).


For more detailed information, surf to

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.