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
9c40a801
Commit
9c40a801
authored
May 04, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 04, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Implement MapViewOfFile3().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
dc5d76b3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
0 deletions
+55
-0
kernelbase.spec
dlls/kernelbase/kernelbase.spec
+1
-0
memory.c
dlls/kernelbase/memory.c
+18
-0
process.c
dlls/kernelbase/tests/process.c
+35
-0
winbase.h
include/winbase.h
+1
-0
No files found.
dlls/kernelbase/kernelbase.spec
View file @
9c40a801
...
...
@@ -981,6 +981,7 @@
# @ stub MapPredefinedHandleInternal
@ stdcall MapUserPhysicalPages(ptr long ptr)
@ stdcall MapViewOfFile(long long long long long)
@ stdcall MapViewOfFile3(long long ptr int64 long long long ptr long)
@ stdcall MapViewOfFileEx(long long long long long ptr)
@ stdcall MapViewOfFileExNuma(long long long long long ptr long)
# @ stub MapViewOfFileFromApp
...
...
dlls/kernelbase/memory.c
View file @
9c40a801
...
...
@@ -234,6 +234,24 @@ LPVOID WINAPI DECLSPEC_HOTPATCH MapViewOfFileEx( HANDLE handle, DWORD access, DW
return
addr
;
}
/***********************************************************************
* MapViewOfFile3 (kernelbase.@)
*/
LPVOID
WINAPI
DECLSPEC_HOTPATCH
MapViewOfFile3
(
HANDLE
handle
,
HANDLE
process
,
PVOID
baseaddr
,
ULONG64
offset
,
SIZE_T
size
,
ULONG
alloc_type
,
ULONG
protection
,
MEM_EXTENDED_PARAMETER
*
params
,
ULONG
params_count
)
{
LARGE_INTEGER
off
;
void
*
addr
;
addr
=
baseaddr
;
off
.
QuadPart
=
offset
;
if
(
!
set_ntstatus
(
NtMapViewOfSectionEx
(
handle
,
process
,
&
addr
,
&
off
,
&
size
,
alloc_type
,
protection
,
params
,
params_count
)))
{
return
NULL
;
}
return
addr
;
}
/***********************************************************************
* ReadProcessMemory (kernelbase.@)
...
...
dlls/kernelbase/tests/process.c
View file @
9c40a801
...
...
@@ -31,6 +31,8 @@
#include "wine/test.h"
static
BOOL
(
WINAPI
*
pCompareObjectHandles
)(
HANDLE
,
HANDLE
);
static
LPVOID
(
WINAPI
*
pMapViewOfFile3
)(
HANDLE
,
HANDLE
,
PVOID
,
ULONG64
offset
,
SIZE_T
size
,
ULONG
,
ULONG
,
MEM_EXTENDED_PARAMETER
*
,
ULONG
);
static
void
test_CompareObjectHandles
(
void
)
{
...
...
@@ -89,6 +91,37 @@ static void test_CompareObjectHandles(void)
CloseHandle
(
h1
);
}
static
void
test_MapViewOfFile3
(
void
)
{
static
const
char
testfile
[]
=
"testfile.xxx"
;
HANDLE
file
,
mapping
;
void
*
ptr
;
if
(
!
pMapViewOfFile3
)
{
win_skip
(
"MapViewOfFile3() is not supported.
\n
"
);
return
;
}
SetLastError
(
0xdeadbeef
);
file
=
CreateFileA
(
testfile
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFile error %lu
\n
"
,
GetLastError
()
);
SetFilePointer
(
file
,
12288
,
NULL
,
FILE_BEGIN
);
SetEndOfFile
(
file
);
SetLastError
(
0xdeadbeef
);
mapping
=
CreateFileMappingA
(
file
,
NULL
,
PAGE_READWRITE
,
0
,
4096
,
NULL
);
ok
(
mapping
!=
0
,
"CreateFileMapping error %lu
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ptr
=
pMapViewOfFile3
(
mapping
,
GetCurrentProcess
(),
NULL
,
0
,
4096
,
0
,
PAGE_READONLY
,
NULL
,
0
);
ok
(
ptr
!=
NULL
,
"MapViewOfFile FILE_MAP_READ error %lu
\n
"
,
GetLastError
()
);
UnmapViewOfFile
(
ptr
);
CloseHandle
(
file
);
DeleteFileA
(
testfile
);
}
START_TEST
(
process
)
{
HMODULE
hmod
;
...
...
@@ -99,6 +132,8 @@ START_TEST(process)
hmod
=
GetModuleHandleA
(
"kernelbase.dll"
);
pCompareObjectHandles
=
(
void
*
)
GetProcAddress
(
hmod
,
"CompareObjectHandles"
);
pMapViewOfFile3
=
(
void
*
)
GetProcAddress
(
hmod
,
"MapViewOfFile3"
);
test_CompareObjectHandles
();
test_MapViewOfFile3
();
}
include/winbase.h
View file @
9c40a801
...
...
@@ -2484,6 +2484,7 @@ WINADVAPI BOOL WINAPI MakeSelfRelativeSD(PSECURITY_DESCRIPTOR,PSECURITY_
WINADVAPI
VOID
WINAPI
MapGenericMask
(
PDWORD
,
PGENERIC_MAPPING
);
WINBASEAPI
BOOL
WINAPI
MapUserPhysicalPages
(
PVOID
,
ULONG_PTR
,
PULONG_PTR
);
WINBASEAPI
LPVOID
WINAPI
MapViewOfFile
(
HANDLE
,
DWORD
,
DWORD
,
DWORD
,
SIZE_T
);
WINBASEAPI
LPVOID
WINAPI
MapViewOfFile3
(
HANDLE
,
HANDLE
,
PVOID
,
ULONG64
,
SIZE_T
,
ULONG
,
ULONG
,
MEM_EXTENDED_PARAMETER
*
,
ULONG
);
WINBASEAPI
LPVOID
WINAPI
MapViewOfFileEx
(
HANDLE
,
DWORD
,
DWORD
,
DWORD
,
SIZE_T
,
LPVOID
);
WINBASEAPI
BOOL
WINAPI
MoveFileA
(
LPCSTR
,
LPCSTR
);
WINBASEAPI
BOOL
WINAPI
MoveFileW
(
LPCWSTR
,
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