https://bugs.winehq.org/show_bug.cgi?id=47878
Bug ID: 47878 Summary: VirtualProtect across page boundaries does not work Product: Wine Version: unspecified Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: kernel32 Assignee: wine-bugs@winehq.org Reporter: c3210606@urhen.com Distribution: ---
Official VirtualProtect documentation states:
The size of the region whose access protection attributes are to be changed, in bytes. The region of affected pages includes all pages containing one or more bytes in the range from the lpAddress parameter to (lpAddress+dwSize). This means that a 2-byte range straddling a page boundary causes the protection attributes of both pages to be changed.
This however is not replicated in Wine as only the first page will have its protection changed and any pages after that resulting from the dwSize crossing the boundary will not be affected.
https://bugs.winehq.org/show_bug.cgi?id=47878
--- Comment #1 from Alexandre Julliard julliard@winehq.org --- Where do you see that? Do you have a test case?
https://bugs.winehq.org/show_bug.cgi?id=47878
--- Comment #2 from c3210606@urhen.com --- It's kinda hard to reproduce. Basically, I was trying to install Median XL Sigma mod over Diablo 2 and run it over Wine. It requires manually extracting the installer ( the installer itself doesn't work on wine ) and applying the file changes by myself. The mod works by hijacking a dll that is put aside the original exe and applying a list of patches to the binary. It works by running a VirtualProtect with 0x40 prot, doing WriteProcessMemory and running VirtualProtect with old prot. It crashes on only one patch which is applied to an offset ending with 0xFFD, and 4 bytes of size. I confirmed the bug by changing the patch to 0xFFC after which it started working flawlessly.
If needed, I can try and prepare the install for someone so you can reproduce.