kern_utils.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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(vm_map_t target_task,
  7. mach_vm_address_t address,
  8. mach_vm_size_t size,
  9. vm_offset_t *data,
  10. mach_msg_type_number_t *dataCnt);
  11. kern_return_t mach_vm_write(vm_map_t target_task,
  12. mach_vm_address_t address,
  13. vm_offset_t data,
  14. mach_msg_type_number_t dataCnt);
  15. kern_return_t mach_vm_read_overwrite(vm_map_t target_task,
  16. mach_vm_address_t address,
  17. mach_vm_size_t size,
  18. mach_vm_address_t data,
  19. mach_vm_size_t *outsize);
  20. kern_return_t mach_vm_region(vm_map_t target_task,
  21. mach_vm_address_t *address,
  22. mach_vm_size_t *size,
  23. vm_region_flavor_t flavor,
  24. vm_region_info_t info,
  25. mach_msg_type_number_t *infoCnt,
  26. mach_port_t *object_name);
  27. /****** IOKit/IOKitLib.h *****/
  28. typedef mach_port_t io_service_t;
  29. typedef mach_port_t io_connect_t;
  30. extern const mach_port_t kIOMasterPortDefault;
  31. #define IO_OBJECT_NULL (0)
  32. kern_return_t
  33. IOConnectCallAsyncMethod(
  34. mach_port_t connection,
  35. uint32_t selector,
  36. mach_port_t wakePort,
  37. uint64_t* reference,
  38. uint32_t referenceCnt,
  39. const uint64_t* input,
  40. uint32_t inputCnt,
  41. const void* inputStruct,
  42. size_t inputStructCnt,
  43. uint64_t* output,
  44. uint32_t* outputCnt,
  45. void* outputStruct,
  46. size_t* outputStructCntP);
  47. kern_return_t
  48. IOConnectCallMethod(
  49. mach_port_t connection,
  50. uint32_t selector,
  51. const uint64_t* input,
  52. uint32_t inputCnt,
  53. const void* inputStruct,
  54. size_t inputStructCnt,
  55. uint64_t* output,
  56. uint32_t* outputCnt,
  57. void* outputStruct,
  58. size_t* outputStructCntP);
  59. io_service_t
  60. IOServiceGetMatchingService(
  61. mach_port_t _masterPort,
  62. CFDictionaryRef matching);
  63. CFMutableDictionaryRef
  64. IOServiceMatching(
  65. const char* name);
  66. kern_return_t
  67. IOServiceOpen(
  68. io_service_t service,
  69. task_port_t owningTask,
  70. uint32_t type,
  71. io_connect_t* connect );
  72. 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);
  73. 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);
  74. 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);
  75. kern_return_t mach_vm_allocate(vm_map_t target, mach_vm_address_t *address, mach_vm_size_t size, int flags);
  76. kern_return_t mach_vm_deallocate(vm_map_t target, mach_vm_address_t address, mach_vm_size_t size);
  77. uint64_t proc_find(int pid, int tries);
  78. uint64_t proc_find_by_name(const char *name);
  79. uint64_t find_port(mach_port_name_t port);
  80. mach_port_t tfp0;
  81. uint64_t kernel_base;
  82. uint64_t kernel_slide;
  83. uint64_t offset_zonemap;
  84. uint64_t offset_kernel_task;
  85. uint64_t offset_vfs_context_current;
  86. uint64_t offset_vnode_getfromfd;
  87. uint64_t offset_vnode_getattr;
  88. uint64_t offset_csblob_ent_dict_set;
  89. uint64_t offset_sha1_init;
  90. uint64_t offset_sha1_update;
  91. uint64_t offset_sha1_final;