Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
nsIWindowsRegKey Interface Reference

This interface is designed to provide scriptable access to the Windows registry system ("With Great Power Comes Great Responsibility"). More...

import "nsIWindowsRegKey.idl";

Inheritance diagram for nsIWindowsRegKey:
Inheritance graph
[legend]
Collaboration diagram for nsIWindowsRegKey:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void close ()
 This method closes the key.
void open (in unsigned long rootKey, in AString relPath, in unsigned long mode)
 This method opens an existing key.
void create (in unsigned long rootKey, in AString relPath, in unsigned long mode)
 This method opens an existing key or creates a new key.
nsIWindowsRegKey openChild (in AString relPath, in unsigned long mode)
 This method opens a subkey relative to this key.
nsIWindowsRegKey createChild (in AString relPath, in unsigned long mode)
 This method opens or creates a subkey relative to this key.
AString getChildName (in unsigned long index)
 This method returns the name of the n'th child key.
boolean hasChild (in AString name)
 This method checks to see if the key has a child by the given name.
AString getValueName (in unsigned long index)
 This method returns the name of the n'th value under this key.
boolean hasValue (in AString name)
 This method checks to see if the key has a value by the given name.
void removeChild (in AString relPath)
 This method removes a child key and all of its values.
void removeValue (in AString name)
 This method removes the value with the given name.
unsigned long getValueType (in AString name)
 This method returns the type of the value with the given name.
AString readStringValue (in AString name)
 This method reads the string contents of the named value as a Unicode string.
unsigned long readIntValue (in AString name)
 This method reads the integer contents of the named value.
unsigned long long readInt64Value (in AString name)
 This method reads the 64-bit integer contents of the named value.
ACString readBinaryValue (in AString name)
 This method reads the binary contents of the named value under this key.
void writeStringValue (in AString name, in AString data)
 This method writes the unicode string contents of the named value.
void writeIntValue (in AString name, in unsigned long data)
 This method writes the integer contents of the named value.
void writeInt64Value (in AString name, in unsigned long long data)
 This method writes the 64-bit integer contents of the named value.
void writeBinaryValue (in AString name, in ACString data)
 This method writes the binary contents of the named value.
void startWatching (in boolean recurse)
 This method starts watching the key to see if any of its values have changed.
void stopWatching ()
 This method stops any watching of the key initiated by a call to startWatching.
boolean isWatching ()
 This method returns true if the key is being watched for changes (i.e., if startWatching() was called).
boolean hasChanged ()
 This method returns true if the key has changed and false otherwise.

Public Attributes

const unsigned long ROOT_KEY_CLASSES_ROOT = 0x80000000
 Root keys.
const unsigned long ROOT_KEY_CURRENT_USER = 0x80000001
const unsigned long ROOT_KEY_LOCAL_MACHINE = 0x80000002
const unsigned long ACCESS_BASIC = 0x00020000
 Values for the mode parameter passed to the open and create methods.
const unsigned long ACCESS_QUERY_VALUE = 0x00000001
const unsigned long ACCESS_SET_VALUE = 0x00000002
const unsigned long ACCESS_CREATE_SUB_KEY = 0x00000004
const unsigned long ACCESS_ENUMERATE_SUB_KEYS = 0x00000008
const unsigned long ACCESS_NOTIFY = 0x00000010
const unsigned long ACCESS_READ
const unsigned long ACCESS_WRITE
const unsigned long ACCESS_ALL
const unsigned long TYPE_NONE = 0
 Values for the type of a registry value.
const unsigned long TYPE_STRING = 1
const unsigned long TYPE_BINARY = 3
const unsigned long TYPE_INT = 4
const unsigned long TYPE_INT64 = 11
attribute HKEY key
 This attribute exposes the native HKEY and is available to provide C++ consumers with the flexibility of making other Windows registry API calls that are not exposed via this interface.
readonly attribute unsigned long childCount
 This attribute returns the number of child keys.
readonly attribute unsigned long valueCount
 This attribute returns the number of values under this key.

Detailed Description

This interface is designed to provide scriptable access to the Windows registry system ("With Great Power Comes Great Responsibility").

The interface represents a single key in the registry.

This interface is highly Win32 specific.

