6 #include <mach/vm_region.h>
9 const void* const funcs
[] = { &malloc
, &free
, &strcmp
, &printf
};
11 bool isReadOnly(const void* addr
)
14 vm_address_t testAddr
= (vm_address_t
)addr
;
16 vm_region_basic_info_data_64_t info
;
17 mach_msg_type_number_t len
= VM_REGION_BASIC_INFO_COUNT_64
;
18 kern_return_t err
= vm_region_64(mach_task_self(), &testAddr
, ®ionSize
, VM_REGION_BASIC_INFO_64
, (vm_region_info_t
)&info
, &len
, &objName
);
21 if ( info
.protection
& VM_PROT_WRITE
)
33 return isReadOnly(&funcs
[1]);
38 return isReadOnly(&funcs
[1]);