PRINTF("\nlockVendor %s \n", (const char *)lockVendor);
nsresult nsPref::useLockPrefFile()//----------------------------------------------------------------------------------------{    nsresult rv = NS_OK;    PrefResult result = PREF_NOERROR;    nsCOMPtr<nsIFileSpec> lockPrefFile;    nsXPIDLString prefVal;    nsXPIDLCString lockFileName;    nsXPIDLCString lockVendor;    char *return_error = nsnull;    PRUint32 fileNameLen = 0;    PRUint32 vendorLen = 0;    nsXPIDLCString configFile;    if (NS_SUCCEEDED(rv = GetLocalizedUnicharPref("browser.startup.homepage",			getter_Copies(prefVal)) && (prefVal)))     {#ifdef DEBUG_tao        printf("\nStartup homepage %s \n", (const char *)NS_ConvertUCS2toUTF8(prefVal));#endif    }    if (NS_SUCCEEDED(rv = CopyCharPref("general.config.filename",			getter_Copies(lockFileName)) && (lockFileName)))    {#ifdef NS_DEBUG        printf("\nlockFile %s \n", (const char *)lockFileName);#endif    }    if (NS_SUCCEEDED(rv = CopyCharPref("general.config.vendor",			getter_Copies(lockVendor)) && (lockVendor)))     {#ifdef NS_DEBUG        printf("\nlockVendor %s \n", (const char *)lockVendor);#endif    }    if ((gLockFileName == nsnull) && (gLockVendor == nsnull))    {        if ((lockFileName == nsnull) && (lockVendor == nsnull))         {            return NS_OK;        }        if ((lockFileName == nsnull) || (lockVendor == nsnull))        {            return_error = PL_strdup("The required configuration filename or vendor name is incorrect.Please check your preferences.");            if (return_error)             {                pref_Alert(return_error);                return NS_ERROR_FAILURE;            }        }        fileNameLen = PL_strlen(lockFileName);        vendorLen = PL_strlen(lockVendor);        if (PL_strncmp(lockFileName, lockVendor, fileNameLen -4) != 0)        {            return_error = PL_strdup("The required configuration filename and vendor name do not match.Please check your preferences.");            if (return_error)             {                pref_Alert(return_error);                PR_FREEIF(return_error);                return NS_ERROR_FAILURE;            }                    }        else        {            configFile = nsXPIDLCString::Copy(lockFileName);            if(configFile == nsnull)                return NS_ERROR_FAILURE;        }    }    else if ((gLockFileName == nsnull) || (gLockVendor == nsnull))    {        return_error = PL_strdup("The required configuration filename or vendor name is incorrect.Please contact your administrator.");        if (return_error)         {            pref_Alert(return_error);            PR_FREEIF(return_error);            return NS_ERROR_FAILURE;        }          }    else    {        fileNameLen = PL_strlen(gLockFileName);        vendorLen = PL_strlen(gLockVendor);        if (PL_strncmp(gLockFileName, gLockVendor, fileNameLen -4) != 0)        {            return_error = PL_strdup("The required configuration filename and vendor name do not match.Please contact your administrator.");            if (return_error)             {                pref_Alert(return_error);                PR_FREEIF(return_error);                return NS_ERROR_FAILURE;            }                    }        else        {            configFile = nsXPIDLCString::Copy(lockFileName);            if(configFile == nsnull)                return NS_ERROR_FAILURE;        }    }        {        nsCOMPtr<nsIFile> aFile;         rv = NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR, getter_AddRefs(aFile));        #ifdef XP_MAC        aFile->Append("Essential Files");#endif        // TODO: Make the rest of this code use nsIFile and        // avoid this conversion        rv = _nsIFileToFileSpec(aFile, getter_AddRefs(lockPrefFile));                if (NS_SUCCEEDED(rv) && lockPrefFile)         {            if (NS_SUCCEEDED(lockPrefFile->AppendRelativeUnixPath(configFile)))            {                if (NS_FAILED(StartUp()))    	            return NS_ERROR_FAILURE;	            JS_BeginRequest(gMochaContext);                result = pref_OpenFileSpec(lockPrefFile, PR_TRUE, PR_TRUE, PR_FALSE, PR_FALSE);                if (result != PREF_NOERROR)                {                    rv = NS_ERROR_FAILURE;                    if (result != PREF_BAD_LOCKFILE)                    {                        return_error = PL_strdup("The required configuration file netscape.cfg could not be found. Please reinstall the software or contact your administrator.");                        if (return_error)                         {                            pref_Alert(return_error);                            PR_FREEIF(return_error);                        }                    }                }                JS_EndRequest(gMochaContext);            }        }    GetLocalizedUnicharPref("browser.startup.homepage",getter_Copies(prefVal));#ifdef DEBUG_tao    printf("\nStartup homepage %s \n", (const char *)NS_ConvertUCS2toUTF8(prefVal));#endif    }    return rv;} // nsPref::useLockPrefFile