Alexandre Julliard : wow64win: Add the infrastructure for wrapping the win32u syscall table.

Alexandre Julliard julliard at winehq.org
Tue Aug 31 15:40:22 CDT 2021


Module: wine
Branch: master
Commit: 18c512089e3ffc2fd315543cb553a332dbf23ab4
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=18c512089e3ffc2fd315543cb553a332dbf23ab4

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Aug 31 11:24:10 2021 +0200

wow64win: Add the infrastructure for wrapping the win32u syscall table.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/win32u/Makefile.in          |  1 +
 dlls/wow64win/Makefile.in        |  6 ++++
 dlls/wow64win/syscall.c          | 65 ++++++++++++++++++++++++++++++++++++++++
 dlls/wow64win/syscall.h          | 27 +++++++++++++++++
 dlls/wow64win/wow64win.spec      |  2 +-
 dlls/wow64win/wow64win_private.h | 30 +++++++++++++++++++
 6 files changed, 130 insertions(+), 1 deletion(-)

diff --git a/dlls/win32u/Makefile.in b/dlls/win32u/Makefile.in
index 9dce0bc39fd..0f76f61b798 100644
--- a/dlls/win32u/Makefile.in
+++ b/dlls/win32u/Makefile.in
@@ -1,4 +1,5 @@
 MODULE    = win32u.dll
+IMPORTLIB = win32u
 IMPORTS   = ntdll winecrt0
 EXTRALIBS = -Wl,--subsystem,unixlib
 
diff --git a/dlls/wow64win/Makefile.in b/dlls/wow64win/Makefile.in
index 3107ce5e537..185d8595282 100644
--- a/dlls/wow64win/Makefile.in
+++ b/dlls/wow64win/Makefile.in
@@ -1 +1,7 @@
 MODULE    = wow64win.dll
+IMPORTS   = win32u ntdll winecrt0
+
+EXTRADLLFLAGS = -nodefaultlibs -mno-cygwin -Wl,--image-base,0x6f200000
+
+C_SRCS = \
+	syscall.c
diff --git a/dlls/wow64win/syscall.c b/dlls/wow64win/syscall.c
new file mode 100644
index 00000000000..1d4918a6025
--- /dev/null
+++ b/dlls/wow64win/syscall.c
@@ -0,0 +1,65 @@
+/*
+ * WoW64 syscall wrapping
+ *
+ * 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 "wow64win_private.h"
+
+extern BOOL WINAPI NtGdiFlush(void);
+
+NTSTATUS WINAPI wow64_NtGdiFlush( UINT *args )
+{
+    return NtGdiFlush();
+}
+
+static void * const win32_syscalls[] =
+{
+#define SYSCALL_ENTRY(func) wow64_ ## func,
+    ALL_WIN32_SYSCALLS
+#undef SYSCALL_ENTRY
+};
+
+static const char * const win32_syscall_names[] =
+{
+#define SYSCALL_ENTRY(func) #func,
+    ALL_WIN32_SYSCALLS
+#undef SYSCALL_ENTRY
+};
+
+SYSTEM_SERVICE_TABLE sdwhwin32 =
+{
+    (ULONG_PTR *)win32_syscalls,
+    (ULONG_PTR *)win32_syscall_names,
+    ARRAY_SIZE(win32_syscalls),
+    NULL
+};
+
+
+BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, void *reserved )
+{
+    if (reason == DLL_PROCESS_ATTACH) LdrDisableThreadCalloutsForDll( inst );
+    return TRUE;
+}
diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h
new file mode 100644
index 00000000000..3e4cc0def33
--- /dev/null
+++ b/dlls/wow64win/syscall.h
@@ -0,0 +1,27 @@
+/*
+ * WoW64 USER32 syscall definitions
+ *
+ * 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
+ */
+
+#ifndef __WOW64WIN_SYSCALL_H
+#define __WOW64WIN_SYSCALL_H
+
+#define ALL_WIN32_SYSCALLS \
+    SYSCALL_ENTRY( NtGdiFlush )
+
+#endif /* __WOW64WIN_SYSCALL_H */
diff --git a/dlls/wow64win/wow64win.spec b/dlls/wow64win/wow64win.spec
index 8ca119ffb34..8939384e2ef 100644
--- a/dlls/wow64win/wow64win.spec
+++ b/dlls/wow64win/wow64win.spec
@@ -1,2 +1,2 @@
 #@ extern sdwhcon
-#@ extern sdwhwin32
+@ extern sdwhwin32
diff --git a/dlls/wow64win/wow64win_private.h b/dlls/wow64win/wow64win_private.h
new file mode 100644
index 00000000000..466dfe5f6e0
--- /dev/null
+++ b/dlls/wow64win/wow64win_private.h
@@ -0,0 +1,30 @@
+/*
+ * WoW64 private definitions
+ *
+ * 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
+ */
+
+#ifndef __WOW64WIN_PRIVATE_H
+#define __WOW64WIN_PRIVATE_H
+
+#include "syscall.h"
+
+#define SYSCALL_ENTRY(func) extern NTSTATUS WINAPI wow64_ ## func( UINT *args ) DECLSPEC_HIDDEN;
+ALL_WIN32_SYSCALLS
+#undef SYSCALL_ENTRY
+
+#endif /* __WOW64WIN_PRIVATE_H */




More information about the wine-cvs mailing list