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
5ceb2271
Commit
5ceb2271
authored
May 13, 2014
by
Jacek Caban
Committed by
Alexandre Julliard
May 13, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use MAP_PRIVATE for copy on write mappings.
parent
82bb4f51
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
virtual.c
dlls/kernel32/tests/virtual.c
+11
-6
virtual.c
dlls/ntdll/virtual.c
+2
-1
No files found.
dlls/kernel32/tests/virtual.c
View file @
5ceb2271
...
...
@@ -2489,7 +2489,7 @@ static void test_shared_memory(BOOL is_child)
CloseHandle
(
mapping
);
}
static
void
test_shared_memory_ro
(
BOOL
is_child
)
static
void
test_shared_memory_ro
(
BOOL
is_child
,
DWORD
child_access
)
{
HANDLE
mapping
;
LONG
*
p
;
...
...
@@ -2501,7 +2501,7 @@ static void test_shared_memory_ro(BOOL is_child)
ok
(
GetLastError
()
==
ERROR_ALREADY_EXISTS
,
"expected ERROR_ALREADY_EXISTS, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbef
);
p
=
MapViewOfFile
(
mapping
,
FILE_MAP_READ
|
(
is_child
?
FILE_MAP_WRITE
:
0
)
,
0
,
0
,
4096
);
p
=
MapViewOfFile
(
mapping
,
is_child
?
child_access
:
FILE_MAP_READ
,
0
,
0
,
4096
);
ok
(
p
!=
NULL
,
"MapViewOfFile error %d
\n
"
,
GetLastError
());
if
(
is_child
)
...
...
@@ -2517,14 +2517,17 @@ static void test_shared_memory_ro(BOOL is_child)
DWORD
ret
;
winetest_get_mainargs
(
&
argv
);
sprintf
(
cmdline
,
"
\"
%s
\"
virtual sharedmemro
"
,
argv
[
0
]
);
sprintf
(
cmdline
,
"
\"
%s
\"
virtual sharedmemro
%x"
,
argv
[
0
],
child_access
);
ret
=
CreateProcessA
(
argv
[
0
],
cmdline
,
NULL
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
&
si
,
&
pi
);
ok
(
ret
,
"CreateProcess(%s) error %d
\n
"
,
cmdline
,
GetLastError
());
winetest_wait_child_process
(
pi
.
hProcess
);
CloseHandle
(
pi
.
hThread
);
CloseHandle
(
pi
.
hProcess
);
ok
(
*
p
==
0xdeadbeef
,
"*p = %x, expected 0xdeadbeef
\n
"
,
*
p
);
if
(
child_access
&
FILE_MAP_WRITE
)
ok
(
*
p
==
0xdeadbeef
,
"*p = %x, expected 0xdeadbeef
\n
"
,
*
p
);
else
ok
(
!*
p
,
"*p = %x, expected 0
\n
"
,
*
p
);
}
UnmapViewOfFile
(
p
);
...
...
@@ -2551,7 +2554,7 @@ START_TEST(virtual)
}
if
(
!
strcmp
(
argv
[
2
],
"sharedmemro"
))
{
test_shared_memory_ro
(
TRUE
);
test_shared_memory_ro
(
TRUE
,
strtol
(
argv
[
3
],
NULL
,
16
)
);
return
;
}
while
(
1
)
...
...
@@ -2580,7 +2583,9 @@ START_TEST(virtual)
pNtUnmapViewOfSection
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"ntdll.dll"
),
"NtUnmapViewOfSection"
);
test_shared_memory
(
FALSE
);
test_shared_memory_ro
(
FALSE
);
test_shared_memory_ro
(
FALSE
,
FILE_MAP_READ
|
FILE_MAP_WRITE
);
test_shared_memory_ro
(
FALSE
,
FILE_MAP_COPY
);
test_shared_memory_ro
(
FALSE
,
FILE_MAP_COPY
|
FILE_MAP_WRITE
);
test_mapping
();
test_CreateFileMapping_protection
();
test_VirtualAlloc_protection
();
...
...
dlls/ntdll/virtual.c
View file @
5ceb2271
...
...
@@ -2627,7 +2627,8 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
TRACE
(
"handle=%p size=%lx offset=%x%08x
\n
"
,
handle
,
size
,
offset
.
u
.
HighPart
,
offset
.
u
.
LowPart
);
res
=
map_file_into_view
(
view
,
unix_handle
,
0
,
size
,
offset
.
QuadPart
,
vprot
,
MAP_SHARED
,
!
dup_mapping
);
res
=
map_file_into_view
(
view
,
unix_handle
,
0
,
size
,
offset
.
QuadPart
,
vprot
,
(
vprot
&
VPROT_WRITECOPY
)
?
MAP_PRIVATE
:
MAP_SHARED
,
!
dup_mapping
);
if
(
res
==
STATUS_SUCCESS
)
{
*
addr_ptr
=
view
->
base
;
...
...
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