Alexandre Julliard : wow64: Add thunks for a few simple syscalls.

Alexandre Julliard julliard at winehq.org
Thu Jul 22 16:28:19 CDT 2021


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Jul 22 18:05:19 2021 +0200

wow64: Add thunks for a few simple syscalls.

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

---

 dlls/wow64/syscall.c       | 110 ++++++++++++++++++++++++++++++++++++++++++++-
 dlls/wow64/syscall.h       |  35 +++++++++++++++
 dlls/wow64/wow64_private.h |  10 +++++
 3 files changed, 153 insertions(+), 2 deletions(-)

diff --git a/dlls/wow64/syscall.c b/dlls/wow64/syscall.c
index 12e13b17574..10abe7a8b38 100644
--- a/dlls/wow64/syscall.c
+++ b/dlls/wow64/syscall.c
@@ -39,12 +39,16 @@ typedef NTSTATUS (WINAPI *syscall_thunk)( UINT *args );
 
 static const syscall_thunk syscall_thunks[] =
 {
-    NULL
+#define SYSCALL_ENTRY(func) wow64_ ## func,
+    ALL_SYSCALLS
+#undef SYSCALL_ENTRY
 };
 
 static const char *syscall_names[] =
 {
-    ""
+#define SYSCALL_ENTRY(func) #func,
+    ALL_SYSCALLS
+#undef SYSCALL_ENTRY
 };
 
 static unsigned short syscall_map[1024];
@@ -74,6 +78,108 @@ void __cdecl __wine_spec_unimplemented_stub( const char *module, const char *fun
 }
 
 
+/**********************************************************************
+ *           wow64_NtAllocateLocallyUniqueId
+ */
+NTSTATUS WINAPI wow64_NtAllocateLocallyUniqueId( UINT *args )
+{
+    LUID *luid = get_ptr( &args );
+
+    return NtAllocateLocallyUniqueId( luid );
+}
+
+
+/**********************************************************************
+ *           wow64_NtAllocateUuids
+ */
+NTSTATUS WINAPI wow64_NtAllocateUuids( UINT *args )
+{
+    ULARGE_INTEGER *time = get_ptr( &args );
+    ULONG *delta = get_ptr( &args );
+    ULONG *sequence = get_ptr( &args );
+    UCHAR *seed = get_ptr( &args );
+
+    return NtAllocateUuids( time, delta, sequence, seed );
+}
+
+
+/**********************************************************************
+ *           wow64_NtClose
+ */
+NTSTATUS WINAPI wow64_NtClose( UINT *args )
+{
+    HANDLE handle = get_handle( &args );
+
+    return NtClose( handle );
+}
+
+
+/**********************************************************************
+ *           wow64_NtGetCurrentProcessorNumber
+ */
+NTSTATUS WINAPI wow64_NtGetCurrentProcessorNumber( UINT *args )
+{
+    return NtGetCurrentProcessorNumber();
+}
+
+
+/**********************************************************************
+ *           wow64_NtQueryDefaultLocale
+ */
+NTSTATUS WINAPI wow64_NtQueryDefaultLocale( UINT *args )
+{
+    BOOLEAN user = get_ulong( &args );
+    LCID *lcid = get_ptr( &args );
+
+    return NtQueryDefaultLocale( user, lcid );
+}
+
+
+/**********************************************************************
+ *           wow64_NtQueryDefaultUILanguage
+ */
+NTSTATUS WINAPI wow64_NtQueryDefaultUILanguage( UINT *args )
+{
+    LANGID *lang = get_ptr( &args );
+
+    return NtQueryDefaultUILanguage( lang );
+}
+
+
+/**********************************************************************
+ *           wow64_NtQueryInstallUILanguage
+ */
+NTSTATUS WINAPI wow64_NtQueryInstallUILanguage( UINT *args )
+{
+    LANGID *lang = get_ptr( &args );
+
+    return NtQueryInstallUILanguage( lang );
+}
+
+
+/**********************************************************************
+ *           wow64_NtSetDefaultLocale
+ */
+NTSTATUS WINAPI wow64_NtSetDefaultLocale( UINT *args )
+{
+    BOOLEAN user = get_ulong( &args );
+    LCID lcid = get_ulong( &args );
+
+    return NtSetDefaultLocale( user, lcid );
+}
+
+
+/**********************************************************************
+ *           wow64_NtSetDefaultUILanguage
+ */
+NTSTATUS WINAPI wow64_NtSetDefaultUILanguage( UINT *args )
+{
+    LANGID lang = get_ulong( &args );
+
+    return NtSetDefaultUILanguage( lang );
+}
+
+
 /**********************************************************************
  *           get_syscall_num
  */
diff --git a/dlls/wow64/syscall.h b/dlls/wow64/syscall.h
new file mode 100644
index 00000000000..33e1670a391
--- /dev/null
+++ b/dlls/wow64/syscall.h
@@ -0,0 +1,35 @@
+/*
+ * WoW64 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 __WOW64_SYSCALL_H
+#define __WOW64_SYSCALL_H
+
+#define ALL_SYSCALLS \
+    SYSCALL_ENTRY( NtAllocateLocallyUniqueId ) \
+    SYSCALL_ENTRY( NtAllocateUuids ) \
+    SYSCALL_ENTRY( NtClose ) \
+    SYSCALL_ENTRY( NtGetCurrentProcessorNumber ) \
+    SYSCALL_ENTRY( NtQueryDefaultLocale ) \
+    SYSCALL_ENTRY( NtQueryDefaultUILanguage ) \
+    SYSCALL_ENTRY( NtQueryInstallUILanguage ) \
+    SYSCALL_ENTRY( NtSetDefaultLocale ) \
+    SYSCALL_ENTRY( NtSetDefaultUILanguage )
+
+#endif /* __WOW64_SYSCALL_H */
diff --git a/dlls/wow64/wow64_private.h b/dlls/wow64/wow64_private.h
index 2c8f6f313fc..c441f1bf481 100644
--- a/dlls/wow64/wow64_private.h
+++ b/dlls/wow64/wow64_private.h
@@ -21,6 +21,12 @@
 #ifndef __WOW64_PRIVATE_H
 #define __WOW64_PRIVATE_H
 
+#include "syscall.h"
+
+#define SYSCALL_ENTRY(func) extern NTSTATUS WINAPI wow64_ ## func( UINT *args ) DECLSPEC_HIDDEN;
+ALL_SYSCALLS
+#undef SYSCALL_ENTRY
+
 extern USHORT native_machine DECLSPEC_HIDDEN;
 extern USHORT current_machine DECLSPEC_HIDDEN;
 
@@ -43,4 +49,8 @@ static inline const WCHAR *get_machine_wow64_dir( USHORT machine )
     }
 }
 
+static inline ULONG get_ulong( UINT **args ) { return *(*args)++; }
+static inline HANDLE get_handle( UINT **args ) { return LongToHandle( *(*args)++ ); }
+static inline void *get_ptr( UINT **args ) { return ULongToPtr( *(*args)++ ); }
+
 #endif /* __WOW64_PRIVATE_H */




More information about the wine-cvs mailing list