NS_WARNING("ApplicationComponentRegistry is unsupported!"); break; case ApplicationRegistry: { EnsureDefaultRegistryDirectory(); nsCOMPtr<nsIProperties> directoryService = do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; directoryService->Get(NS_APP_APPLICATION_REGISTRY_FILE, NS_GET_IID(nsIFile), getter_AddRefs(registryLocation));  if (registryLocation) { foundReg = PR_TRUE; rv = registryLocation->GetNativePath(regFile);   if (NS_FAILED(rv)) return rv; } }
registryLocation = new nsSpecialSystemDirectory(nsSpecialSystemDirectory::XPCOM_CurrentProcessComponentRegistry); if (registryLocation != NULL) foundReg = PR_TRUE;
NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( nsWellKnownRegistry regid ) {    REGERR err = REGERR_OK;    if (mCurRegID != nsIRegistry::None && mCurRegID != regid)    {        // Cant open another registry without closing explictly.        return NS_ERROR_INVALID_ARG;    }    if (mCurRegID == regid)    {        // Already opened.        return NS_OK;    }    nsresult rv;    nsCOMPtr<nsIFile> registryLocation;    PRBool foundReg = PR_FALSE;    nsCAutoString regFile;        switch ( (nsWellKnownRegistry) regid ) {      case ApplicationComponentRegistry:        NS_WARNING("ApplicationComponentRegistry is unsupported!");        break;      case ApplicationRegistry:        {            EnsureDefaultRegistryDirectory();            nsCOMPtr<nsIProperties> directoryService = do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);            if (NS_FAILED(rv)) return rv;            directoryService->Get(NS_APP_APPLICATION_REGISTRY_FILE, NS_GET_IID(nsIFile),                                   getter_AddRefs(registryLocation));            if (registryLocation)            {                foundReg = PR_TRUE;                rv = registryLocation->GetNativePath(regFile);  // dougt fix...                // dveditz needs to fix his registry so that I can pass an                // nsIFile interface and not hack                 if (NS_FAILED(rv))                  return rv;            }        }        break;      default:        break;    }    if (foundReg == PR_FALSE) {        return NS_ERROR_REG_BADTYPE;    }   #ifdef DEBUG_dp    printf("nsRegistry: Opening std registry %s\n", regFile.get());#endif /* DEBUG_dp */    PR_Lock(mregLock);    err = NR_RegOpen((char*)regFile.get(), &mReg );    PR_Unlock(mregLock);    // Store the registry that was opened for optimizing future opens.    mCurRegID = regid;    // Convert the result.    return regerr2nsresult( err );}