www.digitalmars.com

D Programming Language 1.0

Last update Mon Dec 31 10:53:29 2012

std.windows.registry

\file std/windows/registry.d This file contains the \c std.windows.registry.* classes

alias boolean;
A strongly-typed Boolean

enum Endian;
An enumeration representing byte-ordering (Endian) strategies

enum REGSAM;
Enumeration of the recognised registry access modes

\ingroup group_D_win32_reg

enum REG_VALUE_TYPE;
Enumeration of the recognised registry value types

\ingroup group_D_win32_reg

class RegistryException: std.windows.registry.Win32Exception;
Exception class thrown by the std.windows.registry classes

\ingroup group_D_win32_reg

this(string message);
\brief Creates an instance of the exception

\param message The message associated with the exception \name Construction

this(string message, int error);
\brief Creates an instance of the exception, with the given

\param message The message associated with the exception \param error The Win32 error number associated with the exception \name Construction

class Key;
This class represents a registry key

\ingroup group_D_win32_reg

string name();
The name of the key \name Attributes \name Construction

uint keyCount();
The number of sub keys \name Attributes \name Construction

KeySequence keys();
An enumerable sequence of all the sub-keys of this key \name Attributes \name Construction

KeyNameSequence keyNames();
An enumerable sequence of the names of all the sub-keys of this key \name Attributes \name Construction

uint valueCount();
The number of values \name Attributes \name Construction

ValueSequence values();
An enumerable sequence of all the values of this key \name Attributes \name Construction

ValueNameSequence valueNames();
An enumerable sequence of the names of all the values of this key \name Attributes \name Construction

Key createKey(string name, REGSAM access);
Returns the named sub-key of this key

\param name The name of the subkey to create. May not be null \return The created key \note If the key cannot be created, a RegistryException is thrown. \name Methods \name Attributes \name Construction

Key createKey(string name);
Returns the named sub-key of this key

\param name The name of the subkey to create. May not be null \return The created key \note If the key cannot be created, a RegistryException is thrown. \note This function is equivalent to calling CreateKey(name, REGSAM.KEY_ALL_ACCESS), and returns a key with all access \name Methods \name Attributes \name Construction

Key getKey(string name, REGSAM access);
Returns the named sub-key of this key

\param name The name of the subkey to aquire. If name is null (or the empty-string), then the called key is duplicated \param access The desired access; one of the REGSAM enumeration \return The aquired key. \note This function never returns null. If a key corresponding to the requested name is not found, a RegistryException is thrown \name Methods \name Attributes \name Construction

Key getKey(string name);
Returns the named sub-key of this key

\param name The name of the subkey to aquire. If name is null (or the empty-string), then the called key is duplicated \return The aquired key. \note This function never returns null. If a key corresponding to the requested name is not found, a RegistryException is thrown \note This function is equivalent to calling GetKey(name, REGSAM.KEY_READ), and returns a key with read/enum access \name Methods \name Attributes \name Construction

void deleteKey(string name);
Deletes the named key

\param name The name of the key to delete. May not be null \name Methods \name Attributes \name Construction

Value getValue(string name);
Returns the named value

\note if name is null (or the empty-string), then the default value is returned \return This function never returns null. If a value corresponding to the requested name is not found, a RegistryException is thrown \name Methods \name Attributes \name Construction

void setValue(string name, uint value);
Sets the named value with the given 32-bit unsigned integer value

\param name The name of the value to set. If null, or the empty string, sets the default value \param value The 32-bit unsigned value to set \note If a value corresponding to the requested name is not found, a RegistryException is thrown \name Methods \name Attributes \name Construction

void setValue(string name, uint value, Endian endian);
Sets the named value with the given 32-bit unsigned integer value, according to the desired byte-ordering

\param name The name of the value to set. If null, or the empty string, sets the default value \param value The 32-bit unsigned value to set \param endian Can be Endian.Big or Endian.Little \note If a value corresponding to the requested name is not found, a RegistryException is thrown \name Methods \name Attributes \name Construction

