kern_utils.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #import <stdio.h>
  2. #import <mach/mach.h>
  3. #import <mach/error.h>
  4. #import <mach/message.h>
  5. #import <CoreFoundation/CoreFoundation.h>
  6. kern_return_t mach_vm_read(
  7. vm_map_t target_task,
  8. mach_vm_address_t address,
  9. mach_vm_size_t size,
  10. vm_offset_t *data,
  11. mach_msg_type_number_t *dataCnt);
  12. /****** IOKit/IOKitLib.h *****/
  13. typedef mach_port_t io_service_t;
  14. typedef mach_port_t io_connect_t;
  15. extern const mach_port_t kIOMasterPortDefault;
  16. #define IO_OBJECT_NULL (0)
  17. kern_return_t
  18. IOConnectCallAsyncMethod(
  19. mach_port_t connection,
  20. uint32_t selector,
  21. mach_port_t wakePort,
  22. uint64_t* reference,
  23. uint32_t referenceCnt,
  24. const uint64_t* input,
  25. uint32_t inputCnt,
  26. const void* inputStruct,
  27. size_t inputStructCnt,
  28. uint64_t* output,
  29. uint32_t* outputCnt,
  30. void* outputStruct,
  31. size_t* outputStructCntP);
  32. kern_return_t
  33. IOConnectCallMethod(
  34. mach_port_t connection,
  35. uint32_t selector,
  36. const uint64_t* input,
  37. uint32_t inputCnt,
  38. const void* inputStruct,
  39. size_t inputStructCnt,
  40. uint64_t* output,
  41. uint32_t* outputCnt,
  42. void* outputStruct,
  43. size_t* outputStructCntP);
  44. io_service_t
  45. IOServiceGetMatchingService(
  46. mach_port_t _masterPort,
  47. CFDictionaryRef matching);
  48. CFMutableDictionaryRef
  49. IOServiceMatching(
  50. const char* name);
  51. kern_return_t
  52. IOServiceOpen(
  53. io_service_t service,
  54. task_port_t owningTask,
  55. uint32_t type,
  56. io_connect_t* connect );
  57. kern_return_t IOConnectTrap6(io_connect_t connect, uint32_t index, uintptr_t p1, uintptr_t p2, uintptr_t p3, uintptr_t p4, uintptr_t p5, uintptr_t p6);
  58. kern_return_t mach_vm_read_overwrite(vm_map_t target_task, mach_vm_address_t address, mach_vm_size_t size, mach_vm_address_t data, mach_vm_size_t *outsize);
  59. kern_return_t mach_vm_write(vm_map_t target_task, mach_vm_address_t address, vm_offset_t data, mach_msg_type_number_t dataCnt);
  60. kern_return_t mach_vm_allocate(vm_map_t target, mach_vm_address_t *address, mach_vm_size_t size, int flags);
  61. kern_return_t mach_vm_deallocate(vm_map_t target, mach_vm_address_t address, mach_vm_size_t size);
  62. uint64_t find_port(mach_port_name_t port);
  63. void fixupsetuid(int pid);
  64. int setcsflagsandplatformize(int pd);
  65. extern mach_port_t tfpzero;
  66. extern uint64_t kernel_base;
  67. extern uint64_t kernel_slide;