rv = m_reg->Open();  if (NS_SUCCEEDED(rv)) { nsIRegistry::Key key;  rv = m_reg->GetSubtree(nsIRegistry::Common, "Profiles", &key);  if (NS_SUCCEEDED(rv)) {  rv = m_reg->GetString( key, "CurrentProfile", profileName );   if (NS_FAILED(rv)) { profileName = '\0';  #if defined(DEBUG_profile) printf("Profiles:Can't get Current Profile value.\n" ); #endif } } else { #if defined(DEBUG_profile) printf("Registry : Couldn't get Profiles subtree.\n"); #endif } m_reg->Close(); } else { #if defined(DEBUG_profile) printf("Couldn't open registry.\n"); #endif }  } else { #if defined(DEBUG_profile) printf("Registry Object is NULL.\n"); #endif  return NS_ERROR_FAILURE; } return rv;
gProfileDataAccess->GetCurrentProfile(profileName); return (*profileName == nsnull) ? NS_ERROR_FAILURE : NS_OK;
NS_IMETHODIMP nsProfile::GetCurrentProfile(char **profileName){	nsresult rv = NS_OK;#if defined(DEBUG_profile) 	printf("ProfileManager : GetCurrentProfile\n");#endif  	// Check result.	if ( m_reg != nsnull ) 	{		// Latch onto the registry object.		NS_ADDREF(m_reg);		// Open the registry.		rv = m_reg->Open();		if (NS_SUCCEEDED(rv))		{			nsIRegistry::Key key;			rv = m_reg->GetSubtree(nsIRegistry::Common, "Profiles", &key);			if (NS_SUCCEEDED(rv))			{				rv = m_reg->GetString( key, "CurrentProfile", profileName );				// if fails to get the current profile set the value to null				if (NS_FAILED(rv))				{		            profileName = '\0';					#if defined(DEBUG_profile)						printf("Profiles:Can't get Current Profile value.\n" );					#endif				}			}			else			{				#if defined(DEBUG_profile)					printf("Registry : Couldn't get Profiles subtree.\n");				#endif			}			m_reg->Close();		}		else		{			#if defined(DEBUG_profile)				printf("Couldn't open registry.\n");			#endif		}		    }	else	{		#if defined(DEBUG_profile)			printf("Registry Object is NULL.\n");		#endif		return NS_ERROR_FAILURE;	}	return rv;}