I had a bugreport here: https://bugs.winehq.org/show_bug.cgi?id=56161
This pull req fixes the bug that programs that do VirtualAlloc(placeholder)/VirtualFree(keep placeholder)/MapViewOfFile3(replace placeholder), do not run. Like the dotnet pe loader in .net 7 for example.
It was not clear to me at first, because i didnt notice it on msdn, but the way that Dmitry Timoshkov "hacked" it in https://bugs.winehq.org/show_bug.cgi?id=56122 is actually exactly how it is supposed to happen according to msdn.
From here: https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-m... ![image](/uploads/58614927d38c15d4c23517aa5dc09d77/image.png)
So thanks to Dmitry Timoshkov. If you are interested you could also look into the thing i mentioned in the bug report, that MapViewOfFile3 doesn't round down to 64k, but, i don't think this is a serious problem yet.
-- v4: ntdll: Fix: Ignore alignment if MEM_REPLACE_PLACEHOLDER is set in flags
From: Felix Münchhalfenjan.felix.muenchhalfen@rwth-aachen.de
--- dlls/ntdll/unix/virtual.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index abe1b4dc4ec..2a53f56879e 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -5466,6 +5466,9 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p } #endif
+ if (alloc_type & MEM_REPLACE_PLACEHOLDER) + mask = page_mask; + if ((offset.u.LowPart & mask) || (*addr_ptr && ((UINT_PTR)*addr_ptr & mask))) return STATUS_MAPPED_ALIGNMENT;
@@ -5535,6 +5538,9 @@ NTSTATUS WINAPI NtMapViewOfSectionEx( HANDLE handle, HANDLE process, PVOID *addr } #endif
+ if (alloc_type & MEM_REPLACE_PLACEHOLDER) + mask = page_mask; + if ((offset.u.LowPart & mask) || (*addr_ptr && ((UINT_PTR)*addr_ptr & mask))) return STATUS_MAPPED_ALIGNMENT;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=141717
Your paranoid android.
=== debian11b (64 bit WoW report) ===
wininet: http.c:6820: Test failed: lpszSubjectInfo = winehq.org http.c:6821: Test failed: lpszIssuerInfo = US
On Wed Jan 10 21:27:50 2024 +0000, Felix Münchhalfen wrote:
I did another update of the code
Maybe you can build on the existing [NtMapViewOfSection tests](https://gitlab.winehq.org/wine/wine/-/blob/4054795ff199c3f65612f351a88daf17f...) and [MapViewOfFile tests](https://gitlab.winehq.org/wine/wine/-/blob/4054795ff199c3f65612f351a88daf17f...
On Wed Jan 10 21:48:19 2024 +0000, Alex Henrie wrote:
Maybe you can build on the existing [NtMapViewOfSection tests](https://gitlab.winehq.org/wine/wine/-/blob/4054795ff199c3f65612f351a88daf17f...) and [MapViewOfFile tests](https://gitlab.winehq.org/wine/wine/-/blob/4054795ff199c3f65612f351a88daf17f...
I am currently writing a test for memory.c in kernelbase.dll for this case. Just one sec =)