Definition at line 51 of file nsIWindowsRegKey.idl.


Member Function Documentation

This method closes the key.

If the key is already closed, then this method does nothing.

void nsIWindowsRegKey::create ( in unsigned long  rootKey,
in AString  relPath,
in unsigned long  mode 
)

This method opens an existing key or creates a new key.

NOTE: On 32-bit Windows, it is valid to pass any HKEY as the rootKey parameter of this function. However, for compatibility with 64-bit Windows, that usage should probably be avoided in favor of createChild.

Parameters:
rootKeyA root key defined above or any valid HKEY on 32-bit Windows.
relPathA relative path from the given root key.
modeAccess mode, which is a bit-wise OR of the ACCESS_ values defined above.
nsIWindowsRegKey nsIWindowsRegKey::createChild ( in AString  relPath,
in unsigned long  mode 
)

This method opens or creates a subkey relative to this key.

Returns:
nsIWindowsRegKey for the newly opened or created subkey.
AString nsIWindowsRegKey::getChildName ( in unsigned long  index)

This method returns the name of the n'th child key.

Parameters:
indexThe index of the requested child key.
AString nsIWindowsRegKey::getValueName ( in unsigned long  index)

This method returns the name of the n'th value under this key.

Parameters:
indexThe index of the requested value.
unsigned long nsIWindowsRegKey::getValueType ( in AString  name)

This method returns the type of the value with the given name.

The return value is one of the "TYPE_" constants defined above.

Parameters:
nameThe name of the value to query.

This method returns true if the key has changed and false otherwise.

This method will always return false if startWatching was not called.

This method checks to see if the key has a child by the given name.

Parameters:
nameThe name of the requested child key.

This method checks to see if the key has a value by the given name.

Parameters:
nameThe name of the requested value.

This method returns true if the key is being watched for changes (i.e., if startWatching() was called).

void nsIWindowsRegKey::open ( in unsigned long  rootKey,
in AString  relPath,
in unsigned long  mode 
)

This method opens an existing key.

This method fails if the key does not exist.

NOTE: On 32-bit Windows, it is valid to pass any HKEY as the rootKey parameter of this function. However, for compatibility with 64-bit Windows, that usage should probably be avoided in favor of openChild.

Parameters:
rootKeyA root key defined above or any valid HKEY on 32-bit Windows.
relPathA relative path from the given root key.
modeAccess mode, which is a bit-wise OR of the ACCESS_ values defined above.
nsIWindowsRegKey nsIWindowsRegKey::openChild ( in AString  relPath,
in unsigned long  mode 
)

This method opens a subkey relative to this key.

This method fails if the key does not exist.

Returns:
nsIWindowsRegKey for the newly opened subkey.
ACString nsIWindowsRegKey::readBinaryValue ( in AString  name)

This method reads the binary contents of the named value under this key.

JavaScript callers should take care with the result of this method since it will be byte-expanded to form a JS string. (The binary data will be treated as an ISO-Latin-1 character string, which it is not).

Parameters:
nameThe name of the value to query.
unsigned long long nsIWindowsRegKey::readInt64Value ( in AString  name)

This method reads the 64-bit integer contents of the named value.

Parameters:
nameThe name of the value to query.
unsigned long nsIWindowsRegKey::readIntValue ( in AString  name)

This method reads the integer contents of the named value.

Parameters:
nameThe name of the value to query.
AString nsIWindowsRegKey::readStringValue ( in AString  name)

This method reads the string contents of the named value as a Unicode string.

Parameters:
nameThe name of the value to query. This parameter can be the empty string to request the key's default value.
void nsIWindowsRegKey::removeChild ( in AString  relPath)

This method removes a child key and all of its values.

This method will fail if the key has any children of its own.

Parameters:
relPathThe relative path from this key to the key to be removed.

This method removes the value with the given name.

Parameters:
nameThe name of the value to be removed.

This method starts watching the key to see if any of its values have changed.

The key must have been opened with mode including ACCESS_NOTIFY. If recurse is true, then this key and any of its descendant keys are watched. Otherwise, only this key is watched.

Parameters:
recurseIndicates whether or not to also watch child keys.

This method stops any watching of the key initiated by a call to startWatching.

