nsRegistryKey key; rv = m_reg->GetSubtree(nsIRegistry::Common, REGISTRY_PROFILE_SUBTREE_STRING, &key);  if (NS_SUCCEEDED(rv)) { nsRegistryKey newKey;  rv = m_reg->SetString(key, REGISTRY_NEED_MIGRATION_STRING, REGISTRY_TRUE_STRING);  rv = m_reg->GetSubtree(key, mOldProfiles[idx], &newKey);  if (NS_FAILED(rv))
if (m_reg != nsnull) {  rv = m_reg->OpenDefault();  if (NS_SUCCEEDED(rv)) { nsIRegistry::Key key; rv = m_reg->GetSubtree(nsIRegistry::Common, "Profiles", &key);  if (NS_SUCCEEDED(rv)) { nsIRegistry::Key newKey;  rv = m_reg->SetString(key, "NeedMigration", "true");  rv = m_reg->GetSubtree(key, gOldProfiles[idx], &newKey);  if (NS_FAILED(rv))
nsresult nsProfile::UpdateMozProfileRegistry(){	nsresult rv = NS_OK;    rv = OpenRegistry();    if (NS_FAILED(rv)) return rv;                           #if defined(DEBUG_profile)    printf("Entered UpdateMozProfileRegistry.\n");#endif	for (PRInt32 idx = 0; idx < mNumOldProfiles; idx++)	{        nsRegistryKey key;        rv = m_reg->GetSubtree(nsIRegistry::Common, REGISTRY_PROFILE_SUBTREE_STRING, &key);                if (NS_SUCCEEDED(rv))            {                nsRegistryKey newKey;                                rv = m_reg->SetString(key, REGISTRY_NEED_MIGRATION_STRING, REGISTRY_TRUE_STRING);                                rv = m_reg->GetSubtree(key, mOldProfiles[idx], &newKey);                                if (NS_FAILED(rv))					{						rv = m_reg->AddSubtree(key, mOldProfiles[idx], &newKey);                        						if (NS_SUCCEEDED(rv))                            {                                nsFileSpec profileDir(mOldProfLocations[idx]);                                                                nsXPIDLCString profileDirString;	                                nsCOMPtr<nsIFileSpec>spec;                                rv = NS_NewFileSpecWithSpec(profileDir, getter_AddRefs(spec));                                if (NS_SUCCEEDED(rv)) {                                    rv = spec->GetPersistentDescriptorString(getter_Copies(profileDirString));                                }                                                                if (NS_SUCCEEDED(rv) && profileDirString)                                    {                                                                                rv = m_reg->SetString(newKey, REGISTRY_DIRECTORY_STRING, profileDirString);                                                                                if (NS_FAILED(rv))                                            {#if defined(DEBUG_profile)                                                printf("Couldn't set directory property.\n" );#endif                                            }                                                                                rv = m_reg->SetString(newKey, REGISTRY_MIGRATED_STRING, REGISTRY_NO_STRING);                                                                                if (NS_FAILED(rv))                                            {#if defined(DEBUG_profile)                                                printf("Couldn't add migrate flag.\n" );#endif                                            }                                    }                                else                                    {#if defined(DEBUG_profile)                                        printf("NULL value received for directory name.\n" );#endif                                    }                            }						else                            {#if defined(DEBUG_profile)								printf("Profiles : Could not add profile subtree.\n" );#endif                            }					}                else					{#if defined(DEBUG_profile)                        printf("Profiles : Profile name subtree already exists.\n" );#endif					}            }        else            {#if defined(DEBUG_profile)                printf("Registry : Couldn't get Profiles subtree.\n");#endif            }    }		return rv;}