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
cdfc4585
Commit
cdfc4585
authored
Jun 04, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move the section object functions to the Unix library.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f1276b25
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
107 deletions
+87
-107
loader.c
dlls/ntdll/unix/loader.c
+2
-0
sync.c
dlls/ntdll/unix/sync.c
+77
-0
unixlib.h
dlls/ntdll/unixlib.h
+6
-1
virtual.c
dlls/ntdll/virtual.c
+2
-106
No files found.
dlls/ntdll/unix/loader.c
View file @
cdfc4585
...
@@ -991,6 +991,7 @@ static struct unix_funcs unix_funcs =
...
@@ -991,6 +991,7 @@ static struct unix_funcs unix_funcs =
NtCreateEvent
,
NtCreateEvent
,
NtCreateKeyedEvent
,
NtCreateKeyedEvent
,
NtCreateMutant
,
NtCreateMutant
,
NtCreateSection
,
NtCreateSemaphore
,
NtCreateSemaphore
,
NtCreateTimer
,
NtCreateTimer
,
NtCurrentTeb
,
NtCurrentTeb
,
...
@@ -1005,6 +1006,7 @@ static struct unix_funcs unix_funcs =
...
@@ -1005,6 +1006,7 @@ static struct unix_funcs unix_funcs =
NtOpenEvent
,
NtOpenEvent
,
NtOpenKeyedEvent
,
NtOpenKeyedEvent
,
NtOpenMutant
,
NtOpenMutant
,
NtOpenSection
,
NtOpenSemaphore
,
NtOpenSemaphore
,
NtOpenTimer
,
NtOpenTimer
,
NtProtectVirtualMemory
,
NtProtectVirtualMemory
,
...
...
dlls/ntdll/unix/sync.c
View file @
cdfc4585
...
@@ -871,3 +871,80 @@ NTSTATUS WINAPI NtReleaseKeyedEvent( HANDLE handle, const void *key,
...
@@ -871,3 +871,80 @@ NTSTATUS WINAPI NtReleaseKeyedEvent( HANDLE handle, const void *key,
select_op
.
keyed_event
.
key
=
wine_server_client_ptr
(
key
);
select_op
.
keyed_event
.
key
=
wine_server_client_ptr
(
key
);
return
server_wait
(
&
select_op
,
sizeof
(
select_op
.
keyed_event
),
flags
,
timeout
);
return
server_wait
(
&
select_op
,
sizeof
(
select_op
.
keyed_event
),
flags
,
timeout
);
}
}
/***********************************************************************
* NtCreateSection (NTDLL.@)
*/
NTSTATUS
WINAPI
NtCreateSection
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
const
LARGE_INTEGER
*
size
,
ULONG
protect
,
ULONG
sec_flags
,
HANDLE
file
)
{
NTSTATUS
ret
;
unsigned
int
file_access
;
data_size_t
len
;
struct
object_attributes
*
objattr
;
switch
(
protect
&
0xff
)
{
case
PAGE_READONLY
:
case
PAGE_EXECUTE_READ
:
case
PAGE_WRITECOPY
:
case
PAGE_EXECUTE_WRITECOPY
:
file_access
=
FILE_READ_DATA
;
break
;
case
PAGE_READWRITE
:
case
PAGE_EXECUTE_READWRITE
:
if
(
sec_flags
&
SEC_IMAGE
)
file_access
=
FILE_READ_DATA
;
else
file_access
=
FILE_READ_DATA
|
FILE_WRITE_DATA
;
break
;
case
PAGE_EXECUTE
:
case
PAGE_NOACCESS
:
file_access
=
0
;
break
;
default:
return
STATUS_INVALID_PAGE_PROTECTION
;
}
if
((
ret
=
alloc_object_attributes
(
attr
,
&
objattr
,
&
len
)))
return
ret
;
SERVER_START_REQ
(
create_mapping
)
{
req
->
access
=
access
;
req
->
flags
=
sec_flags
;
req
->
file_handle
=
wine_server_obj_handle
(
file
);
req
->
file_access
=
file_access
;
req
->
size
=
size
?
size
->
QuadPart
:
0
;
wine_server_add_data
(
req
,
objattr
,
len
);
ret
=
wine_server_call
(
req
);
*
handle
=
wine_server_ptr_handle
(
reply
->
handle
);
}
SERVER_END_REQ
;
RtlFreeHeap
(
GetProcessHeap
(),
0
,
objattr
);
return
ret
;
}
/***********************************************************************
* NtOpenSection (NTDLL.@)
*/
NTSTATUS
WINAPI
NtOpenSection
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
)
{
NTSTATUS
ret
;
if
((
ret
=
validate_open_object_attributes
(
attr
)))
return
ret
;
SERVER_START_REQ
(
open_mapping
)
{
req
->
access
=
access
;
req
->
attributes
=
attr
->
Attributes
;
req
->
rootdir
=
wine_server_obj_handle
(
attr
->
RootDirectory
);
if
(
attr
->
ObjectName
)
wine_server_add_data
(
req
,
attr
->
ObjectName
->
Buffer
,
attr
->
ObjectName
->
Length
);
ret
=
wine_server_call
(
req
);
*
handle
=
wine_server_ptr_handle
(
reply
->
handle
);
}
SERVER_END_REQ
;
return
ret
;
}
dlls/ntdll/unixlib.h
View file @
cdfc4585
...
@@ -28,7 +28,7 @@ struct ldt_copy;
...
@@ -28,7 +28,7 @@ struct ldt_copy;
struct
msghdr
;
struct
msghdr
;
/* increment this when you change the function table */
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 2
6
#define NTDLL_UNIXLIB_VERSION 2
7
struct
unix_funcs
struct
unix_funcs
{
{
...
@@ -45,6 +45,9 @@ struct unix_funcs
...
@@ -45,6 +45,9 @@ struct unix_funcs
const
OBJECT_ATTRIBUTES
*
attr
,
ULONG
flags
);
const
OBJECT_ATTRIBUTES
*
attr
,
ULONG
flags
);
NTSTATUS
(
WINAPI
*
NtCreateMutant
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
NTSTATUS
(
WINAPI
*
NtCreateMutant
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
BOOLEAN
owned
);
const
OBJECT_ATTRIBUTES
*
attr
,
BOOLEAN
owned
);
NTSTATUS
(
WINAPI
*
NtCreateSection
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
const
LARGE_INTEGER
*
size
,
ULONG
protect
,
ULONG
sec_flags
,
HANDLE
file
);
NTSTATUS
(
WINAPI
*
NtCreateSemaphore
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
NTSTATUS
(
WINAPI
*
NtCreateSemaphore
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
,
LONG
initial
,
LONG
max
);
const
OBJECT_ATTRIBUTES
*
attr
,
LONG
initial
,
LONG
max
);
NTSTATUS
(
WINAPI
*
NtCreateTimer
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
NTSTATUS
(
WINAPI
*
NtCreateTimer
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
...
@@ -72,6 +75,8 @@ struct unix_funcs
...
@@ -72,6 +75,8 @@ struct unix_funcs
const
OBJECT_ATTRIBUTES
*
attr
);
const
OBJECT_ATTRIBUTES
*
attr
);
NTSTATUS
(
WINAPI
*
NtOpenMutant
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
NTSTATUS
(
WINAPI
*
NtOpenMutant
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
);
const
OBJECT_ATTRIBUTES
*
attr
);
NTSTATUS
(
WINAPI
*
NtOpenSection
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
);
NTSTATUS
(
WINAPI
*
NtOpenSemaphore
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
NTSTATUS
(
WINAPI
*
NtOpenSemaphore
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
);
const
OBJECT_ATTRIBUTES
*
attr
);
NTSTATUS
(
WINAPI
*
NtOpenTimer
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
NTSTATUS
(
WINAPI
*
NtOpenTimer
)(
HANDLE
*
handle
,
ACCESS_MASK
access
,
...
...
dlls/ntdll/virtual.c
View file @
cdfc4585
...
@@ -63,17 +63,6 @@
...
@@ -63,17 +63,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
virtual
);
WINE_DEFAULT_DEBUG_CHANNEL
(
virtual
);
/* per-page protection flags */
#define VPROT_READ 0x01
#define VPROT_WRITE 0x02
#define VPROT_EXEC 0x04
#define VPROT_WRITECOPY 0x08
#define VPROT_GUARD 0x10
#define VPROT_COMMITTED 0x20
#define VPROT_WRITEWATCH 0x40
/* per-mapping protection flags */
#define VPROT_SYSTEM 0x0200
/* system view (underlying mmap not under our control) */
static
const
UINT
page_shift
=
12
;
static
const
UINT
page_shift
=
12
;
static
const
UINT_PTR
page_mask
=
0xfff
;
static
const
UINT_PTR
page_mask
=
0xfff
;
...
@@ -84,59 +73,6 @@ static SIZE_T signal_stack_align;
...
@@ -84,59 +73,6 @@ static SIZE_T signal_stack_align;
#define ROUND_SIZE(addr,size) \
#define ROUND_SIZE(addr,size) \
(((SIZE_T)(size) + ((UINT_PTR)(addr) & page_mask) + page_mask) & ~page_mask)
(((SIZE_T)(size) + ((UINT_PTR)(addr) & page_mask) + page_mask) & ~page_mask)
/***********************************************************************
* get_vprot_flags
*
* Build page protections from Win32 flags.
*
* PARAMS
* protect [I] Win32 protection flags
*
* RETURNS
* Value of page protection flags
*/
static
NTSTATUS
get_vprot_flags
(
DWORD
protect
,
unsigned
int
*
vprot
,
BOOL
image
)
{
switch
(
protect
&
0xff
)
{
case
PAGE_READONLY
:
*
vprot
=
VPROT_READ
;
break
;
case
PAGE_READWRITE
:
if
(
image
)
*
vprot
=
VPROT_READ
|
VPROT_WRITECOPY
;
else
*
vprot
=
VPROT_READ
|
VPROT_WRITE
;
break
;
case
PAGE_WRITECOPY
:
*
vprot
=
VPROT_READ
|
VPROT_WRITECOPY
;
break
;
case
PAGE_EXECUTE
:
*
vprot
=
VPROT_EXEC
;
break
;
case
PAGE_EXECUTE_READ
:
*
vprot
=
VPROT_EXEC
|
VPROT_READ
;
break
;
case
PAGE_EXECUTE_READWRITE
:
if
(
image
)
*
vprot
=
VPROT_EXEC
|
VPROT_READ
|
VPROT_WRITECOPY
;
else
*
vprot
=
VPROT_EXEC
|
VPROT_READ
|
VPROT_WRITE
;
break
;
case
PAGE_EXECUTE_WRITECOPY
:
*
vprot
=
VPROT_EXEC
|
VPROT_READ
|
VPROT_WRITECOPY
;
break
;
case
PAGE_NOACCESS
:
*
vprot
=
0
;
break
;
default:
return
STATUS_INVALID_PAGE_PROTECTION
;
}
if
(
protect
&
PAGE_GUARD
)
*
vprot
|=
VPROT_GUARD
;
return
STATUS_SUCCESS
;
}
/**********************************************************************
/**********************************************************************
* RtlCreateUserStack (NTDLL.@)
* RtlCreateUserStack (NTDLL.@)
*/
*/
...
@@ -270,32 +206,7 @@ NTSTATUS WINAPI NtCreateSection( HANDLE *handle, ACCESS_MASK access, const OBJEC
...
@@ -270,32 +206,7 @@ NTSTATUS WINAPI NtCreateSection( HANDLE *handle, ACCESS_MASK access, const OBJEC
const
LARGE_INTEGER
*
size
,
ULONG
protect
,
const
LARGE_INTEGER
*
size
,
ULONG
protect
,
ULONG
sec_flags
,
HANDLE
file
)
ULONG
sec_flags
,
HANDLE
file
)
{
{
NTSTATUS
ret
;
return
unix_funcs
->
NtCreateSection
(
handle
,
access
,
attr
,
size
,
protect
,
sec_flags
,
file
);
unsigned
int
vprot
,
file_access
=
0
;
data_size_t
len
;
struct
object_attributes
*
objattr
;
if
((
ret
=
get_vprot_flags
(
protect
,
&
vprot
,
sec_flags
&
SEC_IMAGE
)))
return
ret
;
if
((
ret
=
alloc_object_attributes
(
attr
,
&
objattr
,
&
len
)))
return
ret
;
if
(
vprot
&
VPROT_READ
)
file_access
|=
FILE_READ_DATA
;
if
(
vprot
&
VPROT_WRITE
)
file_access
|=
FILE_WRITE_DATA
;
SERVER_START_REQ
(
create_mapping
)
{
req
->
access
=
access
;
req
->
flags
=
sec_flags
;
req
->
file_handle
=
wine_server_obj_handle
(
file
);
req
->
file_access
=
file_access
;
req
->
size
=
size
?
size
->
QuadPart
:
0
;
wine_server_add_data
(
req
,
objattr
,
len
);
ret
=
wine_server_call
(
req
);
*
handle
=
wine_server_ptr_handle
(
reply
->
handle
);
}
SERVER_END_REQ
;
RtlFreeHeap
(
GetProcessHeap
(),
0
,
objattr
);
return
ret
;
}
}
...
@@ -305,22 +216,7 @@ NTSTATUS WINAPI NtCreateSection( HANDLE *handle, ACCESS_MASK access, const OBJEC
...
@@ -305,22 +216,7 @@ NTSTATUS WINAPI NtCreateSection( HANDLE *handle, ACCESS_MASK access, const OBJEC
*/
*/
NTSTATUS
WINAPI
NtOpenSection
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
)
NTSTATUS
WINAPI
NtOpenSection
(
HANDLE
*
handle
,
ACCESS_MASK
access
,
const
OBJECT_ATTRIBUTES
*
attr
)
{
{
NTSTATUS
ret
;
return
unix_funcs
->
NtOpenSection
(
handle
,
access
,
attr
);
if
((
ret
=
validate_open_object_attributes
(
attr
)))
return
ret
;
SERVER_START_REQ
(
open_mapping
)
{
req
->
access
=
access
;
req
->
attributes
=
attr
->
Attributes
;
req
->
rootdir
=
wine_server_obj_handle
(
attr
->
RootDirectory
);
if
(
attr
->
ObjectName
)
wine_server_add_data
(
req
,
attr
->
ObjectName
->
Buffer
,
attr
->
ObjectName
->
Length
);
ret
=
wine_server_call
(
req
);
*
handle
=
wine_server_ptr_handle
(
reply
->
handle
);
}
SERVER_END_REQ
;
return
ret
;
}
}
...
...
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