return OpenWellKnownRegistry(nsIRegistry::ApplicationRegistry);
return OpenDefault();
NS_IMETHODIMP nsRegistry::Open( nsIFile *regFile ) {    REGERR err = REGERR_OK;    // Check for default.    if( !regFile ) {        return OpenWellKnownRegistry(nsIRegistry::ApplicationRegistry);    }    nsCAutoString regPath;    nsresult rv = regFile->GetNativePath(regPath);    if (NS_FAILED(rv)) return rv;#ifdef DEBUG_dp    printf("nsRegistry: Opening registry %s\n", regPath.get());#endif /* DEBUG_dp */       if (mCurRegID != nsIRegistry::None && mCurRegID != nsIRegistry::ApplicationCustomRegistry)    {        // Cant open another registry without closing explictly.        return NS_ERROR_INVALID_ARG;    }    // Do we have an open registry ?    if (mCurRegID != nsIRegistry::None)    {        PRBool equals;        if (mCurRegFile && NS_SUCCEEDED(mCurRegFile->Equals(regFile, &equals)) && equals)        {            // The right one is already open            return NS_OK;        }        else        {            // Opening a new registry without closing an already open one.            // This is an error.            return NS_ERROR_FAILURE;        }    }    // Open specified registry.    PR_Lock(mregLock);    err = NR_RegOpen(NS_CONST_CAST(char*,regPath.get()), &mReg);    PR_Unlock(mregLock);    mCurRegID = nsIRegistry::ApplicationCustomRegistry;    // No error checking for no mem. Trust me.    if (NS_FAILED(regFile->Clone(getter_AddRefs(mCurRegFile))))        mCurRegFile = nsnull; // not fatal    // Convert the result.    return regerr2nsresult( err );}