kernelbase: Implement MapViewOfFile3().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
dc5d76b3af
commit
9c40a80100
|
@ -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
|
||||
|
|
|
@ -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.@)
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue