From 8d0ded44d977340cbf12f7e6e26f6f099dc0db31 Mon Sep 17 00:00:00 2001 From: Gabriele Gristina Date: Sat, 3 Jun 2023 22:36:40 +0200 Subject: [PATCH] using hc_IOMasterPortDefault instead of kIOMasterPortDefault/kIOMainPortDefault --- include/ext_iokit.h | 3 +++ src/ext_iokit.c | 4 ++-- src/ext_metal.m | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/ext_iokit.h b/include/ext_iokit.h index 180be3ef9..36676c948 100644 --- a/include/ext_iokit.h +++ b/include/ext_iokit.h @@ -9,6 +9,9 @@ #if defined(__APPLE__) #include +// kIOMasterPortDefault/kIOMainPortDefault is 0 +static const mach_port_t hc_IOMasterPortDefault = 0; + // Apple SMC Keys #define HM_IOKIT_SMC_SENSOR_GRAPHICS_HOT "SGHT" #define HM_IOKIT_SMC_CPU_PROXIMITY "TC0P" diff --git a/src/ext_iokit.c b/src/ext_iokit.c index 78a7cada3..1c45ea367 100644 --- a/src/ext_iokit.c +++ b/src/ext_iokit.c @@ -48,7 +48,7 @@ kern_return_t hm_IOKIT_SMCOpen (void *hashcat_ctx, io_connect_t *conn) CFMutableDictionaryRef matchingDictionary = IOServiceMatching ("AppleSMC"); - result = IOServiceGetMatchingServices (kIOMasterPortDefault, matchingDictionary, &iterator); + result = IOServiceGetMatchingServices (hc_IOMasterPortDefault, matchingDictionary, &iterator); if (result != kIOReturnSuccess) { @@ -231,7 +231,7 @@ int hm_IOKIT_get_utilization_current (void *hashcat_ctx, int *utilization) CFMutableDictionaryRef matching = IOServiceMatching ("IOAccelerator"); - if (IOServiceGetMatchingServices (kIOMasterPortDefault, matching, &iterator) != kIOReturnSuccess) + if (IOServiceGetMatchingServices (hc_IOMasterPortDefault, matching, &iterator) != kIOReturnSuccess) { event_log_error (hashcat_ctx, "IOServiceGetMatchingServices(): failure"); diff --git a/src/ext_metal.m b/src/ext_metal.m index a9ab89229..6a51d48bd 100644 --- a/src/ext_metal.m +++ b/src/ext_metal.m @@ -47,7 +47,7 @@ static bool iokit_getGPUCore (void *hashcat_ctx, int *gpu_core) CFMutableDictionaryRef matching = IOServiceMatching ("IOAccelerator"); - io_service_t service = IOServiceGetMatchingService (kIOMasterPortDefault, matching); + io_service_t service = IOServiceGetMatchingService (hc_IOMasterPortDefault, matching); if (!service) {