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
40d0e55d
Commit
40d0e55d
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 OpenFileMappingFromApp().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
b114b2c9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
1 deletion
+47
-1
kernelbase.spec
dlls/kernelbase/kernelbase.spec
+1
-1
sync.c
dlls/kernelbase/sync.c
+18
-0
process.c
dlls/kernelbase/tests/process.c
+27
-0
winbase.h
include/winbase.h
+1
-0
No files found.
dlls/kernelbase/kernelbase.spec
View file @
40d0e55d
...
...
@@ -1015,7 +1015,7 @@
@ stdcall OpenEventA(long long str)
@ stdcall OpenEventW(long long wstr)
@ stdcall OpenFileById(long ptr long long ptr long)
# @ stub OpenFileMappingFromApp
@ stdcall OpenFileMappingFromApp(long long wstr)
@ stdcall OpenFileMappingW(long long wstr)
# @ stub OpenGlobalizationUserSettingsKey
@ stdcall OpenMutexW(long long wstr)
...
...
dlls/kernelbase/sync.c
View file @
40d0e55d
...
...
@@ -972,6 +972,24 @@ HANDLE WINAPI DECLSPEC_HOTPATCH OpenFileMappingW( DWORD access, BOOL inherit, LP
/***********************************************************************
* OpenFileMappingFromApp (kernelbase.@)
*/
HANDLE
WINAPI
DECLSPEC_HOTPATCH
OpenFileMappingFromApp
(
ULONG
access
,
BOOL
inherit
,
LPCWSTR
name
)
{
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
HANDLE
ret
;
if
(
!
get_open_object_attributes
(
&
attr
,
&
nameW
,
inherit
,
name
))
return
0
;
if
(
access
==
FILE_MAP_COPY
)
access
=
SECTION_MAP_READ
;
if
(
!
set_ntstatus
(
NtOpenSection
(
&
ret
,
access
,
&
attr
)))
return
0
;
return
ret
;
}
/***********************************************************************
* Condition variables
***********************************************************************/
...
...
dlls/kernelbase/tests/process.c
View file @
40d0e55d
...
...
@@ -36,6 +36,7 @@ static LPVOID (WINAPI *pMapViewOfFile3)(HANDLE, HANDLE, PVOID, ULONG64 offset, S
static
LPVOID
(
WINAPI
*
pVirtualAlloc2
)(
HANDLE
,
void
*
,
SIZE_T
,
DWORD
,
DWORD
,
MEM_EXTENDED_PARAMETER
*
,
ULONG
);
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
void
test_CompareObjectHandles
(
void
)
{
...
...
@@ -324,6 +325,30 @@ static void test_VirtualAlloc2FromApp(void)
}
}
static
void
test_OpenFileMappingFromApp
(
void
)
{
HANDLE
file
,
mapping
;
if
(
!
pOpenFileMappingFromApp
)
{
win_skip
(
"OpenFileMappingFromApp is not available.
\n
"
);
return
;
}
file
=
CreateFileMappingA
(
INVALID_HANDLE_VALUE
,
NULL
,
PAGE_EXECUTE_READ
,
0
,
4090
,
"foo"
);
ok
(
!!
file
,
"Failed to create a mapping.
\n
"
);
mapping
=
pOpenFileMappingFromApp
(
FILE_MAP_READ
,
FALSE
,
L"foo"
);
ok
(
!!
mapping
,
"Failed to open a mapping.
\n
"
);
CloseHandle
(
mapping
);
mapping
=
pOpenFileMappingFromApp
(
FILE_MAP_EXECUTE
,
FALSE
,
L"foo"
);
ok
(
!!
mapping
,
"Failed to open a mapping.
\n
"
);
CloseHandle
(
mapping
);
CloseHandle
(
file
);
}
static
void
init_funcs
(
void
)
{
HMODULE
hmod
=
GetModuleHandleA
(
"kernelbase.dll"
);
...
...
@@ -331,6 +356,7 @@ static void init_funcs(void)
#define X(f) { p##f = (void*)GetProcAddress(hmod, #f); }
X
(
CompareObjectHandles
);
X
(
MapViewOfFile3
);
X
(
OpenFileMappingFromApp
);
X
(
VirtualAlloc2
);
X
(
VirtualAlloc2FromApp
);
X
(
VirtualAllocFromApp
);
...
...
@@ -346,4 +372,5 @@ START_TEST(process)
test_VirtualAlloc2
();
test_VirtualAllocFromApp
();
test_VirtualAlloc2FromApp
();
test_OpenFileMappingFromApp
();
}
include/winbase.h
View file @
40d0e55d
...
...
@@ -2537,6 +2537,7 @@ WINBASEAPI HFILE WINAPI OpenFile(LPCSTR,OFSTRUCT*,UINT);
WINBASEAPI
HANDLE
WINAPI
OpenFileMappingA
(
DWORD
,
BOOL
,
LPCSTR
);
WINBASEAPI
HANDLE
WINAPI
OpenFileMappingW
(
DWORD
,
BOOL
,
LPCWSTR
);
#define OpenFileMapping WINELIB_NAME_AW(OpenFileMapping)
WINBASEAPI
HANDLE
WINAPI
OpenFileMappingFromApp
(
ULONG
,
BOOL
,
LPCWSTR
);
WINBASEAPI
HANDLE
WINAPI
OpenJobObjectA
(
DWORD
,
BOOL
,
LPCSTR
);
WINBASEAPI
HANDLE
WINAPI
OpenJobObjectW
(
DWORD
,
BOOL
,
LPCWSTR
);
#define OpenJobObject WINELIB_NAME_AW(OpenJobObject)
...
...
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