+/* Routine io_object_get_superclass */
+kern_return_t is_io_object_get_superclass(
+ mach_port_t master_port,
+ io_name_t obj_name,
+ io_name_t class_name)
+{
+ const OSMetaClass* my_obj = NULL;
+ const OSMetaClass* superclass = NULL;
+ const OSSymbol *my_name = NULL;
+ const char *my_cstr = NULL;
+
+ if (!obj_name || !class_name)
+ return (kIOReturnBadArgument);
+
+ if( master_port != master_device_port)
+ return( kIOReturnNotPrivileged);
+
+ my_name = OSSymbol::withCString(obj_name);
+
+ if (my_name) {
+ my_obj = OSMetaClass::getMetaClassWithName(my_name);
+ my_name->release();
+ }
+ if (my_obj) {
+ superclass = my_obj->getSuperClass();
+ }
+
+ if (!superclass) {
+ return( kIOReturnNotFound );
+ }
+
+ my_cstr = superclass->getClassName();
+
+ if (my_cstr) {
+ strncpy(class_name, my_cstr, sizeof(io_name_t)-1);
+ return( kIOReturnSuccess );
+ }
+ return (kIOReturnNotFound);
+}
+
+/* Routine io_object_get_bundle_identifier */
+kern_return_t is_io_object_get_bundle_identifier(
+ mach_port_t master_port,
+ io_name_t obj_name,
+ io_name_t bundle_name)
+{
+ const OSMetaClass* my_obj = NULL;
+ const OSSymbol *my_name = NULL;
+ const OSSymbol *identifier = NULL;
+ const char *my_cstr = NULL;
+
+ if (!obj_name || !bundle_name)
+ return (kIOReturnBadArgument);
+
+ if( master_port != master_device_port)
+ return( kIOReturnNotPrivileged);
+
+ my_name = OSSymbol::withCString(obj_name);
+
+ if (my_name) {
+ my_obj = OSMetaClass::getMetaClassWithName(my_name);
+ my_name->release();
+ }
+
+ if (my_obj) {
+ identifier = my_obj->getKmodName();
+ }
+ if (!identifier) {
+ return( kIOReturnNotFound );
+ }
+
+ my_cstr = identifier->getCStringNoCopy();
+ if (my_cstr) {
+ strncpy(bundle_name, identifier->getCStringNoCopy(), sizeof(io_name_t)-1);
+ return( kIOReturnSuccess );
+ }
+
+ return (kIOReturnBadArgument);
+}
+