void setValue(string name, ulong value);
Sets the named value with the given 64-bit unsigned integer value

\param name The name of the value to set. If null, or the empty string, sets the default value \param value The 64-bit unsigned value to set \note If a value corresponding to the requested name is not found, a RegistryException is thrown \name Methods \name Attributes \name Construction

void setValue(string name, string value);
Sets the named value with the given string value

\param name The name of the value to set. If null, or the empty string, sets the default value \param value The string value to set \note If a value corresponding to the requested name is not found, a RegistryException is thrown \name Methods \name Attributes \name Construction

void setValue(string name, string value, boolean asEXPAND_SZ);
Sets the named value with the given string value

\param name The name of the value to set. If null, or the empty string, sets the default value \param value The string value to set \param asEXPAND_SZ If true, the value will be stored as an expandable environment string, otherwise as a normal string \note If a value corresponding to the requested name is not found, a RegistryException is thrown \name Methods \name Attributes \name Construction

void setValue(string name, string[] value);
Sets the named value with the given multiple-strings value

\param name The name of the value to set. If null, or the empty string, sets the default value \param value The multiple-strings value to set \note If a value corresponding to the requested name is not found, a RegistryException is thrown \name Methods \name Attributes \name Construction

void setValue(string name, byte[] value);
Sets the named value with the given binary value

\param name The name of the value to set. If null, or the empty string, sets the default value \param value The binary value to set \note If a value corresponding to the requested name is not found, a RegistryException is thrown \name Methods \name Attributes \name Construction

void deleteValue(string name);
Deletes the named value

\param name The name of the value to delete. May not be null \note If a value of the requested name is not found, a RegistryException is thrown \name Methods \name Attributes \name Construction

void flush();
Flushes any changes to the key to disk

\name Methods \name Attributes \name Construction

class Value;
This class represents a value of a registry key

\ingroup group_D_win32_reg

string name();
The name of the value.

\note If the value represents a default value of a key, which has no name, the returned string will be of zero length \name Attributes

REG_VALUE_TYPE type();
The type of value \name Attributes

string value_SZ();
Obtains the current value of the value as a string.

\return The contents of the value \note If the value's type is REG_EXPAND_SZ the returned value is not expanded; Value_EXPAND_SZ() should be called \note Throws a RegistryException if the type of the value is not REG_SZ, REG_EXPAND_SZ, REG_DWORD(*) or REG_QWORD(*): \name Attributes

string value_EXPAND_SZ();
Obtains the current value as a string, within which any environment variables have undergone expansion

\return The contents of the value \note This function works with the same value-types as Value_SZ(). \name Attributes

string[] value_MULTI_SZ();
Obtains the current value as an array of strings

\return The contents of the value \note Throws a RegistryException if the type of the value is not REG_MULTI_SZ \name Attributes

uint value_DWORD();
Obtains the current value as a 32-bit unsigned integer, ordered correctly according to the current architecture

\return The contents of the value \note An exception is thrown for all types other than REG_DWORD, REG_DWORD_LITTLE_ENDIAN and REG_DWORD_BIG_ENDIAN. \name Attributes

deprecated uint value_DWORD_LITTLEENDIAN();
\name Attributes

deprecated uint value_DWORD_BIGENDIAN();
\name Attributes

ulong value_QWORD();
Obtains the value as a 64-bit unsigned integer, ordered correctly according to the current architecture

\return The contents of the value \note Throws a RegistryException if the type of the value is not REG_QWORD \name Attributes

deprecated ulong value_QWORD_LITTLEENDIAN();
\name Attributes

byte[] value_BINARY();
Obtains the value as a binary blob

\return The contents of the value \note Throws a RegistryException if the type of the value is not REG_BINARY \name Attributes

class Registry;
Represents the local system registry.

\ingroup group_D_win32_reg

static Key classesRoot();
Returns the root key for the HKEY_CLASSES_ROOT hive \name Hives

