NS_ADDREF(m_reg);
void nsProfile::GetAllProfiles(){	nsresult rv = NS_OK;#if defined(DEBUG_profile)     printf("ProfileManager : GetAllProfiles\n");#endif		int index = 0;    // 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)) 		{            // Enumerate all subkeys (immediately) under the given node.            nsIEnumerator *enumKeys;            nsIRegistry::Key key;            rv = m_reg->GetSubtree(nsIRegistry::Common, "Profiles", &key);            if (NS_SUCCEEDED(rv)) 			{                rv = m_reg->EnumerateSubtrees( key, &enumKeys );                if (NS_SUCCEEDED(rv)) 				{                    rv = enumKeys->First();                    // Enumerate subkeys till done.                    while( NS_SUCCEEDED( rv ) && !enumKeys->IsDone() )                     {						nsISupports *base;						rv = enumKeys->CurrentItem( &base );						if (NS_SUCCEEDED(rv)) 						{	                        // Get specific interface.		                    nsIRegistryNode *node;			                nsIID nodeIID = NS_IREGISTRYNODE_IID;				            rv = base->QueryInterface( nodeIID, (void**)&node );					        						    // Test that result.							if (NS_SUCCEEDED(rv)) 							{								// Get node name.		                        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, "no") == 0)											{												PL_strcpy(gProfiles[index], profile);												PL_strcat(gProfiles[index], " - migrate");											}											else											{												PL_strcpy(gProfiles[index], profile);											}											#if defined(DEBUG_profile)												printf("proflie%d = %s\n", index, gProfiles[index]);											#endif										}									}								}								node->Release();					        }							base->Release();						}						    rv = enumKeys->Next();						if (NS_FAILED(rv))						{							#if defined(DEBUG_profile)								printf( "Error advancing enumerator, rv=0x%08X\n", (int)rv );							#endif						}						index++;					}					g_numProfiles = index;					NS_RELEASE(enumKeys);				}            }        }        m_reg->Close();    }}