Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
fce615a2
Commit
fce615a2
authored
Nov 11, 2022
by
Paul Gofman
Committed by
Alexandre Julliard
May 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Support MEM_PRESERVE_PLACEHOLDER in NtUnmapViewOfSectionEx().
parent
3e3ca7dd
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
17 deletions
+24
-17
process.c
dlls/kernelbase/tests/process.c
+8
-8
server.c
dlls/ntdll/unix/server.c
+1
-1
virtual.c
dlls/ntdll/unix/virtual.c
+12
-5
server_protocol.h
include/wine/server_protocol.h
+2
-2
protocol.def
server/protocol.def
+1
-1
No files found.
dlls/kernelbase/tests/process.c
View file @
fce615a2
...
...
@@ -211,9 +211,9 @@ static void test_VirtualAlloc2(void)
ret
=
VirtualFree
(
view1
,
size
,
MEM_RELEASE
|
MEM_PRESERVE_PLACEHOLDER
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Got ret %d, error %lu.
\n
"
,
ret
,
GetLastError
());
ret
=
pUnmapViewOfFile2
(
GetCurrentProcess
(),
view1
,
MEM_PRESERVE_PLACEHOLDER
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_ADDRESS
,
"Got ret %d, error %lu.
\n
"
,
ret
,
GetLastError
());
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_ADDRESS
,
"Got ret %d, error %lu.
\n
"
,
ret
,
GetLastError
());
ret
=
pUnmapViewOfFile2
(
GetCurrentProcess
(),
view1
,
0
);
todo_wine
ok
(
ret
,
"Got error %lu.
\n
"
,
GetLastError
());
ok
(
ret
,
"Got error %lu.
\n
"
,
GetLastError
());
view1
=
pMapViewOfFile3
(
section
,
NULL
,
placeholder1
,
0
,
size
,
MEM_REPLACE_PLACEHOLDER
,
PAGE_READWRITE
,
NULL
,
0
);
ok
(
view1
==
placeholder1
,
"Address does not match.
\n
"
);
...
...
@@ -248,9 +248,9 @@ static void test_VirtualAlloc2(void)
memset
(
&
info
,
0
,
sizeof
(
info
));
VirtualQuery
(
placeholder1
,
&
info
,
sizeof
(
info
));
todo_wine
ok
(
info
.
AllocationProtect
==
PAGE_NOACCESS
,
"Unexpected protection %#lx.
\n
"
,
info
.
AllocationProtect
);
todo_wine
ok
(
info
.
State
==
MEM_RESERVE
,
"Unexpected state %#lx.
\n
"
,
info
.
State
);
todo_wine
ok
(
info
.
Type
==
MEM_PRIVATE
,
"Unexpected type %#lx.
\n
"
,
info
.
Type
);
ok
(
info
.
AllocationProtect
==
PAGE_NOACCESS
,
"Unexpected protection %#lx.
\n
"
,
info
.
AllocationProtect
);
ok
(
info
.
State
==
MEM_RESERVE
,
"Unexpected state %#lx.
\n
"
,
info
.
State
);
ok
(
info
.
Type
==
MEM_PRIVATE
,
"Unexpected type %#lx.
\n
"
,
info
.
Type
);
ok
(
info
.
RegionSize
==
size
,
"Unexpected size.
\n
"
);
ret
=
pUnmapViewOfFile2
(
GetCurrentProcess
(),
view1
,
MEM_PRESERVE_PLACEHOLDER
);
...
...
@@ -260,21 +260,21 @@ static void test_VirtualAlloc2(void)
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_ADDRESS
,
"Got error %lu.
\n
"
,
GetLastError
());
view1
=
pMapViewOfFile3
(
section
,
NULL
,
placeholder1
,
0
,
size
,
MEM_REPLACE_PLACEHOLDER
,
PAGE_READWRITE
,
NULL
,
0
);
todo_wine
ok
(
view1
==
placeholder1
,
"Address does not match.
\n
"
);
ok
(
view1
==
placeholder1
,
"Address does not match.
\n
"
);
CloseHandle
(
section
);
ret
=
VirtualFree
(
view1
,
size
,
MEM_RELEASE
|
MEM_PRESERVE_PLACEHOLDER
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Got ret %d, error %lu.
\n
"
,
ret
,
GetLastError
());
ret
=
pUnmapViewOfFile2
(
GetCurrentProcess
(),
view1
,
MEM_UNMAP_WITH_TRANSIENT_BOOST
|
MEM_PRESERVE_PLACEHOLDER
);
todo_wine
ok
(
ret
,
"Got error %lu.
\n
"
,
GetLastError
());
ok
(
ret
,
"Got error %lu.
\n
"
,
GetLastError
());
ret
=
VirtualFree
(
placeholder1
,
size
,
MEM_RELEASE
|
MEM_PRESERVE_PLACEHOLDER
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_ADDRESS
,
"Got ret %d, error %lu.
\n
"
,
ret
,
GetLastError
());
ret
=
VirtualFreeEx
(
GetCurrentProcess
(),
placeholder1
,
size
,
MEM_RELEASE
|
MEM_PRESERVE_PLACEHOLDER
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_ADDRESS
,
"Got ret %d, error %lu.
\n
"
,
ret
,
GetLastError
());
ret
=
VirtualFree
(
placeholder1
,
0
,
MEM_RELEASE
);
todo_wine
ok
(
ret
,
"Got error %lu.
\n
"
,
GetLastError
());
ok
(
ret
,
"Got error %lu.
\n
"
,
GetLastError
());
UnmapViewOfFile
(
view2
);
...
...
dlls/ntdll/unix/server.c
View file @
fce615a2
...
...
@@ -615,7 +615,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
)
result
->
unmap_view
.
status
=
NtUnmapViewOfSection
(
NtCurrentProcess
(),
addr
);
result
->
unmap_view
.
status
=
NtUnmapViewOfSection
Ex
(
NtCurrentProcess
(),
addr
,
call
->
unmap_view
.
flags
);
else
result
->
unmap_view
.
status
=
STATUS_INVALID_PARAMETER
;
break
;
...
...
dlls/ntdll/unix/virtual.c
View file @
fce615a2
...
...
@@ -5225,7 +5225,7 @@ NTSTATUS WINAPI NtMapViewOfSectionEx( HANDLE handle, HANDLE process, PVOID *addr
*
* NtUnmapViewOfSection[Ex] implementation.
*/
static
NTSTATUS
unmap_view_of_section
(
HANDLE
process
,
PVOID
addr
)
static
NTSTATUS
unmap_view_of_section
(
HANDLE
process
,
PVOID
addr
,
ULONG
flags
)
{
struct
file_view
*
view
;
unsigned
int
status
=
STATUS_NOT_MAPPED_VIEW
;
...
...
@@ -5240,6 +5240,7 @@ static 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
);
call
.
unmap_view
.
flags
=
flags
;
status
=
server_queue_process_apc
(
process
,
&
call
,
&
result
);
if
(
status
==
STATUS_SUCCESS
)
status
=
result
.
unmap_view
.
status
;
return
status
;
...
...
@@ -5248,6 +5249,11 @@ static 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
))
goto
done
;
if
(
flags
&
MEM_PRESERVE_PLACEHOLDER
&&
!
(
view
->
protect
&
VPROT_PLACEHOLDER
))
{
status
=
STATUS_CONFLICTING_ADDRESSES
;
goto
done
;
}
if
(
view
->
protect
&
VPROT_SYSTEM
)
{
struct
builtin_module
*
builtin
;
...
...
@@ -5274,7 +5280,8 @@ static NTSTATUS unmap_view_of_section( HANDLE process, PVOID addr )
if
(
!
status
)
{
if
(
view
->
protect
&
SEC_IMAGE
)
release_builtin_module
(
view
->
base
);
delete_view
(
view
);
if
(
flags
&
MEM_PRESERVE_PLACEHOLDER
)
free_pages_preserve_placeholder
(
view
,
view
->
base
,
view
->
size
);
else
delete_view
(
view
);
}
else
FIXME
(
"failed to unmap %p %x
\n
"
,
view
->
base
,
status
);
done:
...
...
@@ -5289,7 +5296,7 @@ done:
*/
NTSTATUS
WINAPI
NtUnmapViewOfSection
(
HANDLE
process
,
PVOID
addr
)
{
return
unmap_view_of_section
(
process
,
addr
);
return
unmap_view_of_section
(
process
,
addr
,
0
);
}
/***********************************************************************
...
...
@@ -5305,8 +5312,8 @@ NTSTATUS WINAPI NtUnmapViewOfSectionEx( HANDLE process, PVOID addr, ULONG flags
WARN
(
"Unsupported flags %#x.
\n
"
,
(
int
)
flags
);
return
STATUS_INVALID_PARAMETER
;
}
if
(
flags
)
FIXME
(
"Ignoring flags %#x.
\n
"
,
(
int
)
flags
);
return
unmap_view_of_section
(
process
,
addr
);
if
(
flags
&
MEM_UNMAP_WITH_TRANSIENT_BOOST
)
FIXME
(
"Ignoring MEM_UNMAP_WITH_TRANSIENT_BOOST.
\n
"
);
return
unmap_view_of_section
(
process
,
addr
,
flags
);
}
/******************************************************************************
...
...
include/wine/server_protocol.h
View file @
fce615a2
...
...
@@ -598,7 +598,7 @@ typedef union
struct
{
enum
apc_type
type
;
int
__pad
;
unsigned
int
flags
;
client_ptr_t
addr
;
}
unmap_view
;
struct
...
...
@@ -6415,7 +6415,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 77
0
#define SERVER_PROTOCOL_VERSION 77
1
/* ### protocol_version end ### */
...
...
server/protocol.def
View file @
fce615a2
...
...
@@ -614,7 +614,7 @@ typedef union
struct
{
enum apc_type type; /* APC_UNMAP_VIEW */
int __pad;
unsigned int flags; /* unmap flags */
client_ptr_t addr; /* view address */
} unmap_view;
struct
...
...
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