nsISupports
Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)The interface represents a single key in the registry.
This interface is highly Win32 specific.
void close(); |
void create(in unsigned long rootKey, in AString relPath, in unsigned long mode); |
nsIWindowsRegKey createChild(in AString relPath, in unsigned long mode); |
AString getChildName(in unsigned long index); |
AString getValueName(in unsigned long index); |
unsigned long getValueType(in AString name); |
boolean hasChanged(); |
boolean hasChild(in AString name); |
boolean hasValue(in AString name); |
boolean isWatching(); |
void open(in unsigned long rootKey, in AString relPath, in unsigned long mode); |
nsIWindowsRegKey openChild(in AString relPath, in unsigned long mode); |
ACString readBinaryValue(in AString name); |
unsigned long long readInt64Value(in AString name); |
unsigned long readIntValue(in AString name); |
AString readStringValue(in AString name); |
void removeChild(in AString relPath); |
void removeValue(in AString name); |
void startWatching(in boolean recurse); |
void stopWatching(); |
void writeBinaryValue(in AString name, in ACString data); |
void writeInt64Value(in AString name, in unsigned long long data); |
void writeIntValue(in AString name, in unsigned long data); |
void writeStringValue(in AString name, in AString data); |
| Attribute | Type | Description |
childCount |
unsigned long |
This attribute returns the number of child keys. Read only. |
key |
HKEY |
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 thekey does not close() the old key. Native code only! |
valueCount |
unsigned long |
This attribute returns the number of values under this key. Read only. |
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.
| Constant | Value | Description |
ROOT_KEY_CLASSES_ROOT |
0x80000000 |
|
ROOT_KEY_CURRENT_USER |
0x80000001 |
|
ROOT_KEY_LOCAL_MACHINE |
0x80000002 |
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.
| Constant | Value | Description |
ACCESS_BASIC |
0x00020000 |
|
ACCESS_QUERY_VALUE |
0x00000001 |
|
ACCESS_SET_VALUE |
0x00000002 |
|
ACCESS_CREATE_SUB_KEY |
0x00000004 |
|
ACCESS_ENUMERATE_SUB_KEYS |
0x00000008 |
|
ACCESS_NOTIFY |
0x00000010 |
|
ACCESS_READ |
ACCESS_BASIC | ACCESS_QUERY_VALUE | ACCESS_ENUMERATE_SUB_KEYS | ACCESS_NOTIFY |
|
ACCESS_WRITE |
ACCESS_BASIC | ACCESS_SET_VALUE | ACCESS_CREATE_SUB_KEY |
|
ACCESS_ALL |
ACCESS_READ | ACCESS_WRITE |
|
WOW64_32 |
0x00000200 |
|
WOW64_64 |
0x00000100 |
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 (that is, getValueType() may return a type not defined below).
| Constant | Value | Description |
TYPE_NONE |
0 |
REG_NONE |
TYPE_STRING |
1 |
REG_SZ |
TYPE_BINARY |
3 |
REG_BINARY |
TYPE_INT |
4 |
REG_DWORD |
TYPE_INT64 |
11 |
REG_QWORD |
This method closes the key. If the key is already closed, then this method does nothing.
void close();
None.
This method opens an existing key or creates a new key.
createChild().void create( in unsigned long rootKey, in AString relPath, in unsigned long mode );
rootKeykey defined above or any valid HKEY on 32-bit Windows.relPathkey.modeThis method opens or creates a subkey relative to this key.
nsIWindowsRegKey createChild( in AString relPath, in unsigned long mode );
relPathmodensIWindowsRegKey for the newly opened or created subkey.
This method returns the name of the n'th child key.
AString getChildName( in unsigned long index );
indexkey.The name of the n'th child key.
This method returns the name of the n'th value under this key.
AString getValueName( in unsigned long index );
indexThe name of the n'th value under this key.
This method returns the type of the value with the given name.
unsigned long getValueType( in AString name );
nameOne of the "TYPE_" constants.
boolean hasChanged();
None.
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.
boolean hasChild( in AString name );
namekey.true if the key has a child by the given name.
This method checks to see if the key has a value by the given name.
boolean hasValue( in AString name );
nametrue if the key has a value by the given name.
This method returns true if the key is being watched for changes (that is, if startWatching() was called).
boolean isWatching();
None.
true if the key is being watched for changes.
This method opens an existing key. This method fails if the key does not exist.
openChild().void open( in unsigned long rootKey, in AString relPath, in unsigned long mode );
rootKeykey defined above or any valid HKEY on 32-bit Windows.relPathkey.modeThis method opens a subkey relative to this key. This method fails if the key does not exist.
nsIWindowsRegKey openChild( in AString relPath, in unsigned long mode );
relPathmodensIWindowsRegKey for the newly opened subkey.
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).
ACString readBinaryValue( in AString name );
nameThe binary contents of the named value under this key.
This method reads the 64-bit integer contents of the named value.
unsigned long long readInt64Value( in AString name );
nameThe 64-bit integer contents of the named value.
This method reads the integer contents of the named value.
unsigned long readIntValue( in AString name );
nameThe integer contents of the named value.
This method reads the string contents of the named value as a Unicode string.
AString readStringValue( in AString name );
namekey's default value.The string contents of the named value as a Unicode string.
writeStringValue(), readStringValue() will work with REG_MULTI_SZ and REG_EXPAND_SZ types.Note: In Gecko 2.0, readStringValue() calls ExpandEnvironmentStrings() on a REG_EXPAND_SZ type.
This method removes a child key and all of its values. This method will fail if the key has any children of its own.
void removeChild( in AString relPath );
relPathkey to the key to be removed.This method removes the value with the given name.
void removeValue( in AString name );
nameThis 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.
void startWatching( in boolean recurse );
recurseThis 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 stopWatching();
None.
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 \u0000 to \u00FF, or else data loss will occur.
void writeBinaryValue( in AString name, in ACString data );
namedataThis method writes the 64-bit integer contents of the named value. The value will be created if it does not already exist.
void writeInt64Value( in AString name, in unsigned long long data );
namedataThis method writes the integer contents of the named value. The value will be created if it does not already exist.
void writeIntValue( in AString name, in unsigned long data );
namedataThis method writes the unicode string contents of the named value. The value will be created if it does not already exist.
void writeStringValue( in AString name, in AString data );
namekey's default value.data