if ( NULL == *name ) return REGERR_MEMORY;
err = nr_Lock( reg ); if ( err != REGERR_OK ) return err;   err = nr_ReadDesc( reg, key, &desc); if ( err == REGERR_OK ) { if ( *state == 0 ) {  if ( desc.value != 0 ) { *buffer = '\0'; err =  nr_ReplaceName( reg, desc.value, buffer, bufsize, &desc ); } else {  err = REGERR_NOMORE; } } else {  err = nr_ReadDesc( reg, *state, &desc ); if ( err == REGERR_OK  || err == REGERR_DELETED ) {  if ( desc.left != 0 ) { *buffer = '\0'; err =  nr_ReplaceName( reg, desc.left, buffer, bufsize, &desc ); } else {  err = REGERR_NOMORE; } } }
VR_INTERFACE(REGERR) NR_RegGetUsername(char **name){    /* XXX: does this need locking? */    if ( name == NULL )        return REGERR_PARAM;    *name = XP_STRDUP(nr_GetUsername());    if ( NULL == *name )        return REGERR_MEMORY;    return REGERR_OK;}