wow64: Add thunks for a few simple syscalls.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-07-22 18:05:19 +02:00
parent 1b63875c66
commit e8984787ac
3 changed files with 153 additions and 2 deletions

View File

@ -39,12 +39,16 @@ typedef NTSTATUS (WINAPI *syscall_thunk)( UINT *args );
static const syscall_thunk syscall_thunks[] = static const syscall_thunk syscall_thunks[] =
{ {
NULL #define SYSCALL_ENTRY(func) wow64_ ## func,
ALL_SYSCALLS
#undef SYSCALL_ENTRY
}; };
static const char *syscall_names[] = static const char *syscall_names[] =
{ {
"" #define SYSCALL_ENTRY(func) #func,
ALL_SYSCALLS
#undef SYSCALL_ENTRY
}; };
static unsigned short syscall_map[1024]; 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 * get_syscall_num
*/ */

35
dlls/wow64/syscall.h Normal file
View File

@ -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 */

View File

@ -21,6 +21,12 @@
#ifndef __WOW64_PRIVATE_H #ifndef __WOW64_PRIVATE_H
#define __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 native_machine DECLSPEC_HIDDEN;
extern USHORT current_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 */ #endif /* __WOW64_PRIVATE_H */