16,551
社区成员
发帖
与我相关
我的任务
分享
这就被看穿了?
看MSDN可不够,文档描述并不清楚:比如VirtualProtect中有关lpAddress参数的描述:
lpAddress [in]
A pointer an address that describes the starting page of the region of pages whose access protection attributes are to be changed.
那么这个pointer究竟是在这个starting page中的“任意地址”还是“首地址(4906边界)”?
再看看VirtualQuery:
lpAddress [in, optional]
A pointer to the base address of the region of pages to be queried. This value is rounded down to the next page boundary.
它明确表示了你传入的地址会自动转换成该页的边界地址。所以你可以传入任意地址而不必手工转换成4096对齐的地址再调用。
但是VirtualProtect中的描述没有说是不是需要手工转换成4096边界地址才能操作。
印象中不用,任意地址都可以,但是确实忘了究竟是不是可以, 虽然证实很容易, 写一小片段代码就行了。
但是 ---- 懒惰,是人类文明不断发展的原因。
就当散分了。