NS_NewLocalFile((char*)valbuf, getter_AddRefs(spec));
NS_NewLocalFile((char*)valbuf, PR_TRUE, getter_AddRefs(spec));
void DeleteScheduledFiles( HREG reg ){    REGERR  err;    RKEY    key;    REGENUM state = 0;    nsresult rv = NS_OK;    /* perform scheduled file deletions  */    if (REGERR_OK == NR_RegGetKey(reg,ROOTKEY_PRIVATE,REG_DELETE_LIST_KEY,&key))    {        // the delete key exists, so we loop through its children        // and try to delete all the listed files        char    namebuf[MAXREGNAMELEN];        char    valbuf[MAXREGPATHLEN];        nsCOMPtr<nsIFile>        doomedFile;        nsCOMPtr<nsILocalFile>   spec;        if (NS_SUCCEEDED(rv))        {            while (REGERR_OK == NR_RegEnumEntries( reg, key, &state, namebuf,                                                   sizeof(namebuf), 0 ) )            {                uint32 bufsize = sizeof(valbuf); // gets changed, must reset                err = NR_RegGetEntry( reg, key, namebuf, valbuf, &bufsize );                if ( err == REGERR_OK )                {                    // no need to check return value of                     // SetPersistentDescriptorString, it's always NS_OK                    //spec->SetPersistentDescriptorString(valbuf); //nsIFileXXX: Do we still need this instead of InitWithPath?                    NS_NewLocalFile((char*)valbuf, getter_AddRefs(spec));                    spec->Clone(getter_AddRefs(doomedFile));                    if (NS_SUCCEEDED(rv))                     {                        PRBool flagExists;                        doomedFile->Delete(PR_FALSE);                        doomedFile->Exists(&flagExists);                        if ( !flagExists )                        {                            // deletion successful, don't have to retry                            NR_RegDeleteEntry( reg, key, namebuf );                        }                    }                }            }            /* delete list node if empty */            state = 0;            err = NR_RegEnumEntries(reg, key, &state, namebuf, sizeof(namebuf), 0);            if ( err == REGERR_NOMORE )            {                NR_RegDeleteKey(reg, ROOTKEY_PRIVATE, REG_DELETE_LIST_KEY);            }        }    }}