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
628d4450
Commit
628d4450
authored
Jun 27, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Move file mapping functions to kernelbase.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
aa7f8e93
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
101 deletions
+106
-101
kernel32.spec
dlls/kernel32/kernel32.spec
+2
-2
sync.c
dlls/kernel32/sync.c
+0
-97
kernelbase.spec
dlls/kernelbase/kernelbase.spec
+2
-2
sync.c
dlls/kernelbase/sync.c
+102
-0
No files found.
dlls/kernel32/kernel32.spec
View file @
628d4450
...
...
@@ -285,7 +285,7 @@
@ stdcall CreateFileMappingA(long ptr long long long str)
# @ stub CreateFileMappingNumaA
# @ stub CreateFileMappingNumaW
@ stdcall CreateFileMappingW(long ptr long long long wstr)
@ stdcall
-import
CreateFileMappingW(long ptr long long long wstr)
@ stdcall CreateFileW(wstr long long ptr long long long)
@ stdcall CreateHardLinkA(str str ptr)
@ stdcall CreateHardLinkTransactedA(str str ptr ptr)
...
...
@@ -1117,7 +1117,7 @@
@ stdcall OpenFile(str ptr long)
@ stdcall OpenFileById(long ptr long long ptr long)
@ stdcall OpenFileMappingA(long long str)
@ stdcall OpenFileMappingW(long long wstr)
@ stdcall
-import
OpenFileMappingW(long long wstr)
@ stdcall OpenJobObjectA(long long str)
@ stdcall OpenJobObjectW(long long wstr)
@ stdcall OpenMutexA(long long str)
...
...
dlls/kernel32/sync.c
View file @
628d4450
...
...
@@ -663,73 +663,6 @@ HANDLE WINAPI CreateFileMappingA( HANDLE file, SECURITY_ATTRIBUTES *sa, DWORD pr
/***********************************************************************
* CreateFileMappingW (KERNEL32.@)
*/
HANDLE
WINAPI
CreateFileMappingW
(
HANDLE
file
,
LPSECURITY_ATTRIBUTES
sa
,
DWORD
protect
,
DWORD
size_high
,
DWORD
size_low
,
LPCWSTR
name
)
{
static
const
int
sec_flags
=
(
SEC_FILE
|
SEC_IMAGE
|
SEC_RESERVE
|
SEC_COMMIT
|
SEC_NOCACHE
|
SEC_WRITECOMBINE
|
SEC_LARGE_PAGES
);
HANDLE
ret
;
NTSTATUS
status
;
DWORD
access
,
sec_type
;
LARGE_INTEGER
size
;
UNICODE_STRING
nameW
;
OBJECT_ATTRIBUTES
attr
;
sec_type
=
protect
&
sec_flags
;
protect
&=
~
sec_flags
;
if
(
!
sec_type
)
sec_type
=
SEC_COMMIT
;
/* Win9x compatibility */
if
(
!
protect
&&
!
is_version_nt
())
protect
=
PAGE_READONLY
;
switch
(
protect
)
{
case
PAGE_READONLY
:
case
PAGE_WRITECOPY
:
access
=
STANDARD_RIGHTS_REQUIRED
|
SECTION_QUERY
|
SECTION_MAP_READ
;
break
;
case
PAGE_READWRITE
:
access
=
STANDARD_RIGHTS_REQUIRED
|
SECTION_QUERY
|
SECTION_MAP_READ
|
SECTION_MAP_WRITE
;
break
;
case
PAGE_EXECUTE_READ
:
case
PAGE_EXECUTE_WRITECOPY
:
access
=
STANDARD_RIGHTS_REQUIRED
|
SECTION_QUERY
|
SECTION_MAP_READ
|
SECTION_MAP_EXECUTE
;
break
;
case
PAGE_EXECUTE_READWRITE
:
access
=
STANDARD_RIGHTS_REQUIRED
|
SECTION_QUERY
|
SECTION_MAP_READ
|
SECTION_MAP_WRITE
|
SECTION_MAP_EXECUTE
;
break
;
default:
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
size
.
u
.
LowPart
=
size_low
;
size
.
u
.
HighPart
=
size_high
;
if
(
file
==
INVALID_HANDLE_VALUE
)
{
file
=
0
;
if
(
!
size
.
QuadPart
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
}
get_create_object_attributes
(
&
attr
,
&
nameW
,
sa
,
name
);
status
=
NtCreateSection
(
&
ret
,
access
,
&
attr
,
&
size
,
protect
,
sec_type
,
file
);
if
(
status
==
STATUS_OBJECT_NAME_EXISTS
)
SetLastError
(
ERROR_ALREADY_EXISTS
);
else
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
ret
;
}
/***********************************************************************
* OpenFileMappingA (KERNEL32.@)
*/
HANDLE
WINAPI
OpenFileMappingA
(
DWORD
access
,
BOOL
inherit
,
LPCSTR
name
)
...
...
@@ -747,36 +680,6 @@ HANDLE WINAPI OpenFileMappingA( DWORD access, BOOL inherit, LPCSTR name )
}
/***********************************************************************
* OpenFileMappingW (KERNEL32.@)
*/
HANDLE
WINAPI
OpenFileMappingW
(
DWORD
access
,
BOOL
inherit
,
LPCWSTR
name
)
{
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
HANDLE
ret
;
NTSTATUS
status
;
if
(
!
get_open_object_attributes
(
&
attr
,
&
nameW
,
inherit
,
name
))
return
0
;
if
(
access
==
FILE_MAP_COPY
)
access
=
SECTION_MAP_READ
;
if
(
!
is_version_nt
())
{
/* win9x doesn't do access checks, so try with full access first */
if
(
!
NtOpenSection
(
&
ret
,
access
|
SECTION_MAP_READ
|
SECTION_MAP_WRITE
,
&
attr
))
return
ret
;
}
status
=
NtOpenSection
(
&
ret
,
access
,
&
attr
);
if
(
status
!=
STATUS_SUCCESS
)
{
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
0
;
}
return
ret
;
}
/*
* Pipes
*/
...
...
dlls/kernelbase/kernelbase.spec
View file @
628d4450
...
...
@@ -189,7 +189,7 @@
@ stdcall CreateFileA(str long long ptr long long long) kernel32.CreateFileA
# @ stub CreateFileMappingFromApp
@ stub CreateFileMappingNumaW
@ stdcall CreateFileMappingW(long ptr long long long wstr)
kernel32.CreateFileMappingW
@ stdcall CreateFileMappingW(long ptr long long long wstr)
@ stdcall CreateFileW(wstr long long ptr long long long) kernel32.CreateFileW
@ stdcall CreateHardLinkA(str str ptr) kernel32.CreateHardLinkA
@ stdcall CreateHardLinkW(wstr wstr ptr) kernel32.CreateHardLinkW
...
...
@@ -985,7 +985,7 @@
@ stdcall OpenEventW(long long wstr)
@ stdcall OpenFileById(long ptr long long ptr long) kernel32.OpenFileById
# @ stub OpenFileMappingFromApp
@ stdcall OpenFileMappingW(long long wstr)
kernel32.OpenFileMappingW
@ stdcall OpenFileMappingW(long long wstr)
# @ stub OpenGlobalizationUserSettingsKey
@ stdcall OpenMutexW(long long wstr)
# @ stub OpenPackageInfoByFullName
...
...
dlls/kernelbase/sync.c
View file @
628d4450
...
...
@@ -617,3 +617,105 @@ BOOL WINAPI DECLSPEC_HOTPATCH InitializeCriticalSectionEx( CRITICAL_SECTION *cri
if
(
ret
)
RtlRaiseStatus
(
ret
);
return
!
ret
;
}
/***********************************************************************
* File mappings
***********************************************************************/
/***********************************************************************
* CreateFileMappingW (kernelbase.@)
*/
HANDLE
WINAPI
DECLSPEC_HOTPATCH
CreateFileMappingW
(
HANDLE
file
,
LPSECURITY_ATTRIBUTES
sa
,
DWORD
protect
,
DWORD
size_high
,
DWORD
size_low
,
LPCWSTR
name
)
{
static
const
int
sec_flags
=
(
SEC_FILE
|
SEC_IMAGE
|
SEC_RESERVE
|
SEC_COMMIT
|
SEC_NOCACHE
|
SEC_WRITECOMBINE
|
SEC_LARGE_PAGES
);
HANDLE
ret
;
NTSTATUS
status
;
DWORD
access
,
sec_type
;
LARGE_INTEGER
size
;
UNICODE_STRING
nameW
;
OBJECT_ATTRIBUTES
attr
;
sec_type
=
protect
&
sec_flags
;
protect
&=
~
sec_flags
;
if
(
!
sec_type
)
sec_type
=
SEC_COMMIT
;
/* Win9x compatibility */
if
(
!
protect
&&
!
is_version_nt
())
protect
=
PAGE_READONLY
;
switch
(
protect
)
{
case
PAGE_READONLY
:
case
PAGE_WRITECOPY
:
access
=
STANDARD_RIGHTS_REQUIRED
|
SECTION_QUERY
|
SECTION_MAP_READ
;
break
;
case
PAGE_READWRITE
:
access
=
STANDARD_RIGHTS_REQUIRED
|
SECTION_QUERY
|
SECTION_MAP_READ
|
SECTION_MAP_WRITE
;
break
;
case
PAGE_EXECUTE_READ
:
case
PAGE_EXECUTE_WRITECOPY
:
access
=
STANDARD_RIGHTS_REQUIRED
|
SECTION_QUERY
|
SECTION_MAP_READ
|
SECTION_MAP_EXECUTE
;
break
;
case
PAGE_EXECUTE_READWRITE
:
access
=
STANDARD_RIGHTS_REQUIRED
|
SECTION_QUERY
|
SECTION_MAP_READ
|
SECTION_MAP_WRITE
|
SECTION_MAP_EXECUTE
;
break
;
default:
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
size
.
u
.
LowPart
=
size_low
;
size
.
u
.
HighPart
=
size_high
;
if
(
file
==
INVALID_HANDLE_VALUE
)
{
file
=
0
;
if
(
!
size
.
QuadPart
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
}
get_create_object_attributes
(
&
attr
,
&
nameW
,
sa
,
name
);
status
=
NtCreateSection
(
&
ret
,
access
,
&
attr
,
&
size
,
protect
,
sec_type
,
file
);
if
(
status
==
STATUS_OBJECT_NAME_EXISTS
)
SetLastError
(
ERROR_ALREADY_EXISTS
);
else
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
ret
;
}
/***********************************************************************
* OpenFileMappingW (kernelbase.@)
*/
HANDLE
WINAPI
DECLSPEC_HOTPATCH
OpenFileMappingW
(
DWORD
access
,
BOOL
inherit
,
LPCWSTR
name
)
{
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
HANDLE
ret
;
NTSTATUS
status
;
if
(
!
get_open_object_attributes
(
&
attr
,
&
nameW
,
inherit
,
name
))
return
0
;
if
(
access
==
FILE_MAP_COPY
)
access
=
SECTION_MAP_READ
;
if
(
!
is_version_nt
())
{
/* win9x doesn't do access checks, so try with full access first */
if
(
!
NtOpenSection
(
&
ret
,
access
|
SECTION_MAP_READ
|
SECTION_MAP_WRITE
,
&
attr
))
return
ret
;
}
status
=
NtOpenSection
(
&
ret
,
access
,
&
attr
);
if
(
status
!=
STATUS_SUCCESS
)
{
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
0
;
}
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