rv = nsServiceManager::GetService(kPrefCID, nsIPref::GetIID(), (nsISupports **)&prefs);
rv = loadPrefs();
NS_IMETHODIMP nsProfile::StartCommunicator(const char* profileName){    nsresult rv = NS_OK;#if defined(DEBUG_profile)    printf("ProfileManager : Start AppRunner\n");#endif	nsIPref *prefs = nsnull;	/*	 * Need to load new profile prefs.	 */	rv = nsServiceManager::GetService(kPrefCID,                                     nsIPref::GetIID(),                                     (nsISupports **)&prefs);		// First, set the profile to be the current profile.	// So that FileLocation services grabs right directory when it needs to.	if (NS_SUCCEEDED(rv))	{		rv = m_reg->OpenDefault();		if (NS_SUCCEEDED(rv))		{			nsIRegistry::Key profileRootKey;			rv = m_reg->GetSubtree(nsIRegistry::Common, "Profiles", &profileRootKey);			if (NS_SUCCEEDED(rv))			{				rv = m_reg->SetString(profileRootKey, "CurrentProfile", profileName);			}			m_reg->Close();		}		nsIFileLocator* locator = nsnull;    		rv = nsServiceManager::GetService(kFileLocatorCID, nsIFileLocator::GetIID(), (nsISupports**)&locator);					if (locator)		{			rv = locator->ForgetProfileDir();			nsServiceManager::ReleaseService(kFileLocatorCID, locator);		}		if (NS_SUCCEEDED(rv))		{			prefs->StartUp();		}				// Release prefs service.		if (prefs) {			nsServiceManager::ReleaseService(kPrefCID, prefs);		}	}    return rv;}