Dmitry Timoshkov dmitry@baikal.ru writes:
Alexandre Julliard julliard@winehq.org wrote:
NtProtectVirtualMemory( NtCurrentProcess(), &protect_base,
&protect_size, PAGE_WRITECOPY, &protect_old );
&protect_size, PAGE_READWRITE, &protect_old );
Restoring the permissions is not going to work if it was already writable.
Do you mean that mprotect may fail or something else? Also, how is that different from what current code is doing? Do you suggest to check the old protection permissions before changing/restoring access with NtProtectVirtualMemory()?
What I mean is that if the old protection contains WRITECOPY, you won't be able to restore it correctly since you are going to make NtProtectVirtualMemory reject that.