This method does nothing if the key is not being watched.

void nsIWindowsRegKey::writeBinaryValue ( in AString  name,
in ACString  data 
)

This method writes the binary contents of the named value.

The value will be created if it does not already exist.

JavaScript callers should take care with the value passed to this method since it will be truncated from a JS string (unicode) to a ISO-Latin-1 string. (The binary data will be treated as an ISO-Latin-1 character string, which it is not). So, JavaScript callers should only pass character values in the range to , or else data loss will occur.

Parameters:
nameThe name of the value to modify.
dataThe data for the value to modify.
void nsIWindowsRegKey::writeInt64Value ( in AString  name,
in unsigned long long  data 
)

This method writes the 64-bit integer contents of the named value.

The value will be created if it does not already exist.

Parameters:
nameThe name of the value to modify.
dataThe data for the value to modify.
void nsIWindowsRegKey::writeIntValue ( in AString  name,
in unsigned long  data 
)

This method writes the integer contents of the named value.

The value will be created if it does not already exist.

Parameters:
nameThe name of the value to modify.
dataThe data for the value to modify.
void nsIWindowsRegKey::writeStringValue ( in AString  name,
in AString  data 
)

This method writes the unicode string contents of the named value.

The value will be created if it does not already exist.

Parameters:
nameThe name of the value to modify. This parameter can be the empty string to modify the key's default value.
dataThe data for the value to modify.

Member Data Documentation

Initial value:

Definition at line 84 of file nsIWindowsRegKey.idl.

const unsigned long nsIWindowsRegKey::ACCESS_BASIC = 0x00020000

Values for the mode parameter passed to the open and create methods.

The values defined here correspond to the REGSAM values defined in WinNT.h in the MS Platform SDK, where ACCESS_ is replaced with KEY_.

This interface is not restricted to using only these access types.

Definition at line 71 of file nsIWindowsRegKey.idl.

Definition at line 74 of file nsIWindowsRegKey.idl.

Definition at line 75 of file nsIWindowsRegKey.idl.

Definition at line 76 of file nsIWindowsRegKey.idl.

Definition at line 72 of file nsIWindowsRegKey.idl.

Definition at line 73 of file nsIWindowsRegKey.idl.

Initial value:

Definition at line 81 of file nsIWindowsRegKey.idl.

This attribute returns the number of child keys.

Definition at line 178 of file nsIWindowsRegKey.idl.

This attribute exposes the native HKEY and is available to provide C++ consumers with the flexibility of making other Windows registry API calls that are not exposed via this interface.

It is possible to initialize this object by setting an HKEY on it. In that case, it is the responsibility of the consumer setting the HKEY to ensure that it is a valid HKEY.

WARNING: Setting the key does not close the old key.

Definition at line 117 of file nsIWindowsRegKey.idl.

Root keys.

The values for these keys correspond to the values from WinReg.h in the MS Platform SDK. The ROOT_KEY_ prefix corresponds to the HKEY_ prefix in the MS Platform SDK.

This interface is not restricted to using only these root keys.

Definition at line 60 of file nsIWindowsRegKey.idl.

Definition at line 61 of file nsIWindowsRegKey.idl.

Definition at line 62 of file nsIWindowsRegKey.idl.

Definition at line 102 of file nsIWindowsRegKey.idl.

Definition at line 103 of file nsIWindowsRegKey.idl.

Definition at line 104 of file nsIWindowsRegKey.idl.

Values for the type of a registry value.

The numeric values of these constants are taken directly from WinNT.h in the MS Platform SDK. The Microsoft documentation should be consulted for the exact meaning of these value types.

This interface is somewhat restricted to using only these value types. There is no method that is directly equivalent to RegQueryValueEx or RegSetValueEx. In particular, this interface does not support the REG_MULTI_SZ and REG_EXPAND_SZ value types. It is still possible to enumerate values that have other types (i.e., getValueType may return a type not defined below).

Definition at line 100 of file nsIWindowsRegKey.idl.

Definition at line 101 of file nsIWindowsRegKey.idl.

This attribute returns the number of values under this key.

Definition at line 199 of file nsIWindowsRegKey.idl.


The documentation for this interface was generated from the following file: