When a device is permanently removed from the system, the information pertaining to the device must be removed from the Name Registry. When a name entry is removed from the Registry, all properties associated with that entry are automatically removed as well. Listing 10-14 illustrates removing a device entry from the Registry.
In the current Mac OS, all children of a parent entry are removed when the parent is removed. Removing a parent entry, thereby creating orphan entries, may not be supported in future releases.
Listing 10-14 Removing a device entry from the Name Registry
#include <NameRegistry.h>
OSStatus
JoePro_RemName(const RegCStrPathName *name)
{
OSErr err = noErr;
RegEntryID entry;
/* from previous example */
err = JoePro_FindEntry(name, &entry);
if (err == noErr) {
err = JoePro_RemEntry(&entry);
RegistryEntryIDDispose(&entry);
}
return err;
}
OSStatus
JoePro_RemEntry(RegEntryID *entry)
{
return RegistryEntryDelete(entry);
}