Interface nsIWindowsRegKeyType

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.

Hierarchy

Properties

childCount: number

This attribute returns the number of child keys.

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 the key does not close the old key.

valueCount: number

This attribute returns the number of values under this key.

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

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

    Returns void

  • 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

    • rootKey: number

      A root key defined above or any valid HKEY on 32-bit Windows.

    • relPath: string

      A relative path from the given root key.

    • mode: number

      Access mode, which is a bit-wise OR of the ACCESS_ values defined above.

    Returns void

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

    Returns

    nsIWindowsRegKey for the newly opened or created subkey.

    Parameters

    • relPath: string
    • mode: number

    Returns nsIWindowsRegKey

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

    Parameters

    • index: number

      The index of the requested child key.

    Returns string

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

    Parameters

    • index: number

      The index of the requested value.

    Returns string

  • This method returns the type of the value with the given name. The return value is one of the "TYPE_" constants defined above.

    Parameters

    • name: string

      The name of the value to query.

    Returns number

  • This method returns true if the key has changed and false otherwise. This method will always return false if startWatching was not called.

    Returns boolean

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

    Parameters

    • name: string

      The name of the requested child key.

    Returns boolean

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

    Parameters

    • name: string

      The name of the requested value.

    Returns boolean

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

    Returns boolean

  • 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

    • rootKey: number

      A root key defined above or any valid HKEY on 32-bit Windows.

    • relPath: string

      A relative path from the given root key.

    • mode: number

      Access mode, which is a bit-wise OR of the ACCESS_ values defined above.

    Returns void

  • 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.

    Parameters

    • relPath: string
    • mode: number

    Returns nsIWindowsRegKey

  • 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

    • name: string

      The name of the value to query.

    Returns string

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

    Parameters

    • name: string

      The name of the value to query.

    Returns number

  • This method reads the integer contents of the named value.

    Parameters

    • name: string

      The name of the value to query.

    Returns number

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

    Parameters

    • name: string

      The name of the value to query. This parameter can be the empty string to request the key's default value.

    Returns string

  • 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

    • relPath: string

      The relative path from this key to the key to be removed.

    Returns void

  • This method removes the value with the given name.

    Parameters

    • name: string

      The name of the value to be removed.

    Returns void

  • 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

    • recurse: boolean

      Indicates whether or not to also watch child keys.

    Returns void

  • 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.

    Returns void

  • 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.

    Parameters

    • name: string

      The name of the value to modify.

    • data: string

      The data for the value to modify.

    Returns void

  • This method writes the 64-bit integer contents of the named value. The value will be created if it does not already exist.

    Parameters

    • name: string

      The name of the value to modify.

    • data: number

      The data for the value to modify.

    Returns void

  • This method writes the integer contents of the named value. The value will be created if it does not already exist.

    Parameters

    • name: string

      The name of the value to modify.

    • data: number

      The data for the value to modify.

    Returns void

  • This method writes the unicode string contents of the named value. The value will be created if it does not already exist.

    Parameters

    • name: string

      The name of the value to modify. This parameter can be the empty string to modify the key's default value.

    • data: string

      The data for the value to modify.

    Returns void

Generated using TypeDoc