rv = value->GetName( &name );
rv = value->GetNameUTF8( &name );
static void displayValues( nsIRegistry *reg, nsRegistryKey root ) {    // Emumerate values at this registry location.    nsIEnumerator *values;    nsresult rv = reg->EnumerateValues( root, &values );    // Check result.    if ( rv == NS_OK ) {        // Go to beginning.        rv = values->First();        // Enumerate values till done.        while( rv == NS_OK && (NS_OK != values->IsDone()) ) {            nsISupports *base;            rv = values->CurrentItem( &base );            // Test result.            if ( rv == NS_OK ) {                // Get specific interface.                nsIRegistryValue *value;                nsIID valueIID = NS_IREGISTRYVALUE_IID;                rv = base->QueryInterface( valueIID, (void**)&value );                // Test that result.                if ( rv == NS_OK ) {                    // Get node name.                    char *name;                    rv = value->GetName( &name );                    // Test result.                    if ( rv == NS_OK ) {                        // Print name:                        printf( "\t\t%s", name );                        // Get info about this value.                        PRUint32 type;                        rv = reg->GetValueType( root, name, &type );                        if ( rv == NS_OK ) {                            // Print value contents.                            switch ( type ) {                                case nsIRegistry::String: {                                        char *strValue;                                        rv = reg->GetStringUTF8( root, name, &strValue );                                        if ( rv == NS_OK ) {                                            printString( strValue, strlen(name) );                                            nsAllocator::Free( strValue );                                        } else {                                            printf( "\t Error getting string value, rv=0x%08X", (int)rv );                                        }                                    }                                    break;                                case nsIRegistry::Int32:                                    {                                        PRInt32 val = 0;                                        rv = reg->GetInt( root, name, &val );                                        if (NS_SUCCEEDED(rv)) {                                            printf( "\t= Int32 [%d, 0x%x]", val, val);                                        }                                        else {                                            printf( "\t Error getting int32 value, rv=%08X", (int)rv);                                        }                                    }                                    break;                                case nsIRegistry::Bytes:                                    printf( "\t= Bytes" );                                    break;                                case nsIRegistry::File:                                    printf( "\t= File (?)" );                                    break;                                default:                                    printf( "\t= ? (unknown type=0x%02X)", (int)type );                                    break;                            }                        } else {                            printf( "\t= ? (error getting value, rv=0x%08X)", (int)rv );                        }                        printf("\n");                        nsAllocator::Free( name );                    } else {                        printf( "Error getting value name, rv=0x%08X\n", (int)rv );                    }                    // Release node.                    value->Release();                } else {                    printf( "Error converting base node ptr to nsIRegistryNode, rv=0x%08X\n", (int)rv );                }                // Release item.                base->Release();                // Advance to next key.                rv = values->Next();                // Check result.                if ( NS_SUCCEEDED( rv ) ) {                } else {                    printf( "Error advancing enumerator, rv=0x%08X\n", (int)rv );                    break;                }            } else {                printf( "Error getting current item, rv=0x%08X\n", (int)rv );                break;            }        }        values->Release();    } else {        printf( "\t\tError enumerating values, rv=0x%08X\n", (int)rv );    }    return;}