expose libreg ability to delete named values in nsIRegistry. Patch from
Jonas Utterstr�m <jonas.utterstrom@vittran.norrnod.se>, r=dveditz
This commit is contained in:
@@ -61,6 +61,7 @@ interface nsIRegistry : nsISupports
|
|||||||
|
|
||||||
unsigned long getValueType(in nsRegistryKey baseKey, in string path);
|
unsigned long getValueType(in nsRegistryKey baseKey, in string path);
|
||||||
PRUint32 getValueLength(in nsRegistryKey baseKey, in string path);
|
PRUint32 getValueLength(in nsRegistryKey baseKey, in string path);
|
||||||
|
void deleteValue(in nsRegistryKey baseKey, in string path);
|
||||||
|
|
||||||
attribute string currentUserName;
|
attribute string currentUserName;
|
||||||
|
|
||||||
|
|||||||
@@ -859,6 +859,20 @@ NS_IMETHODIMP nsRegistry::GetValueLength( nsRegistryKey baseKey, const char *pat
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-------------------------- nsRegistry::DeleteValue ---------------------------
|
||||||
|
| Remove the registry value with the specified name |
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
NS_IMETHODIMP nsRegistry::DeleteValue( nsRegistryKey baseKey, const char *path)
|
||||||
|
{
|
||||||
|
REGERR err = REGERR_OK;
|
||||||
|
// Delete the value
|
||||||
|
PR_Lock(mregLock);
|
||||||
|
err = NR_RegDeleteEntry( mReg,(RKEY)baseKey,(char*)path );
|
||||||
|
PR_Unlock(mregLock);
|
||||||
|
// Convert result.
|
||||||
|
return regerr2nsresult( err );
|
||||||
|
}
|
||||||
|
|
||||||
/*------------------------ nsRegistry::EnumerateValues -------------------------
|
/*------------------------ nsRegistry::EnumerateValues -------------------------
|
||||||
| Allocates and returns an instance of nsRegValueEnumerator constructed in |
|
| Allocates and returns an instance of nsRegValueEnumerator constructed in |
|
||||||
| a similar fashion as the nsRegSubtreeEnumerator is allocated/returned by |
|
| a similar fashion as the nsRegSubtreeEnumerator is allocated/returned by |
|
||||||
@@ -1169,7 +1183,7 @@ nsRegistryValue::nsRegistryValue( HREG hReg, RKEY key, REGENUM slot )
|
|||||||
#ifdef EXTRA_THREADSAFE
|
#ifdef EXTRA_THREADSAFE
|
||||||
mregLock = PR_NewLock();
|
mregLock = PR_NewLock();
|
||||||
#endif
|
#endif
|
||||||
return;
|
mInfo.size = sizeof(REGINFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRegistryValue::~nsRegistryValue()
|
nsRegistryValue::~nsRegistryValue()
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ interface nsIRegistry : nsISupports
|
|||||||
|
|
||||||
unsigned long getValueType(in nsRegistryKey baseKey, in string path);
|
unsigned long getValueType(in nsRegistryKey baseKey, in string path);
|
||||||
PRUint32 getValueLength(in nsRegistryKey baseKey, in string path);
|
PRUint32 getValueLength(in nsRegistryKey baseKey, in string path);
|
||||||
|
void deleteValue(in nsRegistryKey baseKey, in string path);
|
||||||
|
|
||||||
attribute string currentUserName;
|
attribute string currentUserName;
|
||||||
|
|
||||||
|
|||||||
@@ -859,6 +859,20 @@ NS_IMETHODIMP nsRegistry::GetValueLength( nsRegistryKey baseKey, const char *pat
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*-------------------------- nsRegistry::DeleteValue ---------------------------
|
||||||
|
| Remove the registry value with the specified name |
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
NS_IMETHODIMP nsRegistry::DeleteValue( nsRegistryKey baseKey, const char *path)
|
||||||
|
{
|
||||||
|
REGERR err = REGERR_OK;
|
||||||
|
// Delete the value
|
||||||
|
PR_Lock(mregLock);
|
||||||
|
err = NR_RegDeleteEntry( mReg,(RKEY)baseKey,(char*)path );
|
||||||
|
PR_Unlock(mregLock);
|
||||||
|
// Convert result.
|
||||||
|
return regerr2nsresult( err );
|
||||||
|
}
|
||||||
|
|
||||||
/*------------------------ nsRegistry::EnumerateValues -------------------------
|
/*------------------------ nsRegistry::EnumerateValues -------------------------
|
||||||
| Allocates and returns an instance of nsRegValueEnumerator constructed in |
|
| Allocates and returns an instance of nsRegValueEnumerator constructed in |
|
||||||
| a similar fashion as the nsRegSubtreeEnumerator is allocated/returned by |
|
| a similar fashion as the nsRegSubtreeEnumerator is allocated/returned by |
|
||||||
@@ -1169,7 +1183,7 @@ nsRegistryValue::nsRegistryValue( HREG hReg, RKEY key, REGENUM slot )
|
|||||||
#ifdef EXTRA_THREADSAFE
|
#ifdef EXTRA_THREADSAFE
|
||||||
mregLock = PR_NewLock();
|
mregLock = PR_NewLock();
|
||||||
#endif
|
#endif
|
||||||
return;
|
mInfo.size = sizeof(REGINFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRegistryValue::~nsRegistryValue()
|
nsRegistryValue::~nsRegistryValue()
|
||||||
|
|||||||
Reference in New Issue
Block a user