зеркало из https://github.com/mozilla/gecko-dev.git
nsIRegistry scriptability and beginning of category support, r=dp,alecf,dveditz a=leaf,chofmann
This commit is contained in:
Родитель
c16b8d92f1
Коммит
f28337480b
|
@ -0,0 +1,87 @@
|
|||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.1 (the "MPL"); you may not use this file except in
|
||||
* compliance with the MPL. You may obtain a copy of the MPL at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the MPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* MPL.
|
||||
*
|
||||
* The Initial Developer of this code under the MPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIEnumerator.idl"
|
||||
|
||||
typedef PRUint32 nsRegistryKey;
|
||||
typedef long nsWellKnownRegistry;
|
||||
|
||||
[scriptable,uuid(5D41A440-8E37-11d2-8059-00600811A9C3)]
|
||||
interface nsIRegistry : nsISupports
|
||||
{
|
||||
const long None = 0;
|
||||
const long Users = 1;
|
||||
const long Common = 2;
|
||||
const long CurrentUser = 3;
|
||||
|
||||
const long ApplicationComponentRegistry = 1;
|
||||
|
||||
void open(in string regFile);
|
||||
void openWellKnownRegistry(in long regid);
|
||||
void openDefault();
|
||||
void close();
|
||||
boolean isOpen();
|
||||
|
||||
string getString(in nsRegistryKey baseKey, in string path);
|
||||
void setString(in nsRegistryKey baseKey, in string path, in string value);
|
||||
PRInt32 getInt(in nsRegistryKey baseKey, in string path);
|
||||
void setInt(in nsRegistryKey baseKey, in string path, in PRInt32 value);
|
||||
|
||||
nsRegistryKey addSubtree(in nsRegistryKey baseKey, in string path);
|
||||
void removeSubtree(in nsRegistryKey baseKey, in string path);
|
||||
nsRegistryKey getSubtree(in nsRegistryKey baseKey, in string path);
|
||||
|
||||
nsRegistryKey addSubtreeRaw(in nsRegistryKey baseKey, in string path);
|
||||
void removeSubtreeRaw(in nsRegistryKey baseKey, in string path);
|
||||
nsRegistryKey getSubtreeRaw(in nsRegistryKey baseKey, in string path);
|
||||
|
||||
nsIEnumerator enumerateSubtrees(in nsRegistryKey baseKey);
|
||||
nsIEnumerator enumerateAllSubtrees(in nsRegistryKey baseKey);
|
||||
nsIEnumerator enumerateValues(in nsRegistryKey baseKey);
|
||||
|
||||
const unsigned long String = 1;
|
||||
const unsigned long Int32 = 2;
|
||||
const unsigned long Bytes = 3;
|
||||
const unsigned long File = 4;
|
||||
|
||||
unsigned long getValueType(in nsRegistryKey baseKey, in string path);
|
||||
PRUint32 getValueLength(in nsRegistryKey baseKey, in string path);
|
||||
|
||||
attribute string currentUserName;
|
||||
|
||||
void pack();
|
||||
};
|
||||
|
||||
[scriptable, uuid(D1B54831-AC07-11d2-805E-00600811A9C3)]
|
||||
interface nsIRegistryNode : nsISupports
|
||||
{
|
||||
readonly attribute string name;
|
||||
readonly attribute nsRegistryKey key;
|
||||
};
|
||||
|
||||
[scriptable,uuid(5316C380-B2F8-11d2-A374-0080C6F80E4B)]
|
||||
interface nsIRegistryValue : nsISupports
|
||||
{
|
||||
readonly attribute string name;
|
||||
readonly attribute unsigned long type;
|
||||
readonly attribute PRUint32 length;
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#include "nsIRegistryUtils.h"
|
||||
%}
|
|
@ -0,0 +1,40 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef __nsIRegistryUtils_h
|
||||
#define __nsIRegistryUtils_h
|
||||
|
||||
#define NS_REGISTRY_PROGID "component://netscape/registry"
|
||||
#define NS_REGISTRY_CLASSNAME "Mozilla Registry"
|
||||
/* be761f00-a3b0-11d2-996c-0080c7cb1081 */
|
||||
#define NS_REGISTRY_CID \
|
||||
{ 0xbe761f00, 0xa3b0, 0x11d2, \
|
||||
{0x99, 0x6c, 0x00, 0x80, 0xc7, 0xcb, 0x10, 0x81} }
|
||||
|
||||
/*------------------------------- Error Codes ----------------------------------
|
||||
------------------------------------------------------------------------------*/
|
||||
#define NS_ERROR_REG_BADTYPE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 1 )
|
||||
#define NS_ERROR_REG_NO_MORE NS_ERROR_GENERATE_SUCCESS( NS_ERROR_MODULE_REG, 2 )
|
||||
#define NS_ERROR_REG_NOT_FOUND NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 3 )
|
||||
#define NS_ERROR_REG_NOFILE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 4 )
|
||||
#define NS_ERROR_REG_BUFFER_TOO_SMALL NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 5 )
|
||||
#define NS_ERROR_REG_NAME_TOO_LONG NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 6 )
|
||||
#define NS_ERROR_REG_NO_PATH NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 7 )
|
||||
#define NS_ERROR_REG_READ_ONLY NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 8 )
|
||||
#define NS_ERROR_REG_BAD_UTF8 NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 9 )
|
||||
|
||||
#endif
|
|
@ -51,39 +51,7 @@ struct nsRegistry : public nsIRegistry {
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// This class implements the nsIRegistry interface functions.
|
||||
NS_IMETHOD Open( const char *regFile);
|
||||
NS_IMETHOD OpenWellKnownRegistry( uint32 regid );
|
||||
NS_IMETHOD OpenDefault();
|
||||
NS_IMETHOD Close();
|
||||
NS_IMETHOD IsOpen( PRBool *result );
|
||||
|
||||
NS_IMETHOD GetString( Key baseKey, const char *path, char **result );
|
||||
NS_IMETHOD SetString( Key baseKey, const char *path, const char *value );
|
||||
NS_IMETHOD GetInt( Key baseKey, const char *path, int32 *result );
|
||||
NS_IMETHOD SetInt( Key baseKey, const char *path, int32 value );
|
||||
NS_IMETHOD GetBytes( Key baseKey, const char *path, void **result, uint32 *len );
|
||||
NS_IMETHOD SetBytes( Key baseKey, const char *path, void *value, uint32 len );
|
||||
|
||||
NS_IMETHOD AddSubtree( Key baseKey, const char *path, Key *result );
|
||||
NS_IMETHOD RemoveSubtree( Key baseKey, const char *path );
|
||||
NS_IMETHOD GetSubtree( Key baseKey, const char *path, Key *result );
|
||||
|
||||
NS_IMETHOD AddSubtreeRaw( Key baseKey, const char *path, Key *result );
|
||||
NS_IMETHOD RemoveSubtreeRaw( Key baseKey, const char *keyname );
|
||||
NS_IMETHOD GetSubtreeRaw( Key baseKey, const char *path, Key *result );
|
||||
|
||||
NS_IMETHOD EnumerateSubtrees( Key baseKey, nsIEnumerator **result );
|
||||
NS_IMETHOD EnumerateAllSubtrees( Key baseKey, nsIEnumerator **result );
|
||||
|
||||
NS_IMETHOD GetValueType( Key baseKey, const char *path, uint32 *result );
|
||||
NS_IMETHOD GetValueLength( Key baseKey, const char *path, uint32 *result );
|
||||
|
||||
NS_IMETHOD EnumerateValues( Key baseKey, nsIEnumerator **result );
|
||||
|
||||
NS_IMETHOD GetCurrentUserName( char **result );
|
||||
NS_IMETHOD SetCurrentUserName( const char *name );
|
||||
|
||||
NS_IMETHOD Pack();
|
||||
NS_DECL_NSIREGISTRY
|
||||
|
||||
// ctor/dtor
|
||||
nsRegistry();
|
||||
|
@ -95,7 +63,7 @@ protected:
|
|||
PRLock *mregLock; // libreg isn't threadsafe. Use locks to synchronize.
|
||||
#endif
|
||||
char *mCurRegFile; // these are to prevent open from opening the registry again
|
||||
uint32 mCurRegID;
|
||||
nsWellKnownRegistry mCurRegID;
|
||||
}; // nsRegistry
|
||||
|
||||
|
||||
|
@ -172,10 +140,7 @@ struct nsRegistryNode : public nsIRegistryNode {
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// This class implements the nsIRegistryNode interface functions.
|
||||
NS_IMETHOD GetName( char **result );
|
||||
|
||||
// Get the key associated with this node
|
||||
NS_IMETHOD GetKey( nsIRegistry::Key *r_key );
|
||||
NS_DECL_NSIREGISTRYNODE
|
||||
|
||||
// ctor
|
||||
nsRegistryNode( HREG hReg, char *name, RKEY childKey );
|
||||
|
@ -200,9 +165,7 @@ struct nsRegistryValue : public nsIRegistryValue {
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// This class implements the nsIRegistryValue interface functions.
|
||||
NS_IMETHOD GetName( char **result );
|
||||
NS_IMETHOD GetValueType( uint32 *result );
|
||||
NS_IMETHOD GetValueLength( uint32 *result );
|
||||
NS_DECL_NSIREGISTRYVALUE
|
||||
|
||||
// ctor
|
||||
nsRegistryValue( HREG hReg, RKEY key, REGENUM slot );
|
||||
|
@ -429,7 +392,7 @@ NS_IMETHODIMP nsRegistry::Open( const char *regFile ) {
|
|||
| Takes a registry id and maps that to a file name for opening. We first check |
|
||||
| to see if a registry file is already open and close it if so. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( uint32 regid ) {
|
||||
NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( nsWellKnownRegistry regid ) {
|
||||
REGERR err = REGERR_OK;
|
||||
|
||||
if (mCurRegID == regid)
|
||||
|
@ -444,7 +407,7 @@ NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( uint32 regid ) {
|
|||
nsSpecialSystemDirectory *registryLocation = NULL;
|
||||
PRBool foundReg = PR_FALSE;
|
||||
|
||||
switch ( (WellKnownRegistry) regid ) {
|
||||
switch ( (nsWellKnownRegistry) regid ) {
|
||||
case ApplicationComponentRegistry:
|
||||
registryLocation =
|
||||
new nsSpecialSystemDirectory(nsSpecialSystemDirectory::XPCOM_CurrentProcessComponentRegistry);
|
||||
|
@ -525,7 +488,7 @@ NS_IMETHODIMP nsRegistry::IsOpen( PRBool *result ) {
|
|||
| First, look for the entry using GetValueInfo. If found, and it's a string, |
|
||||
| allocate space for it and fetch the value. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::GetString( Key baseKey, const char *path, char **result ) {
|
||||
NS_IMETHODIMP nsRegistry::GetString( nsRegistryKey baseKey, const char *path, char **result ) {
|
||||
nsresult rv = NS_OK;
|
||||
REGERR err = REGERR_OK;
|
||||
|
||||
|
@ -596,7 +559,7 @@ NS_IMETHODIMP nsRegistry::GetString( Key baseKey, const char *path, char **resul
|
|||
/*--------------------------- nsRegistry::SetString ----------------------------
|
||||
| Simply sets the registry contents using NR_RegSetEntryString. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::SetString( Key baseKey, const char *path, const char *value ) {
|
||||
NS_IMETHODIMP nsRegistry::SetString( nsRegistryKey baseKey, const char *path, const char *value ) {
|
||||
REGERR err = REGERR_OK;
|
||||
// Set the contents.
|
||||
PR_Lock(mregLock);
|
||||
|
@ -610,7 +573,7 @@ NS_IMETHODIMP nsRegistry::SetString( Key baseKey, const char *path, const char *
|
|||
| This function is just shorthand for fetching a 1-element int32 array. We |
|
||||
| implement it "manually" using NR_RegGetEntry |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::GetInt( Key baseKey, const char *path, int32 *result ) {
|
||||
NS_IMETHODIMP nsRegistry::GetInt( nsRegistryKey baseKey, const char *path, int32 *result ) {
|
||||
nsresult rv = NS_OK;
|
||||
REGERR err = REGERR_OK;
|
||||
|
||||
|
@ -644,7 +607,7 @@ NS_IMETHODIMP nsRegistry::GetInt( Key baseKey, const char *path, int32 *result )
|
|||
/*---------------------------- nsRegistry::SetInt ------------------------------
|
||||
| Write out the value as a one-element int32 array, using NR_RegSetEntry. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::SetInt( Key baseKey, const char *path, int32 value ) {
|
||||
NS_IMETHODIMP nsRegistry::SetInt( nsRegistryKey baseKey, const char *path, int32 value ) {
|
||||
REGERR err = REGERR_OK;
|
||||
// Set the contents.
|
||||
PR_Lock(mregLock);
|
||||
|
@ -659,59 +622,10 @@ NS_IMETHODIMP nsRegistry::SetInt( Key baseKey, const char *path, int32 value ) {
|
|||
return regerr2nsresult( err );
|
||||
}
|
||||
|
||||
/*--------------------------- nsRegistry::GetBytes -----------------------------
|
||||
| Get the registry contents at specified location using NR_RegGetEntry. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::GetBytes( Key baseKey, const char *path, void **result, uint32 *len ) {
|
||||
nsresult rv = NS_OK;
|
||||
REGERR err = REGERR_OK;
|
||||
|
||||
// Make sure caller gave us place for result.
|
||||
if( result && len ) {
|
||||
// Get info about the requested entry.
|
||||
uint32 type;
|
||||
rv = GetValueType( baseKey, path, &type );
|
||||
// See if that worked.
|
||||
if( rv == NS_OK ) {
|
||||
// Make sure the entry is bytes.
|
||||
if( type == Bytes ) {
|
||||
// Get bytes from registry into result field.
|
||||
*result = PR_Malloc(*len);
|
||||
PR_Lock(mregLock);
|
||||
err = NR_RegGetEntry( mReg,(RKEY)baseKey,(char*)path, *result, len );
|
||||
PR_Unlock(mregLock);
|
||||
// Convert status.
|
||||
rv = regerr2nsresult( err );
|
||||
} else {
|
||||
// They asked for the wrong type of value.
|
||||
rv = NS_ERROR_REG_BADTYPE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*--------------------------- nsRegistry::SetBytes -----------------------------
|
||||
| Set the contents at the specified registry location, using NR_RegSetEntry. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::SetBytes( Key baseKey, const char *path, void *value, uint32 len ) {
|
||||
REGERR err = REGERR_OK;
|
||||
// Set contents.
|
||||
PR_Lock(mregLock);
|
||||
err = NR_RegSetEntry( mReg,(RKEY)baseKey,(char*)path,
|
||||
REGTYPE_ENTRY_BYTES, value, len );
|
||||
PR_Unlock(mregLock);
|
||||
// Convert result;
|
||||
return regerr2nsresult( err );
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------- nsRegistry::AddSubtree ----------------------------
|
||||
| Add a new registry subkey with the specified name, using NR_RegAddKey. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::AddSubtree( Key baseKey, const char *path, Key *result ) {
|
||||
NS_IMETHODIMP nsRegistry::AddSubtree( nsRegistryKey baseKey, const char *path, nsRegistryKey *result ) {
|
||||
REGERR err = REGERR_OK;
|
||||
// Add the subkey.
|
||||
PR_Lock(mregLock);
|
||||
|
@ -724,7 +638,7 @@ NS_IMETHODIMP nsRegistry::AddSubtree( Key baseKey, const char *path, Key *result
|
|||
/*-------------------------- nsRegistry::AddSubtreeRaw--------------------------
|
||||
| Add a new registry subkey with the specified name, using NR_RegAddKeyRaw |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::AddSubtreeRaw( Key baseKey, const char *path, Key *result ) {
|
||||
NS_IMETHODIMP nsRegistry::AddSubtreeRaw( nsRegistryKey baseKey, const char *path, nsRegistryKey *result ) {
|
||||
REGERR err = REGERR_OK;
|
||||
// Add the subkey.
|
||||
PR_Lock(mregLock);
|
||||
|
@ -738,7 +652,7 @@ NS_IMETHODIMP nsRegistry::AddSubtreeRaw( Key baseKey, const char *path, Key *res
|
|||
/*------------------------- nsRegistry::RemoveSubtree --------------------------
|
||||
| Deletes the subtree at a given location using NR_RegDeleteKey. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::RemoveSubtree( Key baseKey, const char *path ) {
|
||||
NS_IMETHODIMP nsRegistry::RemoveSubtree( nsRegistryKey baseKey, const char *path ) {
|
||||
REGERR err = REGERR_OK;
|
||||
// Delete the subkey.
|
||||
PR_Lock(mregLock);
|
||||
|
@ -752,7 +666,7 @@ NS_IMETHODIMP nsRegistry::RemoveSubtree( Key baseKey, const char *path ) {
|
|||
/*------------------------- nsRegistry::RemoveSubtreeRaw -----------------------
|
||||
| Deletes the subtree at a given location using NR_RegDeleteKeyRaw |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::RemoveSubtreeRaw( Key baseKey, const char *keyname ) {
|
||||
NS_IMETHODIMP nsRegistry::RemoveSubtreeRaw( nsRegistryKey baseKey, const char *keyname ) {
|
||||
nsresult rv = NS_OK;
|
||||
REGERR err = REGERR_OK;
|
||||
|
||||
|
@ -801,10 +715,10 @@ NS_IMETHODIMP nsRegistry::RemoveSubtreeRaw( Key baseKey, const char *keyname ) {
|
|||
return rv;
|
||||
}
|
||||
/*-------------------------- nsRegistry::GetSubtree ----------------------------
|
||||
| Returns a nsIRegistry::Key(RKEY) for a given key/path. The key is |
|
||||
| Returns a nsRegistryKey(RKEY) for a given key/path. The key is |
|
||||
| obtained using NR_RegGetKey. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::GetSubtree( Key baseKey, const char *path, Key *result ) {
|
||||
NS_IMETHODIMP nsRegistry::GetSubtree( nsRegistryKey baseKey, const char *path, nsRegistryKey *result ) {
|
||||
nsresult rv = NS_OK;
|
||||
REGERR err = REGERR_OK;
|
||||
// Make sure we have a place for the result.
|
||||
|
@ -822,10 +736,10 @@ NS_IMETHODIMP nsRegistry::GetSubtree( Key baseKey, const char *path, Key *result
|
|||
}
|
||||
|
||||
/*-------------------------- nsRegistry::GetSubtreeRaw--------------------------
|
||||
| Returns a nsIRegistry::Key(RKEY) for a given key/path. The key is |
|
||||
| Returns a nsRegistryKey(RKEY) for a given key/path. The key is |
|
||||
| obtained using NR_RegGetKeyRaw. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::GetSubtreeRaw( Key baseKey, const char *path, Key *result ) {
|
||||
NS_IMETHODIMP nsRegistry::GetSubtreeRaw( nsRegistryKey baseKey, const char *path, nsRegistryKey *result ) {
|
||||
nsresult rv = NS_OK;
|
||||
REGERR err = REGERR_OK;
|
||||
// Make sure we have a place for the result.
|
||||
|
@ -850,7 +764,7 @@ NS_IMETHODIMP nsRegistry::GetSubtreeRaw( Key baseKey, const char *path, Key *res
|
|||
| to recurse down subtrees. No libreg functions are invoked at this point |
|
||||
|(that will happen when the enumerator member functions are called). |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::EnumerateSubtrees( Key baseKey, nsIEnumerator **result ) {
|
||||
NS_IMETHODIMP nsRegistry::EnumerateSubtrees( nsRegistryKey baseKey, nsIEnumerator **result ) {
|
||||
nsresult rv = NS_OK;
|
||||
// Make sure we have a place to put the result.
|
||||
if( result ) {
|
||||
|
@ -873,7 +787,7 @@ NS_IMETHODIMP nsRegistry::EnumerateSubtrees( Key baseKey, nsIEnumerator **result
|
|||
| Same as EnumerateSubtrees but we pass PR_TRUE to request that the |
|
||||
| enumerator object descend subtrees when it is used. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::EnumerateAllSubtrees( Key baseKey, nsIEnumerator **result ) {
|
||||
NS_IMETHODIMP nsRegistry::EnumerateAllSubtrees( nsRegistryKey baseKey, nsIEnumerator **result ) {
|
||||
nsresult rv = NS_OK;
|
||||
// Make sure we have a place to put the result.
|
||||
if( result ) {
|
||||
|
@ -897,7 +811,7 @@ NS_IMETHODIMP nsRegistry::EnumerateAllSubtrees( Key baseKey, nsIEnumerator **res
|
|||
| The result is transferred to the uint32 value passed in (with conversion |
|
||||
| to the appropriate nsIRegistry::DataType value). |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::GetValueType( Key baseKey, const char *path, uint32 *result ) {
|
||||
NS_IMETHODIMP nsRegistry::GetValueType( nsRegistryKey baseKey, const char *path, uint32 *result ) {
|
||||
nsresult rv = NS_OK;
|
||||
REGERR err = REGERR_OK;
|
||||
// Make sure we have a place to put the result.
|
||||
|
@ -923,7 +837,7 @@ NS_IMETHODIMP nsRegistry::GetValueType( Key baseKey, const char *path, uint32 *r
|
|||
| Gets the registry value info via NR_RegGetEntryInfo. The length is |
|
||||
| converted to the proper "units" via reginfo2Length. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::GetValueLength( Key baseKey, const char *path, uint32 *result ) {
|
||||
NS_IMETHODIMP nsRegistry::GetValueLength( nsRegistryKey baseKey, const char *path, uint32 *result ) {
|
||||
nsresult rv = NS_OK;
|
||||
REGERR err = REGERR_OK;
|
||||
// Make sure we have a place to put the result.
|
||||
|
@ -950,7 +864,7 @@ NS_IMETHODIMP nsRegistry::GetValueLength( Key baseKey, const char *path, uint32
|
|||
| a similar fashion as the nsRegSubtreeEnumerator is allocated/returned by |
|
||||
| EnumerateSubtrees. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::EnumerateValues( Key baseKey, nsIEnumerator **result ) {
|
||||
NS_IMETHODIMP nsRegistry::EnumerateValues( nsRegistryKey baseKey, nsIEnumerator **result ) {
|
||||
nsresult rv = NS_OK;
|
||||
// Make sure we have a place to put the result.
|
||||
if( result ) {
|
||||
|
@ -1237,7 +1151,7 @@ NS_IMETHODIMP nsRegistryNode::GetName( char **result ) {
|
|||
| Get the subkey corresponding to this node |
|
||||
| using NR_RegEnumSubkeys. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistryNode::GetKey( nsIRegistry::Key *r_key ) {
|
||||
NS_IMETHODIMP nsRegistryNode::GetKey( nsRegistryKey *r_key ) {
|
||||
nsresult rv = NS_OK;
|
||||
if (r_key == NULL) return NS_ERROR_NULL_POINTER;
|
||||
*r_key = mChildKey;
|
||||
|
@ -1291,12 +1205,12 @@ NS_IMETHODIMP nsRegistryValue::GetName( char **result ) {
|
|||
return rv;
|
||||
}
|
||||
|
||||
/*----------------------- nsRegistryValue::GetValueType ------------------------
|
||||
/*----------------------- nsRegistryValue::GetType ------------------------
|
||||
| We test if we've got the info already. If not, we git it by calling |
|
||||
| getInfo. We calculate the result by converting the REGINFO type field to |
|
||||
| a nsIRegistry::DataType value (using reginfo2DataType). |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistryValue::GetValueType( uint32 *result ) {
|
||||
NS_IMETHODIMP nsRegistryValue::GetType( PRUint32 *result ) {
|
||||
nsresult rv = NS_OK;
|
||||
// Make sure we have room for th result.
|
||||
if( result ) {
|
||||
|
@ -1313,12 +1227,12 @@ NS_IMETHODIMP nsRegistryValue::GetValueType( uint32 *result ) {
|
|||
return rv;
|
||||
}
|
||||
|
||||
/*---------------------- nsRegistryValue::GetValueLength -----------------------
|
||||
/*---------------------- nsRegistryValue::GetLength -----------------------
|
||||
| We test if we've got the info already. If not, we git it by calling |
|
||||
| getInfo. We calculate the result by converting the REGINFO type field to |
|
||||
| a nsIRegistry::DataType value (using reginfo2Length). |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistryValue::GetValueLength( uint32 *result ) {
|
||||
NS_IMETHODIMP nsRegistryValue::GetLength( uint32 *result ) {
|
||||
nsresult rv = NS_OK;
|
||||
// Make sure we have room for th result.
|
||||
if( result ) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
nsIGenericFactory.h
|
||||
nsIRegistry.h
|
||||
nsIRegistryUtils.h
|
||||
nsIServiceManager.h
|
||||
nsIServiceProvider.h
|
||||
nsRepository.h
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
nsIFactory.idl
|
||||
nsICategoryHandler.idl
|
||||
nsICategoryManager.idl
|
||||
nsIComponentLoader.idl
|
||||
nsIComponentManager.idl
|
||||
nsIFactory.idl
|
||||
nsIRegistry.idl
|
||||
|
|
|
@ -38,7 +38,7 @@ CPPSRCS = \
|
|||
EXPORTS = \
|
||||
nsComponentManagerUtils.h \
|
||||
nsIGenericFactory.h \
|
||||
nsIRegistry.h \
|
||||
nsIRegistryUtils.h \
|
||||
nsIServiceManager.h \
|
||||
nsIServiceProvider.h \
|
||||
nsRepository.h \
|
||||
|
@ -46,10 +46,13 @@ EXPORTS = \
|
|||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsICategoryHandler.idl \
|
||||
nsICategoryManager.idl \
|
||||
nsIComponentLoader.idl \
|
||||
nsIComponentManager.idl \
|
||||
nsIFactory.idl \
|
||||
nsIModule.idl \
|
||||
nsIRegistry.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
@ -64,3 +67,6 @@ include $(topsrcdir)/config/rules.mk
|
|||
|
||||
DEFINES += -DUSE_NSREG -D_IMPL_NS_COM -D_IMPL_NS_BASE
|
||||
|
||||
# XXX need common install rule!
|
||||
install:: $(TARGETS)
|
||||
$(INSTALL) $(srcdir)/nsCategoryManager.js $(DIST)/bin/components
|
||||
|
|
|
@ -26,7 +26,7 @@ MODULE = xpcom_components
|
|||
EXPORTS = \
|
||||
nsComponentManagerUtils.h \
|
||||
nsIGenericFactory.h \
|
||||
nsIRegistry.h \
|
||||
nsIRegistryUtils.h \
|
||||
nsIServiceManager.h \
|
||||
nsIServiceProvider.h \
|
||||
nsRepository.h \
|
||||
|
@ -34,10 +34,13 @@ EXPORTS = \
|
|||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsICategoryHandler.idl \
|
||||
.\nsICategoryManager.idl \
|
||||
.\nsIComponentLoader.idl \
|
||||
.\nsIComponentManager.idl \
|
||||
.\nsIFactory.idl \
|
||||
.\nsIModule.idl \
|
||||
.\nsIRegistry.idl \
|
||||
$(NULL)
|
||||
|
||||
################################################################################
|
||||
|
|
|
@ -0,0 +1,140 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
function CategoryManager() {
|
||||
this.categories = { };
|
||||
}
|
||||
function NYI () { throw Components.results.NS_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
var proto = CategoryManager.prototype;
|
||||
var nsICategoryManager = Components.interfaces.nsICategoryManager;
|
||||
|
||||
proto.getCategoryEntry = function (category, entry) {
|
||||
var cat = this.categories[category];
|
||||
if (!cat)
|
||||
return null;
|
||||
if ("override" in cat)
|
||||
return cat.override.getCategoryEntry(category, entry);
|
||||
var table = cat.table;
|
||||
if (entry in table)
|
||||
return table[entry];
|
||||
if ("fallback" in cat) {
|
||||
dump("\n--fallback: " + cat.fallback + "\n");
|
||||
return cat.fallback.getCategoryEntry(category, entry);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
proto.getCategoryEntryRaw = function (category, entry) {
|
||||
var table;
|
||||
var cat = this.categories[category];
|
||||
if (!cat ||
|
||||
(!entry in (table = cat.table)))
|
||||
return null;
|
||||
if (entry in table)
|
||||
return table[entry];
|
||||
if ("fallback" in cat)
|
||||
return cat.fallback.getCategoryEntry(category, entry);
|
||||
return null;
|
||||
}
|
||||
|
||||
proto.addCategoryEntry = function (category, entry, value, persist, replace) {
|
||||
if (!(category in this.categories)) {
|
||||
dump("aCE: creating category \"" + category + "\"\n");
|
||||
this.categories[category] = { name:category, table:{ } };
|
||||
}
|
||||
var table = this.categories[category].table;
|
||||
var oldValue;
|
||||
if (entry in table) {
|
||||
if (!replace)
|
||||
throw Components.results.NS_ERROR_INVALID_ARG;
|
||||
oldValue = table[entry];
|
||||
} else {
|
||||
oldValue = null;
|
||||
}
|
||||
table[entry] = value;
|
||||
if (persist)
|
||||
// need registry
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
proto.enumerateCategory = NYI;
|
||||
proto.getCategoryContents = NYI;
|
||||
|
||||
proto.registerCategoryHandler = function(category, handler, mode) {
|
||||
dump("nCM: handler.getCategoryEntry: " + handler.getCategoryEntry + "\n");
|
||||
dump("typeof handler: " + typeof handler + "\n");
|
||||
/*
|
||||
dump('rCH: "' + category + '".' +
|
||||
(mode == nsICategoryManager.fallback ? "fallback" :
|
||||
(mode == nsICategoryManager.override ? "override" :
|
||||
mode)) + " = " + handler + "\n");
|
||||
*/
|
||||
if (!(category in this.categories)) {
|
||||
dump("rCH: creating category \"" + category + "\"\n");
|
||||
this.categories[category] = { table:{ } };
|
||||
}
|
||||
var old;
|
||||
var category = this.categories[category];
|
||||
if (mode == nsICategoryManager.override) {
|
||||
old = category.override || null;
|
||||
category.override = handler;
|
||||
} else if (mode == nsICategoryManager.fallback) {
|
||||
old = category.fallback || null;
|
||||
category.fallback = handler;
|
||||
} else {
|
||||
dump("\nregisterCategoryHandler: illegal mode " + mode + "\n\n");
|
||||
throw Components.results.NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
return old;
|
||||
};
|
||||
proto.unregisterCategoryHandler = NYI;
|
||||
|
||||
var module = {
|
||||
RegisterSelf:function (compMgr, fileSpec, location, type) {
|
||||
compMgr.registerComponentWithType(this.myCID,
|
||||
"Category Manager",
|
||||
"mozilla.categorymanager.1",
|
||||
fileSpec, location, true, true,
|
||||
type);
|
||||
},
|
||||
GetClassObject:function (compMgr, cid, iid) {
|
||||
if (!cid.equals(this.myCID))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
if (!iid.equals(Components.interfaces.nsIFactory))
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
return this.myFactory;
|
||||
},
|
||||
myCID:Components.ID("{16d222a6-1dd2-11b2-b693-f38b02c021b2}"),
|
||||
myFactory:{
|
||||
CreateInstance:function (outer, iid) {
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
if (!(iid.equals(nsICategoryManager) ||
|
||||
iid.equals(Components.interfaces.nsISupports)))
|
||||
throw Components.results.NS_ERROR_INVALID_ARG;
|
||||
return new CategoryManager();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function NSGetModule(compMgr, fileSpec) { return module; }
|
|
@ -413,7 +413,7 @@ nsresult
|
|||
nsComponentManagerImpl::PlatformVersionCheck()
|
||||
{
|
||||
|
||||
nsIRegistry::Key xpcomKey;
|
||||
nsRegistryKey xpcomKey;
|
||||
nsresult rv;
|
||||
rv = mRegistry->AddSubtree(nsIRegistry::Common, xpcomKeyName, &xpcomKey);
|
||||
|
||||
|
@ -432,7 +432,7 @@ nsComponentManagerImpl::PlatformVersionCheck()
|
|||
"registry hierarchy.", buf, NS_XPCOM_COMPONENT_MANAGER_VERSION_STRING));
|
||||
|
||||
// Delete the XPCOM and CLSID hierarchy
|
||||
nsIRegistry::Key mozillaKey;
|
||||
nsRegistryKey mozillaKey;
|
||||
rv = mRegistry->GetSubtree(nsIRegistry::Common, mozillaKeyName,
|
||||
&mozillaKey);
|
||||
if(NS_FAILED(rv))
|
||||
|
@ -512,7 +512,7 @@ nsComponentManagerImpl::PlatformVersionCheck()
|
|||
|
||||
#if 0
|
||||
void
|
||||
nsComponentManagerImpl::PlatformSetFileInfo(nsIRegistry::Key key, PRUint32 lastModifiedTime, PRUint32 fileSize)
|
||||
nsComponentManagerImpl::PlatformSetFileInfo(nsRegistryKey key, PRUint32 lastModifiedTime, PRUint32 fileSize)
|
||||
{
|
||||
mRegistry->SetInt(key, lastModValueName, lastModifiedTime);
|
||||
mRegistry->SetInt(key, fileSizeValueName, fileSize);
|
||||
|
@ -532,7 +532,7 @@ nsComponentManagerImpl::PlatformMarkNoComponents(nsDll *dll)
|
|||
|
||||
nsresult rv;
|
||||
|
||||
nsIRegistry::Key dllPathKey;
|
||||
nsRegistryKey dllPathKey;
|
||||
rv = mRegistry->AddSubtreeRaw(mXPCOMKey, dll->GetPersistentDescriptorString(), &dllPathKey);
|
||||
if(NS_FAILED(rv))
|
||||
{
|
||||
|
@ -557,7 +557,7 @@ nsComponentManagerImpl::PlatformRegister(const char *cidString,
|
|||
|
||||
nsresult rv;
|
||||
|
||||
nsIRegistry::Key IDkey;
|
||||
nsRegistryKey IDkey;
|
||||
rv = mRegistry->AddSubtreeRaw(mCLSIDKey, cidString, &IDkey);
|
||||
if (NS_FAILED(rv)) return (rv);
|
||||
|
||||
|
@ -571,7 +571,7 @@ nsComponentManagerImpl::PlatformRegister(const char *cidString,
|
|||
|
||||
if (progID)
|
||||
{
|
||||
nsIRegistry::Key progIDKey;
|
||||
nsRegistryKey progIDKey;
|
||||
rv = mRegistry->AddSubtreeRaw(mClassesKey, progID, &progIDKey);
|
||||
rv = mRegistry->SetString(progIDKey, classIDValueName, cidString);
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ nsComponentManagerImpl::PlatformRegister(const char *cidString,
|
|||
// XXX the registry non-xp. Someone beat on the nspr people to get
|
||||
// XXX a longlong serialization function please!
|
||||
|
||||
nsIRegistry::Key dllPathKey;
|
||||
nsRegistryKey dllPathKey;
|
||||
rv = mRegistry->AddSubtreeRaw(mXPCOMKey,dll->GetPersistentDescriptorString(), &dllPathKey);
|
||||
|
||||
PlatformSetFileInfo(dllPathKey, dll->GetLastModifiedTime(), dll->GetSize());
|
||||
|
@ -602,7 +602,7 @@ nsComponentManagerImpl::PlatformUnregister(const char *cidString,
|
|||
|
||||
nsresult rv;
|
||||
|
||||
nsIRegistry::Key cidKey;
|
||||
nsRegistryKey cidKey;
|
||||
rv = mRegistry->AddSubtreeRaw(mCLSIDKey, cidString, &cidKey);
|
||||
|
||||
char *progID = NULL;
|
||||
|
@ -615,7 +615,7 @@ nsComponentManagerImpl::PlatformUnregister(const char *cidString,
|
|||
|
||||
mRegistry->RemoveSubtree(mCLSIDKey, cidString);
|
||||
|
||||
nsIRegistry::Key libKey;
|
||||
nsRegistryKey libKey;
|
||||
rv = mRegistry->GetSubtreeRaw(mXPCOMKey, aLibrary, &libKey);
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -647,7 +647,7 @@ nsComponentManagerImpl::PlatformFind(const nsCID &aCID, nsFactoryEntry* *result)
|
|||
|
||||
char *cidString = aCID.ToString();
|
||||
|
||||
nsIRegistry::Key cidKey;
|
||||
nsRegistryKey cidKey;
|
||||
rv = mRegistry->GetSubtreeRaw(mCLSIDKey, cidString, &cidKey);
|
||||
delete [] cidString;
|
||||
|
||||
|
@ -699,7 +699,7 @@ nsComponentManagerImpl::PlatformProgIDToCLSID(const char *aProgID, nsCID *aClass
|
|||
|
||||
nsresult rv;
|
||||
|
||||
nsIRegistry::Key progIDKey;
|
||||
nsRegistryKey progIDKey;
|
||||
rv = mRegistry->GetSubtreeRaw(mClassesKey, aProgID, &progIDKey);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -726,7 +726,7 @@ nsComponentManagerImpl::PlatformCLSIDToProgID(const nsCID *aClass,
|
|||
nsresult rv;
|
||||
|
||||
char* cidStr = aClass->ToString();
|
||||
nsIRegistry::Key cidKey;
|
||||
nsRegistryKey cidKey;
|
||||
rv = mRegistry->GetSubtreeRaw(mCLSIDKey, cidStr, &cidKey);
|
||||
if(NS_FAILED(rv)) return rv;
|
||||
PR_FREEIF(cidStr);
|
||||
|
@ -775,7 +775,7 @@ nsresult nsComponentManagerImpl::PlatformPrePopulateRegistry()
|
|||
autoStringFree delete_cidString(cidString, autoStringFree::nsCRT_String_Delete);
|
||||
|
||||
// Get key associated with library
|
||||
nsIRegistry::Key cidKey;
|
||||
nsRegistryKey cidKey;
|
||||
rv = node->GetKey(&cidKey);
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
||||
|
@ -829,7 +829,7 @@ nsresult nsComponentManagerImpl::PlatformPrePopulateRegistry()
|
|||
autoStringFree delete_progidString(progidString, autoStringFree::nsCRT_String_Delete);
|
||||
|
||||
// Get cid string
|
||||
nsIRegistry::Key progidKey;
|
||||
nsRegistryKey progidKey;
|
||||
rv = node->GetKey(&progidKey);
|
||||
if (NS_FAILED(rv)) continue;
|
||||
char *cidString = NULL;
|
||||
|
@ -1645,7 +1645,7 @@ nsComponentManagerImpl::GetLoaderForType(const char *aType,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIRegistry::Key loaderKey;
|
||||
nsRegistryKey loaderKey;
|
||||
rv = mRegistry->GetSubtreeRaw(mLoadersKey, aType, &loaderKey);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -1677,7 +1677,7 @@ nsresult
|
|||
nsComponentManagerImpl::RegisterComponentLoader(const char *aType, const char *aProgID,
|
||||
PRBool aReplace)
|
||||
{
|
||||
nsIRegistry::Key loaderKey;
|
||||
nsRegistryKey loaderKey;
|
||||
nsresult rv = mRegistry->AddSubtreeRaw(mLoadersKey, aType, &loaderKey);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -1701,7 +1701,7 @@ nsComponentManagerImpl::AddComponentToRegistry(const nsCID &aClass,
|
|||
const char *aType)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIRegistry::Key IDKey;
|
||||
nsRegistryKey IDKey;
|
||||
int32 nComponents = 0;
|
||||
|
||||
/* so why do we use strings here rather than writing bytes, anyway? */
|
||||
|
@ -1731,7 +1731,7 @@ nsComponentManagerImpl::AddComponentToRegistry(const nsCID &aClass,
|
|||
if (NS_FAILED(rv))
|
||||
goto out;
|
||||
|
||||
nsIRegistry::Key progIDKey;
|
||||
nsRegistryKey progIDKey;
|
||||
rv = mRegistry->AddSubtreeRaw(mClassesKey, aProgID, &progIDKey);
|
||||
if (NS_FAILED(rv))
|
||||
goto out;
|
||||
|
@ -1740,7 +1740,7 @@ nsComponentManagerImpl::AddComponentToRegistry(const nsCID &aClass,
|
|||
goto out;
|
||||
}
|
||||
|
||||
nsIRegistry::Key compKey;
|
||||
nsRegistryKey compKey;
|
||||
rv = mRegistry->AddSubtreeRaw(mXPCOMKey, aRegistryName, &compKey);
|
||||
|
||||
// update component count
|
||||
|
|
|
@ -97,11 +97,11 @@ protected:
|
|||
nsSupportsHashtable* mLoaders;
|
||||
PRMonitor* mMon;
|
||||
nsIRegistry* mRegistry;
|
||||
nsIRegistry::Key mXPCOMKey;
|
||||
nsIRegistry::Key mClassesKey;
|
||||
nsIRegistry::Key mCLSIDKey;
|
||||
nsRegistryKey mXPCOMKey;
|
||||
nsRegistryKey mClassesKey;
|
||||
nsRegistryKey mCLSIDKey;
|
||||
PRBool mPrePopulationDone;
|
||||
nsIRegistry::Key mLoadersKey;
|
||||
nsRegistryKey mLoadersKey;
|
||||
nsNativeComponentLoader *mNativeComponentLoader;
|
||||
nsSpecialSystemDirectory *mComponentsDir;
|
||||
PRUint32 mComponentsDirLen;
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/* -*- Mode: idl; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(9c1af822-1dd1-11b2-b8ce-a1d231c7953f)]
|
||||
interface nsICategoryHandler : nsISupports
|
||||
{
|
||||
/**
|
||||
* Get the entry for the given category's tag.
|
||||
* @param category The name of the category ("protocol")
|
||||
* @param entry The entry you're looking for ("http")
|
||||
*/
|
||||
string getCategoryEntry(in string category, in string entry);
|
||||
};
|
|
@ -0,0 +1,95 @@
|
|||
/* -*- Mode: idl; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIEnumerator.idl"
|
||||
#include "nsICategoryHandler.idl"
|
||||
|
||||
[scriptable, uuid(5a1e1a2c-1dd2-11b2-a72f-967357e43a00)]
|
||||
interface nsICategoryManager : nsISupports
|
||||
{
|
||||
/**
|
||||
* Get the value for the given category's entry.
|
||||
* @param aCategory The name of the category ("protocol")
|
||||
* @param aEntry The entry you're looking for ("http")
|
||||
* @return The value.
|
||||
*/
|
||||
string getCategoryEntry(in string aCategory, in string aEntry);
|
||||
|
||||
/**
|
||||
* As above, but do not permit overriding. This is useful to allow
|
||||
* an override handler to get at the ``normal'' category contents.
|
||||
*/
|
||||
string getCategoryEntryRaw(in string aCategory, in string aEntry);
|
||||
|
||||
/**
|
||||
* Add an entry to a category.
|
||||
* @param aCategory The name of the category ("protocol")
|
||||
* @param aEntry The entry to be added ("http")
|
||||
* @param aValue The value for the entry ("moz.httprulez.1")
|
||||
* @param aPersist Should we persist between invocations?
|
||||
* @param aReplace Should we replace an existing entry?
|
||||
* @return previous entry, if any
|
||||
*/
|
||||
string addCategoryEntry(in string aCategory, in string aEntry,
|
||||
in string aValue, in boolean aPersist,
|
||||
in boolean aReplace);
|
||||
|
||||
/**
|
||||
* Enumerate the entries in a category.
|
||||
* @param aCategory The category to be enumerated.
|
||||
*/
|
||||
nsIEnumerator enumerateCategory(in string aCategory);
|
||||
|
||||
/**
|
||||
* Get all the category contents.
|
||||
*/
|
||||
void getCategoryContents(in string category,
|
||||
[array, size_is(count)] out string entries,
|
||||
[array, size_is(count)] out string values,
|
||||
[retval] out long count);
|
||||
|
||||
const long override = 0;
|
||||
const long fallback = 1;
|
||||
const long checkFirst = 0;
|
||||
const long checkLast = 1;
|
||||
|
||||
/*
|
||||
* Register a category handler for override or fallback when
|
||||
* searching a given category.
|
||||
* @param aCategory The name of the category ("protocol")
|
||||
* @param aHandler The handler to be installed
|
||||
* @param aMode override or fallback?
|
||||
* @return The previously-installed category handler, if any
|
||||
*/
|
||||
nsICategoryHandler registerCategoryHandler(in string aCategory,
|
||||
in nsICategoryHandler aHandler,
|
||||
in long aMode);
|
||||
|
||||
/*
|
||||
* Unregister a category handler for the given category.
|
||||
* XXX will this cause shutdown problems? Who has owning refs on whom?
|
||||
* @param category The name of the category ("protocol")
|
||||
* @param handler The handler to be unregistered.
|
||||
* @param previous The handler that this one replaced, typically the
|
||||
* return from the registerCategoryHandler call.
|
||||
*/
|
||||
void unregisterCategoryHandler(in string category,
|
||||
in nsICategoryHandler handler,
|
||||
in nsICategoryHandler previous);
|
||||
};
|
|
@ -89,6 +89,7 @@ interface nsIComponentManager : nsISupports
|
|||
boolean isRegistered(in nsCIDRef aClass);
|
||||
nsIEnumerator enumerateCLSIDs();
|
||||
nsIEnumerator enumerateProgIDs();
|
||||
|
||||
};
|
||||
|
||||
%{ C++
|
||||
|
|
|
@ -1,358 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef __nsIRegistry_h
|
||||
#define __nsIRegistry_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
// {5D41A440-8E37-11d2-8059-00600811A9C3}
|
||||
#define NS_IREGISTRY_IID { 0x5d41a440, 0x8e37, 0x11d2, { 0x80, 0x59, 0x0, 0x60, 0x8, 0x11, 0xa9, 0xc3 } }
|
||||
#define NS_REGISTRY_PROGID "component://netscape/registry"
|
||||
#define NS_REGISTRY_CLASSNAME "Mozilla Registry"
|
||||
|
||||
// {D1B54831-AC07-11d2-805E-00600811A9C3}
|
||||
#define NS_IREGISTRYNODE_IID { 0xd1b54831, 0xac07, 0x11d2, { 0x80, 0x5e, 0x0, 0x60, 0x8, 0x11, 0xa9, 0xc3 } }
|
||||
// {5316C380-B2F8-11d2-A374-0080C6F80E4B}
|
||||
#define NS_IREGISTRYVALUE_IID { 0x5316c380, 0xb2f8, 0x11d2, { 0xa3, 0x74, 0x0, 0x80, 0xc6, 0xf8, 0xe, 0x4b } }
|
||||
|
||||
/* be761f00-a3b0-11d2-996c-0080c7cb1081 */
|
||||
#define NS_REGISTRY_CID \
|
||||
{ 0xbe761f00, 0xa3b0, 0x11d2, \
|
||||
{0x99, 0x6c, 0x00, 0x80, 0xc7, 0xcb, 0x10, 0x81} }
|
||||
|
||||
|
||||
class nsIEnumerator;
|
||||
|
||||
/*-------------------------------- nsIRegistry ---------------------------------
|
||||
| This interface provides access to a tree of arbitrary values. |
|
||||
| |
|
||||
| Each node of the tree contains either a value or a subtree or both. |
|
||||
| |
|
||||
| The value at any of these leaf nodes can be any of these "primitive" types: |
|
||||
| o string (null terminated UTF string) |
|
||||
| o array of 32-bit integers |
|
||||
| o arbitrary array of bytes |
|
||||
| o file identifier |
|
||||
| Of course, since you can store an arbitrary array of bytes, you can put |
|
||||
| any data you like into a registry (although you have the burden of |
|
||||
| encoding/decoding your data in that case). |
|
||||
| |
|
||||
| Each branch of the tree is labelled with a string "key." The entire path |
|
||||
| from a given point of the tree to another point further down can be |
|
||||
| presented as a single string composed of each branch's label, concatenated |
|
||||
| to the next, with an intervening forward slash ('/'). The term "key" |
|
||||
| refers to both specific tree branch labels and to such concatenated paths. |
|
||||
| |
|
||||
| The branches from a given node must have unique labels. Distinct nodes can |
|
||||
| have branches with the same label. |
|
||||
| |
|
||||
| For example, here's a small registry tree: |
|
||||
| | |
|
||||
| /\ |
|
||||
| / \ |
|
||||
| / \ |
|
||||
| / \ |
|
||||
| "Classes" "Users" |
|
||||
| / \ |
|
||||
| / \ |
|
||||
| / ["joe"] |
|
||||
| / / \ |
|
||||
| | / \ |
|
||||
| /\ / \ |
|
||||
| / \ "joe" "bob" |
|
||||
| / \ / \ |
|
||||
| / \ |
|
||||
| "{xxxx-xx-1}" "{xxxx-xx-2}" ["c:/joe"] ["d:/Robert"] |
|
||||
| | | |
|
||||
| /\ /\ |
|
||||
| / \ / \ |
|
||||
| / \ / \ |
|
||||
| "Library" "Version" "Library" "Version" |
|
||||
| / \ / \ |
|
||||
| ["foo.dll"] 2 ["bar.dll"] 1 |
|
||||
| |
|
||||
| In this example, there are 2 keys under the root: "Classes" and "Users". |
|
||||
| The first denotes a subtree only (which has two subtrees, ...). The second |
|
||||
| denotes both a value ["joe"] and two subtrees labelled "joe" and "bob". |
|
||||
| The value at the node "/Users" is ["joe"], at "/Users/bob" is ["d:/Robert"]. |
|
||||
| The value at "/Classes/{xxxx-xx-1}/Version" is 2. |
|
||||
| |
|
||||
| The registry interface provides functions that let you navigate the tree |
|
||||
| and manipulate it's contents. |
|
||||
| |
|
||||
| Please note that the registry itself does not impose any structure or |
|
||||
| meaning on the contents of the tree. For example, the registry doesn't |
|
||||
| control whether the value at the key "/Users" is the label for the subtree |
|
||||
| with information about the last active user. That meaning is applied by |
|
||||
| the code that stores these values and uses them for that purpose. |
|
||||
| |
|
||||
| [Any resemblence between this example and actual contents of any actual |
|
||||
| registry is purely coincidental.] |
|
||||
------------------------------------------------------------------------------*/
|
||||
struct nsIRegistry : public nsISupports {
|
||||
/*------------------------------ Constants ---------------------------------
|
||||
| The following enumerated types and values are used by the registry |
|
||||
| interface. |
|
||||
--------------------------------------------------------------------------*/
|
||||
typedef enum {
|
||||
String = 1,
|
||||
Int32,
|
||||
Bytes,
|
||||
File
|
||||
} DataType;
|
||||
|
||||
/*-------------------------------- Types -----------------------------------
|
||||
| The following data types are used by this interface. All are basically |
|
||||
| opaque types. You obtain objects of these types via certain member |
|
||||
| function calls and re-use them later (without having to know what they |
|
||||
| contain). |
|
||||
| |
|
||||
| Key - Placeholder to represent a particular node in a registry |
|
||||
| tree. There are 3 enumerated values that correspond to |
|
||||
| specific nodes: |
|
||||
| Common - Where most stuff goes. |
|
||||
| Users - Special subtree to hold info about |
|
||||
| "users"; if you don't know what goes |
|
||||
| here, don't mess with it. |
|
||||
| CurrentUser - Subtree under Users corresponding to |
|
||||
| whatever user is designed the "current" |
|
||||
| one; see note above. |
|
||||
| You can specify any of these enumerated values as "keys" |
|
||||
| on any member function that takes a nsRegistry::Key. |
|
||||
| ValueInfo - Structure describing a registry value. |
|
||||
--------------------------------------------------------------------------*/
|
||||
typedef uint32 Key;
|
||||
|
||||
enum WellKnownKeys { None = 0, Users = 1, Common = 2, CurrentUser = 3 };
|
||||
|
||||
enum WellKnownRegistry {
|
||||
ApplicationComponentRegistry = 1
|
||||
};
|
||||
|
||||
struct ValueInfo {
|
||||
DataType type;
|
||||
uint32 length;
|
||||
};
|
||||
|
||||
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IREGISTRY_IID; return iid; }
|
||||
|
||||
/*--------------------------- Opening/Closing ------------------------------
|
||||
| These functions open the specified registry file (Open() with a non-null |
|
||||
| argument) or the default "standard" registry file (Open() with a null |
|
||||
| argument or OpenDefault()). |
|
||||
| |
|
||||
| Once opened, you can access the registry contents via the read/write |
|
||||
| or query functions. |
|
||||
| |
|
||||
| The registry file will be closed automatically when the registry object |
|
||||
| is destroyed. You can close the file prior to that by using the |
|
||||
| Close() function. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD Open( const char *regFile ) = 0;
|
||||
NS_IMETHOD OpenWellKnownRegistry( uint32 regid ) = 0;
|
||||
NS_IMETHOD OpenDefault() = 0;
|
||||
NS_IMETHOD Close() = 0;
|
||||
NS_IMETHOD IsOpen( PRBool *result ) = 0;
|
||||
|
||||
/*----------------------- Reading/Writing Values ---------------------------
|
||||
| These functions read/write the registry values at a given node. |
|
||||
| |
|
||||
| All functions require you to specify where in the registry key to |
|
||||
| get/set the value. The location is specified using two components: |
|
||||
| o A "base key" indicating where to start from; this is a value of type |
|
||||
| nsIRegistry::Key. You use either one of the special "root" key |
|
||||
| values or a subkey obtained via some other member function call. |
|
||||
| o A "relative path," expressed as a sequence of subtree names |
|
||||
| separated by forward slashes. This path describes how to get from |
|
||||
| the base key to the node at which you want to store the data. This |
|
||||
| component can be a null pointer which means the value goes directly |
|
||||
| at the node denoted by the base key. |
|
||||
| |
|
||||
| When you request a value of a given type, the data stored at the |
|
||||
| specified node must be of the type requested. If not, an error results. |
|
||||
| |
|
||||
| GetString - Obtains a newly allocated copy of a string type value. The |
|
||||
| caller is obligated to free the returned string using |
|
||||
| PR_Free. |
|
||||
| SetString - Stores the argument string at the specified node. |
|
||||
| GetInt - Obtains an int32 value at the specified node. The result |
|
||||
| is returned into an int32 location you specify. |
|
||||
| SetInt - Stores a given int32 value at a node. |
|
||||
| GetBytes - Obtains a byte array value; this returns both an allocated |
|
||||
| array of bytes and a length (necessary because there may be |
|
||||
| embedded null bytes in the array). You must free the |
|
||||
| resulting array using PR_Free. |
|
||||
| SetBytes - Stores a given array of bytes; you specify the bytes via a |
|
||||
| pointer and a length. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD GetString( Key baseKey, const char *path, char **result ) = 0;
|
||||
NS_IMETHOD SetString( Key baseKey, const char *path, const char *value ) = 0;
|
||||
NS_IMETHOD GetInt( Key baseKey, const char *path, int32 *result ) = 0;
|
||||
NS_IMETHOD SetInt( Key baseKey, const char *path, int32 value ) = 0;
|
||||
NS_IMETHOD GetBytes( Key baseKey, const char *path, void **result, uint32 *len ) = 0;
|
||||
NS_IMETHOD SetBytes( Key baseKey, const char *path, void *value, uint32 len ) = 0;
|
||||
|
||||
/*------------------------------ Navigation --------------------------------
|
||||
| These functions let you navigate through the registry tree, querying |
|
||||
| its contents. |
|
||||
| |
|
||||
| As above, all these functions requires a starting tree location ("base |
|
||||
| key") specified as a nsIRegistry::Key. Some also require a path |
|
||||
| name to locate the registry node location relative to this base key. |
|
||||
| |
|
||||
| AddSubtree - Adds a new registry subtree at the specified |
|
||||
| location. Returns the resulting key in |
|
||||
| the location specified by the third argument |
|
||||
| (unless that pointer is 0). |
|
||||
| AddSubtreeRaw - Adds a new registry subtree at the specified |
|
||||
| location. Returns the resulting key in |
|
||||
| the location specified by the third argument |
|
||||
| (unless that pointer is 0). |
|
||||
| Does not interpret special chars in key names. |
|
||||
| |
|
||||
| RemoveSubtree - Removes the specified registry subtree or |
|
||||
| value at the specified location. |
|
||||
| RemoveSubtreeRaw - Removes the specified registry subtree or |
|
||||
| value at the specified location. |
|
||||
| Does not interpret special chars in key names. |
|
||||
| |
|
||||
| GetSubtree - Returns a nsIRegistry::Key that can be used |
|
||||
| to refer to the specified registry location. |
|
||||
| GetSubtreeRaw - Returns a nsIRegistry::Key that can be used |
|
||||
| to refer to the specified registry location. |
|
||||
| Does not interpret special chars in key names. |
|
||||
| |
|
||||
| EnumerateSubtrees - Returns a nsIEnumerator object that you can |
|
||||
| use to enumerate all the subtrees descending |
|
||||
| from a specified location. You must free the |
|
||||
| enumerator via Release() when you're done with |
|
||||
| it. |
|
||||
| EnumerateAllSubtrees - Like EnumerateSubtrees, but will recursively |
|
||||
| enumerate lower-level subtrees, too. |
|
||||
| GetValueInfo - Returns a uint32 value that designates the type |
|
||||
| of data stored at this location in the registry; |
|
||||
| the possible values are defined by the enumerated |
|
||||
| type nsIRegistry::DataType. |
|
||||
| GetValueLength - Returns a uint32 value that indicates the length |
|
||||
| of this registry value; the length is the number |
|
||||
| of characters (for Strings), the number of bytes |
|
||||
| (for Bytes), or the number of int32 values (for |
|
||||
| Int32). |
|
||||
| EnumerateValues - Returns a nsIEnumerator that you can use to |
|
||||
| enumerate all the value nodes descending from |
|
||||
| a specified location. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD AddSubtree( Key baseKey, const char *path, Key *result ) = 0;
|
||||
NS_IMETHOD RemoveSubtree( Key baseKey, const char *path ) = 0;
|
||||
NS_IMETHOD GetSubtree( Key baseKey, const char *path, Key *result ) = 0;
|
||||
|
||||
NS_IMETHOD AddSubtreeRaw( Key baseKey, const char *keyname, Key *result ) = 0;
|
||||
NS_IMETHOD RemoveSubtreeRaw( Key baseKey, const char *keyname ) = 0;
|
||||
NS_IMETHOD GetSubtreeRaw( Key baseKey, const char *keyname, Key *result ) = 0;
|
||||
|
||||
NS_IMETHOD EnumerateSubtrees( Key baseKey, nsIEnumerator **result ) = 0;
|
||||
NS_IMETHOD EnumerateAllSubtrees( Key baseKey, nsIEnumerator **result ) = 0;
|
||||
|
||||
NS_IMETHOD GetValueType( Key baseKey, const char *path, uint32 *result ) = 0;
|
||||
NS_IMETHOD GetValueLength( Key baseKey, const char *path, uint32 *result ) = 0;
|
||||
|
||||
NS_IMETHOD EnumerateValues( Key baseKey, nsIEnumerator **result ) = 0;
|
||||
|
||||
/*------------------------------ User Name ---------------------------------
|
||||
| These functions manipulate the current "user name." This value controls |
|
||||
| the behavior of certain registry functions (namely, ?). |
|
||||
| |
|
||||
| GetCurrentUserName allocates a copy of the current user name (which the |
|
||||
| caller should free using PR_Free). |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD GetCurrentUserName( char **result ) = 0;
|
||||
NS_IMETHOD SetCurrentUserName( const char *name ) = 0;
|
||||
|
||||
/*------------------------------ Utilities ---------------------------------
|
||||
| Various utility functions: |
|
||||
| |
|
||||
| Pack() is used to compress the contents of an open registry file. |
|
||||
--------------------------------------------------------------------------*/
|
||||
NS_IMETHOD Pack() = 0;
|
||||
|
||||
}; // nsIRegistry
|
||||
|
||||
/*------------------------------ nsIRegistryNode -------------------------------
|
||||
| This interface is implemented by all the objects obtained from the |
|
||||
| nsIEnumerators that nsIRegistry provides when you call either of the |
|
||||
| subtree enumeration functions EnumerateSubtrees or EnumerateAllSubtrees. |
|
||||
| |
|
||||
| You can call this function to get the name of this subtree. This is the |
|
||||
| relative path from the base key from which you got this interface. |
|
||||
| |
|
||||
| GetName - Returns the path name of this node; this is the relative path |
|
||||
| from the base key from which this subtree was obtained. The |
|
||||
| function allocates a copy of the name; the caller must free it |
|
||||
| using PR_Free. |
|
||||
------------------------------------------------------------------------------*/
|
||||
struct nsIRegistryNode : public nsISupports {
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IREGISTRYNODE_IID)
|
||||
NS_IMETHOD GetName( char **result ) = 0;
|
||||
NS_IMETHOD GetKey( nsIRegistry::Key *r_key ) = 0;
|
||||
}; // nsIRegistryNode
|
||||
|
||||
/*------------------------------ nsIRegistryValue ------------------------------
|
||||
| This interface is implemented by the objects obtained from the |
|
||||
| nsIEnumerators that nsIRegistry provides when you call the |
|
||||
| EnumerateValues function. An object supporting this interface is |
|
||||
| returned when you call the CurrentItem() function on that enumerator. |
|
||||
| |
|
||||
| You use the member functions of this interface to obtain information |
|
||||
| about each registry value. |
|
||||
| |
|
||||
| GetName - Returns the path name of this node; this is the relative |
|
||||
| path\ from the base key from which this value was obtained. |
|
||||
| The function allocates a copy of the name; the caller must |
|
||||
| subsequently free it via PR_Free. |
|
||||
| GetValueType - Returns (into a location provided by the caller) the type |
|
||||
| of the value; the types are defined by the enumerated |
|
||||
| type nsIRegistry::DataType. |
|
||||
| GetValueLength - Returns a uint32 value that indicates the length |
|
||||
| of this registry value; the length is the number |
|
||||
| of characters (for Strings), the number of bytes |
|
||||
| (for Bytes), or the number of int32 values (for |
|
||||
| Int32). |
|
||||
------------------------------------------------------------------------------*/
|
||||
struct nsIRegistryValue : public nsISupports {
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IREGISTRYVALUE_IID; return iid; }
|
||||
|
||||
NS_IMETHOD GetName( char **result ) = 0;
|
||||
NS_IMETHOD GetValueType( uint32 *result ) = 0;
|
||||
NS_IMETHOD GetValueLength( uint32 *result ) = 0;
|
||||
}; // nsIRegistryEntry
|
||||
|
||||
|
||||
/*------------------------------- Error Codes ----------------------------------
|
||||
------------------------------------------------------------------------------*/
|
||||
#define NS_ERROR_REG_BADTYPE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 1 )
|
||||
#define NS_ERROR_REG_NO_MORE NS_ERROR_GENERATE_SUCCESS( NS_ERROR_MODULE_REG, 2 )
|
||||
#define NS_ERROR_REG_NOT_FOUND NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 3 )
|
||||
#define NS_ERROR_REG_NOFILE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 4 )
|
||||
#define NS_ERROR_REG_BUFFER_TOO_SMALL NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 5 )
|
||||
#define NS_ERROR_REG_NAME_TOO_LONG NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 6 )
|
||||
#define NS_ERROR_REG_NO_PATH NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 7 )
|
||||
#define NS_ERROR_REG_READ_ONLY NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 8 )
|
||||
#define NS_ERROR_REG_BAD_UTF8 NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 9 )
|
||||
|
||||
#endif
|
|
@ -0,0 +1,87 @@
|
|||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public License
|
||||
* Version 1.1 (the "MPL"); you may not use this file except in
|
||||
* compliance with the MPL. You may obtain a copy of the MPL at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the MPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* MPL.
|
||||
*
|
||||
* The Initial Developer of this code under the MPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIEnumerator.idl"
|
||||
|
||||
typedef PRUint32 nsRegistryKey;
|
||||
typedef long nsWellKnownRegistry;
|
||||
|
||||
[scriptable,uuid(5D41A440-8E37-11d2-8059-00600811A9C3)]
|
||||
interface nsIRegistry : nsISupports
|
||||
{
|
||||
const long None = 0;
|
||||
const long Users = 1;
|
||||
const long Common = 2;
|
||||
const long CurrentUser = 3;
|
||||
|
||||
const long ApplicationComponentRegistry = 1;
|
||||
|
||||
void open(in string regFile);
|
||||
void openWellKnownRegistry(in long regid);
|
||||
void openDefault();
|
||||
void close();
|
||||
boolean isOpen();
|
||||
|
||||
string getString(in nsRegistryKey baseKey, in string path);
|
||||
void setString(in nsRegistryKey baseKey, in string path, in string value);
|
||||
PRInt32 getInt(in nsRegistryKey baseKey, in string path);
|
||||
void setInt(in nsRegistryKey baseKey, in string path, in PRInt32 value);
|
||||
|
||||
nsRegistryKey addSubtree(in nsRegistryKey baseKey, in string path);
|
||||
void removeSubtree(in nsRegistryKey baseKey, in string path);
|
||||
nsRegistryKey getSubtree(in nsRegistryKey baseKey, in string path);
|
||||
|
||||
nsRegistryKey addSubtreeRaw(in nsRegistryKey baseKey, in string path);
|
||||
void removeSubtreeRaw(in nsRegistryKey baseKey, in string path);
|
||||
nsRegistryKey getSubtreeRaw(in nsRegistryKey baseKey, in string path);
|
||||
|
||||
nsIEnumerator enumerateSubtrees(in nsRegistryKey baseKey);
|
||||
nsIEnumerator enumerateAllSubtrees(in nsRegistryKey baseKey);
|
||||
nsIEnumerator enumerateValues(in nsRegistryKey baseKey);
|
||||
|
||||
const unsigned long String = 1;
|
||||
const unsigned long Int32 = 2;
|
||||
const unsigned long Bytes = 3;
|
||||
const unsigned long File = 4;
|
||||
|
||||
unsigned long getValueType(in nsRegistryKey baseKey, in string path);
|
||||
PRUint32 getValueLength(in nsRegistryKey baseKey, in string path);
|
||||
|
||||
attribute string currentUserName;
|
||||
|
||||
void pack();
|
||||
};
|
||||
|
||||
[scriptable, uuid(D1B54831-AC07-11d2-805E-00600811A9C3)]
|
||||
interface nsIRegistryNode : nsISupports
|
||||
{
|
||||
readonly attribute string name;
|
||||
readonly attribute nsRegistryKey key;
|
||||
};
|
||||
|
||||
[scriptable,uuid(5316C380-B2F8-11d2-A374-0080C6F80E4B)]
|
||||
interface nsIRegistryValue : nsISupports
|
||||
{
|
||||
readonly attribute string name;
|
||||
readonly attribute unsigned long type;
|
||||
readonly attribute PRUint32 length;
|
||||
};
|
||||
|
||||
%{ C++
|
||||
#include "nsIRegistryUtils.h"
|
||||
%}
|
|
@ -0,0 +1,40 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef __nsIRegistryUtils_h
|
||||
#define __nsIRegistryUtils_h
|
||||
|
||||
#define NS_REGISTRY_PROGID "component://netscape/registry"
|
||||
#define NS_REGISTRY_CLASSNAME "Mozilla Registry"
|
||||
/* be761f00-a3b0-11d2-996c-0080c7cb1081 */
|
||||
#define NS_REGISTRY_CID \
|
||||
{ 0xbe761f00, 0xa3b0, 0x11d2, \
|
||||
{0x99, 0x6c, 0x00, 0x80, 0xc7, 0xcb, 0x10, 0x81} }
|
||||
|
||||
/*------------------------------- Error Codes ----------------------------------
|
||||
------------------------------------------------------------------------------*/
|
||||
#define NS_ERROR_REG_BADTYPE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 1 )
|
||||
#define NS_ERROR_REG_NO_MORE NS_ERROR_GENERATE_SUCCESS( NS_ERROR_MODULE_REG, 2 )
|
||||
#define NS_ERROR_REG_NOT_FOUND NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 3 )
|
||||
#define NS_ERROR_REG_NOFILE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 4 )
|
||||
#define NS_ERROR_REG_BUFFER_TOO_SMALL NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 5 )
|
||||
#define NS_ERROR_REG_NAME_TOO_LONG NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 6 )
|
||||
#define NS_ERROR_REG_NO_PATH NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 7 )
|
||||
#define NS_ERROR_REG_READ_ONLY NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 8 )
|
||||
#define NS_ERROR_REG_BAD_UTF8 NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 9 )
|
||||
|
||||
#endif
|
|
@ -232,7 +232,7 @@ nsNativeComponentLoader::Init(nsIComponentManager *aCompMgr, nsISupports *aReg)
|
|||
autoStringFree delete_library(library, autoStringFree::nsCRT_String_Delete);
|
||||
|
||||
// Get key associated with library
|
||||
nsIRegistry::Key libKey;
|
||||
nsRegistryKey libKey;
|
||||
rv = node->GetKey(&libKey);
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
||||
|
@ -904,7 +904,7 @@ nsNativeComponentLoader::GetRegistryDllInfo(const char *aLocation,
|
|||
{
|
||||
nsresult rv;
|
||||
|
||||
nsIRegistry::Key key;
|
||||
nsRegistryKey key;
|
||||
rv = mRegistry->GetSubtreeRaw(mXPCOMKey, aLocation, &key);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -912,7 +912,7 @@ nsNativeComponentLoader::GetRegistryDllInfo(const char *aLocation,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsNativeComponentLoader::GetRegistryDllInfo(nsIRegistry::Key key,
|
||||
nsNativeComponentLoader::GetRegistryDllInfo(nsRegistryKey key,
|
||||
PRUint32 *lastModifiedTime,
|
||||
PRUint32 *fileSize)
|
||||
{
|
||||
|
@ -935,7 +935,7 @@ nsNativeComponentLoader::SetRegistryDllInfo(const char *aLocation,
|
|||
PRUint32 fileSize)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIRegistry::Key key;
|
||||
nsRegistryKey key;
|
||||
rv = mRegistry->GetSubtreeRaw(mXPCOMKey, aLocation, &key);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class nsNativeComponentLoader : public nsIComponentLoader {
|
|||
nsIComponentManager* mCompMgr; // weak reference -- backpointer
|
||||
nsObjectHashtable* mDllStore;
|
||||
NS_IMETHOD RegisterComponentsInDir(PRInt32 when, nsIFileSpec *dir);
|
||||
nsIRegistry::Key mXPCOMKey;
|
||||
nsRegistryKey mXPCOMKey;
|
||||
|
||||
private:
|
||||
nsresult CreateDll(nsIFileSpec *aSpec, const char *aLocation,
|
||||
|
@ -57,7 +57,7 @@ class nsNativeComponentLoader : public nsIComponentLoader {
|
|||
nsresult SelfUnregisterDll(nsDll *dll);
|
||||
nsresult GetRegistryDllInfo(const char *aLocation, PRUint32 *lastModifiedTime,
|
||||
PRUint32 *fileSize);
|
||||
nsresult GetRegistryDllInfo(nsIRegistry::Key key, PRUint32 *lastModifiedTime,
|
||||
nsresult GetRegistryDllInfo(nsRegistryKey key, PRUint32 *lastModifiedTime,
|
||||
PRUint32 *fileSize);
|
||||
nsresult SetRegistryDllInfo(const char *aLocation, PRUint32 lastModifiedTime,
|
||||
PRUint32 fileSize);
|
||||
|
|
|
@ -51,39 +51,7 @@ struct nsRegistry : public nsIRegistry {
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// This class implements the nsIRegistry interface functions.
|
||||
NS_IMETHOD Open( const char *regFile);
|
||||
NS_IMETHOD OpenWellKnownRegistry( uint32 regid );
|
||||
NS_IMETHOD OpenDefault();
|
||||
NS_IMETHOD Close();
|
||||
NS_IMETHOD IsOpen( PRBool *result );
|
||||
|
||||
NS_IMETHOD GetString( Key baseKey, const char *path, char **result );
|
||||
NS_IMETHOD SetString( Key baseKey, const char *path, const char *value );
|
||||
NS_IMETHOD GetInt( Key baseKey, const char *path, int32 *result );
|
||||
NS_IMETHOD SetInt( Key baseKey, const char *path, int32 value );
|
||||
NS_IMETHOD GetBytes( Key baseKey, const char *path, void **result, uint32 *len );
|
||||
NS_IMETHOD SetBytes( Key baseKey, const char *path, void *value, uint32 len );
|
||||
|
||||
NS_IMETHOD AddSubtree( Key baseKey, const char *path, Key *result );
|
||||
NS_IMETHOD RemoveSubtree( Key baseKey, const char *path );
|
||||
NS_IMETHOD GetSubtree( Key baseKey, const char *path, Key *result );
|
||||
|
||||
NS_IMETHOD AddSubtreeRaw( Key baseKey, const char *path, Key *result );
|
||||
NS_IMETHOD RemoveSubtreeRaw( Key baseKey, const char *keyname );
|
||||
NS_IMETHOD GetSubtreeRaw( Key baseKey, const char *path, Key *result );
|
||||
|
||||
NS_IMETHOD EnumerateSubtrees( Key baseKey, nsIEnumerator **result );
|
||||
NS_IMETHOD EnumerateAllSubtrees( Key baseKey, nsIEnumerator **result );
|
||||
|
||||
NS_IMETHOD GetValueType( Key baseKey, const char *path, uint32 *result );
|
||||
NS_IMETHOD GetValueLength( Key baseKey, const char *path, uint32 *result );
|
||||
|
||||
NS_IMETHOD EnumerateValues( Key baseKey, nsIEnumerator **result );
|
||||
|
||||
NS_IMETHOD GetCurrentUserName( char **result );
|
||||
NS_IMETHOD SetCurrentUserName( const char *name );
|
||||
|
||||
NS_IMETHOD Pack();
|
||||
NS_DECL_NSIREGISTRY
|
||||
|
||||
// ctor/dtor
|
||||
nsRegistry();
|
||||
|
@ -95,7 +63,7 @@ protected:
|
|||
PRLock *mregLock; // libreg isn't threadsafe. Use locks to synchronize.
|
||||
#endif
|
||||
char *mCurRegFile; // these are to prevent open from opening the registry again
|
||||
uint32 mCurRegID;
|
||||
nsWellKnownRegistry mCurRegID;
|
||||
}; // nsRegistry
|
||||
|
||||
|
||||
|
@ -172,10 +140,7 @@ struct nsRegistryNode : public nsIRegistryNode {
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// This class implements the nsIRegistryNode interface functions.
|
||||
NS_IMETHOD GetName( char **result );
|
||||
|
||||
// Get the key associated with this node
|
||||
NS_IMETHOD GetKey( nsIRegistry::Key *r_key );
|
||||
NS_DECL_NSIREGISTRYNODE
|
||||
|
||||
// ctor
|
||||
nsRegistryNode( HREG hReg, char *name, RKEY childKey );
|
||||
|
@ -200,9 +165,7 @@ struct nsRegistryValue : public nsIRegistryValue {
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// This class implements the nsIRegistryValue interface functions.
|
||||
NS_IMETHOD GetName( char **result );
|
||||
NS_IMETHOD GetValueType( uint32 *result );
|
||||
NS_IMETHOD GetValueLength( uint32 *result );
|
||||
NS_DECL_NSIREGISTRYVALUE
|
||||
|
||||
// ctor
|
||||
nsRegistryValue( HREG hReg, RKEY key, REGENUM slot );
|
||||
|
@ -429,7 +392,7 @@ NS_IMETHODIMP nsRegistry::Open( const char *regFile ) {
|
|||
| Takes a registry id and maps that to a file name for opening. We first check |
|
||||
| to see if a registry file is already open and close it if so. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( uint32 regid ) {
|
||||
NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( nsWellKnownRegistry regid ) {
|
||||
REGERR err = REGERR_OK;
|
||||
|
||||
if (mCurRegID == regid)
|
||||
|
@ -444,7 +407,7 @@ NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( uint32 regid ) {
|
|||
nsSpecialSystemDirectory *registryLocation = NULL;
|
||||
PRBool foundReg = PR_FALSE;
|
||||
|
||||
switch ( (WellKnownRegistry) regid ) {
|
||||
switch ( (nsWellKnownRegistry) regid ) {
|
||||
case ApplicationComponentRegistry:
|
||||
registryLocation =
|
||||
new nsSpecialSystemDirectory(nsSpecialSystemDirectory::XPCOM_CurrentProcessComponentRegistry);
|
||||
|
@ -525,7 +488,7 @@ NS_IMETHODIMP nsRegistry::IsOpen( PRBool *result ) {
|
|||
| First, look for the entry using GetValueInfo. If found, and it's a string, |
|
||||
| allocate space for it and fetch the value. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::GetString( Key baseKey, const char *path, char **result ) {
|
||||
NS_IMETHODIMP nsRegistry::GetString( nsRegistryKey baseKey, const char *path, char **result ) {
|
||||
nsresult rv = NS_OK;
|
||||
REGERR err = REGERR_OK;
|
||||
|
||||
|
@ -596,7 +559,7 @@ NS_IMETHODIMP nsRegistry::GetString( Key baseKey, const char *path, char **resul
|
|||
/*--------------------------- nsRegistry::SetString ----------------------------
|
||||
| Simply sets the registry contents using NR_RegSetEntryString. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::SetString( Key baseKey, const char *path, const char *value ) {
|
||||
NS_IMETHODIMP nsRegistry::SetString( nsRegistryKey baseKey, const char *path, const char *value ) {
|
||||
REGERR err = REGERR_OK;
|
||||
// Set the contents.
|
||||
PR_Lock(mregLock);
|
||||
|
@ -610,7 +573,7 @@ NS_IMETHODIMP nsRegistry::SetString( Key baseKey, const char *path, const char *
|
|||
| This function is just shorthand for fetching a 1-element int32 array. We |
|
||||
| implement it "manually" using NR_RegGetEntry |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::GetInt( Key baseKey, const char *path, int32 *result ) {
|
||||
NS_IMETHODIMP nsRegistry::GetInt( nsRegistryKey baseKey, const char *path, int32 *result ) {
|
||||
nsresult rv = NS_OK;
|
||||
REGERR err = REGERR_OK;
|
||||
|
||||
|
@ -644,7 +607,7 @@ NS_IMETHODIMP nsRegistry::GetInt( Key baseKey, const char *path, int32 *result )
|
|||
/*---------------------------- nsRegistry::SetInt ------------------------------
|
||||
| Write out the value as a one-element int32 array, using NR_RegSetEntry. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::SetInt( Key baseKey, const char *path, int32 value ) {
|
||||
NS_IMETHODIMP nsRegistry::SetInt( nsRegistryKey baseKey, const char *path, int32 value ) {
|
||||
REGERR err = REGERR_OK;
|
||||
// Set the contents.
|
||||
PR_Lock(mregLock);
|
||||
|
@ -659,59 +622,10 @@ NS_IMETHODIMP nsRegistry::SetInt( Key baseKey, const char *path, int32 value ) {
|
|||
return regerr2nsresult( err );
|
||||
}
|
||||
|
||||
/*--------------------------- nsRegistry::GetBytes -----------------------------
|
||||
| Get the registry contents at specified location using NR_RegGetEntry. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::GetBytes( Key baseKey, const char *path, void **result, uint32 *len ) {
|
||||
nsresult rv = NS_OK;
|
||||
REGERR err = REGERR_OK;
|
||||
|
||||
// Make sure caller gave us place for result.
|
||||
if( result && len ) {
|
||||
// Get info about the requested entry.
|
||||
uint32 type;
|
||||
rv = GetValueType( baseKey, path, &type );
|
||||
// See if that worked.
|
||||
if( rv == NS_OK ) {
|
||||
// Make sure the entry is bytes.
|
||||
if( type == Bytes ) {
|
||||
// Get bytes from registry into result field.
|
||||
*result = PR_Malloc(*len);
|
||||
PR_Lock(mregLock);
|
||||
err = NR_RegGetEntry( mReg,(RKEY)baseKey,(char*)path, *result, len );
|
||||
PR_Unlock(mregLock);
|
||||
// Convert status.
|
||||
rv = regerr2nsresult( err );
|
||||
} else {
|
||||
// They asked for the wrong type of value.
|
||||
rv = NS_ERROR_REG_BADTYPE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*--------------------------- nsRegistry::SetBytes -----------------------------
|
||||
| Set the contents at the specified registry location, using NR_RegSetEntry. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::SetBytes( Key baseKey, const char *path, void *value, uint32 len ) {
|
||||
REGERR err = REGERR_OK;
|
||||
// Set contents.
|
||||
PR_Lock(mregLock);
|
||||
err = NR_RegSetEntry( mReg,(RKEY)baseKey,(char*)path,
|
||||
REGTYPE_ENTRY_BYTES, value, len );
|
||||
PR_Unlock(mregLock);
|
||||
// Convert result;
|
||||
return regerr2nsresult( err );
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------- nsRegistry::AddSubtree ----------------------------
|
||||
| Add a new registry subkey with the specified name, using NR_RegAddKey. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::AddSubtree( Key baseKey, const char *path, Key *result ) {
|
||||
NS_IMETHODIMP nsRegistry::AddSubtree( nsRegistryKey baseKey, const char *path, nsRegistryKey *result ) {
|
||||
REGERR err = REGERR_OK;
|
||||
// Add the subkey.
|
||||
PR_Lock(mregLock);
|
||||
|
@ -724,7 +638,7 @@ NS_IMETHODIMP nsRegistry::AddSubtree( Key baseKey, const char *path, Key *result
|
|||
/*-------------------------- nsRegistry::AddSubtreeRaw--------------------------
|
||||
| Add a new registry subkey with the specified name, using NR_RegAddKeyRaw |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::AddSubtreeRaw( Key baseKey, const char *path, Key *result ) {
|
||||
NS_IMETHODIMP nsRegistry::AddSubtreeRaw( nsRegistryKey baseKey, const char *path, nsRegistryKey *result ) {
|
||||
REGERR err = REGERR_OK;
|
||||
// Add the subkey.
|
||||
PR_Lock(mregLock);
|
||||
|
@ -738,7 +652,7 @@ NS_IMETHODIMP nsRegistry::AddSubtreeRaw( Key baseKey, const char *path, Key *res
|
|||
/*------------------------- nsRegistry::RemoveSubtree --------------------------
|
||||
| Deletes the subtree at a given location using NR_RegDeleteKey. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::RemoveSubtree( Key baseKey, const char *path ) {
|
||||
NS_IMETHODIMP nsRegistry::RemoveSubtree( nsRegistryKey baseKey, const char *path ) {
|
||||
REGERR err = REGERR_OK;
|
||||
// Delete the subkey.
|
||||
PR_Lock(mregLock);
|
||||
|
@ -752,7 +666,7 @@ NS_IMETHODIMP nsRegistry::RemoveSubtree( Key baseKey, const char *path ) {
|
|||
/*------------------------- nsRegistry::RemoveSubtreeRaw -----------------------
|
||||
| Deletes the subtree at a given location using NR_RegDeleteKeyRaw |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::RemoveSubtreeRaw( Key baseKey, const char *keyname ) {
|
||||
NS_IMETHODIMP nsRegistry::RemoveSubtreeRaw( nsRegistryKey baseKey, const char *keyname ) {
|
||||
nsresult rv = NS_OK;
|
||||
REGERR err = REGERR_OK;
|
||||
|
||||
|
@ -801,10 +715,10 @@ NS_IMETHODIMP nsRegistry::RemoveSubtreeRaw( Key baseKey, const char *keyname ) {
|
|||
return rv;
|
||||
}
|
||||
/*-------------------------- nsRegistry::GetSubtree ----------------------------
|
||||
| Returns a nsIRegistry::Key(RKEY) for a given key/path. The key is |
|
||||
| Returns a nsRegistryKey(RKEY) for a given key/path. The key is |
|
||||
| obtained using NR_RegGetKey. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::GetSubtree( Key baseKey, const char *path, Key *result ) {
|
||||
NS_IMETHODIMP nsRegistry::GetSubtree( nsRegistryKey baseKey, const char *path, nsRegistryKey *result ) {
|
||||
nsresult rv = NS_OK;
|
||||
REGERR err = REGERR_OK;
|
||||
// Make sure we have a place for the result.
|
||||
|
@ -822,10 +736,10 @@ NS_IMETHODIMP nsRegistry::GetSubtree( Key baseKey, const char *path, Key *result
|
|||
}
|
||||
|
||||
/*-------------------------- nsRegistry::GetSubtreeRaw--------------------------
|
||||
| Returns a nsIRegistry::Key(RKEY) for a given key/path. The key is |
|
||||
| Returns a nsRegistryKey(RKEY) for a given key/path. The key is |
|
||||
| obtained using NR_RegGetKeyRaw. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::GetSubtreeRaw( Key baseKey, const char *path, Key *result ) {
|
||||
NS_IMETHODIMP nsRegistry::GetSubtreeRaw( nsRegistryKey baseKey, const char *path, nsRegistryKey *result ) {
|
||||
nsresult rv = NS_OK;
|
||||
REGERR err = REGERR_OK;
|
||||
// Make sure we have a place for the result.
|
||||
|
@ -850,7 +764,7 @@ NS_IMETHODIMP nsRegistry::GetSubtreeRaw( Key baseKey, const char *path, Key *res
|
|||
| to recurse down subtrees. No libreg functions are invoked at this point |
|
||||
|(that will happen when the enumerator member functions are called). |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::EnumerateSubtrees( Key baseKey, nsIEnumerator **result ) {
|
||||
NS_IMETHODIMP nsRegistry::EnumerateSubtrees( nsRegistryKey baseKey, nsIEnumerator **result ) {
|
||||
nsresult rv = NS_OK;
|
||||
// Make sure we have a place to put the result.
|
||||
if( result ) {
|
||||
|
@ -873,7 +787,7 @@ NS_IMETHODIMP nsRegistry::EnumerateSubtrees( Key baseKey, nsIEnumerator **result
|
|||
| Same as EnumerateSubtrees but we pass PR_TRUE to request that the |
|
||||
| enumerator object descend subtrees when it is used. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::EnumerateAllSubtrees( Key baseKey, nsIEnumerator **result ) {
|
||||
NS_IMETHODIMP nsRegistry::EnumerateAllSubtrees( nsRegistryKey baseKey, nsIEnumerator **result ) {
|
||||
nsresult rv = NS_OK;
|
||||
// Make sure we have a place to put the result.
|
||||
if( result ) {
|
||||
|
@ -897,7 +811,7 @@ NS_IMETHODIMP nsRegistry::EnumerateAllSubtrees( Key baseKey, nsIEnumerator **res
|
|||
| The result is transferred to the uint32 value passed in (with conversion |
|
||||
| to the appropriate nsIRegistry::DataType value). |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::GetValueType( Key baseKey, const char *path, uint32 *result ) {
|
||||
NS_IMETHODIMP nsRegistry::GetValueType( nsRegistryKey baseKey, const char *path, uint32 *result ) {
|
||||
nsresult rv = NS_OK;
|
||||
REGERR err = REGERR_OK;
|
||||
// Make sure we have a place to put the result.
|
||||
|
@ -923,7 +837,7 @@ NS_IMETHODIMP nsRegistry::GetValueType( Key baseKey, const char *path, uint32 *r
|
|||
| Gets the registry value info via NR_RegGetEntryInfo. The length is |
|
||||
| converted to the proper "units" via reginfo2Length. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::GetValueLength( Key baseKey, const char *path, uint32 *result ) {
|
||||
NS_IMETHODIMP nsRegistry::GetValueLength( nsRegistryKey baseKey, const char *path, uint32 *result ) {
|
||||
nsresult rv = NS_OK;
|
||||
REGERR err = REGERR_OK;
|
||||
// Make sure we have a place to put the result.
|
||||
|
@ -950,7 +864,7 @@ NS_IMETHODIMP nsRegistry::GetValueLength( Key baseKey, const char *path, uint32
|
|||
| a similar fashion as the nsRegSubtreeEnumerator is allocated/returned by |
|
||||
| EnumerateSubtrees. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistry::EnumerateValues( Key baseKey, nsIEnumerator **result ) {
|
||||
NS_IMETHODIMP nsRegistry::EnumerateValues( nsRegistryKey baseKey, nsIEnumerator **result ) {
|
||||
nsresult rv = NS_OK;
|
||||
// Make sure we have a place to put the result.
|
||||
if( result ) {
|
||||
|
@ -1237,7 +1151,7 @@ NS_IMETHODIMP nsRegistryNode::GetName( char **result ) {
|
|||
| Get the subkey corresponding to this node |
|
||||
| using NR_RegEnumSubkeys. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistryNode::GetKey( nsIRegistry::Key *r_key ) {
|
||||
NS_IMETHODIMP nsRegistryNode::GetKey( nsRegistryKey *r_key ) {
|
||||
nsresult rv = NS_OK;
|
||||
if (r_key == NULL) return NS_ERROR_NULL_POINTER;
|
||||
*r_key = mChildKey;
|
||||
|
@ -1291,12 +1205,12 @@ NS_IMETHODIMP nsRegistryValue::GetName( char **result ) {
|
|||
return rv;
|
||||
}
|
||||
|
||||
/*----------------------- nsRegistryValue::GetValueType ------------------------
|
||||
/*----------------------- nsRegistryValue::GetType ------------------------
|
||||
| We test if we've got the info already. If not, we git it by calling |
|
||||
| getInfo. We calculate the result by converting the REGINFO type field to |
|
||||
| a nsIRegistry::DataType value (using reginfo2DataType). |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistryValue::GetValueType( uint32 *result ) {
|
||||
NS_IMETHODIMP nsRegistryValue::GetType( PRUint32 *result ) {
|
||||
nsresult rv = NS_OK;
|
||||
// Make sure we have room for th result.
|
||||
if( result ) {
|
||||
|
@ -1313,12 +1227,12 @@ NS_IMETHODIMP nsRegistryValue::GetValueType( uint32 *result ) {
|
|||
return rv;
|
||||
}
|
||||
|
||||
/*---------------------- nsRegistryValue::GetValueLength -----------------------
|
||||
/*---------------------- nsRegistryValue::GetLength -----------------------
|
||||
| We test if we've got the info already. If not, we git it by calling |
|
||||
| getInfo. We calculate the result by converting the REGINFO type field to |
|
||||
| a nsIRegistry::DataType value (using reginfo2Length). |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistryValue::GetValueLength( uint32 *result ) {
|
||||
NS_IMETHODIMP nsRegistryValue::GetLength( uint32 *result ) {
|
||||
nsresult rv = NS_OK;
|
||||
// Make sure we have room for th result.
|
||||
if( result ) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче