mirror of
git://source.winehq.org/git/wine.git
synced 2024-08-31 22:54:48 +00:00
kernelbase: Add OpenFileMappingFromApp().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
parent
b114b2c9eb
commit
40d0e55d4c
|
@ -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)
|
||||
|
|
|
@ -971,6 +971,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
|
||||
***********************************************************************/
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue