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()?