nsCOMPtr<nsIPref> pPref(do_GetService(kPrefCID, &rv));
nsCOMPtr<nsIPref> pPref(do_GetService(NS_PREF_CONTRACTID, &rv));
static void DIR_SetBoolPref (const char *prefRoot, const char *prefLeaf, char *scratch, PRBool value, PRBool defaultValue){    nsresult rv = NS_OK;    nsCOMPtr<nsIPref> pPref(do_GetService(kPrefCID, &rv));     if (NS_FAILED(rv) || !pPref) 		return;	PRBool defaultPref;	PRInt32 prefErr = PREF_NOERROR;	PL_strcpy(scratch, prefRoot);	PL_strcat(scratch, ".");	PL_strcat(scratch, prefLeaf);	if (PREF_NOERROR == pPref->GetDefaultBoolPref (scratch, &defaultPref))	{		/* solve the problem where reordering user prefs must override default prefs */		prefErr = pPref->SetBoolPref (scratch, value);	}	else	{		PRBool userPref;		if (PREF_NOERROR == pPref->GetBoolPref (scratch, &userPref))		{			if (value != defaultValue)				prefErr = pPref->SetBoolPref(scratch, value);			else				DIR_ClearBoolPref (scratch);		}		else		{			if (value != defaultValue)				prefErr = pPref->SetBoolPref (scratch, value);		}	}	PR_ASSERT(prefErr >= 0);}