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


  

RegistryCStrEntryCreate

RegistryCStrEntryCreate creates a new child name entry in the Name Registry.

OSStatus RegistryCStrEntryCreate(
                     const RegEntryID *parentEntry,
                     const RegCStrPathName *name,
                     RegEntryID *newEntry);
--> parentEntry
Pointer to RegEntryID value that identifies the parent name entry.
--> name
Pointer to the pathname of the new entry relative to the parent, as a C string.
<-- newEntry
Pointer to the returned RegEntryID value of the new name entry.
DESCRIPTION

Given the RegEntryID value of a parent name entry, RegistryCStrEntryCreate creates a new entry that is a descendant of the parent, with the C string pathname name. It returns the RegEntryID value that identifies the new name entry.

The rules for composing pathnames are given in Pathnames. Note that the pathname in name includes the name of the new entry. If parentEntry is NULL, name is a pathname relative to the root.

EXECUTION CONTEXT

RegistryCStrEntryCreate may be called only from task level.

RESULT CODES
noErr 0 No error
paramErr -50 Bad parameter
nrNotEnoughMemoryErr -2537 Not enough space in the system heap
nrInvalidNodeErr -2538 RegEntryID value not valid
nrPathNotFound -2539 Path component lookup failed
nrNotCreatedErr -2540 Entry or property could not be created
CODE SAMPLE

Listing 10-2 shows code that uses RegistryCStrEntryCreate to add a name entry for a new child device to the Name Registry.

Listing 10-2 Adding a name entry to the Name Registry

OSStatus
AddDevice(
    constRegEntryID        *parentEntry,
    constRegCStrEntryName  *deviceName,
    RegEntryID             *deviceEntry
)

{
    RegCStrPathName     devicePathBuf[kRegCStrMaxEntryNameLength+2]
                          = {kRegPathNameSeparator,kRegPathNameTerminator};
    RegCStrPathName     *devicePath = &devicePathBuf[0];
    OSStatus            err = noErr;

    /*
    * Need to construct a relative path name since we are not
    * attaching the new entry to the root.
    */
    devicePath = strcat(devicePath, deviceName);

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

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