mirror of
https://github.com/Karmaz95/Snake_Apple.git
synced 2026-03-30 14:00:16 +02:00
Adding IOConnectCallMethod simple examples
This commit is contained in:
20
X. NU/custom/drivers/AppleJPEGDriver_method_0.cpp
Normal file
20
X. NU/custom/drivers/AppleJPEGDriver_method_0.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <IOKit/IOKitLib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
// Get service
|
||||
io_service_t service = IOServiceGetMatchingService(kIOMainPortDefault, IOServiceMatching("AppleJPEGDriver"));
|
||||
|
||||
// Connect to service
|
||||
io_connect_t connect;
|
||||
kern_return_t kr = IOServiceOpen(service, mach_task_self(), 1, &connect);
|
||||
IOObjectRelease(service);
|
||||
|
||||
// Call external method
|
||||
kr = IOConnectCallMethod(connect, 0, NULL, 0, NULL, 0, NULL, NULL, NULL, NULL);
|
||||
printf("Method call result: 0x%x\n", kr);
|
||||
|
||||
// Cleanup
|
||||
IOServiceClose(connect);
|
||||
return 0;
|
||||
}
|
||||
10
X. NU/custom/drivers/AppleJPEGDriver_method_0.py
Normal file
10
X. NU/custom/drivers/AppleJPEGDriver_method_0.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import iokitlib
|
||||
|
||||
# Get service and connect
|
||||
iokit = iokitlib.iokit()
|
||||
conn = iokit.open_service(b"AppleJPEGDriver", 1)
|
||||
print(f"Connection handle: {conn}")
|
||||
|
||||
# Call external method
|
||||
kr = iokit.connect_call_method(conn, 0, None, None, None, None)
|
||||
print(f"Method call result: {kr}")
|
||||
Reference in New Issue
Block a user