rv = OpenRegistry(); if (NS_FAILED(rv)) return rv;
if (m_reg != nsnull) {  rv = m_reg->OpenDefault();
NS_IMETHODIMP nsProfile::ProfileExists(const char *profileName, PRBool *exists){	nsresult rv = NS_OK;    rv = OpenRegistry();    if (NS_FAILED(rv)) return rv;        nsRegistryKey key;        rv = m_reg->GetSubtree(nsIRegistry::Common, REGISTRY_PROFILE_SUBTREE_STRING, &key);    if (NS_FAILED(rv)) return rv;        nsRegistryKey newKey;                // Get handle to <profileName> passed    rv = m_reg->GetSubtree(key, profileName, &newKey);    if (NS_FAILED(rv)) {        *exists = PR_FALSE;    }    else {        *exists = PR_TRUE;    }	return NS_OK;}