You've already forked wine-staging
mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2025-04-13 14:42:51 -07:00
Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ca7fc8fb51 | ||
|
cc0df4cd1b | ||
|
8791ceb20d | ||
|
09808df495 | ||
|
9c995c8d8e | ||
|
b72829659d | ||
|
88ffa2bda8 | ||
|
2524bc48fe | ||
|
00ec1171cc | ||
|
277ed0c6fb | ||
|
0c2c469c7b | ||
|
7f36a96808 | ||
|
566a2bcdfd | ||
|
4eb322dc41 | ||
|
182d6c76e3 | ||
|
3e931ce80f |
@@ -1,29 +0,0 @@
|
||||
From ff117878cb3a0c74a50355ca64ac36c5fe6cee67 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Costa <titan.costa@gmail.com>
|
||||
Date: Fri, 10 Mar 2017 22:07:37 +0100
|
||||
Subject: ddraw: Silence noisy FIXME about unimplemented
|
||||
D3DPROCESSVERTICES_UPDATEEXTENTS.
|
||||
|
||||
---
|
||||
dlls/ddraw/executebuffer.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/ddraw/executebuffer.c b/dlls/ddraw/executebuffer.c
|
||||
index 393c52c1e2..9b64c687d3 100644
|
||||
--- a/dlls/ddraw/executebuffer.c
|
||||
+++ b/dlls/ddraw/executebuffer.c
|
||||
@@ -302,7 +302,10 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
|
||||
ci->wStart, ci->wDest, ci->dwCount, ci->dwFlags);
|
||||
|
||||
if (ci->dwFlags & D3DPROCESSVERTICES_UPDATEEXTENTS)
|
||||
- FIXME("D3DPROCESSVERTICES_UPDATEEXTENTS not implemented.\n");
|
||||
+ {
|
||||
+ static int once;
|
||||
+ if (!once++) FIXME("D3DPROCESSVERTICES_UPDATEEXTENTS not implemented.\n");
|
||||
+ }
|
||||
if (ci->dwFlags & D3DPROCESSVERTICES_NOCOLOR)
|
||||
FIXME("D3DPROCESSVERTICES_NOCOLOR not implemented.\n");
|
||||
|
||||
--
|
||||
2.11.0
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From 4e5fabb55f5ef955074cdab6db875e6d32592c2d Mon Sep 17 00:00:00 2001
|
||||
From 612c0266b7a8cec562f82f1a2aaf55cffc15f35e Mon Sep 17 00:00:00 2001
|
||||
From: Zebediah Figura <z.figura12@gmail.com>
|
||||
Date: Wed, 21 Oct 2020 16:03:21 -0500
|
||||
Subject: [PATCH] winegstreamer: Allow videoconvert to parallelize.
|
||||
@@ -11,12 +11,12 @@ Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c
|
||||
index 2fa87ac611b..d2f682df281 100644
|
||||
index dfb3da9a4ab..2135dea456b 100644
|
||||
--- a/dlls/winegstreamer/wg_parser.c
|
||||
+++ b/dlls/winegstreamer/wg_parser.c
|
||||
@@ -812,6 +812,9 @@ static void pad_added_cb(GstElement *element, GstPad *pad, gpointer user)
|
||||
@@ -842,6 +842,9 @@ static bool stream_create_post_processing_elements(struct wg_parser_stream *stre
|
||||
|| !append_element(parser->container, element, &first, &last))
|
||||
goto out;
|
||||
return false;
|
||||
|
||||
+ /* Let GStreamer choose a default number of threads. */
|
||||
+ gst_util_set_object_arg(G_OBJECT(element), "n-threads", "0");
|
||||
|
@@ -1,35 +1,26 @@
|
||||
From ca64589b2447f378651f19eb15672f27c2133493 Mon Sep 17 00:00:00 2001
|
||||
From 7d0af0dc23f87241726af6f7c48f47df441503a6 Mon Sep 17 00:00:00 2001
|
||||
From: Derek Lesho <dlesho@codeweavers.com>
|
||||
Date: Fri, 19 Mar 2021 17:01:54 -0400
|
||||
Subject: [PATCH] winegstreamer: Report streams backwards in media source.
|
||||
|
||||
Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
|
||||
---
|
||||
dlls/winegstreamer/media_source.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
dlls/winegstreamer/media_source.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
|
||||
index 1b57d8bfba8..4d2a29a6bc1 100644
|
||||
index 335b617becd..e6117fd0090 100644
|
||||
--- a/dlls/winegstreamer/media_source.c
|
||||
+++ b/dlls/winegstreamer/media_source.c
|
||||
@@ -1497,7 +1497,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
|
||||
DWORD len;
|
||||
char *str;
|
||||
|
||||
- IMFMediaStream_GetStreamDescriptor(&object->streams[i]->IMFMediaStream_iface, &descriptors[i]);
|
||||
+ IMFMediaStream_GetStreamDescriptor(&object->streams[i]->IMFMediaStream_iface, &descriptors[object->stream_count - 1 - i]);
|
||||
|
||||
for (j = 0; j < ARRAY_SIZE(tags); ++j)
|
||||
{
|
||||
@@ -1510,7 +1510,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
|
||||
@@ -1604,7 +1604,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
|
||||
}
|
||||
strW = malloc(len * sizeof(*strW));
|
||||
if (MultiByteToWideChar(CP_UTF8, 0, str, -1, strW, len))
|
||||
- IMFStreamDescriptor_SetString(descriptors[i], tags[j].mf_attr, strW);
|
||||
+ IMFStreamDescriptor_SetString(descriptors[object->stream_count - 1 - i], tags[j].mf_attr, strW);
|
||||
- IMFStreamDescriptor_SetString(object->descriptors[i], tags[j].mf_attr, strW);
|
||||
+ IMFStreamDescriptor_SetString(object->descriptors[object->stream_count - 1 - i], tags[j].mf_attr, strW);
|
||||
free(strW);
|
||||
free(str);
|
||||
}
|
||||
--
|
||||
2.40.0
|
||||
2.40.1
|
||||
|
||||
|
@@ -1 +1,2 @@
|
||||
Fixes: [49692] Multiple applications need a Media Foundation media source implementation
|
||||
Disabled: True
|
||||
|
@@ -1,3 +1,4 @@
|
||||
Fixes: [48175] AION (64 bit) - crashes in crysystem.dll.CryFree() due to high memory pointers allocated
|
||||
Fixes: [46568] 64-bit msxml6.dll from Microsoft Core XML Services 6.0 redist package fails to load (Wine doesn't respect 44-bit user-mode VA limitation from Windows < 8.1)
|
||||
Depends: ntdll-Placeholders
|
||||
Disabled: True
|
||||
|
@@ -1,105 +0,0 @@
|
||||
From 7c13335d926a1b47f7cf88065d641c4d5fa80a59 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Fri, 11 Nov 2022 17:51:26 -0600
|
||||
Subject: [PATCH] ntdll/tests: Add tests for freeing a part of view.
|
||||
|
||||
---
|
||||
dlls/ntdll/tests/virtual.c | 70 ++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 67 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c
|
||||
index 6831fe3c522..8e94566fb7f 100644
|
||||
--- a/dlls/ntdll/tests/virtual.c
|
||||
+++ b/dlls/ntdll/tests/virtual.c
|
||||
@@ -1639,21 +1639,85 @@ static void test_syscalls(void)
|
||||
|
||||
static void test_NtFreeVirtualMemory(void)
|
||||
{
|
||||
+ void *addr1, *addr;
|
||||
NTSTATUS status;
|
||||
- void *addr1;
|
||||
SIZE_T size;
|
||||
|
||||
size = 0x10000;
|
||||
addr1 = NULL;
|
||||
- status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr1, 0, &size, MEM_RESERVE, PAGE_READWRITE);
|
||||
+ status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr1, 0, &size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
|
||||
ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
|
||||
size = 0;
|
||||
status = NtFreeVirtualMemory(NULL, &addr1, &size, MEM_RELEASE);
|
||||
ok(status == STATUS_INVALID_HANDLE, "Unexpected status %08lx.\n", status);
|
||||
|
||||
+ addr = (char *)addr1 + 0x1000;
|
||||
+ size = 0;
|
||||
+ status = NtFreeVirtualMemory(NtCurrentProcess(), &addr, &size, MEM_RELEASE);
|
||||
+ ok(status == STATUS_FREE_VM_NOT_AT_BASE, "Unexpected status %08lx.\n", status);
|
||||
+
|
||||
+ size = 0x11000;
|
||||
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr1, &size, MEM_RELEASE);
|
||||
- ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
+ todo_wine ok(status == STATUS_UNABLE_TO_FREE_VM, "Unexpected status %08lx.\n", status);
|
||||
+
|
||||
+ addr = (char *)addr1 + 0x1001;
|
||||
+ size = 0xffff;
|
||||
+ status = NtFreeVirtualMemory(NtCurrentProcess(), &addr, &size, MEM_RELEASE);
|
||||
+ todo_wine ok(status == STATUS_UNABLE_TO_FREE_VM, "Unexpected status %08lx.\n", status);
|
||||
+ ok(size == 0xffff, "Unexpected size %p.\n", (void *)size);
|
||||
+ ok(addr == (char *)addr1 + 0x1001, "Got addr %p, addr1 %p.\n", addr, addr1);
|
||||
+
|
||||
+ size = 0xfff;
|
||||
+ addr = (char *)addr1 + 0x1001;
|
||||
+ status = NtFreeVirtualMemory(NtCurrentProcess(), &addr, &size, MEM_RELEASE);
|
||||
+ todo_wine ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
+ *(volatile char *)addr1 = 1;
|
||||
+ *((volatile char *)addr1 + 0x2000) = 1;
|
||||
+ todo_wine ok(size == 0x1000, "Unexpected size %p.\n", (void *)size);
|
||||
+ todo_wine ok(addr == (char *)addr1 + 0x1000, "Got addr %p, addr1 %p.\n", addr, addr1);
|
||||
+
|
||||
+ size = 0xfff;
|
||||
+ addr = (char *)addr1 + 1;
|
||||
+ status = NtFreeVirtualMemory(NtCurrentProcess(), &addr, &size, MEM_RELEASE);
|
||||
+ todo_wine ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
+ *((volatile char *)addr1 + 0x2000) = 1;
|
||||
+ todo_wine ok(size == 0x1000, "Unexpected size %p.\n", (void *)size);
|
||||
+ todo_wine ok(addr == addr1, "Got addr %p, addr1 %p.\n", addr, addr1);
|
||||
+
|
||||
+ size = 0x1000;
|
||||
+ addr = addr1;
|
||||
+ status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr, 0, &size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
|
||||
+ todo_wine ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
+ ok(addr == addr1, "Unexpected addr %p, addr1 %p.\n", addr, addr1);
|
||||
+ ok(size == 0x1000, "Unexpected size %p.\n", (void *)size);
|
||||
+
|
||||
+ size = 0x10000;
|
||||
+ status = NtFreeVirtualMemory(NtCurrentProcess(), &addr1, &size, MEM_DECOMMIT);
|
||||
+ todo_wine ok(status == STATUS_UNABLE_TO_FREE_VM, "Unexpected status %08lx.\n", status);
|
||||
+
|
||||
+ size = 0x10000;
|
||||
+ status = NtFreeVirtualMemory(NtCurrentProcess(), &addr1, &size, MEM_RELEASE);
|
||||
+ todo_wine ok(status == STATUS_UNABLE_TO_FREE_VM, "Unexpected status %08lx.\n", status);
|
||||
+
|
||||
+ size = 0;
|
||||
+ addr = (char *)addr1 + 0x1000;
|
||||
+ status = NtFreeVirtualMemory(NtCurrentProcess(), &addr, &size, MEM_RELEASE);
|
||||
+ todo_wine ok(status == STATUS_MEMORY_NOT_ALLOCATED, "Unexpected status %08lx.\n", status);
|
||||
+
|
||||
+ size = 0x1000;
|
||||
+ addr = (char *)addr1 + 0x1000;
|
||||
+ status = NtFreeVirtualMemory(NtCurrentProcess(), &addr, &size, MEM_DECOMMIT);
|
||||
+ todo_wine ok(status == STATUS_MEMORY_NOT_ALLOCATED, "Unexpected status %08lx.\n", status);
|
||||
+
|
||||
+ size = 0;
|
||||
+ addr = (char *)addr1 + 0x2000;
|
||||
+ status = NtFreeVirtualMemory(NtCurrentProcess(), &addr, &size, MEM_RELEASE);
|
||||
+ todo_wine ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
+
|
||||
+ size = 0x1000;
|
||||
+ status = NtFreeVirtualMemory(NtCurrentProcess(), &addr1, &size, MEM_RELEASE);
|
||||
+ todo_wine ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
}
|
||||
|
||||
static void test_prefetch(void)
|
||||
--
|
||||
2.38.1
|
||||
|
@@ -1,30 +0,0 @@
|
||||
From bc937422e5f600be650e21de5f6c9b8656d5c23c Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Fri, 11 Nov 2022 17:56:42 -0600
|
||||
Subject: [PATCH] kernelbase: Validate nonzero size for MEM_RELEASE in
|
||||
VirtualFreeEx().
|
||||
|
||||
---
|
||||
dlls/kernelbase/memory.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/dlls/kernelbase/memory.c b/dlls/kernelbase/memory.c
|
||||
index 2a503587e93..c01fe817972 100644
|
||||
--- a/dlls/kernelbase/memory.c
|
||||
+++ b/dlls/kernelbase/memory.c
|
||||
@@ -447,6 +447,12 @@ BOOL WINAPI DECLSPEC_HOTPATCH VirtualFree( void *addr, SIZE_T size, DWORD type )
|
||||
*/
|
||||
BOOL WINAPI DECLSPEC_HOTPATCH VirtualFreeEx( HANDLE process, void *addr, SIZE_T size, DWORD type )
|
||||
{
|
||||
+ if (type == MEM_RELEASE && size)
|
||||
+ {
|
||||
+ WARN( "Trying to release memory with specified size.\n" );
|
||||
+ SetLastError( ERROR_INVALID_PARAMETER );
|
||||
+ return FALSE;
|
||||
+ }
|
||||
return set_ntstatus( NtFreeVirtualMemory( process, &addr, &size, type ));
|
||||
}
|
||||
|
||||
--
|
||||
2.38.1
|
||||
|
@@ -1,117 +0,0 @@
|
||||
From 22dc17764c3b231ebd226e479686a00c7aaaf01a Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Fri, 11 Nov 2022 18:12:47 -0600
|
||||
Subject: [PATCH] ntdll: Fix size validation in NtFreeVirtualMemory().
|
||||
|
||||
---
|
||||
dlls/ntdll/tests/virtual.c | 16 ++++++++--------
|
||||
dlls/ntdll/unix/virtual.c | 26 ++++++++++++++++++--------
|
||||
2 files changed, 26 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c
|
||||
index 8e94566fb7f..81e9bd0bda3 100644
|
||||
--- a/dlls/ntdll/tests/virtual.c
|
||||
+++ b/dlls/ntdll/tests/virtual.c
|
||||
@@ -1659,12 +1659,12 @@ static void test_NtFreeVirtualMemory(void)
|
||||
|
||||
size = 0x11000;
|
||||
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr1, &size, MEM_RELEASE);
|
||||
- todo_wine ok(status == STATUS_UNABLE_TO_FREE_VM, "Unexpected status %08lx.\n", status);
|
||||
+ ok(status == STATUS_UNABLE_TO_FREE_VM, "Unexpected status %08lx.\n", status);
|
||||
|
||||
addr = (char *)addr1 + 0x1001;
|
||||
size = 0xffff;
|
||||
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr, &size, MEM_RELEASE);
|
||||
- todo_wine ok(status == STATUS_UNABLE_TO_FREE_VM, "Unexpected status %08lx.\n", status);
|
||||
+ ok(status == STATUS_UNABLE_TO_FREE_VM, "Unexpected status %08lx.\n", status);
|
||||
ok(size == 0xffff, "Unexpected size %p.\n", (void *)size);
|
||||
ok(addr == (char *)addr1 + 0x1001, "Got addr %p, addr1 %p.\n", addr, addr1);
|
||||
|
||||
@@ -1674,16 +1674,16 @@ static void test_NtFreeVirtualMemory(void)
|
||||
todo_wine ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
*(volatile char *)addr1 = 1;
|
||||
*((volatile char *)addr1 + 0x2000) = 1;
|
||||
- todo_wine ok(size == 0x1000, "Unexpected size %p.\n", (void *)size);
|
||||
- todo_wine ok(addr == (char *)addr1 + 0x1000, "Got addr %p, addr1 %p.\n", addr, addr1);
|
||||
+ ok(size == 0x1000, "Unexpected size %p.\n", (void *)size);
|
||||
+ ok(addr == (char *)addr1 + 0x1000, "Got addr %p, addr1 %p.\n", addr, addr1);
|
||||
|
||||
size = 0xfff;
|
||||
addr = (char *)addr1 + 1;
|
||||
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr, &size, MEM_RELEASE);
|
||||
todo_wine ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
*((volatile char *)addr1 + 0x2000) = 1;
|
||||
- todo_wine ok(size == 0x1000, "Unexpected size %p.\n", (void *)size);
|
||||
- todo_wine ok(addr == addr1, "Got addr %p, addr1 %p.\n", addr, addr1);
|
||||
+ ok(size == 0x1000, "Unexpected size %p.\n", (void *)size);
|
||||
+ ok(addr == addr1, "Got addr %p, addr1 %p.\n", addr, addr1);
|
||||
|
||||
size = 0x1000;
|
||||
addr = addr1;
|
||||
@@ -1703,12 +1703,12 @@ static void test_NtFreeVirtualMemory(void)
|
||||
size = 0;
|
||||
addr = (char *)addr1 + 0x1000;
|
||||
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr, &size, MEM_RELEASE);
|
||||
- todo_wine ok(status == STATUS_MEMORY_NOT_ALLOCATED, "Unexpected status %08lx.\n", status);
|
||||
+ ok(status == STATUS_MEMORY_NOT_ALLOCATED, "Unexpected status %08lx.\n", status);
|
||||
|
||||
size = 0x1000;
|
||||
addr = (char *)addr1 + 0x1000;
|
||||
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr, &size, MEM_DECOMMIT);
|
||||
- todo_wine ok(status == STATUS_MEMORY_NOT_ALLOCATED, "Unexpected status %08lx.\n", status);
|
||||
+ ok(status == STATUS_MEMORY_NOT_ALLOCATED, "Unexpected status %08lx.\n", status);
|
||||
|
||||
size = 0;
|
||||
addr = (char *)addr1 + 0x2000;
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index 24d5a4e2da8..4cb0f349ffc 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -4127,26 +4127,36 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *si
|
||||
if (addr == (void *)1 && !size && type == MEM_RELEASE) virtual_release_address_space();
|
||||
else status = STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
- else if (!(view = find_view( base, size )) || !is_view_valloc( view ))
|
||||
- {
|
||||
- status = STATUS_INVALID_PARAMETER;
|
||||
- }
|
||||
+ else if (!(view = find_view( base, 0 ))) status = STATUS_MEMORY_NOT_ALLOCATED;
|
||||
+ else if (!is_view_valloc( view )) status = STATUS_INVALID_PARAMETER;
|
||||
else if (type == MEM_RELEASE)
|
||||
{
|
||||
/* Free the pages */
|
||||
|
||||
- if (size) status = STATUS_INVALID_PARAMETER;
|
||||
- else if (base != view->base) status = STATUS_FREE_VM_NOT_AT_BASE;
|
||||
+ if (size && (char *)view->base + view->size - base < size) status = STATUS_UNABLE_TO_FREE_VM;
|
||||
+ else if (!size && base != view->base) status = STATUS_FREE_VM_NOT_AT_BASE;
|
||||
else
|
||||
{
|
||||
+ if (!size) size = view->size;
|
||||
+
|
||||
+ if (size == view->size)
|
||||
+ {
|
||||
+ assert( base == view->base );
|
||||
+ delete_view( view );
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ FIXME( "Parial view release is not supported.\n" );
|
||||
+ status = STATUS_INVALID_PARAMETER;
|
||||
+ }
|
||||
*addr_ptr = base;
|
||||
- *size_ptr = view->size;
|
||||
- delete_view( view );
|
||||
+ *size_ptr = size;
|
||||
}
|
||||
}
|
||||
else if (type == MEM_DECOMMIT)
|
||||
{
|
||||
if (!size && base != view->base) status = STATUS_FREE_VM_NOT_AT_BASE;
|
||||
+ else if (base - (char *)view->base + size > view->size) status = STATUS_UNABLE_TO_FREE_VM;
|
||||
else status = decommit_pages( view, base - (char *)view->base, size );
|
||||
if (status == STATUS_SUCCESS)
|
||||
{
|
||||
--
|
||||
2.38.1
|
||||
|
@@ -1,81 +0,0 @@
|
||||
From c97697f6bbc3c9671210e480f2fcfe761b54893d Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Fri, 11 Nov 2022 18:30:20 -0600
|
||||
Subject: [PATCH] ntdll: Fully support unaligned views in free ranges
|
||||
management.
|
||||
|
||||
---
|
||||
dlls/ntdll/unix/virtual.c | 41 ++++++++++++++++++++-------------------
|
||||
1 file changed, 21 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index 4cb0f349ffc..2dca5dfa45f 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -749,18 +749,19 @@ static void free_ranges_insert_view( struct file_view *view )
|
||||
assert( range != free_ranges_end );
|
||||
assert( range->end > view_base || next != free_ranges_end );
|
||||
|
||||
- /* this happens because virtual_alloc_thread_stack shrinks a view, then creates another one on top,
|
||||
- * or because AT_ROUND_TO_PAGE was used with NtMapViewOfSection to force 4kB aligned mapping. */
|
||||
- if ((range->end > view_base && range->base >= view_end) ||
|
||||
- (range->end == view_base && next->base >= view_end))
|
||||
- {
|
||||
- /* on Win64, assert that it's correctly aligned so we're not going to be in trouble later */
|
||||
-#ifdef _WIN64
|
||||
- assert( view->base == view_base );
|
||||
-#endif
|
||||
- WARN( "range %p - %p is already mapped\n", view_base, view_end );
|
||||
+ /* Free ranges addresses are aligned at granularity_mask while the views may be not. */
|
||||
+
|
||||
+ if (range->base > view_base)
|
||||
+ view_base = range->base;
|
||||
+ if (range->end < view_end)
|
||||
+ view_end = range->end;
|
||||
+ if (range->end == view_base && next->base >= view_end)
|
||||
+ view_end = view_base;
|
||||
+
|
||||
+ TRACE( "%p - %p, aligned %p - %p.\n", view->base, (char *)view->base + view->size, view_base, view_end );
|
||||
+
|
||||
+ if (view_end <= view_base)
|
||||
return;
|
||||
- }
|
||||
|
||||
/* this should never happen */
|
||||
if (range->base > view_base || range->end < view_end)
|
||||
@@ -810,9 +811,7 @@ static void free_ranges_remove_view( struct file_view *view )
|
||||
struct range_entry *range = free_ranges_lower_bound( view_base );
|
||||
struct range_entry *next = range + 1;
|
||||
|
||||
- /* It's possible to use AT_ROUND_TO_PAGE on 32bit with NtMapViewOfSection to force 4kB alignment,
|
||||
- * and this breaks our assumptions. Look at the views around to check if the range is still in use. */
|
||||
-#ifndef _WIN64
|
||||
+ /* Free ranges addresses are aligned at granularity_mask while the views may be not. */
|
||||
struct file_view *prev_view = RB_ENTRY_VALUE( rb_prev( &view->entry ), struct file_view, entry );
|
||||
struct file_view *next_view = RB_ENTRY_VALUE( rb_next( &view->entry ), struct file_view, entry );
|
||||
void *prev_view_base = prev_view ? ROUND_ADDR( prev_view->base, granularity_mask ) : NULL;
|
||||
@@ -820,13 +819,15 @@ static void free_ranges_remove_view( struct file_view *view )
|
||||
void *next_view_base = next_view ? ROUND_ADDR( next_view->base, granularity_mask ) : NULL;
|
||||
void *next_view_end = next_view ? ROUND_ADDR( (char *)next_view->base + next_view->size + granularity_mask, granularity_mask ) : NULL;
|
||||
|
||||
- if ((prev_view_base < view_end && prev_view_end > view_base) ||
|
||||
- (next_view_base < view_end && next_view_end > view_base))
|
||||
- {
|
||||
- WARN( "range %p - %p is still mapped\n", view_base, view_end );
|
||||
+ if (prev_view_end && prev_view_end > view_base && prev_view_base < view_end)
|
||||
+ view_base = prev_view_end;
|
||||
+ if (next_view_base && next_view_base < view_end && next_view_end > view_base)
|
||||
+ view_end = next_view_base;
|
||||
+
|
||||
+ TRACE( "%p - %p, aligned %p - %p.\n", view->base, (char *)view->base + view->size, view_base, view_end );
|
||||
+
|
||||
+ if (view_end <= view_base)
|
||||
return;
|
||||
- }
|
||||
-#endif
|
||||
|
||||
/* free_ranges initial value is such that the view is either inside range or before another one. */
|
||||
assert( range != free_ranges_end );
|
||||
--
|
||||
2.38.1
|
||||
|
@@ -1,85 +0,0 @@
|
||||
From 4baf5566da8495ef3b260783ed88f175e43b4f70 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Fri, 11 Nov 2022 18:37:43 -0600
|
||||
Subject: [PATCH] ntdll: Factor out some view manipulation functions.
|
||||
|
||||
---
|
||||
dlls/ntdll/unix/virtual.c | 47 +++++++++++++++++++++++++++++++++------
|
||||
1 file changed, 40 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index 2dca5dfa45f..bdc410472ec 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -1563,6 +1563,31 @@ static struct file_view *alloc_view(void)
|
||||
}
|
||||
|
||||
|
||||
+/***********************************************************************
|
||||
+ * free_view
|
||||
+ *
|
||||
+ * Free memory for view structure. virtual_mutex must be held by caller.
|
||||
+ */
|
||||
+static void free_view( struct file_view *view )
|
||||
+{
|
||||
+ *(struct file_view **)view = next_free_view;
|
||||
+ next_free_view = view;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/***********************************************************************
|
||||
+ * unregister_view
|
||||
+ *
|
||||
+ * Remove view from the tree and update free ranges. virtual_mutex must be held by caller.
|
||||
+ */
|
||||
+static void unregister_view( struct file_view *view )
|
||||
+{
|
||||
+ if (mmap_is_in_reserved_area( view->base, view->size ))
|
||||
+ free_ranges_remove_view( view );
|
||||
+ wine_rb_remove( &views_tree, &view->entry );
|
||||
+}
|
||||
+
|
||||
+
|
||||
/***********************************************************************
|
||||
* delete_view
|
||||
*
|
||||
@@ -1572,11 +1597,21 @@ static void delete_view( struct file_view *view ) /* [in] View */
|
||||
{
|
||||
if (!(view->protect & VPROT_SYSTEM)) unmap_area( view->base, view->size );
|
||||
set_page_vprot( view->base, view->size, 0 );
|
||||
+ unregister_view( view );
|
||||
+ free_view( view );
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/***********************************************************************
|
||||
+ * register_view
|
||||
+ *
|
||||
+ * Add view to the tree and update free ranges. virtual_mutex must be held by caller.
|
||||
+ */
|
||||
+static void register_view( struct file_view *view )
|
||||
+{
|
||||
+ wine_rb_put( &views_tree, view->base, &view->entry );
|
||||
if (mmap_is_in_reserved_area( view->base, view->size ))
|
||||
- free_ranges_remove_view( view );
|
||||
- wine_rb_remove( &views_tree, &view->entry );
|
||||
- *(struct file_view **)view = next_free_view;
|
||||
- next_free_view = view;
|
||||
+ free_ranges_insert_view( view );
|
||||
}
|
||||
|
||||
|
||||
@@ -1620,9 +1655,7 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz
|
||||
view->protect = vprot;
|
||||
set_page_vprot( base, size, vprot );
|
||||
|
||||
- wine_rb_put( &views_tree, view->base, &view->entry );
|
||||
- if (mmap_is_in_reserved_area( view->base, view->size ))
|
||||
- free_ranges_insert_view( view );
|
||||
+ register_view( view );
|
||||
|
||||
*view_ret = view;
|
||||
|
||||
--
|
||||
2.38.1
|
||||
|
@@ -1,123 +0,0 @@
|
||||
From 261ba5e0003f13c83f9f08e5b3931862586f46d3 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Fri, 11 Nov 2022 18:41:50 -0600
|
||||
Subject: [PATCH] ntdll: Support partial view release in NtFreeVirtualMemory().
|
||||
|
||||
---
|
||||
dlls/ntdll/tests/virtual.c | 14 ++++++-------
|
||||
dlls/ntdll/unix/virtual.c | 42 ++++++++++++++++++++++++++++++++++++--
|
||||
2 files changed, 47 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c
|
||||
index 81e9bd0bda3..0dccb35bd27 100644
|
||||
--- a/dlls/ntdll/tests/virtual.c
|
||||
+++ b/dlls/ntdll/tests/virtual.c
|
||||
@@ -1671,7 +1671,7 @@ static void test_NtFreeVirtualMemory(void)
|
||||
size = 0xfff;
|
||||
addr = (char *)addr1 + 0x1001;
|
||||
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr, &size, MEM_RELEASE);
|
||||
- todo_wine ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
+ ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
*(volatile char *)addr1 = 1;
|
||||
*((volatile char *)addr1 + 0x2000) = 1;
|
||||
ok(size == 0x1000, "Unexpected size %p.\n", (void *)size);
|
||||
@@ -1680,7 +1680,7 @@ static void test_NtFreeVirtualMemory(void)
|
||||
size = 0xfff;
|
||||
addr = (char *)addr1 + 1;
|
||||
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr, &size, MEM_RELEASE);
|
||||
- todo_wine ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
+ ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
*((volatile char *)addr1 + 0x2000) = 1;
|
||||
ok(size == 0x1000, "Unexpected size %p.\n", (void *)size);
|
||||
ok(addr == addr1, "Got addr %p, addr1 %p.\n", addr, addr1);
|
||||
@@ -1688,17 +1688,17 @@ static void test_NtFreeVirtualMemory(void)
|
||||
size = 0x1000;
|
||||
addr = addr1;
|
||||
status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr, 0, &size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
|
||||
- todo_wine ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
+ ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
ok(addr == addr1, "Unexpected addr %p, addr1 %p.\n", addr, addr1);
|
||||
ok(size == 0x1000, "Unexpected size %p.\n", (void *)size);
|
||||
|
||||
size = 0x10000;
|
||||
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr1, &size, MEM_DECOMMIT);
|
||||
- todo_wine ok(status == STATUS_UNABLE_TO_FREE_VM, "Unexpected status %08lx.\n", status);
|
||||
+ ok(status == STATUS_UNABLE_TO_FREE_VM, "Unexpected status %08lx.\n", status);
|
||||
|
||||
size = 0x10000;
|
||||
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr1, &size, MEM_RELEASE);
|
||||
- todo_wine ok(status == STATUS_UNABLE_TO_FREE_VM, "Unexpected status %08lx.\n", status);
|
||||
+ ok(status == STATUS_UNABLE_TO_FREE_VM, "Unexpected status %08lx.\n", status);
|
||||
|
||||
size = 0;
|
||||
addr = (char *)addr1 + 0x1000;
|
||||
@@ -1713,11 +1713,11 @@ static void test_NtFreeVirtualMemory(void)
|
||||
size = 0;
|
||||
addr = (char *)addr1 + 0x2000;
|
||||
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr, &size, MEM_RELEASE);
|
||||
- todo_wine ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
+ ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
|
||||
size = 0x1000;
|
||||
status = NtFreeVirtualMemory(NtCurrentProcess(), &addr1, &size, MEM_RELEASE);
|
||||
- todo_wine ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
+ ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
}
|
||||
|
||||
static void test_prefetch(void)
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index bdc410472ec..5775287cd19 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -4180,8 +4180,46 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *si
|
||||
}
|
||||
else
|
||||
{
|
||||
- FIXME( "Parial view release is not supported.\n" );
|
||||
- status = STATUS_INVALID_PARAMETER;
|
||||
+ struct file_view *new_view = NULL;
|
||||
+
|
||||
+ if (view->base != base && base + size != (char *)view->base + view->size
|
||||
+ && !(new_view = alloc_view()))
|
||||
+ {
|
||||
+ ERR( "out of memory for %p-%p\n", base, (char *)base + size );
|
||||
+ return STATUS_NO_MEMORY;
|
||||
+ }
|
||||
+ unregister_view( view );
|
||||
+
|
||||
+ if (new_view)
|
||||
+ {
|
||||
+ new_view->base = base + size;
|
||||
+ new_view->size = (char *)view->base + view->size - (char *)new_view->base;
|
||||
+ new_view->protect = view->protect;
|
||||
+
|
||||
+ view->size = base - (char *)view->base;
|
||||
+ register_view( view );
|
||||
+ register_view( new_view );
|
||||
+
|
||||
+ VIRTUAL_DEBUG_DUMP_VIEW( view );
|
||||
+ VIRTUAL_DEBUG_DUMP_VIEW( new_view );
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (view->base == base)
|
||||
+ {
|
||||
+ view->base = base + size;
|
||||
+ view->size -= size;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ view->size = base - (char *)view->base;
|
||||
+ }
|
||||
+ register_view( view );
|
||||
+ VIRTUAL_DEBUG_DUMP_VIEW( view );
|
||||
+ }
|
||||
+
|
||||
+ set_page_vprot( base, size, 0 );
|
||||
+ unmap_area( base, size );
|
||||
}
|
||||
*addr_ptr = base;
|
||||
*size_ptr = size;
|
||||
--
|
||||
2.38.1
|
||||
|
@@ -1,99 +0,0 @@
|
||||
From aa5b49a7893ddb97b11251c65506d242e2e160f9 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Tue, 4 Oct 2022 20:26:39 -0500
|
||||
Subject: [PATCH] ntdll: Add logging for free ranges.
|
||||
|
||||
---
|
||||
dlls/ntdll/unix/virtual.c | 25 +++++++++++++++++++++----
|
||||
1 file changed, 21 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index 5775287cd19..7142d2adf79 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -76,6 +76,7 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(virtual);
|
||||
WINE_DECLARE_DEBUG_CHANNEL(module);
|
||||
+WINE_DECLARE_DEBUG_CHANNEL(virtual_ranges);
|
||||
|
||||
struct preload_info
|
||||
{
|
||||
@@ -186,6 +187,7 @@ static struct list teb_list = LIST_INIT( teb_list );
|
||||
#define ROUND_SIZE(addr,size) (((SIZE_T)(size) + ((UINT_PTR)(addr) & page_mask) + page_mask) & ~page_mask)
|
||||
|
||||
#define VIRTUAL_DEBUG_DUMP_VIEW(view) do { if (TRACE_ON(virtual)) dump_view(view); } while (0)
|
||||
+#define VIRTUAL_DEBUG_DUMP_RANGES() do { if (TRACE_ON(virtual_ranges)) dump_free_ranges(); } while (0)
|
||||
|
||||
#ifndef MAP_NORESERVE
|
||||
#define MAP_NORESERVE 0
|
||||
@@ -732,6 +734,12 @@ static struct range_entry *free_ranges_lower_bound( void *addr )
|
||||
return begin;
|
||||
}
|
||||
|
||||
+static void dump_free_ranges(void)
|
||||
+{
|
||||
+ struct range_entry *r;
|
||||
+ for (r = free_ranges; r != free_ranges_end; ++r)
|
||||
+ TRACE_(virtual_ranges)("%p - %p.\n", r->base, r->end);
|
||||
+}
|
||||
|
||||
/***********************************************************************
|
||||
* free_ranges_insert_view
|
||||
@@ -761,7 +769,10 @@ static void free_ranges_insert_view( struct file_view *view )
|
||||
TRACE( "%p - %p, aligned %p - %p.\n", view->base, (char *)view->base + view->size, view_base, view_end );
|
||||
|
||||
if (view_end <= view_base)
|
||||
+ {
|
||||
+ VIRTUAL_DEBUG_DUMP_RANGES();
|
||||
return;
|
||||
+ }
|
||||
|
||||
/* this should never happen */
|
||||
if (range->base > view_base || range->end < view_end)
|
||||
@@ -789,16 +800,19 @@ static void free_ranges_insert_view( struct file_view *view )
|
||||
else
|
||||
range->base = view_end;
|
||||
|
||||
- if (range->base < range->end) return;
|
||||
-
|
||||
+ if (range->base < range->end)
|
||||
+ {
|
||||
+ VIRTUAL_DEBUG_DUMP_RANGES();
|
||||
+ return;
|
||||
+ }
|
||||
/* and possibly remove it if it's now empty */
|
||||
memmove( range, next, (free_ranges_end - next) * sizeof(struct range_entry) );
|
||||
free_ranges_end -= 1;
|
||||
assert( free_ranges_end - free_ranges > 0 );
|
||||
}
|
||||
+ VIRTUAL_DEBUG_DUMP_RANGES();
|
||||
}
|
||||
|
||||
-
|
||||
/***********************************************************************
|
||||
* free_ranges_remove_view
|
||||
*
|
||||
@@ -827,8 +841,10 @@ static void free_ranges_remove_view( struct file_view *view )
|
||||
TRACE( "%p - %p, aligned %p - %p.\n", view->base, (char *)view->base + view->size, view_base, view_end );
|
||||
|
||||
if (view_end <= view_base)
|
||||
+ {
|
||||
+ VIRTUAL_DEBUG_DUMP_RANGES();
|
||||
return;
|
||||
-
|
||||
+ }
|
||||
/* free_ranges initial value is such that the view is either inside range or before another one. */
|
||||
assert( range != free_ranges_end );
|
||||
assert( range->end > view_base || next != free_ranges_end );
|
||||
@@ -870,6 +886,7 @@ static void free_ranges_remove_view( struct file_view *view )
|
||||
range->base = view_base;
|
||||
range->end = view_end;
|
||||
}
|
||||
+ VIRTUAL_DEBUG_DUMP_RANGES();
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
2.38.1
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From 72dcf52735e6306fa67f25f49fd78da24d7d89cb Mon Sep 17 00:00:00 2001
|
||||
From ebca5e5a6d9e498ca1f7c0f823e40c25be547500 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Thu, 10 Nov 2022 18:40:18 -0600
|
||||
Subject: [PATCH] ntdll: Handle NULL process handle in MapViewOfFile3().
|
||||
@@ -10,10 +10,10 @@ Based on a patch by Nikolay Sivov.
|
||||
2 files changed, 15 insertions(+)
|
||||
|
||||
diff --git a/dlls/kernelbase/memory.c b/dlls/kernelbase/memory.c
|
||||
index c01fe817972..ee12f6abb91 100644
|
||||
index 4188eebf181..19381e00b31 100644
|
||||
--- a/dlls/kernelbase/memory.c
|
||||
+++ b/dlls/kernelbase/memory.c
|
||||
@@ -255,6 +255,8 @@ LPVOID WINAPI DECLSPEC_HOTPATCH MapViewOfFile3( HANDLE handle, HANDLE process, P
|
||||
@@ -265,6 +265,8 @@ LPVOID WINAPI DECLSPEC_HOTPATCH MapViewOfFile3( HANDLE handle, HANDLE process, P
|
||||
LARGE_INTEGER off;
|
||||
void *addr;
|
||||
|
||||
@@ -23,10 +23,10 @@ index c01fe817972..ee12f6abb91 100644
|
||||
off.QuadPart = offset;
|
||||
if (!set_ntstatus( NtMapViewOfSectionEx( handle, process, &addr, &off, &size, alloc_type, protection,
|
||||
diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c
|
||||
index 0dccb35bd27..486efabaf70 100644
|
||||
index ffa462f579f..559ba484d60 100644
|
||||
--- a/dlls/ntdll/tests/virtual.c
|
||||
+++ b/dlls/ntdll/tests/virtual.c
|
||||
@@ -1060,6 +1060,13 @@ static void test_NtMapViewOfSection(void)
|
||||
@@ -1131,6 +1131,13 @@ static void test_NtMapViewOfSection(void)
|
||||
process = create_target_process("sleep");
|
||||
ok(process != NULL, "Can't start process\n");
|
||||
|
||||
@@ -40,7 +40,7 @@ index 0dccb35bd27..486efabaf70 100644
|
||||
ptr = NULL;
|
||||
size = 0;
|
||||
offset.QuadPart = 0;
|
||||
@@ -1303,6 +1310,12 @@ static void test_NtMapViewOfSectionEx(void)
|
||||
@@ -1404,6 +1411,12 @@ static void test_NtMapViewOfSectionEx(void)
|
||||
process = create_target_process("sleep");
|
||||
ok(process != NULL, "Can't start process\n");
|
||||
|
||||
@@ -51,8 +51,8 @@ index 0dccb35bd27..486efabaf70 100644
|
||||
+ ok(status == STATUS_INVALID_HANDLE, "Unexpected status %08lx\n", status);
|
||||
+
|
||||
ptr = NULL;
|
||||
size = 0;
|
||||
size = 0x1000;
|
||||
offset.QuadPart = 0;
|
||||
--
|
||||
2.38.1
|
||||
2.40.1
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From 0a8dca419f3f5eacab2e9e11903cfc4c0a58dc93 Mon Sep 17 00:00:00 2001
|
||||
From 81be823356cc1752e878a0c26529d8a579d96a54 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Thu, 10 Nov 2022 18:48:14 -0600
|
||||
Subject: [PATCH] ntdll: Pass allocation type to map_view().
|
||||
@@ -9,10 +9,10 @@ Based on a patch by Nikolay Sivov.
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index 85c4ab878b3..eb1d186e11c 100644
|
||||
index 418ad19d990..71cf44bec39 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -2007,8 +2007,9 @@ static NTSTATUS map_fixed_area( void *base, size_t size, unsigned int vprot )
|
||||
@@ -2012,8 +2012,9 @@ static NTSTATUS map_fixed_area( void *base, size_t size, unsigned int vprot )
|
||||
* virtual_mutex must be held by caller.
|
||||
*/
|
||||
static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
|
||||
@@ -23,7 +23,7 @@ index 85c4ab878b3..eb1d186e11c 100644
|
||||
void *ptr;
|
||||
NTSTATUS status;
|
||||
|
||||
@@ -2223,7 +2224,7 @@ static NTSTATUS allocate_dos_memory( struct file_view **view, unsigned int vprot
|
||||
@@ -2230,7 +2231,7 @@ static NTSTATUS allocate_dos_memory( struct file_view **view, unsigned int vprot
|
||||
if (mmap_is_in_reserved_area( low_64k, dosmem_size - 0x10000 ) != 1)
|
||||
{
|
||||
addr = anon_mmap_tryfixed( low_64k, dosmem_size - 0x10000, unix_prot, 0 );
|
||||
@@ -32,15 +32,15 @@ index 85c4ab878b3..eb1d186e11c 100644
|
||||
}
|
||||
|
||||
/* now try to allocate the low 64K too */
|
||||
@@ -3236,7 +3237,7 @@ NTSTATUS virtual_alloc_thread_stack( INITIAL_TEB *stack, ULONG_PTR zero_bits, SI
|
||||
@@ -3371,7 +3372,7 @@ NTSTATUS virtual_alloc_thread_stack( INITIAL_TEB *stack, ULONG_PTR limit, SIZE_T
|
||||
|
||||
server_enter_uninterrupted_section( &virtual_mutex, &sigset );
|
||||
|
||||
- if ((status = map_view( &view, NULL, size + extra_size, FALSE,
|
||||
+ if ((status = map_view( &view, NULL, size + extra_size, 0,
|
||||
VPROT_READ | VPROT_WRITE | VPROT_COMMITTED, get_zero_bits_mask( zero_bits ), 0 ))
|
||||
!= STATUS_SUCCESS)
|
||||
goto done;
|
||||
- status = map_view( &view, NULL, size, FALSE, VPROT_READ | VPROT_WRITE | VPROT_COMMITTED, limit, 0 );
|
||||
+ status = map_view( &view, NULL, size, 0, VPROT_READ | VPROT_WRITE | VPROT_COMMITTED, limit, 0 );
|
||||
if (status != STATUS_SUCCESS) goto done;
|
||||
|
||||
#ifdef VALGRIND_STACK_REGISTER
|
||||
--
|
||||
2.38.1
|
||||
2.40.1
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From 6fbb8f079b1024d742f2cc34425e6099e23f2f39 Mon Sep 17 00:00:00 2001
|
||||
From ed0aa7cbd5dcaad27598466c273ed4fb96c71a60 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Thu, 10 Nov 2022 18:53:10 -0600
|
||||
Subject: [PATCH] ntdll: Support MEM_RESERVE_PLACEHOLDER in
|
||||
@@ -10,10 +10,10 @@ Based on a patch by Nikolay Sivov.
|
||||
1 file changed, 24 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index f078e114b4c..6204ed5a452 100644
|
||||
index 71cf44bec39..d0f1a1d37b1 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -3891,13 +3891,18 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ
|
||||
@@ -4045,8 +4045,7 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ
|
||||
|
||||
/* Compute the alloc type flags */
|
||||
|
||||
@@ -23,7 +23,9 @@ index f078e114b4c..6204ed5a452 100644
|
||||
{
|
||||
WARN("called with wrong alloc type flags (%08x) !\n", (int)type);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
@@ -4054,6 +4053,12 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ
|
||||
|
||||
if (!arm64ec_map && (attributes & MEM_EXTENDED_PARAMETER_EC_CODE)) return STATUS_INVALID_PARAMETER;
|
||||
|
||||
+ if (type & MEM_RESERVE_PLACEHOLDER && (protect != PAGE_NOACCESS))
|
||||
+ {
|
||||
@@ -34,7 +36,7 @@ index f078e114b4c..6204ed5a452 100644
|
||||
/* Reserve the memory */
|
||||
|
||||
server_enter_uninterrupted_section( &virtual_mutex, &sigset );
|
||||
@@ -3908,6 +3913,7 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ
|
||||
@@ -4064,6 +4069,7 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ
|
||||
{
|
||||
if (type & MEM_COMMIT) vprot |= VPROT_COMMITTED;
|
||||
if (type & MEM_WRITE_WATCH) vprot |= VPROT_WRITEWATCH;
|
||||
@@ -42,7 +44,7 @@ index f078e114b4c..6204ed5a452 100644
|
||||
if (protect & PAGE_NOCACHE) vprot |= SEC_NOCACHE;
|
||||
|
||||
if (vprot & VPROT_WRITECOPY) status = STATUS_INVALID_PAGE_PROTECTION;
|
||||
@@ -3927,6 +3933,7 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ
|
||||
@@ -4083,6 +4089,7 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ
|
||||
{
|
||||
if (!(view = find_view( base, size ))) status = STATUS_NOT_MAPPED_VIEW;
|
||||
else if (view->protect & SEC_FILE) status = STATUS_ALREADY_COMMITTED;
|
||||
@@ -50,7 +52,7 @@ index f078e114b4c..6204ed5a452 100644
|
||||
else if (!(status = set_protection( view, base, size, protect )) && (view->protect & SEC_RESERVE))
|
||||
{
|
||||
SERVER_START_REQ( add_mapping_committed_range )
|
||||
@@ -3960,6 +3967,7 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ
|
||||
@@ -4118,6 +4125,7 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ
|
||||
NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG_PTR zero_bits,
|
||||
SIZE_T *size_ptr, ULONG type, ULONG protect )
|
||||
{
|
||||
@@ -58,7 +60,7 @@ index f078e114b4c..6204ed5a452 100644
|
||||
ULONG_PTR limit;
|
||||
|
||||
TRACE("%p %p %08lx %x %08x\n", process, *ret, *size_ptr, (int)type, (int)protect );
|
||||
@@ -3971,6 +3979,12 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG_PTR z
|
||||
@@ -4129,6 +4137,12 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG_PTR z
|
||||
if (!is_old_wow64() && zero_bits >= 32) return STATUS_INVALID_PARAMETER_3;
|
||||
#endif
|
||||
|
||||
@@ -71,7 +73,7 @@ index f078e114b4c..6204ed5a452 100644
|
||||
if (process != NtCurrentProcess())
|
||||
{
|
||||
apc_call_t call;
|
||||
@@ -4013,6 +4027,8 @@ NTSTATUS WINAPI NtAllocateVirtualMemoryEx( HANDLE process, PVOID *ret, SIZE_T *s
|
||||
@@ -4231,6 +4245,8 @@ NTSTATUS WINAPI NtAllocateVirtualMemoryEx( HANDLE process, PVOID *ret, SIZE_T *s
|
||||
ULONG protect, MEM_EXTENDED_PARAMETER *parameters,
|
||||
ULONG count )
|
||||
{
|
||||
@@ -79,10 +81,10 @@ index f078e114b4c..6204ed5a452 100644
|
||||
+ | MEM_RESET | MEM_RESERVE_PLACEHOLDER;
|
||||
ULONG_PTR limit = 0;
|
||||
ULONG_PTR align = 0;
|
||||
|
||||
@@ -4021,6 +4037,12 @@ NTSTATUS WINAPI NtAllocateVirtualMemoryEx( HANDLE process, PVOID *ret, SIZE_T *s
|
||||
|
||||
if (count && !parameters) return STATUS_INVALID_PARAMETER;
|
||||
ULONG attributes = 0;
|
||||
@@ -4239,6 +4255,12 @@ NTSTATUS WINAPI NtAllocateVirtualMemoryEx( HANDLE process, PVOID *ret, SIZE_T *s
|
||||
TRACE( "%p %p %08lx %x %08x %p %u\n",
|
||||
process, *ret, *size_ptr, (int)type, (int)protect, parameters, (int)count );
|
||||
|
||||
+ if (type & ~type_mask)
|
||||
+ {
|
||||
@@ -90,9 +92,9 @@ index f078e114b4c..6204ed5a452 100644
|
||||
+ return STATUS_INVALID_PARAMETER;
|
||||
+ }
|
||||
+
|
||||
if (count)
|
||||
{
|
||||
MEM_ADDRESS_REQUIREMENTS *r = NULL;
|
||||
status = get_extended_params( parameters, count, &limit, &align, &attributes );
|
||||
if (status) return status;
|
||||
|
||||
--
|
||||
2.40.0
|
||||
2.40.1
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From 15d43de746bf26b783e4b357fbc23dfa7247c78a Mon Sep 17 00:00:00 2001
|
||||
From 34562a9ed59356de31669c76bdf87886ee9febe4 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Thu, 10 Nov 2022 18:58:26 -0600
|
||||
Subject: [PATCH] ntdll: Support MEM_REPLACE_PLACEHOLDER in
|
||||
@@ -9,10 +9,10 @@ Subject: [PATCH] ntdll: Support MEM_REPLACE_PLACEHOLDER in
|
||||
1 file changed, 37 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index 5bea8ba8322..4d8dd54554c 100644
|
||||
index dd146126361..0f2818f563d 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -125,6 +125,7 @@ struct file_view
|
||||
@@ -126,6 +126,7 @@ struct file_view
|
||||
/* per-mapping protection flags */
|
||||
#define VPROT_SYSTEM 0x0200 /* system view (underlying mmap not under our control) */
|
||||
#define VPROT_PLACEHOLDER 0x0400
|
||||
@@ -20,7 +20,7 @@ index 5bea8ba8322..4d8dd54554c 100644
|
||||
|
||||
/* Conversion from VPROT_* to Win32 flags */
|
||||
static const BYTE VIRTUAL_Win32Flags[16] =
|
||||
@@ -2011,6 +2012,31 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
|
||||
@@ -2044,6 +2045,31 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size,
|
||||
void *ptr;
|
||||
NTSTATUS status;
|
||||
|
||||
@@ -52,7 +52,7 @@ index 5bea8ba8322..4d8dd54554c 100644
|
||||
if (base)
|
||||
{
|
||||
if (is_beyond_limit( base, size, address_space_limit ))
|
||||
@@ -3894,7 +3920,7 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ
|
||||
@@ -4048,7 +4074,7 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ
|
||||
|
||||
if (*ret)
|
||||
{
|
||||
@@ -61,7 +61,7 @@ index 5bea8ba8322..4d8dd54554c 100644
|
||||
base = ROUND_ADDR( *ret, granularity_mask );
|
||||
else
|
||||
base = ROUND_ADDR( *ret, page_mask );
|
||||
@@ -3918,7 +3944,8 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ
|
||||
@@ -4072,7 +4098,8 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ
|
||||
|
||||
/* Compute the alloc type flags */
|
||||
|
||||
@@ -71,7 +71,7 @@ index 5bea8ba8322..4d8dd54554c 100644
|
||||
{
|
||||
WARN("called with wrong alloc type flags (%08x) !\n", (int)type);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
@@ -3945,7 +3972,7 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ
|
||||
@@ -4101,7 +4128,7 @@ static NTSTATUS allocate_virtual_memory( void **ret, SIZE_T *size_ptr, ULONG typ
|
||||
|
||||
if (vprot & VPROT_WRITECOPY) status = STATUS_INVALID_PAGE_PROTECTION;
|
||||
else if (is_dos_memory) status = allocate_dos_memory( &view, vprot );
|
||||
@@ -80,7 +80,7 @@ index 5bea8ba8322..4d8dd54554c 100644
|
||||
align ? align - 1 : granularity_mask );
|
||||
|
||||
if (status == STATUS_SUCCESS) base = view->base;
|
||||
@@ -4055,7 +4082,7 @@ NTSTATUS WINAPI NtAllocateVirtualMemoryEx( HANDLE process, PVOID *ret, SIZE_T *s
|
||||
@@ -4213,7 +4240,7 @@ NTSTATUS WINAPI NtAllocateVirtualMemoryEx( HANDLE process, PVOID *ret, SIZE_T *s
|
||||
ULONG count )
|
||||
{
|
||||
static const ULONG type_mask = MEM_COMMIT | MEM_RESERVE | MEM_TOP_DOWN | MEM_WRITE_WATCH
|
||||
@@ -88,8 +88,8 @@ index 5bea8ba8322..4d8dd54554c 100644
|
||||
+ | MEM_RESET | MEM_RESERVE_PLACEHOLDER | MEM_REPLACE_PLACEHOLDER;
|
||||
ULONG_PTR limit = 0;
|
||||
ULONG_PTR align = 0;
|
||||
|
||||
@@ -4209,6 +4236,12 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *si
|
||||
ULONG attributes = 0;
|
||||
@@ -4371,6 +4398,12 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *si
|
||||
|
||||
if (size && (char *)view->base + view->size - base < size) status = STATUS_UNABLE_TO_FREE_VM;
|
||||
else if (!size && base != view->base) status = STATUS_FREE_VM_NOT_AT_BASE;
|
||||
@@ -103,5 +103,5 @@ index 5bea8ba8322..4d8dd54554c 100644
|
||||
{
|
||||
if (!size) size = view->size;
|
||||
--
|
||||
2.38.1
|
||||
2.40.1
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From f44017255bb3f5858d3393ed29ad6415ec307896 Mon Sep 17 00:00:00 2001
|
||||
From 96519657b5925777d613f6a6c0e93bc4d85897b9 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Thu, 10 Nov 2022 19:01:50 -0600
|
||||
Subject: [PATCH] ntdll: Support MEM_REPLACE_PLACEHOLDER in
|
||||
@@ -6,23 +6,22 @@ Subject: [PATCH] ntdll: Support MEM_REPLACE_PLACEHOLDER in
|
||||
|
||||
Based on a patch by Nikolay Sivov.
|
||||
---
|
||||
dlls/ntdll/unix/virtual.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
dlls/ntdll/unix/virtual.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index 4d8dd54554c..60203bd4380 100644
|
||||
index a36d2c47269..7f57b436b55 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -2719,7 +2719,8 @@ static unsigned int virtual_map_section( HANDLE handle, PVOID *addr_ptr, ULONG_P
|
||||
@@ -2857,7 +2857,7 @@ static unsigned int virtual_map_section( HANDLE handle, PVOID *addr_ptr, ULONG_P
|
||||
|
||||
server_enter_uninterrupted_section( &virtual_mutex, &sigset );
|
||||
|
||||
- res = map_view( &view, base, size, alloc_type & MEM_TOP_DOWN, vprot, get_zero_bits_mask( zero_bits ), 0 );
|
||||
+ res = map_view( &view, base, size, alloc_type & (MEM_TOP_DOWN | MEM_REPLACE_PLACEHOLDER),
|
||||
+ vprot, get_zero_bits_mask( zero_bits ), 0 );
|
||||
- res = map_view( &view, base, size, alloc_type & MEM_TOP_DOWN, vprot, limit, 0 );
|
||||
+ res = map_view( &view, base, size, alloc_type & (MEM_TOP_DOWN | MEM_REPLACE_PLACEHOLDER), vprot, limit, 0 );
|
||||
if (res) goto done;
|
||||
|
||||
TRACE( "handle=%p size=%lx offset=%s\n", handle, size, wine_dbgstr_longlong(offset.QuadPart) );
|
||||
--
|
||||
2.38.1
|
||||
2.40.1
|
||||
|
||||
|
@@ -1,15 +1,15 @@
|
||||
From e47dfda03cf4f2e4c1676273da4ee8f54fabbf01 Mon Sep 17 00:00:00 2001
|
||||
From 2248dedbf01f0abeb4290d79c13c3b967010ba97 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Wed, 9 Nov 2022 21:23:19 -0600
|
||||
Subject: [PATCH] ntdll/tests: Add more tests for placeholders.
|
||||
|
||||
---
|
||||
dlls/kernelbase/tests/process.c | 15 ++-
|
||||
dlls/ntdll/tests/virtual.c | 227 +++++++++++++++++++++++---------
|
||||
2 files changed, 179 insertions(+), 63 deletions(-)
|
||||
dlls/ntdll/tests/virtual.c | 217 +++++++++++++++++++++++---------
|
||||
2 files changed, 171 insertions(+), 61 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernelbase/tests/process.c b/dlls/kernelbase/tests/process.c
|
||||
index ed213f1f7b6..0d75c6e2dda 100644
|
||||
index b8c3bbb7276..03f76a1b73a 100644
|
||||
--- a/dlls/kernelbase/tests/process.c
|
||||
+++ b/dlls/kernelbase/tests/process.c
|
||||
@@ -168,7 +168,6 @@ static void test_VirtualAlloc2(void)
|
||||
@@ -42,15 +42,16 @@ index ed213f1f7b6..0d75c6e2dda 100644
|
||||
UnmapViewOfFile(view1);
|
||||
UnmapViewOfFile(view2);
|
||||
diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c
|
||||
index 486efabaf70..b41f42ac9d1 100644
|
||||
index 335ba118fb9..3000ae68620 100644
|
||||
--- a/dlls/ntdll/tests/virtual.c
|
||||
+++ b/dlls/ntdll/tests/virtual.c
|
||||
@@ -291,9 +291,13 @@ static void check_region_size_(void *p, SIZE_T s, unsigned int line)
|
||||
@@ -293,10 +293,14 @@ static void check_region_size_(void *p, SIZE_T s, unsigned int line)
|
||||
|
||||
static void test_NtAllocateVirtualMemoryEx(void)
|
||||
{
|
||||
+ MEMORY_BASIC_INFORMATION mbi;
|
||||
+ void *addresses[16];
|
||||
MEM_EXTENDED_PARAMETER ext;
|
||||
SIZE_T size, size2;
|
||||
char *p, *p1, *p2;
|
||||
+ ULONG granularity;
|
||||
@@ -59,7 +60,7 @@ index 486efabaf70..b41f42ac9d1 100644
|
||||
void *addr1;
|
||||
|
||||
if (!pNtAllocateVirtualMemoryEx)
|
||||
@@ -329,98 +333,197 @@ static void test_NtAllocateVirtualMemoryEx(void)
|
||||
@@ -332,48 +336,148 @@ static void test_NtAllocateVirtualMemoryEx(void)
|
||||
status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr1, 0, &size, MEM_RESERVE | MEM_RESERVE_PLACEHOLDER, PAGE_NOACCESS);
|
||||
ok(status == STATUS_INVALID_PARAMETER, "Unexpected status %08lx.\n", status);
|
||||
|
||||
@@ -69,7 +70,7 @@ index 486efabaf70..b41f42ac9d1 100644
|
||||
+
|
||||
status = pNtAllocateVirtualMemoryEx(NtCurrentProcess(), &addr1, &size, MEM_RESERVE | MEM_RESERVE_PLACEHOLDER,
|
||||
PAGE_NOACCESS, NULL, 0);
|
||||
- todo_wine
|
||||
todo_wine
|
||||
ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
|
||||
- if (addr1)
|
||||
@@ -105,7 +106,8 @@ index 486efabaf70..b41f42ac9d1 100644
|
||||
+ size = 0x10000;
|
||||
+ status = NtFreeVirtualMemory(NtCurrentProcess(), (void **)&addr1, &size, MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER);
|
||||
+ ok(!status, "Unexpected status %08lx.\n", status);
|
||||
+
|
||||
|
||||
- /* Placeholder region splitting. */
|
||||
+ status = NtQueryVirtualMemory( NtCurrentProcess(), addr1, MemoryBasicInformation, &mbi, sizeof(mbi), &size );
|
||||
+ ok(!status, "Unexpected status %08lx.\n", status);
|
||||
+ ok(mbi.AllocationProtect == PAGE_NOACCESS, "Unexpected protection %#lx.\n", mbi.AllocationProtect);
|
||||
@@ -174,8 +176,8 @@ index 486efabaf70..b41f42ac9d1 100644
|
||||
+ size = 0;
|
||||
+ status = NtFreeVirtualMemory(NtCurrentProcess(), &addr1, &size, MEM_RELEASE);
|
||||
+ ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
|
||||
/* Placeholder region splitting. */
|
||||
+
|
||||
+ /* Placeholder region splitting. */
|
||||
+ addr1 = NULL;
|
||||
+ size = 0x10000;
|
||||
+ status = pNtAllocateVirtualMemoryEx(NtCurrentProcess(), &addr1, &size, MEM_RESERVE,
|
||||
@@ -186,7 +188,6 @@ index 486efabaf70..b41f42ac9d1 100644
|
||||
+ ok(status == STATUS_CONFLICTING_ADDRESSES, "Unexpected status %08lx.\n", status);
|
||||
+ status = NtFreeVirtualMemory(NtCurrentProcess(), (void **)&p, &size, MEM_RELEASE);
|
||||
+ ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
+
|
||||
|
||||
/* Split in three regions. */
|
||||
addr1 = NULL;
|
||||
@@ -216,9 +217,6 @@ index 486efabaf70..b41f42ac9d1 100644
|
||||
- status = NtFreeVirtualMemory(NtCurrentProcess(), (void **)&p2, &size2, MEM_RELEASE);
|
||||
- ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
- }
|
||||
+ status = NtFreeVirtualMemory(NtCurrentProcess(), (void **)&addr1, &size, MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER);
|
||||
+ ok(status == STATUS_CONFLICTING_ADDRESSES, "Unexpected status %08lx.\n", status);
|
||||
+
|
||||
+ p = addr1;
|
||||
+ p1 = p + size / 2;
|
||||
+ p2 = p1 + size / 4;
|
||||
@@ -239,10 +237,8 @@ index 486efabaf70..b41f42ac9d1 100644
|
||||
|
||||
/* Split in two regions, specifying lower part. */
|
||||
addr1 = NULL;
|
||||
size = 0x10000;
|
||||
status = pNtAllocateVirtualMemoryEx(NtCurrentProcess(), &addr1, &size, MEM_RESERVE | MEM_RESERVE_PLACEHOLDER,
|
||||
PAGE_NOACCESS, NULL, 0);
|
||||
- todo_wine
|
||||
@@ -383,22 +487,19 @@ static void test_NtAllocateVirtualMemoryEx(void)
|
||||
todo_wine
|
||||
ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
|
||||
- if (status == STATUS_SUCCESS)
|
||||
@@ -261,10 +257,6 @@ index 486efabaf70..b41f42ac9d1 100644
|
||||
- status = NtFreeVirtualMemory(NtCurrentProcess(), (void **)&p2, &size2, MEM_RELEASE);
|
||||
- ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
- }
|
||||
+ size2 = 0;
|
||||
+ status = NtFreeVirtualMemory(NtCurrentProcess(), (void **)&addr1, &size2, MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER);
|
||||
+ ok(status == STATUS_INVALID_PARAMETER_3, "Unexpected status %08lx.\n", status);
|
||||
+
|
||||
+ p1 = addr1;
|
||||
+ p2 = p1 + size / 4;
|
||||
+ size2 = size / 4;
|
||||
@@ -281,11 +273,12 @@ index 486efabaf70..b41f42ac9d1 100644
|
||||
|
||||
/* Split in two regions, specifying second half. */
|
||||
addr1 = NULL;
|
||||
size = 0x10000;
|
||||
status = pNtAllocateVirtualMemoryEx(NtCurrentProcess(), &addr1, &size, MEM_RESERVE | MEM_RESERVE_PLACEHOLDER,
|
||||
@@ -407,23 +508,19 @@ static void test_NtAllocateVirtualMemoryEx(void)
|
||||
PAGE_NOACCESS, NULL, 0);
|
||||
- todo_wine
|
||||
todo_wine
|
||||
ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
+ p1 = addr1;
|
||||
+ p2 = p1 + size / 2;
|
||||
|
||||
- if (status == STATUS_SUCCESS)
|
||||
- {
|
||||
@@ -303,9 +296,6 @@ index 486efabaf70..b41f42ac9d1 100644
|
||||
- status = NtFreeVirtualMemory(NtCurrentProcess(), (void **)&p2, &size2, MEM_RELEASE);
|
||||
- ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
- }
|
||||
+ p1 = addr1;
|
||||
+ p2 = p1 + size / 2;
|
||||
+
|
||||
+ size2 = size / 2;
|
||||
+ status = NtFreeVirtualMemory(NtCurrentProcess(), (void **)&p2, &size2, MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER);
|
||||
+ ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
@@ -316,9 +306,9 @@ index 486efabaf70..b41f42ac9d1 100644
|
||||
+ ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
+ status = NtFreeVirtualMemory(NtCurrentProcess(), (void **)&p2, &size2, MEM_RELEASE);
|
||||
+ ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status);
|
||||
}
|
||||
|
||||
static void test_NtAllocateVirtualMemoryEx_address_requirements(void)
|
||||
memset( &ext, 0, sizeof(ext) );
|
||||
ext.Type = MemExtendedParameterAttributeFlags;
|
||||
--
|
||||
2.38.1
|
||||
2.40.1
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From 3106c711fd02bdbdcac1361a389a651494d2f3b3 Mon Sep 17 00:00:00 2001
|
||||
From 41d2b081fcdf72704cfc9a7a0e0f53215074346c Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Fri, 11 Nov 2022 12:41:31 -0600
|
||||
Subject: [PATCH] ntdll: Factor out unmap_view_of_section() function.
|
||||
@@ -8,11 +8,11 @@ Subject: [PATCH] ntdll: Factor out unmap_view_of_section() function.
|
||||
1 file changed, 11 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index 226c99c5512..d96facb6aa3 100644
|
||||
index ed6d9be8b6f..320596c740e 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -5009,11 +5009,7 @@ NTSTATUS WINAPI NtMapViewOfSectionEx( HANDLE handle, HANDLE process, PVOID *addr
|
||||
return NtMapViewOfSection( handle, process, addr_ptr, 0, 0, offset_ptr, size_ptr, ViewShare, alloc_type, protect );
|
||||
@@ -5208,11 +5208,7 @@ NTSTATUS WINAPI NtMapViewOfSectionEx( HANDLE handle, HANDLE process, PVOID *addr
|
||||
return virtual_map_section( handle, addr_ptr, limit, 0, offset_ptr, size_ptr, alloc_type, protect );
|
||||
}
|
||||
|
||||
-/***********************************************************************
|
||||
@@ -24,7 +24,7 @@ index 226c99c5512..d96facb6aa3 100644
|
||||
{
|
||||
struct file_view *view;
|
||||
unsigned int status = STATUS_NOT_MAPPED_VIEW;
|
||||
@@ -5070,6 +5066,15 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr )
|
||||
@@ -5269,6 +5265,15 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr )
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ index 226c99c5512..d96facb6aa3 100644
|
||||
/***********************************************************************
|
||||
* NtUnmapViewOfSectionEx (NTDLL.@)
|
||||
* ZwUnmapViewOfSectionEx (NTDLL.@)
|
||||
@@ -5077,7 +5082,7 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr )
|
||||
@@ -5276,7 +5281,7 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr )
|
||||
NTSTATUS WINAPI NtUnmapViewOfSectionEx( HANDLE process, PVOID addr, ULONG flags )
|
||||
{
|
||||
if (flags) FIXME("Ignoring flags %#x.\n", (int)flags);
|
||||
@@ -50,5 +50,5 @@ index 226c99c5512..d96facb6aa3 100644
|
||||
|
||||
/******************************************************************************
|
||||
--
|
||||
2.38.1
|
||||
2.40.1
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
From cd27d91f8c74141651568af082c29c09ec6ade52 Mon Sep 17 00:00:00 2001
|
||||
From af7dcbb2688ca53aa22421b30f02e2b7b08601ca Mon Sep 17 00:00:00 2001
|
||||
From: Paul Gofman <pgofman@codeweavers.com>
|
||||
Date: Fri, 11 Nov 2022 12:54:19 -0600
|
||||
Subject: [PATCH] ntdll: Support MEM_PRESERVE_PLACEHOLDER in
|
||||
@@ -12,7 +12,7 @@ Subject: [PATCH] ntdll: Support MEM_PRESERVE_PLACEHOLDER in
|
||||
4 files changed, 73 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernelbase/tests/process.c b/dlls/kernelbase/tests/process.c
|
||||
index 0d75c6e2dda..5221a102863 100644
|
||||
index 03f76a1b73a..448369a3743 100644
|
||||
--- a/dlls/kernelbase/tests/process.c
|
||||
+++ b/dlls/kernelbase/tests/process.c
|
||||
@@ -41,6 +41,7 @@ static PVOID (WINAPI *pVirtualAllocFromApp)(PVOID, SIZE_T, DWORD, DWORD);
|
||||
@@ -105,7 +105,7 @@ index 0d75c6e2dda..5221a102863 100644
|
||||
ret = VirtualFree(p1, size / 2, MEM_RELEASE | MEM_PRESERVE_PLACEHOLDER);
|
||||
ok(ret, "Failed to split a placeholder.\n");
|
||||
check_region_size(p1, size / 2);
|
||||
@@ -447,6 +493,7 @@ static void init_funcs(void)
|
||||
@@ -462,6 +508,7 @@ static void init_funcs(void)
|
||||
X(VirtualAlloc2);
|
||||
X(VirtualAlloc2FromApp);
|
||||
X(VirtualAllocFromApp);
|
||||
@@ -114,10 +114,10 @@ index 0d75c6e2dda..5221a102863 100644
|
||||
hmod = GetModuleHandleA("ntdll.dll");
|
||||
|
||||
diff --git a/dlls/ntdll/unix/server.c b/dlls/ntdll/unix/server.c
|
||||
index f23a3d383f6..77eb2c0aaeb 100644
|
||||
index c143560e360..40efda551e0 100644
|
||||
--- a/dlls/ntdll/unix/server.c
|
||||
+++ b/dlls/ntdll/unix/server.c
|
||||
@@ -553,7 +553,7 @@ static void invoke_system_apc( const apc_call_t *call, apc_result_t *result, BOO
|
||||
@@ -618,7 +618,7 @@ static void invoke_system_apc( const apc_call_t *call, apc_result_t *result, BOO
|
||||
result->type = call->type;
|
||||
addr = wine_server_get_ptr( call->unmap_view.addr );
|
||||
if ((ULONG_PTR)addr == call->unmap_view.addr)
|
||||
@@ -127,11 +127,11 @@ index f23a3d383f6..77eb2c0aaeb 100644
|
||||
result->unmap_view.status = STATUS_INVALID_PARAMETER;
|
||||
break;
|
||||
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
|
||||
index d96facb6aa3..881f7fd8f59 100644
|
||||
index 320596c740e..493f6b80419 100644
|
||||
--- a/dlls/ntdll/unix/virtual.c
|
||||
+++ b/dlls/ntdll/unix/virtual.c
|
||||
@@ -5009,7 +5009,7 @@ NTSTATUS WINAPI NtMapViewOfSectionEx( HANDLE handle, HANDLE process, PVOID *addr
|
||||
return NtMapViewOfSection( handle, process, addr_ptr, 0, 0, offset_ptr, size_ptr, ViewShare, alloc_type, protect );
|
||||
@@ -5208,7 +5208,7 @@ NTSTATUS WINAPI NtMapViewOfSectionEx( HANDLE handle, HANDLE process, PVOID *addr
|
||||
return virtual_map_section( handle, addr_ptr, limit, 0, offset_ptr, size_ptr, alloc_type, protect );
|
||||
}
|
||||
|
||||
-NTSTATUS unmap_view_of_section( HANDLE process, PVOID addr )
|
||||
@@ -139,7 +139,7 @@ index d96facb6aa3..881f7fd8f59 100644
|
||||
{
|
||||
struct file_view *view;
|
||||
unsigned int status = STATUS_NOT_MAPPED_VIEW;
|
||||
@@ -5024,6 +5024,7 @@ NTSTATUS unmap_view_of_section( HANDLE process, PVOID addr )
|
||||
@@ -5223,6 +5223,7 @@ NTSTATUS unmap_view_of_section( HANDLE process, PVOID addr )
|
||||
|
||||
call.unmap_view.type = APC_UNMAP_VIEW;
|
||||
call.unmap_view.addr = wine_server_client_ptr( addr );
|
||||
@@ -147,7 +147,7 @@ index d96facb6aa3..881f7fd8f59 100644
|
||||
status = server_queue_process_apc( process, &call, &result );
|
||||
if (status == STATUS_SUCCESS) status = result.unmap_view.status;
|
||||
return status;
|
||||
@@ -5032,6 +5033,11 @@ NTSTATUS unmap_view_of_section( HANDLE process, PVOID addr )
|
||||
@@ -5231,6 +5232,11 @@ NTSTATUS unmap_view_of_section( HANDLE process, PVOID addr )
|
||||
server_enter_uninterrupted_section( &virtual_mutex, &sigset );
|
||||
if ((view = find_view( addr, 0 )) && !is_view_valloc( view ))
|
||||
{
|
||||
@@ -159,7 +159,7 @@ index d96facb6aa3..881f7fd8f59 100644
|
||||
if (view->protect & VPROT_SYSTEM)
|
||||
{
|
||||
struct builtin_module *builtin;
|
||||
@@ -5058,10 +5064,21 @@ NTSTATUS unmap_view_of_section( HANDLE process, PVOID addr )
|
||||
@@ -5257,10 +5263,21 @@ NTSTATUS unmap_view_of_section( HANDLE process, PVOID addr )
|
||||
if (!status)
|
||||
{
|
||||
if (view->protect & SEC_IMAGE) release_builtin_module( view->base );
|
||||
@@ -182,7 +182,7 @@ index d96facb6aa3..881f7fd8f59 100644
|
||||
server_leave_uninterrupted_section( &virtual_mutex, &sigset );
|
||||
return status;
|
||||
}
|
||||
@@ -5072,7 +5089,7 @@ NTSTATUS unmap_view_of_section( HANDLE process, PVOID addr )
|
||||
@@ -5271,7 +5288,7 @@ NTSTATUS unmap_view_of_section( HANDLE process, PVOID addr )
|
||||
*/
|
||||
NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr )
|
||||
{
|
||||
@@ -191,7 +191,7 @@ index d96facb6aa3..881f7fd8f59 100644
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -5082,7 +5099,7 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr )
|
||||
@@ -5281,7 +5298,7 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr )
|
||||
NTSTATUS WINAPI NtUnmapViewOfSectionEx( HANDLE process, PVOID addr, ULONG flags )
|
||||
{
|
||||
if (flags) FIXME("Ignoring flags %#x.\n", (int)flags);
|
||||
@@ -201,10 +201,10 @@ index d96facb6aa3..881f7fd8f59 100644
|
||||
|
||||
/******************************************************************************
|
||||
diff --git a/server/protocol.def b/server/protocol.def
|
||||
index e3e9d3641aa..825c25693cc 100644
|
||||
index 8f5202792b4..10729e3ff64 100644
|
||||
--- a/server/protocol.def
|
||||
+++ b/server/protocol.def
|
||||
@@ -602,6 +602,7 @@ typedef union
|
||||
@@ -615,6 +615,7 @@ typedef union
|
||||
enum apc_type type; /* APC_UNMAP_VIEW */
|
||||
int __pad;
|
||||
client_ptr_t addr; /* view address */
|
||||
@@ -213,5 +213,5 @@ index e3e9d3641aa..825c25693cc 100644
|
||||
struct
|
||||
{
|
||||
--
|
||||
2.38.1
|
||||
2.40.1
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user