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
3ede82e2
Commit
3ede82e2
authored
Sep 18, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Add CreateFileMappingFromApp().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
40d0e55d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
2 deletions
+54
-2
kernelbase.spec
dlls/kernelbase/kernelbase.spec
+1
-1
sync.c
dlls/kernelbase/sync.c
+9
-1
process.c
dlls/kernelbase/tests/process.c
+43
-0
winbase.h
include/winbase.h
+1
-0
No files found.
dlls/kernelbase/kernelbase.spec
View file @
3ede82e2
...
...
@@ -190,7 +190,7 @@
@ stdcall CreateFiberEx(long long long ptr ptr)
@ stdcall CreateFile2(wstr long long long ptr)
@ stdcall CreateFileA(str long long ptr long long long)
# @ stub CreateFileMappingFromApp
@ stdcall CreateFileMappingFromApp(long ptr long int64 wstr)
@ stdcall CreateFileMappingNumaW(long ptr long long long wstr long)
@ stdcall CreateFileMappingW(long ptr long long long wstr)
@ stdcall CreateFileW(wstr long long ptr long long long)
...
...
dlls/kernelbase/sync.c
View file @
3ede82e2
...
...
@@ -879,7 +879,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH InitializeCriticalSectionEx( CRITICAL_SECTION *cri
* File mappings
***********************************************************************/
/***********************************************************************
* CreateFileMappingW (kernelbase.@)
*/
...
...
@@ -948,6 +947,15 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateFileMappingW( HANDLE file, LPSECURITY_ATTR
/***********************************************************************
* CreateFileMappingFromApp (kernelbase.@)
*/
HANDLE
WINAPI
DECLSPEC_HOTPATCH
CreateFileMappingFromApp
(
HANDLE
file
,
LPSECURITY_ATTRIBUTES
sa
,
ULONG
protect
,
ULONG64
size
,
LPCWSTR
name
)
{
return
CreateFileMappingW
(
file
,
sa
,
protect
,
size
<<
32
,
size
,
name
);
}
/***********************************************************************
* OpenFileMappingW (kernelbase.@)
*/
HANDLE
WINAPI
DECLSPEC_HOTPATCH
OpenFileMappingW
(
DWORD
access
,
BOOL
inherit
,
LPCWSTR
name
)
...
...
dlls/kernelbase/tests/process.c
View file @
3ede82e2
...
...
@@ -30,6 +30,8 @@
#include "wine/test.h"
static
NTSTATUS
(
WINAPI
*
pNtQueryObject
)(
HANDLE
,
OBJECT_INFORMATION_CLASS
,
PVOID
,
ULONG
,
PULONG
);
static
BOOL
(
WINAPI
*
pCompareObjectHandles
)(
HANDLE
,
HANDLE
);
static
LPVOID
(
WINAPI
*
pMapViewOfFile3
)(
HANDLE
,
HANDLE
,
PVOID
,
ULONG64
offset
,
SIZE_T
size
,
ULONG
,
ULONG
,
MEM_EXTENDED_PARAMETER
*
,
ULONG
);
...
...
@@ -37,6 +39,7 @@ static LPVOID (WINAPI *pVirtualAlloc2)(HANDLE, void *, SIZE_T, DWORD, DWORD, MEM
static
LPVOID
(
WINAPI
*
pVirtualAlloc2FromApp
)(
HANDLE
,
void
*
,
SIZE_T
,
DWORD
,
DWORD
,
MEM_EXTENDED_PARAMETER
*
,
ULONG
);
static
PVOID
(
WINAPI
*
pVirtualAllocFromApp
)(
PVOID
,
SIZE_T
,
DWORD
,
DWORD
);
static
HANDLE
(
WINAPI
*
pOpenFileMappingFromApp
)(
ULONG
,
BOOL
,
LPCWSTR
);
static
HANDLE
(
WINAPI
*
pCreateFileMappingFromApp
)(
HANDLE
,
PSECURITY_ATTRIBUTES
,
ULONG
,
ULONG64
,
PCWSTR
);
static
void
test_CompareObjectHandles
(
void
)
{
...
...
@@ -327,7 +330,10 @@ static void test_VirtualAlloc2FromApp(void)
static
void
test_OpenFileMappingFromApp
(
void
)
{
OBJECT_BASIC_INFORMATION
info
;
HANDLE
file
,
mapping
;
NTSTATUS
status
;
ULONG
length
;
if
(
!
pOpenFileMappingFromApp
)
{
...
...
@@ -340,26 +346,62 @@ static void test_OpenFileMappingFromApp(void)
mapping
=
pOpenFileMappingFromApp
(
FILE_MAP_READ
,
FALSE
,
L"foo"
);
ok
(
!!
mapping
,
"Failed to open a mapping.
\n
"
);
status
=
pNtQueryObject
(
mapping
,
ObjectBasicInformation
,
&
info
,
sizeof
(
info
),
&
length
);
ok
(
!
status
,
"Failed to get object information.
\n
"
);
ok
(
info
.
GrantedAccess
==
SECTION_MAP_READ
,
"Unexpected access mask %#lx.
\n
"
,
info
.
GrantedAccess
);
CloseHandle
(
mapping
);
mapping
=
pOpenFileMappingFromApp
(
FILE_MAP_EXECUTE
,
FALSE
,
L"foo"
);
ok
(
!!
mapping
,
"Failed to open a mapping.
\n
"
);
status
=
pNtQueryObject
(
mapping
,
ObjectBasicInformation
,
&
info
,
sizeof
(
info
),
&
length
);
ok
(
!
status
,
"Failed to get object information.
\n
"
);
todo_wine
ok
(
info
.
GrantedAccess
==
SECTION_MAP_EXECUTE
,
"Unexpected access mask %#lx.
\n
"
,
info
.
GrantedAccess
);
CloseHandle
(
mapping
);
CloseHandle
(
file
);
}
static
void
test_CreateFileMappingFromApp
(
void
)
{
OBJECT_BASIC_INFORMATION
info
;
NTSTATUS
status
;
ULONG
length
;
HANDLE
file
;
if
(
!
pCreateFileMappingFromApp
)
{
win_skip
(
"CreateFileMappingFromApp is not available.
\n
"
);
return
;
}
file
=
pCreateFileMappingFromApp
(
INVALID_HANDLE_VALUE
,
NULL
,
PAGE_EXECUTE_READWRITE
,
1024
,
L"foo"
);
ok
(
!!
file
||
broken
(
!
file
)
/* Win8 */
,
"Failed to create a mapping, error %lu.
\n
"
,
GetLastError
());
if
(
!
file
)
return
;
status
=
pNtQueryObject
(
file
,
ObjectBasicInformation
,
&
info
,
sizeof
(
info
),
&
length
);
ok
(
!
status
,
"Failed to get object information.
\n
"
);
ok
(
info
.
GrantedAccess
&
SECTION_MAP_EXECUTE
,
"Unexpected access mask %#lx.
\n
"
,
info
.
GrantedAccess
);
CloseHandle
(
file
);
}
static
void
init_funcs
(
void
)
{
HMODULE
hmod
=
GetModuleHandleA
(
"kernelbase.dll"
);
#define X(f) { p##f = (void*)GetProcAddress(hmod, #f); }
X
(
CompareObjectHandles
);
X
(
CreateFileMappingFromApp
);
X
(
MapViewOfFile3
);
X
(
OpenFileMappingFromApp
);
X
(
VirtualAlloc2
);
X
(
VirtualAlloc2FromApp
);
X
(
VirtualAllocFromApp
);
hmod
=
GetModuleHandleA
(
"ntdll.dll"
);
X
(
NtQueryObject
);
#undef X
}
...
...
@@ -373,4 +415,5 @@ START_TEST(process)
test_VirtualAllocFromApp
();
test_VirtualAlloc2FromApp
();
test_OpenFileMappingFromApp
();
test_CreateFileMappingFromApp
();
}
include/winbase.h
View file @
3ede82e2
...
...
@@ -1876,6 +1876,7 @@ WINBASEAPI HANDLE WINAPI CreateFileW(LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBU
WINBASEAPI
HANDLE
WINAPI
CreateFileMappingA
(
HANDLE
,
LPSECURITY_ATTRIBUTES
,
DWORD
,
DWORD
,
DWORD
,
LPCSTR
);
WINBASEAPI
HANDLE
WINAPI
CreateFileMappingW
(
HANDLE
,
LPSECURITY_ATTRIBUTES
,
DWORD
,
DWORD
,
DWORD
,
LPCWSTR
);
#define CreateFileMapping WINELIB_NAME_AW(CreateFileMapping)
WINBASEAPI
HANDLE
WINAPI
CreateFileMappingFromApp
(
HANDLE
,
PSECURITY_ATTRIBUTES
,
ULONG
,
ULONG64
,
PCWSTR
);
WINBASEAPI
HANDLE
WINAPI
CreateIoCompletionPort
(
HANDLE
,
HANDLE
,
ULONG_PTR
,
DWORD
);
WINBASEAPI
HANDLE
WINAPI
CreateJobObjectA
(
LPSECURITY_ATTRIBUTES
,
LPCSTR
);
WINBASEAPI
HANDLE
WINAPI
CreateJobObjectW
(
LPSECURITY_ATTRIBUTES
,
LPCWSTR
);
...
...
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