Last update February 14, 2007

Doc Comments / Phobos /
Std CWindows Registry



std.windows.registry    

Table of contents of this page
std.windows.registry   
Documentation   
Links   

Documentation    

Based on documentation generated by:

 dmd registry.d -D -c -o-
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

typedef HKEY;
The registry key handle

enum REGSAM;
Enumeration of the recognised registry access modes

enum REG_VALUE_TYPE;
Enumeration of the recognised registry value types

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

this(char[] message);

Creates an instance of the exception

message: The message associated with the exception

this(char[] message, int error);

Creates an instance of the exception, with the given

message: The message associated with the exception
error: The Win32 error number associated with the exception

class Key;
This class represents a registry key

char[] name();
The name of the key

uint keyCount();
The number of sub keys

KeySequence keys();
An enumerable sequence of all the sub-keys of this key

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

uint valueCount();
The number of values

ValueSequence values();
An enumerable sequence of all the values of this key

ValueNameSequence valueNames();
An enumerable sequence of the names of all the values of this key

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

name: The name of the subkey to create. May not be null

Returns: The created key

Note: If the key cannot be created, a RegistryException is thrown.

Key createKey(char[] name);
Returns the named sub-key of this key

name: The name of the subkey to create. May not be null

Returns: 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

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

name: The name of the subkey to aquire. If name is null (or the empty-string), then the called key is duplicated

access: The desired access; one of the REGSAM enumeration

Returns: The aquired key.

Note: This function never returns null. If a key corresponding to the requested name is not found, a RegistryException is thrown

Key getKey(char[] name);
Returns the named sub-key of this key

name: The name of the subkey to aquire. If name is null (or the empty-string), then the called key is duplicated

Returns: 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

void deleteKey(char[] name);
Deletes the named key

name: The name of the key to delete. May not be null

Value getValue(char[] name);
Returns the named value

Note: if name is null (or the empty-string), then the default value is returned

Returns: This function never returns null. If a value corresponding to the requested name is not found, a RegistryException? is thrown

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

name: The name of the value to set. If null, or the empty string, sets the default value

value: The 32-bit unsigned value to set

Note: If a value corresponding to the requested name is not found, a RegistryException is thrown

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

name: The name of the value to set. If null, or the empty string, sets the default value

value: The 32-bit unsigned value to set

endian: Can be Endian.Big or Endian.Little

Note: If a value corresponding to the requested name is not found, a RegistryException is thrown

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

name: The name of the value to set. If null, or the empty string, sets the default value

value: The 64-bit unsigned value to set

Note: If a value corresponding to the requested name is not found, a RegistryException is thrown

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

name: The name of the value to set. If null, or the empty string, sets the default value

value: The string value to set

Note: If a value corresponding to the requested name is not found, a RegistryException is thrown

void setValue(char[] name, char[] value, int asEXPAND_SZ);
Sets the named value with the given string value

name: The name of the value to set. If null, or the empty string, sets the default value

value: The string value to set

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

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

name: The name of the value to set. If null, or the empty string, sets the default value

value: The multiple-strings value to set

Note: If a value corresponding to the requested name is not found, a RegistryException is thrown

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

name: The name of the value to set. If null, or the empty string, sets the default value

value: The binary value to set

Note: If a value corresponding to the requested name is not found, a RegistryException is thrown

void deleteValue(char[] name);
Deletes the named value

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

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

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

char[] 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

REG_VALUE_TYPE type();
The type of value

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

Returns: 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(*):

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

Returns: The contents of the value

Note: This function works with the same value-types as {Value SZ}?().

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

Returns: The contents of the value

Note: Throws a RegistryException if the type of the value is not REG_MULTI_SZ

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

Returns: 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.

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

Returns: The contents of the value

Note: Throws a RegistryException if the type of the value is not {REG QWORD}?

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

Returns: The contents of the value

Note: Throws a RegistryException if the type of the value is not {REG BINARY}?

class Registry;
Represents the local system registry.

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

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

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

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

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

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

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

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); }

uint count();
The number of keys

char[] getKeyName(uint index);
The name of the key at the given index

index: The 0-based index of the key to retrieve

Returns: The name of the key corresponding to the given index

Note: Throws a RegistryException? if no corresponding key is retrieved

char[] opIndex(uint index);
The name of the key at the given index

index: The 0-based index of the key to retrieve

Returns: The name of the key corresponding to the given index

Note: Throws a RegistryException if no corresponding key is retrieved

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); }

uint count();
The number of keys

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

index: The 0-based index of the key to retrieve

Returns: The key corresponding to the given index

Note: Throws a RegistryException if no corresponding key is retrieved

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

index: The 0-based index of the key to retrieve

Returns: The key corresponding to the given index

Note: Throws a RegistryException if no corresponding key is retrieved

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); }

uint count();
The number of values

char[] getValueName(uint index);
The name of the value at the given index

index: The 0-based index of the value to retrieve

Returns: The name of the value corresponding to the given index

Note: Throws a RegistryException if no corresponding value is retrieved

char[] opIndex(uint index);
The name of the value at the given index

index: The 0-based index of the value to retrieve

Returns: The name of the value corresponding to the given index

Note: Throws a RegistryException if no corresponding value is retrieved

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); }

uint count();
The number of values

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

index: The 0-based index of the value to retrieve

Returns: The value corresponding to the given index

Note: Throws a RegistryException if no corresponding value is retrieved

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

index: The 0-based index of the value to retrieve

Returns: The value corresponding to the given index

Note: Throws a RegistryException if no corresponding value is retrieved

Links    


FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: February 14, 2007 7:29 (diff))