static Key currentUser();
Returns the root key for the HKEY_CURRENT_USER hive \name Hives

static Key localMachine();
Returns the root key for the HKEY_LOCAL_MACHINE hive \name Hives

static Key users();
Returns the root key for the HKEY_USERS hive \name Hives

static Key performanceData();
Returns the root key for the HKEY_PERFORMANCE_DATA hive \name Hives

static Key currentConfig();
Returns the root key for the HKEY_CURRENT_CONFIG hive \name Hives

static Key dynData();
Returns the root key for the HKEY_DYN_DATA hive \name Hives

class KeyNameSequence;
An enumerable sequence representing the names of the sub-keys of a registry Key

It would be used as follows:

  Key key = . . .

  foreach(char[] kName; key.SubKeys)
  {
    process_Key(kName);
  }



\ingroup group_D_win32_reg

uint count();
The number of keys \name Attributes @{ Construction

string getKeyName(uint index);
The name of the key at the given index

\param index The 0-based index of the key to retrieve \return The name of the key corresponding to the given index \note Throws a RegistryException if no corresponding key is retrieved \name Attributes @{ Construction

string opIndex(uint index);
The name of the key at the given index

\param index The 0-based index of the key to retrieve \return The name of the key corresponding to the given index \note Throws a RegistryException if no corresponding key is retrieved \name Attributes @{ Construction

int opApply(int delegate(ref char[] name) dg);
@} \name Attributes @{ Construction

class KeySequence;
An enumerable sequence representing the sub-keys of a registry Key

It would be used as follows:

  Key key = . . .

  foreach(Key k; key.SubKeys)
  {
    process_Key(k);
  }



\ingroup group_D_win32_reg

uint count();
The number of keys \name Attributes @{ Construction

Key getKey(uint index);
The key at the given index

\param index The 0-based index of the key to retrieve \return The key corresponding to the given index \note Throws a RegistryException if no corresponding key is retrieved \name Attributes @{ Construction

Key opIndex(uint index);
The key at the given index

\param index The 0-based index of the key to retrieve \return The key corresponding to the given index \note Throws a RegistryException if no corresponding key is retrieved \name Attributes @{ Construction

int opApply(int delegate(ref Key key) dg);
@} \name Attributes @{ Construction

class ValueNameSequence;
An enumerable sequence representing the names of the values of a registry Key

It would be used as follows:

  Key key = . . .

  foreach(char[] vName; key.Values)
  {
    process_Value(vName);
  }



\ingroup group_D_win32_reg

uint count();
The number of values \name Attributes @{ Construction

string getValueName(uint index);
The name of the value at the given index

\param index The 0-based index of the value to retrieve \return The name of the value corresponding to the given index \note Throws a RegistryException if no corresponding value is retrieved \name Attributes @{ Construction

string opIndex(uint index);
The name of the value at the given index

\param index The 0-based index of the value to retrieve \return The name of the value corresponding to the given index \note Throws a RegistryException if no corresponding value is retrieved \name Attributes @{ Construction

int opApply(int delegate(ref char[] name) dg);
@} \name Attributes @{ Construction

class ValueSequence;
An enumerable sequence representing the values of a registry Key

It would be used as follows:

  Key key = . . .

  foreach(Value v; key.Values)
  {
    process_Value(v);
  }



\ingroup group_D_win32_reg

uint count();
The number of values \name Attributes @{ Construction

Value getValue(uint index);
The value at the given index

\param index The 0-based index of the value to retrieve \return The value corresponding to the given index \note Throws a RegistryException if no corresponding value is retrieved \name Attributes @{ Construction

Value opIndex(uint index);
The value at the given index

\param index The 0-based index of the value to retrieve \return The value corresponding to the given index \note Throws a RegistryException if no corresponding value is retrieved \name Attributes @{ Construction

int opApply(int delegate(ref Value value) dg);
@} \name Attributes @{ Construction