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


  

RegistryPropertyGetSize

A property's value may have any length. If the length of a property's value is not known, use RegistryPropertyGetSize to determine its size so you can allocate space for it.

OSStatus RegistryPropertyGetSize (
                     const RegEntryID *entryID,
                     const RegPropertyName *propertyName,
                     RegPropertyValueSize *propertySize);
--> entryID
Pointer to the RegEntryID value that identifies a name entry.
--> propertyName
Pointer to the name of the property.
<-- propertySize
Pointer to the size in bytes returned for the property's value.
DESCRIPTION

RegistryPropertyGetSize returns in propertySize the length (in bytes) of the property named propertyName and associated with the name entry identified by entryID.

EXECUTION CONTEXT

RegistryPropertyGetSize may be called from task level or secondary interrupt level.

RESULT CODES
noErr 0 No error
paramErr -50 Bad parameter
nrInvalidNodeErr -2538 RegEntryID value not valid
nrNotFoundErr -2539 Search failed to match criteria
CODE SAMPLE

In Listing 10-9, RegistryPropertyGetSize and RegistryPropertyGet are used to obtain the value of a property.

Listing 10-9 Obtaining a property value

OSStatus GetDeviceProperty(
    constRegEntryID        *deviceEntry,
    constRegPropertyName   *propertyName,
    RegPropertyValue        propertyValue,
    RegPropertyValueSize    *propertySize
    )
{
    RegPropertyValueSize    size;
    OSStatus                err = noErr;

    /*
    * Get the size of the value first to see if our buffer is big enough.
    */
    err = RegistryPropertyGetSize(deviceEntry, propertyName, &size);
    if (err == noErr) {
        if (size > *propertySize)
            return kPropBufferTooSmall;
        /*
        * Note, we return the actual property size.
        */
        err = RegistryPropertyGet(deviceEntry, propertyName, propertyValue,
               propertySize);
    }
    return err;
}

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