RegistryEntryGetMod fetches the modifiers for a name entry in the Registry.
OSStatus RegistryEntryGetMod (
const RegEntryID *entry,
RegEntryModifiers *modifiers);
RegistryEntryGetMod returns in modifiers the current modifiers for the name entry identified by entry.
noErr
|
0 | No error |
paramErr
|
-50 | Bad parameter |
nrInvalidNodeErr
|
-2538 | RegEntryID value not valid |
In Listing 10-10, RegistryEntryGetMod and RegistryEntrySetMod are used to save a property to disk.
Listing 10-10 Saving a property to disk
OSStatus SaveDeviceProperty(
constRegEntryID *deviceEntry,
constRegPropertyName *propertyName
)
{
RegPropertyModifiers propertyModifiers;
OSStatus err = noErr;
/*
* Get the existing modifiers first.
*/
err = RegistryPropertyGetMod(deviceEntry, propertyName, &propertyModifiers);
if (err == noErr) {
/*
* Set the save-to-disk modifier preserving the
* already existing ones.
*/
propertyModifiers = propertyModifiers
&kRegPropertyValueIsSavedToDisk;
err = RegistryPropertySetMod
(deviceEntry, propertyName, propertyModifiers);
}
return err;
}