Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
fb6a6374
Commit
fb6a6374
authored
Nov 11, 2022
by
Paul Gofman
Committed by
Alexandre Julliard
May 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Support partial view release in NtFreeVirtualMemory().
parent
3d1c27d5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
9 deletions
+47
-9
virtual.c
dlls/ntdll/tests/virtual.c
+7
-7
virtual.c
dlls/ntdll/unix/virtual.c
+40
-2
No files found.
dlls/ntdll/tests/virtual.c
View file @
fb6a6374
...
...
@@ -1869,7 +1869,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
);
...
...
@@ -1878,7 +1878,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
);
...
...
@@ -1886,17 +1886,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
;
...
...
@@ -1911,11 +1911,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
)
...
...
dlls/ntdll/unix/virtual.c
View file @
fb6a6374
...
...
@@ -4258,8 +4258,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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment