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
1ceba353
Commit
1ceba353
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 MapViewOfFileFromApp().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
3ede82e2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
1 deletion
+48
-1
kernelbase.spec
dlls/kernelbase/kernelbase.spec
+1
-1
memory.c
dlls/kernelbase/memory.c
+9
-0
process.c
dlls/kernelbase/tests/process.c
+37
-0
winbase.h
include/winbase.h
+1
-0
No files found.
dlls/kernelbase/kernelbase.spec
View file @
1ceba353
...
...
@@ -984,7 +984,7 @@
@ 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
@ stdcall MapViewOfFileFromApp(long long int64 long)
@ stdcall MoveFileExW(wstr wstr long)
# @ stub MoveFileWithProgressTransactedW
@ stdcall MoveFileWithProgressW(wstr wstr ptr ptr long)
...
...
dlls/kernelbase/memory.c
View file @
1ceba353
...
...
@@ -237,6 +237,15 @@ LPVOID WINAPI DECLSPEC_HOTPATCH MapViewOfFileEx( HANDLE handle, DWORD access, DW
return
addr
;
}
/***********************************************************************
* MapViewOfFileFromApp (kernelbase.@)
*/
LPVOID
WINAPI
DECLSPEC_HOTPATCH
MapViewOfFileFromApp
(
HANDLE
handle
,
ULONG
access
,
ULONG64
offset
,
SIZE_T
size
)
{
return
MapViewOfFile
(
handle
,
access
,
offset
<<
32
,
offset
,
size
);
}
/***********************************************************************
* MapViewOfFile3 (kernelbase.@)
*/
...
...
dlls/kernelbase/tests/process.c
View file @
1ceba353
...
...
@@ -40,6 +40,7 @@ static LPVOID (WINAPI *pVirtualAlloc2FromApp)(HANDLE, void *, SIZE_T, DWORD, DWO
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
LPVOID
(
WINAPI
*
pMapViewOfFileFromApp
)(
HANDLE
,
ULONG
,
ULONG64
,
SIZE_T
);
static
void
test_CompareObjectHandles
(
void
)
{
...
...
@@ -386,6 +387,40 @@ static void test_CreateFileMappingFromApp(void)
CloseHandle
(
file
);
}
static
void
test_MapViewOfFileFromApp
(
void
)
{
static
const
char
testfile
[]
=
"testfile.xxx"
;
HANDLE
file
,
mapping
;
void
*
ptr
;
BOOL
ret
;
if
(
!
pMapViewOfFileFromApp
)
{
win_skip
(
"MapViewOfFileFromApp() 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
,
"Failed to create a file, 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
,
"Failed to create file mapping, error %lu.
\n
"
,
GetLastError
()
);
SetLastError
(
0xdeadbeef
);
ptr
=
pMapViewOfFileFromApp
(
mapping
,
PAGE_EXECUTE_READWRITE
,
0
,
4096
);
ok
(
ptr
!=
NULL
,
"Mapping failed, error %lu.
\n
"
,
GetLastError
()
);
UnmapViewOfFile
(
ptr
);
CloseHandle
(
mapping
);
CloseHandle
(
file
);
ret
=
DeleteFileA
(
testfile
);
ok
(
ret
,
"Failed to delete a test file.
\n
"
);
}
static
void
init_funcs
(
void
)
{
HMODULE
hmod
=
GetModuleHandleA
(
"kernelbase.dll"
);
...
...
@@ -394,6 +429,7 @@ static void init_funcs(void)
X
(
CompareObjectHandles
);
X
(
CreateFileMappingFromApp
);
X
(
MapViewOfFile3
);
X
(
MapViewOfFileFromApp
);
X
(
OpenFileMappingFromApp
);
X
(
VirtualAlloc2
);
X
(
VirtualAlloc2FromApp
);
...
...
@@ -416,4 +452,5 @@ START_TEST(process)
test_VirtualAlloc2FromApp
();
test_OpenFileMappingFromApp
();
test_CreateFileMappingFromApp
();
test_MapViewOfFileFromApp
();
}
include/winbase.h
View file @
1ceba353
...
...
@@ -2493,6 +2493,7 @@ 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
LPVOID
WINAPI
MapViewOfFileFromApp
(
HANDLE
,
ULONG
,
ULONG64
,
SIZE_T
);
WINBASEAPI
BOOL
WINAPI
MoveFileA
(
LPCSTR
,
LPCSTR
);
WINBASEAPI
BOOL
WINAPI
MoveFileW
(
LPCWSTR
,
LPCWSTR
);
#define MoveFile WINELIB_NAME_AW(MoveFile)
...
...
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