[PATCH 0/1] MR9804: ntdll: Allow region allocation for some non growable heaps.
Thanks to Bernhard Übelacker for debugging this issue. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55176 --- We could alternatively do this based on a Windows version check, but it doesn't seem very convenient and it's probably even harmless to allow allocations here, it's just not what any Windows version after Windows 95 does. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9804
From: Rémi Bernon <rbernon@codeweavers.com> Thanks to Bernhard Übelacker for debugging this issue. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55176 --- dlls/ntdll/heap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index b40b2d2ace8..e146d5783a4 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -977,8 +977,10 @@ static void *allocate_region( struct heap *heap, ULONG flags, SIZE_T *region_siz if (heap && !(flags & HEAP_GROWABLE)) { - WARN( "Heap %p isn't growable, cannot allocate %#Ix bytes\n", heap, *region_size ); - return NULL; + /* workaround for compatibility with Win95 for Wing Commander Secret Ops/Prophecy */ + BOOL compat = (flags & HEAP_NO_SERIALIZE) && sizeof(void *) == sizeof(int); + WARN( "Heap %p isn't growable, %s %#Ix bytes\n", heap, compat ? "forcing allocation" : "cannot allocate", *region_size ); + if (!compat) return NULL; } *region_size = ROUND_SIZE( *region_size, align - 1 ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9804
Maybe Windows version check would be actually better? Looks not particularly great to maintain WIn95 behaviour. The checks there probably make it less likely to regress things but it still can, and the checks are special to match the specific game behaviour, IMO it would be more straightforward to just check game .exe name or some PE header attribute? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9804#note_125912
I don't think that's something wine does in general. Maybe in the future when we have some compatibility database we can revisit this, but I don't think this specific set of conditions, and the fact that we are actually succeeding an allocation that otherwise fails is likely to break anything. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9804#note_125913
Also note how this is filled as a regression, so we were previously succeeding these allocations in all cases. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9804#note_125914
But we do occasionally Win version checks. Yes but it is old regression, so some things may in theory depend on this. But I don't think that exactly regressions are too much likely with those checks, it is just a behaviour which we can't back by tests, with inobvious condition, and we can't fix it if something starts depending on up to date behaviour without reintroducing that regression. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9804#note_125915
How does it work on WIndows, it doesn't, or has to be manually run in Win95 compat mode (or has that in compat DB)? FWIW previously in such cases we did Win version check, we have some handful of cases like that. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9804#note_125916
It doesn't work on Windows, unless Win95 compatibility mode is set too. I guess then perhaps using a Windows version check and requiring to manually change emulated Windows version for this application (which could eventually be set automatically in the future) is acceptable. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9804#note_125919
participants (3)
-
Paul Gofman (@gofman) -
Rémi Bernon -
Rémi Bernon (@rbernon)