PATH 
ADC Home > Documentation > Hardware > Device Managers and Drivers > PCI Card Services > Designing PCI Cards and Drivers for Power Macintosh Computers


  

RegistryCStrEntryToName

RegistryCStrEntryToName retrieves the name component of a name entry and returns the ID of the entry's parent.

OSStatus RegistryCStrEntryToName (
                     const RegEntryID *entryID,
                     RegEntryID *parentEntry,
                     RegCStrEntryName *nameComponent,
                     Boolean *done);
--> entryID
Pointer to the RegEntryID value that identifies a name entry.
<-- parentEntry
Pointer to the returned RegEntryID value of the entry's parent entry.
<-- nameComponent
Pointer to the returned name of the entry as a C string.
<-- done
Pointer, returns true when parentEntry is the root.
DESCRIPTION

Given a RegEntryID value that identifies a name entry, RegistryCStrEntryToName returns the RegEntryID value that identifies its parent entry in parentEntry and the name component of the name entry in nameComponent. RegistryCStrEntryToName is useful for locating the parent of a name entry and for constructing a relative pathname from the parent to the entry.

RESULT CODES
noErr 0 No error
paramErr -50 Bad parameter
nrInvalidNodeErr -2538 RegEntryID value not valid
CODE SAMPLE

Listing 10-6 shows code that uses RegistryCStrEntryToName to obtain the parent entry for a given child entry.

Listing 10-6 Obtaining a parent entry

OSStatus LocateParentDevice(
    constRegEntryID    *deviceEntry,
    RegEntryID          *parentEntry
)
{
    RegCStrEntryName    deviceNameBuf[kRegCStrMaxEntryNameLength + 1];
    Boolean             done;
    OSStatus            err = noErr;

    err = RegistryCStrEntryToName(deviceEntry, parentEntry,
                                &deviceNameBuf[0], &done);
    if (err != noErr)
        return err;

    /*
    * If done == true, we have reached the root, there is no parent!
    */
    if (done)
        err = kNotFoundErr;

    return err;
}

© 1999 Apple Computer, Inc. – (Last Updated 26 March 99)