nsSpecialSystemDirectory systemDir(nsSpecialSystemDirectory::Win_WindowsDirectory);   PL_strcpy(oldRegFile, systemDir.GetNativePathCString()); PL_strcat(oldRegFile, oldWinReg); #endif   #ifdef XP_MAC nsSpecialSystemDirectory *regLocation = NULL;   regLocation = new nsSpecialSystemDirectory(nsSpecialSystemDirectory::Mac_SystemDirectory);   *regLocation += "Preferences"; *regLocation += oldMacReg;  PL_strcpy(oldRegFile, regLocation->GetNativePathCString()); #endif rv = m_reg->Open(oldRegFile);   if (NS_SUCCEEDED(rv)) {  nsCOMPtr<nsIEnumerator> enumKeys;  if (NS_SUCCEEDED(rv)) {  rv = m_reg->EnumerateSubtrees(nsIRegistry::Users, getter_AddRefs(enumKeys));  if (NS_SUCCEEDED(rv)) {  rv = enumKeys->First();   while( NS_SUCCEEDED( rv ) && (NS_OK != enumKeys->IsDone()) ) { nsCOMPtr<nsISupports> base; rv = enumKeys->CurrentItem(getter_AddRefs(base));  if (NS_SUCCEEDED(rv)) {  nsIRegistryNode *node; nsIID nodeIID = NS_IREGISTRYNODE_IID; rv = base->QueryInterface( nodeIID, (void**)&node );   if (NS_SUCCEEDED(rv)) {  char *profile = nsnull; rv = node->GetName( &profile );  #if defined(DEBUG_profile) printf("oldProflie = %s\n", profile); #endif  nsIRegistry::Key key;  rv = m_reg->GetSubtree(nsIRegistry::Users, profile, &key);  if (NS_SUCCEEDED(rv)) { PL_strcpy(gOldProfiles[g_numOldProfiles], nsUnescape(profile)); }  char *profLoc = nsnull;  rv = m_reg->GetString( key, "ProfileLocation", &profLoc);  #if defined(DEBUG_profile) printf("oldProflie Location = %s\n", profLoc); #endif  if (NS_SUCCEEDED(rv)) { PL_strcpy(gOldProfLocations[g_numOldProfiles], profLoc); g_numOldProfiles++; }  PR_FREEIF(profile); PR_FREEIF(profLoc); } } rv = enumKeys->Next(); } } } m_reg->Close();  if (g_numOldProfiles > 0) { UpdateMozProfileRegistry(); } } }
NS_IMETHODIMP nsProfile::MigrateProfileInfo(){    nsresult rv = NS_OK;#if defined(XP_PC) || defined(XP_MAC)#if defined(DEBUG_profile_verbose)    printf("Entered MigrateProfileInfo.\n");#endif    char oldRegFile[_MAX_LENGTH] = {'\0'};#ifdef XP_PC#ifdef XP_OS2    nsSpecialSystemDirectory systemDir(nsSpecialSystemDirectory::OS2_OS2Directory);#else    // Registry file has been traditionally stored in the windows directory (XP_PC).    nsSpecialSystemDirectory systemDir(nsSpecialSystemDirectory::Win_WindowsDirectory);#endif        // Append the name of the old registry to the path obtained.    PL_strcpy(oldRegFile, systemDir.GetNativePathCString());    PL_strcat(oldRegFile, OLD_REGISTRY_FILE_NAME);#else /* XP_MAC */    nsSpecialSystemDirectory regLocation(nsSpecialSystemDirectory::Mac_PreferencesDirectory);        // Append the name of the old registry to the path obtained.    regLocation += OLD_REGISTRY_FILE_NAME;        PL_strcpy(oldRegFile, regLocation.GetNativePathCString());#endif /* XP_PC */    rv = gProfileDataAccess->Get4xProfileInfo(oldRegFile);#elif defined (XP_BEOS)#else    /* XP_UNIX */    rv = gProfileDataAccess->Get4xProfileInfo(nsnull);#endif /* XP_PC || XP_MAC */    gProfileDataAccess->mProfileDataChanged = PR_TRUE;    gProfileDataAccess->UpdateRegistry(nsnull);	return rv;}