win32u: Add the infrastructure for building the syscall table.
With a simple NtGdiFlush() export as example. Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2781af45d5
commit
33e99ce5f7
|
@ -1 +1,9 @@
|
|||
MODULE = win32u.dll
|
||||
IMPORTS = ntdll winecrt0
|
||||
EXTRALIBS = -Wl,--subsystem,unixlib
|
||||
|
||||
EXTRADLLFLAGS = -nodefaultlibs -mno-cygwin -Wb,--syscall-table,1
|
||||
|
||||
C_SRCS = \
|
||||
main.c \
|
||||
syscall.c
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Win32u kernel interface
|
||||
*
|
||||
* Copyright 2021 Alexandre Julliard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winnt.h"
|
||||
#include "winternl.h"
|
||||
#include "wine/exception.h"
|
||||
#include "wine/unixlib.h"
|
||||
|
||||
extern void *__wine_syscall_dispatcher DECLSPEC_HIDDEN;
|
||||
|
||||
static unixlib_handle_t win32u_handle;
|
||||
|
||||
void __cdecl __wine_spec_unimplemented_stub( const char *module, const char *function )
|
||||
{
|
||||
EXCEPTION_RECORD record;
|
||||
|
||||
record.ExceptionCode = EXCEPTION_WINE_STUB;
|
||||
record.ExceptionFlags = EH_NONCONTINUABLE;
|
||||
record.ExceptionRecord = NULL;
|
||||
record.ExceptionAddress = __wine_spec_unimplemented_stub;
|
||||
record.NumberParameters = 2;
|
||||
record.ExceptionInformation[0] = (ULONG_PTR)module;
|
||||
record.ExceptionInformation[1] = (ULONG_PTR)function;
|
||||
for (;;) RtlRaiseException( &record );
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved )
|
||||
{
|
||||
switch (reason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
LdrDisableThreadCalloutsForDll( inst );
|
||||
if (__wine_syscall_dispatcher) break; /* already set through Wow64Transition */
|
||||
if (!NtQueryVirtualMemory( GetCurrentProcess(), inst, MemoryWineUnixFuncs,
|
||||
&win32u_handle, sizeof(win32u_handle), NULL ))
|
||||
{
|
||||
__wine_unix_call( win32u_handle, 0, &__wine_syscall_dispatcher );
|
||||
}
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Unix interface for Win32 syscalls
|
||||
*
|
||||
* Copyright (C) 2021 Alexandre Julliard
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#pragma makedep unix
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
#include "windef.h"
|
||||
#include "winnt.h"
|
||||
#include "winternl.h"
|
||||
#include "wine/unixlib.h"
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* NtGdiFlush (win32u.@)
|
||||
*/
|
||||
BOOL WINAPI NtGdiFlush(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void * const syscalls[] =
|
||||
{
|
||||
NtGdiFlush,
|
||||
};
|
||||
|
||||
static BYTE arguments[ARRAY_SIZE(syscalls)];
|
||||
|
||||
static SYSTEM_SERVICE_TABLE syscall_table =
|
||||
{
|
||||
(ULONG_PTR *)syscalls,
|
||||
0,
|
||||
ARRAY_SIZE(syscalls),
|
||||
arguments
|
||||
};
|
||||
|
||||
static NTSTATUS init( void *dispatcher )
|
||||
{
|
||||
return ntdll_init_syscalls( 1, &syscall_table, dispatcher );
|
||||
}
|
||||
|
||||
unixlib_entry_t __wine_unix_call_funcs[] = { init };
|
|
@ -1,3 +1,4 @@
|
|||
@ extern -arch=win32 Wow64Transition __wine_syscall_dispatcher
|
||||
@ stub NtBindCompositionSurface
|
||||
@ stub NtCloseCompositionInputSink
|
||||
@ stub NtCompositionInputThread
|
||||
|
@ -435,7 +436,7 @@
|
|||
@ stub NtGdiFillPath
|
||||
@ stub NtGdiFillRgn
|
||||
@ stub NtGdiFlattenPath
|
||||
@ stub NtGdiFlush
|
||||
@ stdcall -syscall NtGdiFlush()
|
||||
@ stub NtGdiFontIsLinked
|
||||
@ stub NtGdiForceUFIMapping
|
||||
@ stub NtGdiFrameRgn
|
||||
|
|
Loading…
Reference in New Issue