Skip to content

Commit

Permalink
Change IORegistryEntryGetParentIterator to IORegistryEntryCreateIterator
Browse files Browse the repository at this point in the history
  • Loading branch information
benbaker76 committed Mar 18, 2020
1 parent 968a73b commit bc3fa38
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 31 deletions.
8 changes: 4 additions & 4 deletions EFI Agent.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,12 @@
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 0132;
CURRENT_PROJECT_VERSION = 0133;
DEVELOPMENT_TEAM = 5LGHPJM9ZR;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "$(SRCROOT)/EFIAgent/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MARKETING_VERSION = 1.3.2;
MARKETING_VERSION = 1.3.3;
PRODUCT_BUNDLE_IDENTIFIER = com.Headsoft.EFIAgent;
PRODUCT_NAME = "$(TARGET_NAME)";
SYSTEM_FRAMEWORK_SEARCH_PATHS = "$(inherited) $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks";
Expand All @@ -388,12 +388,12 @@
CLANG_ENABLE_OBJC_WEAK = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 0132;
CURRENT_PROJECT_VERSION = 0133;
DEVELOPMENT_TEAM = 5LGHPJM9ZR;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = "$(SRCROOT)/EFIAgent/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MARKETING_VERSION = 1.3.2;
MARKETING_VERSION = 1.3.3;
PRODUCT_BUNDLE_IDENTIFIER = com.Headsoft.EFIAgent;
PRODUCT_NAME = "$(TARGET_NAME)";
SYSTEM_FRAMEWORK_SEARCH_PATHS = "$(inherited) $(SYSTEM_LIBRARY_DIR)/PrivateFrameworks";
Expand Down
Binary file not shown.
30 changes: 3 additions & 27 deletions EFIAgent/IORegTools.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@

bool getIORegChild(io_service_t device, NSArray *nameArray, io_service_t *foundDevice, uint32_t *foundIndex, bool useClass, bool recursive)
{
kern_return_t kr;
io_iterator_t childIterator;

kr = IORegistryEntryGetChildIterator(device, kIOServicePlane, &childIterator);
kern_return_t kr = IORegistryEntryCreateIterator(device, kIOServicePlane, (recursive ? kIORegistryIterateRecursively : 0), &childIterator);

if (kr != KERN_SUCCESS)
return false;
Expand All @@ -45,12 +43,6 @@ bool getIORegChild(io_service_t device, NSArray *nameArray, io_service_t *foundD
}
}
}

if (recursive)
{
if (getIORegChild(childDevice, nameArray, foundDevice, foundIndex, useClass, recursive))
return true;
}
}

return false;
Expand All @@ -65,10 +57,8 @@ bool getIORegChild(io_service_t device, NSArray *nameArray, io_service_t *foundD

bool getIORegParent(io_service_t device, NSString *name, io_service_t *foundDevice, bool recursive)
{
kern_return_t kr;
io_iterator_t parentIterator;

kr = IORegistryEntryGetParentIterator(device, kIOServicePlane, &parentIterator);
kern_return_t kr = IORegistryEntryCreateIterator(device, kIOServicePlane, (recursive ? kIORegistryIterateRecursively : 0) | kIORegistryIterateParents, &parentIterator);

if (kr != KERN_SUCCESS)
return false;
Expand All @@ -83,23 +73,15 @@ bool getIORegParent(io_service_t device, NSString *name, io_service_t *foundDevi

return true;
}

if (recursive)
{
if (getIORegParent(parentDevice, name, foundDevice, recursive))
return true;
}
}

return false;
}

bool getIORegParent(io_service_t device, NSArray *nameArray, io_service_t *foundDevice, uint32_t *foundIndex, bool useClass, bool recursive)
{
kern_return_t kr;
io_iterator_t parentIterator;

kr = IORegistryEntryGetParentIterator(device, kIOServicePlane, &parentIterator);
kern_return_t kr = IORegistryEntryCreateIterator(device, kIOServicePlane, (recursive ? kIORegistryIterateRecursively : 0) | kIORegistryIterateParents, &parentIterator);

if (kr != KERN_SUCCESS)
return false;
Expand All @@ -124,12 +106,6 @@ bool getIORegParent(io_service_t device, NSArray *nameArray, io_service_t *found
}
}
}

if (recursive)
{
if (getIORegParent(parentDevice, nameArray, foundDevice, foundIndex, useClass, recursive))
return true;
}
}

return false;
Expand Down

0 comments on commit bc3fa38

Please sign in to comment.