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


  

RegistryCStrEntryLookup

RegistryCStrEntryLookup finds a name entry in the Name Registry by starting from a designated point and traversing a defined path. This makes it faster than most search or iterate routines.

OSStatus RegistryCStrEntryLookup(
                     const RegEntryID *searchPointID,
                     const RegCStrPathName *pathName,
                     RegEntryID *foundEntry);
--> searchPointID
Pointer to the RegEntryID value that identifies starting point of search.
--> pathName
Pointer to the pathname of entry to be found.
<-- foundEntry
Pointer to the RegEntryID value of found name entry.
DESCRIPTION

RegistryCStrEntryLookup finds a name entry in the Registry based on pathName, starting from the entry designated by searchPointID.

If searchPointID is NULL, the path is assumed to be a rooted path and pathName must contain an absolute pathname. If the pathname begins with a colon, the path is relative to searchPointID and pathName must contain a relative pathname. If the pathname does not begin with a colon, the path is a rooted path and pathName must contain an absolute pathname.

After using RegistryCStrEntryLookup, dispose of the foundEntry ID by calling RegistryEntryIDDispose.

Note

A reverse lookup mechanism has not been provided because some name services may not provide a fast, general algorithm. To perform reverse lookup, the process described in Name Iteration and Searching should be used.

EXECUTION CONTEXT

RegistryCStrEntryLookup may be called only from task level.

RESULT CODES
noErr 0 No error
paramErr -50 Bad parameter
nrInvalidNodeErr -2538 RegEntryID value not valid
nrPathNotFound -2539 Path component lookup failed
CODE SAMPLE

Listing 10-5 shows code that uses RegistryCStrEntryLookup to obtain the entry ID for a child device.

Listing 10-5 Obtaining an entry ID

OSStatus
LocateChildDevice(
    constRegEntryID            *parentEntry,
    constRegCStrEntryName      *deviceName,
    RegEntryID                  *deviceEntry
    )
{
    RegCStrPathName     devicePathBuf[kRegCStrMaxEntryNameLength+2]
                        = {kRegPathNameSeparator, kRegPathNameTerminator};
    RegCStrPathName     *devicePath = &devicePathBuf[0];
    OSStatus            err = noErr;

    /*
    * Need to construct a relative pathname from the parent entry.
    */
    devicePath = strcat(devicePath,deviceName);

    err = RegistryCStrEntryLookup(parentEntry, devicePath, deviceEntry);
    return err;
}

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