nsXPIDLCString profile; nsXPIDLCString isMigrated;  rv = node->GetName( getter_Copies(profile) );  if (NS_SUCCEEDED(rv) && (profile)) { nsRegistryKey profKey;  rv = m_reg->GetSubtree(key, profile, &profKey);  if (NS_SUCCEEDED(rv)) { rv = m_reg->GetString(profKey, REGISTRY_MIGRATED_STRING, getter_Copies(isMigrated));  if (NS_SUCCEEDED(rv) && (isMigrated)) { if (PL_strcmp(isMigrated, REGISTRY_YES_STRING) == 0) { numKeys++; } } } } } } rv = enumKeys->Next(); }
char *profile = nsnull; char *isMigrated = nsnull;  rv = node->GetName( &profile );  if (NS_SUCCEEDED(rv) && (profile)) { nsIRegistry::Key profKey;  rv = m_reg->GetSubtree(key, profile, &profKey);  if (NS_SUCCEEDED(rv)) { rv = m_reg->GetString(profKey, "migrated", &isMigrated);  if (NS_SUCCEEDED(rv) && (isMigrated)) { if (PL_strcmp(isMigrated, "yes") == 0) { numKeys++; } nsCRT::free(isMigrated); } } } node->Release(); } base->Release(); } rv = enumKeys->Next(); }
NS_IMETHODIMP nsProfile::GetProfileCount(PRInt32 *numProfiles){    nsresult rv = NS_OK;#if defined(DEBUG_profile)    printf("ProfileManager : GetProfileCount\n");#endif    rv = OpenRegistry();    if (NS_FAILED(rv)) return rv;        // Enumerate all subkeys (immediately) under the given node.    nsCOMPtr<nsIEnumerator> enumKeys;    nsRegistryKey key;        rv = m_reg->GetSubtree(nsIRegistry::Common, REGISTRY_PROFILE_SUBTREE_STRING, &key);        if (NS_SUCCEEDED(rv))        {            rv = m_reg->EnumerateSubtrees( key, getter_AddRefs(enumKeys));                        if (NS_SUCCEEDED(rv))				{			        PRInt32 numKeys=0;					rv = enumKeys->First();                    			        while( NS_SUCCEEDED( rv ) && (NS_OK != enumKeys->IsDone()) )                         {                            nsCOMPtr<nsISupports> base;                                                        rv = enumKeys->CurrentItem( getter_AddRefs(base) );                                                        if (NS_SUCCEEDED(rv))                                 {                                    // Get specific interface.                                    nsCOMPtr <nsIRegistryNode> node;                                    nsIID nodeIID = NS_IREGISTRYNODE_IID;                                                                        rv = base->QueryInterface( nodeIID, getter_AddRefs(node));                                                                        // Test that result.                                    if (NS_SUCCEEDED(rv))                                         {								// Get node name.                                            nsXPIDLCString profile;                                            nsXPIDLCString isMigrated;                                                                                        rv = node->GetName( getter_Copies(profile) );                                                                                        if (NS_SUCCEEDED(rv) && (profile))                                                {                                                    nsRegistryKey profKey;								                                                                                                        rv = m_reg->GetSubtree(key, profile, &profKey);                                                                                                        if (NS_SUCCEEDED(rv))                                                         {                                                            rv = m_reg->GetString(profKey, REGISTRY_MIGRATED_STRING, getter_Copies(isMigrated));                                                                                                                        if (NS_SUCCEEDED(rv) && (isMigrated))                                                                {                                                                    if (PL_strcmp(isMigrated, REGISTRY_YES_STRING) == 0)                                                                        {                                                                            numKeys++;                                                                        }                                                                }                                                        }                                                }                                        }                                }	                            rv = enumKeys->Next();                        }					*numProfiles = numKeys;				}            else				{#if defined(DEBUG_profile)                    printf("Profiles : Can't enumerate subtrees.\n" );#endif				}        }    else        {#if defined(DEBUG_profile)            printf("Registry : Couldn't get Profiles subtree.\n");#endif        }	return rv;}