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
5fa8713d
Commit
5fa8713d
authored
Sep 26, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: No longer store the mapping handle with the view.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ab182dbf
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
16 additions
and
47 deletions
+16
-47
virtual.c
dlls/kernel32/tests/virtual.c
+0
-6
virtual.c
dlls/ntdll/virtual.c
+11
-20
server_protocol.h
include/wine/server_protocol.h
+1
-3
mapping.c
server/mapping.c
+2
-13
protocol.def
server/protocol.def
+0
-1
request.h
server/request.h
+2
-3
trace.c
server/trace.c
+0
-1
No files found.
dlls/kernel32/tests/virtual.c
View file @
5fa8713d
...
...
@@ -1009,15 +1009,12 @@ static void test_MapViewOfFile(void)
SetLastError
(
0xdeadbeef
);
map2
=
OpenFileMappingA
(
FILE_MAP_READ
,
FALSE
,
name
);
todo_wine
ok
(
map2
==
0
,
"OpenFileMappingA succeeded
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"OpenFileMappingA set error %d
\n
"
,
GetLastError
()
);
if
(
map2
)
CloseHandle
(
map2
);
/* FIXME: remove once Wine is fixed */
SetLastError
(
0xdeadbeef
);
mapping
=
CreateFileMappingA
(
INVALID_HANDLE_VALUE
,
NULL
,
PAGE_READWRITE
,
0
,
MAPPING_SIZE
,
name
);
ok
(
mapping
!=
0
,
"CreateFileMappingA failed
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"CreateFileMappingA set error %d
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
CloseHandle
(
mapping
);
...
...
@@ -1098,15 +1095,12 @@ static void test_MapViewOfFile(void)
SetLastError
(
0xdeadbeef
);
map2
=
OpenFileMappingA
(
FILE_MAP_READ
,
FALSE
,
name
);
todo_wine
ok
(
map2
==
0
,
"OpenFileMappingA succeeded
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"OpenFileMappingA set error %d
\n
"
,
GetLastError
()
);
CloseHandle
(
map2
);
SetLastError
(
0xdeadbeef
);
mapping
=
CreateFileMappingA
(
file
,
NULL
,
PAGE_READWRITE
,
0
,
MAPPING_SIZE
,
name
);
ok
(
mapping
!=
0
,
"CreateFileMappingA failed
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"CreateFileMappingA set error %d
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ret
=
CloseHandle
(
mapping
);
...
...
dlls/ntdll/virtual.c
View file @
5fa8713d
...
...
@@ -70,7 +70,6 @@ struct file_view
struct
wine_rb_entry
entry
;
/* entry in global view tree */
void
*
base
;
/* base address */
size_t
size
;
/* size in bytes */
HANDLE
mapping
;
/* handle to the file mapping */
unsigned
int
protect
;
/* protection for all pages at allocation time and SEC_* flags */
};
...
...
@@ -328,11 +327,11 @@ static void VIRTUAL_DumpView( struct file_view *view )
if
(
view
->
protect
&
VPROT_SYSTEM
)
TRACE
(
" (builtin image)
\n
"
);
else
if
(
view
->
protect
&
SEC_IMAGE
)
TRACE
(
" (image)
%p
\n
"
,
view
->
mapping
);
TRACE
(
" (image)
\n
"
);
else
if
(
view
->
protect
&
SEC_FILE
)
TRACE
(
" (file)
%p
\n
"
,
view
->
mapping
);
TRACE
(
" (file)
\n
"
);
else
if
(
view
->
protect
&
(
SEC_RESERVE
|
SEC_COMMIT
))
TRACE
(
" (anonymous)
%p
\n
"
,
view
->
mapping
);
TRACE
(
" (anonymous)
\n
"
);
else
TRACE
(
" (valloc)
\n
"
);
...
...
@@ -684,7 +683,6 @@ 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
);
wine_rb_remove
(
&
views_tree
,
&
view
->
entry
);
if
(
view
->
mapping
)
close_handle
(
view
->
mapping
);
*
(
struct
file_view
**
)
view
=
next_free_view
;
next_free_view
=
view
;
}
...
...
@@ -727,7 +725,6 @@ static NTSTATUS create_view( struct file_view **view_ret, void *base, size_t siz
view
->
base
=
base
;
view
->
size
=
size
;
view
->
mapping
=
0
;
view
->
protect
=
vprot
;
set_page_vprot
(
base
,
size
,
vprot
);
...
...
@@ -1311,7 +1308,7 @@ static NTSTATUS allocate_dos_memory( struct file_view **view, unsigned int vprot
* Map an executable (PE format) image into memory.
*/
static
NTSTATUS
map_image
(
HANDLE
hmapping
,
ACCESS_MASK
access
,
int
fd
,
char
*
base
,
SIZE_T
total_size
,
SIZE_T
mask
,
SIZE_T
header_size
,
int
shared_fd
,
HANDLE
dup_mapping
,
PVOID
*
addr_ptr
)
SIZE_T
mask
,
SIZE_T
header_size
,
int
shared_fd
,
BOOL
removable
,
PVOID
*
addr_ptr
)
{
IMAGE_DOS_HEADER
*
dos
;
IMAGE_NT_HEADERS
*
nt
;
...
...
@@ -1354,7 +1351,7 @@ static NTSTATUS map_image( HANDLE hmapping, ACCESS_MASK access, int fd, char *ba
if
(
!
st
.
st_size
)
goto
error
;
header_size
=
min
(
header_size
,
st
.
st_size
);
if
(
map_file_into_view
(
view
,
fd
,
0
,
header_size
,
0
,
VPROT_COMMITTED
|
VPROT_READ
|
VPROT_WRITECOPY
,
!
dup_mapping
)
!=
STATUS_SUCCESS
)
goto
error
;
removable
)
!=
STATUS_SUCCESS
)
goto
error
;
dos
=
(
IMAGE_DOS_HEADER
*
)
ptr
;
nt
=
(
IMAGE_NT_HEADERS
*
)(
ptr
+
dos
->
e_lfanew
);
header_end
=
ptr
+
ROUND_SIZE
(
0
,
header_size
);
...
...
@@ -1379,7 +1376,7 @@ static NTSTATUS map_image( HANDLE hmapping, ACCESS_MASK access, int fd, char *ba
/* in that case Windows simply maps in the whole file */
if
(
map_file_into_view
(
view
,
fd
,
0
,
total_size
,
0
,
VPROT_COMMITTED
|
VPROT_READ
|
VPROT_WRITECOPY
,
!
dup_mapping
)
!=
STATUS_SUCCESS
)
goto
error
;
removable
)
!=
STATUS_SUCCESS
)
goto
error
;
/* check that all sections are loaded at the right offset */
if
(
nt
->
OptionalHeader
.
FileAlignment
!=
nt
->
OptionalHeader
.
SectionAlignment
)
goto
error
;
...
...
@@ -1470,7 +1467,7 @@ static NTSTATUS map_image( HANDLE hmapping, ACCESS_MASK access, int fd, char *ba
end
<
file_start
||
map_file_into_view
(
view
,
fd
,
sec
->
VirtualAddress
,
file_size
,
file_start
,
VPROT_COMMITTED
|
VPROT_READ
|
VPROT_WRITECOPY
,
!
dup_mapping
)
!=
STATUS_SUCCESS
)
removable
)
!=
STATUS_SUCCESS
)
{
ERR_
(
module
)(
"Could not map section %.8s, file probably truncated
\n
"
,
sec
->
Name
);
goto
error
;
...
...
@@ -1517,7 +1514,6 @@ static NTSTATUS map_image( HANDLE hmapping, ACCESS_MASK access, int fd, char *ba
}
done:
view
->
mapping
=
dup_mapping
;
SERVER_START_REQ
(
map_view
)
{
...
...
@@ -1544,7 +1540,6 @@ static NTSTATUS map_image( HANDLE hmapping, ACCESS_MASK access, int fd, char *ba
error:
if
(
view
)
delete_view
(
view
);
server_leave_uninterrupted_section
(
&
csVirtual
,
&
sigset
);
if
(
dup_mapping
)
close_handle
(
dup_mapping
);
return
status
;
}
...
...
@@ -2816,7 +2811,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
unsigned
int
vprot
,
sec_flags
;
struct
file_view
*
view
;
pe_image_info_t
image_info
;
HANDLE
dup_mapping
,
shared_file
;
HANDLE
shared_file
;
LARGE_INTEGER
offset
;
sigset_t
sigset
;
...
...
@@ -2897,7 +2892,6 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
res
=
wine_server_call
(
req
);
sec_flags
=
reply
->
flags
;
full_size
=
reply
->
size
;
dup_mapping
=
wine_server_ptr_handle
(
reply
->
mapping
);
shared_file
=
wine_server_ptr_handle
(
reply
->
shared_file
);
}
SERVER_END_REQ
;
...
...
@@ -2925,14 +2919,14 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
if
((
res
=
server_get_unix_fd
(
shared_file
,
FILE_READ_DATA
|
FILE_WRITE_DATA
,
&
shared_fd
,
&
shared_needs_close
,
NULL
,
NULL
)))
goto
done
;
res
=
map_image
(
handle
,
access
,
unix_handle
,
base
,
size
,
mask
,
image_info
.
header_size
,
shared_fd
,
dup_mapping
,
addr_ptr
);
shared_fd
,
needs_close
,
addr_ptr
);
if
(
shared_needs_close
)
close
(
shared_fd
);
close_handle
(
shared_file
);
}
else
{
res
=
map_image
(
handle
,
access
,
unix_handle
,
base
,
size
,
mask
,
image_info
.
header_size
,
-
1
,
dup_mapping
,
addr_ptr
);
-
1
,
needs_close
,
addr_ptr
);
}
if
(
needs_close
)
close
(
unix_handle
);
if
(
res
>=
0
)
*
size_ptr
=
size
;
...
...
@@ -2981,7 +2975,7 @@ 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
,
!
dup_mapping
);
res
=
map_file_into_view
(
view
,
unix_handle
,
0
,
size
,
offset
.
QuadPart
,
vprot
,
needs_close
);
if
(
res
==
STATUS_SUCCESS
)
{
SERVER_START_REQ
(
map_view
)
...
...
@@ -3000,8 +2994,6 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
{
*
addr_ptr
=
view
->
base
;
*
size_ptr
=
size
;
view
->
mapping
=
dup_mapping
;
dup_mapping
=
0
;
/* don't close it */
VIRTUAL_DEBUG_DUMP_VIEW
(
view
);
}
else
...
...
@@ -3014,7 +3006,6 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
server_leave_uninterrupted_section
(
&
csVirtual
,
&
sigset
);
done:
if
(
dup_mapping
)
close_handle
(
dup_mapping
);
if
(
needs_close
)
close
(
unix_handle
);
return
res
;
}
...
...
include/wine/server_protocol.h
View file @
5fa8713d
...
...
@@ -2218,10 +2218,8 @@ struct get_mapping_info_reply
struct
reply_header
__header
;
mem_size_t
size
;
unsigned
int
flags
;
obj_handle_t
mapping
;
obj_handle_t
shared_file
;
/* VARARG(image,pe_image_info); */
char
__pad_28
[
4
];
};
...
...
@@ -6461,6 +6459,6 @@ union generic_reply
struct
terminate_job_reply
terminate_job_reply
;
};
#define SERVER_PROTOCOL_VERSION 54
1
#define SERVER_PROTOCOL_VERSION 54
2
#endif
/* __WINE_WINE_SERVER_PROTOCOL_H */
server/mapping.c
View file @
5fa8713d
...
...
@@ -839,7 +839,6 @@ DECL_HANDLER(open_mapping)
DECL_HANDLER
(
get_mapping_info
)
{
struct
mapping
*
mapping
;
struct
fd
*
fd
;
if
(
!
(
mapping
=
get_mapping_obj
(
current
->
process
,
req
->
handle
,
req
->
access
)))
return
;
...
...
@@ -862,19 +861,9 @@ DECL_HANDLER(get_mapping_info)
return
;
}
if
((
fd
=
get_obj_fd
(
&
mapping
->
obj
)))
{
if
(
!
is_fd_removable
(
fd
))
reply
->
mapping
=
alloc_handle
(
current
->
process
,
mapping
,
0
,
0
);
release_object
(
fd
);
}
if
(
mapping
->
shared_file
)
{
if
(
!
(
reply
->
shared_file
=
alloc_handle
(
current
->
process
,
mapping
->
shared_file
,
GENERIC_READ
|
GENERIC_WRITE
,
0
)))
{
if
(
reply
->
mapping
)
close_handle
(
current
->
process
,
reply
->
mapping
);
}
}
reply
->
shared_file
=
alloc_handle
(
current
->
process
,
mapping
->
shared_file
,
GENERIC_READ
|
GENERIC_WRITE
,
0
);
release_object
(
mapping
);
}
...
...
server/protocol.def
View file @
5fa8713d
...
...
@@ -1717,7 +1717,6 @@ enum char_info_mode
@REPLY
mem_size_t size; /* mapping size */
unsigned int flags; /* SEC_* flags */
obj_handle_t mapping; /* duplicate mapping handle unless removable */
obj_handle_t shared_file; /* shared mapping file handle */
VARARG(image,pe_image_info);/* image info for SEC_IMAGE mappings */
@END
...
...
server/request.h
View file @
5fa8713d
...
...
@@ -1266,9 +1266,8 @@ C_ASSERT( FIELD_OFFSET(struct get_mapping_info_request, access) == 16 );
C_ASSERT
(
sizeof
(
struct
get_mapping_info_request
)
==
24
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_mapping_info_reply
,
size
)
==
8
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_mapping_info_reply
,
flags
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_mapping_info_reply
,
mapping
)
==
20
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_mapping_info_reply
,
shared_file
)
==
24
);
C_ASSERT
(
sizeof
(
struct
get_mapping_info_reply
)
==
32
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_mapping_info_reply
,
shared_file
)
==
20
);
C_ASSERT
(
sizeof
(
struct
get_mapping_info_reply
)
==
24
);
C_ASSERT
(
FIELD_OFFSET
(
struct
map_view_request
,
mapping
)
==
12
);
C_ASSERT
(
FIELD_OFFSET
(
struct
map_view_request
,
access
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
map_view_request
,
base
)
==
24
);
...
...
server/trace.c
View file @
5fa8713d
...
...
@@ -2235,7 +2235,6 @@ static void dump_get_mapping_info_reply( const struct get_mapping_info_reply *re
{
dump_uint64
(
" size="
,
&
req
->
size
);
fprintf
(
stderr
,
", flags=%08x"
,
req
->
flags
);
fprintf
(
stderr
,
", mapping=%04x"
,
req
->
mapping
);
fprintf
(
stderr
,
", shared_file=%04x"
,
req
->
shared_file
);
dump_varargs_pe_image_info
(
", image="
,
cur_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