小白问题]mach_vm_write写入指定地址失败,这个目的地址是执行段,不可写,如何修改这里的不可写属性为可写呢 ?谢谢
也可能是其他原因,写入失败,我猜测是不可写,帮忙分析下,谢谢
vm_protect
Function - Set access privilege attribute for a region of virtual memory.
SYNOPSIS
kern_return_t vm_protect
(vm_task_t target_task,
vm_address_t address,
vm_size_t size,
boolean_t set_maximum,
vm_prot_t new_protection);
PARAMETERS
target_task
[in task send right] The port for the task whose address space contains the region.
address
[in scalar] The starting address for the region.
size
[in scalar] The number of bytes in the region.
set_maximum
[in scalar] Maximum/current indicator. If true, the new protection sets the maximum protection for the region. If false, the new protection sets the current protection for the region. If the maximum protection is set below the current protection, the current protection is also reset to the new maximum.
new_protection
[in scalar] The new protection for the region. Valid values are obtained by or’ing together the following values:
VM_PROT_READ
Allows read access.
VM_PROT_WRITE
Allows write access.
VM_PROT_EXECUTE
Allows execute access.