wow64: Add thunks for a number of system syscalls.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-07-30 13:09:23 +02:00
parent 595039be05
commit e028401d08
4 changed files with 253 additions and 0 deletions

View file

@ -11,4 +11,5 @@ C_SRCS = \
security.c \
sync.c \
syscall.c \
system.c \
virtual.c

View file

@ -72,6 +72,7 @@
SYSCALL_ENTRY( NtDeleteFile ) \
SYSCALL_ENTRY( NtDeleteKey ) \
SYSCALL_ENTRY( NtDeleteValueKey ) \
SYSCALL_ENTRY( NtDisplayString ) \
SYSCALL_ENTRY( NtDuplicateObject ) \
SYSCALL_ENTRY( NtDuplicateToken ) \
SYSCALL_ENTRY( NtEnumerateKey ) \
@ -89,8 +90,10 @@
SYSCALL_ENTRY( NtGetNlsSectionPtr ) \
SYSCALL_ENTRY( NtGetWriteWatch ) \
SYSCALL_ENTRY( NtImpersonateAnonymousToken ) \
SYSCALL_ENTRY( NtInitiatePowerAction ) \
SYSCALL_ENTRY( NtIsProcessInJob ) \
SYSCALL_ENTRY( NtListenPort ) \
SYSCALL_ENTRY( NtLoadDriver ) \
SYSCALL_ENTRY( NtLoadKey ) \
SYSCALL_ENTRY( NtLoadKey2 ) \
SYSCALL_ENTRY( NtLockFile ) \
@ -121,6 +124,7 @@
SYSCALL_ENTRY( NtOpenThreadToken ) \
SYSCALL_ENTRY( NtOpenThreadTokenEx ) \
SYSCALL_ENTRY( NtOpenTimer ) \
SYSCALL_ENTRY( NtPowerInformation ) \
SYSCALL_ENTRY( NtPrivilegeCheck ) \
SYSCALL_ENTRY( NtProtectVirtualMemory ) \
SYSCALL_ENTRY( NtPulseEvent ) \
@ -141,6 +145,7 @@
SYSCALL_ENTRY( NtQueryInstallUILanguage ) \
SYSCALL_ENTRY( NtQueryIoCompletion ) \
SYSCALL_ENTRY( NtQueryKey ) \
SYSCALL_ENTRY( NtQueryLicenseValue ) \
SYSCALL_ENTRY( NtQueryMultipleValueKey ) \
SYSCALL_ENTRY( NtQueryMutant ) \
SYSCALL_ENTRY( NtQueryObject ) \
@ -149,6 +154,9 @@
SYSCALL_ENTRY( NtQuerySecurityObject ) \
SYSCALL_ENTRY( NtQuerySemaphore ) \
SYSCALL_ENTRY( NtQuerySymbolicLinkObject ) \
SYSCALL_ENTRY( NtQuerySystemEnvironmentValue ) \
SYSCALL_ENTRY( NtQuerySystemEnvironmentValueEx ) \
SYSCALL_ENTRY( NtQuerySystemTime ) \
SYSCALL_ENTRY( NtQueryTimer ) \
SYSCALL_ENTRY( NtQueryTimerResolution ) \
SYSCALL_ENTRY( NtQueryValueKey ) \
@ -188,20 +196,26 @@
SYSCALL_ENTRY( NtSetInformationProcess ) \
SYSCALL_ENTRY( NtSetInformationThread ) \
SYSCALL_ENTRY( NtSetInformationToken ) \
SYSCALL_ENTRY( NtSetIntervalProfile ) \
SYSCALL_ENTRY( NtSetIoCompletion ) \
SYSCALL_ENTRY( NtSetPowerRequest ) \
SYSCALL_ENTRY( NtSetSecurityObject ) \
SYSCALL_ENTRY( NtSetSystemInformation ) \
SYSCALL_ENTRY( NtSetSystemTime ) \
SYSCALL_ENTRY( NtSetThreadExecutionState ) \
SYSCALL_ENTRY( NtSetTimer ) \
SYSCALL_ENTRY( NtSetTimerResolution ) \
SYSCALL_ENTRY( NtSetValueKey ) \
SYSCALL_ENTRY( NtSetVolumeInformationFile ) \
SYSCALL_ENTRY( NtShutdownSystem ) \
SYSCALL_ENTRY( NtSignalAndWaitForSingleObject ) \
SYSCALL_ENTRY( NtSuspendProcess ) \
SYSCALL_ENTRY( NtSuspendThread ) \
SYSCALL_ENTRY( NtSystemDebugControl ) \
SYSCALL_ENTRY( NtTerminateJobObject ) \
SYSCALL_ENTRY( NtTerminateProcess ) \
SYSCALL_ENTRY( NtTerminateThread ) \
SYSCALL_ENTRY( NtUnloadDriver ) \
SYSCALL_ENTRY( NtUnloadKey ) \
SYSCALL_ENTRY( NtUnlockFile ) \
SYSCALL_ENTRY( NtUnlockVirtualMemory ) \

237
dlls/wow64/system.c Normal file
View file

@ -0,0 +1,237 @@
/*
* WoW64 system functions
*
* 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 "wow64_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wow);
/**********************************************************************
* wow64_NtDisplayString
*/
NTSTATUS WINAPI wow64_NtDisplayString( UINT *args )
{
const UNICODE_STRING32 *str32 = get_ptr( &args );
UNICODE_STRING str;
return NtDisplayString( unicode_str_32to64( &str, str32 ));
}
/**********************************************************************
* wow64_NtInitiatePowerAction
*/
NTSTATUS WINAPI wow64_NtInitiatePowerAction( UINT *args )
{
POWER_ACTION action = get_ulong( &args );
SYSTEM_POWER_STATE state = get_ulong( &args );
ULONG flags = get_ulong( &args );
BOOLEAN async = get_ulong( &args );
return NtInitiatePowerAction( action, state, flags, async );
}
/**********************************************************************
* wow64_NtLoadDriver
*/
NTSTATUS WINAPI wow64_NtLoadDriver( UINT *args )
{
UNICODE_STRING32 *str32 = get_ptr( &args );
UNICODE_STRING str;
return NtLoadDriver( unicode_str_32to64( &str, str32 ));
}
/**********************************************************************
* wow64_NtPowerInformation
*/
NTSTATUS WINAPI wow64_NtPowerInformation( UINT *args )
{
POWER_INFORMATION_LEVEL level = get_ulong( &args );
void *in_buf = get_ptr( &args );
ULONG in_len = get_ulong( &args );
void *out_buf = get_ptr( &args );
ULONG out_len = get_ulong( &args );
switch (level)
{
case SystemPowerCapabilities: /* SYSTEM_POWER_CAPABILITIES */
case SystemBatteryState: /* SYSTEM_BATTERY_STATE */
case SystemExecutionState: /* ULONG */
case ProcessorInformation: /* PROCESSOR_POWER_INFORMATION */
return NtPowerInformation( level, in_buf, in_len, out_buf, out_len );
default:
FIXME( "unsupported level %u\n", level );
return STATUS_NOT_IMPLEMENTED;
}
}
/**********************************************************************
* wow64_NtQueryLicenseValue
*/
NTSTATUS WINAPI wow64_NtQueryLicenseValue( UINT *args )
{
UNICODE_STRING32 *str32 = get_ptr( &args );
ULONG *type = get_ptr( &args );
void *buffer = get_ptr( &args );
ULONG len = get_ulong( &args );
ULONG *retlen = get_ptr( &args );
UNICODE_STRING str;
return NtQueryLicenseValue( unicode_str_32to64( &str, str32 ), type, buffer, len, retlen );
}
/**********************************************************************
* wow64_NtQuerySystemEnvironmentValue
*/
NTSTATUS WINAPI wow64_NtQuerySystemEnvironmentValue( UINT *args )
{
UNICODE_STRING32 *str32 = get_ptr( &args );
WCHAR *buffer = get_ptr( &args );
ULONG len = get_ulong( &args );
ULONG *retlen = get_ptr( &args );
UNICODE_STRING str;
return NtQuerySystemEnvironmentValue( unicode_str_32to64( &str, str32 ), buffer, len, retlen );
}
/**********************************************************************
* wow64_NtQuerySystemEnvironmentValueEx
*/
NTSTATUS WINAPI wow64_NtQuerySystemEnvironmentValueEx( UINT *args )
{
UNICODE_STRING32 *str32 = get_ptr( &args );
GUID *vendor = get_ptr( &args );
void *buffer = get_ptr( &args );
ULONG *retlen = get_ptr( &args );
ULONG *attrib = get_ptr( &args );
UNICODE_STRING str;
return NtQuerySystemEnvironmentValueEx( unicode_str_32to64( &str, str32 ),
vendor, buffer, retlen, attrib );
}
/**********************************************************************
* wow64_NtQuerySystemTime
*/
NTSTATUS WINAPI wow64_NtQuerySystemTime( UINT *args )
{
LARGE_INTEGER *time = get_ptr( &args );
return NtQuerySystemTime( time );
}
/**********************************************************************
* wow64_NtSetIntervalProfile
*/
NTSTATUS WINAPI wow64_NtSetIntervalProfile( UINT *args )
{
ULONG interval = get_ulong( &args );
KPROFILE_SOURCE source = get_ulong( &args );
return NtSetIntervalProfile( interval, source );
}
/**********************************************************************
* wow64_NtSetSystemInformation
*/
NTSTATUS WINAPI wow64_NtSetSystemInformation( UINT *args )
{
SYSTEM_INFORMATION_CLASS class = get_ulong( &args );
void *info = get_ptr( &args );
ULONG len = get_ulong( &args );
return NtSetSystemInformation( class, info, len );
}
/**********************************************************************
* wow64_NtSetSystemTime
*/
NTSTATUS WINAPI wow64_NtSetSystemTime( UINT *args )
{
const LARGE_INTEGER *new = get_ptr( &args );
LARGE_INTEGER *old = get_ptr( &args );
return NtSetSystemTime( new, old );
}
/**********************************************************************
* wow64_NtShutdownSystem
*/
NTSTATUS WINAPI wow64_NtShutdownSystem( UINT *args )
{
SHUTDOWN_ACTION action = get_ulong( &args );
return NtShutdownSystem( action );
}
/**********************************************************************
* wow64_NtSystemDebugControl
*/
NTSTATUS WINAPI wow64_NtSystemDebugControl( UINT *args )
{
SYSDBG_COMMAND command = get_ulong( &args );
void *in_buf = get_ptr( &args );
ULONG in_len = get_ulong( &args );
void *out_buf = get_ptr( &args );
ULONG out_len = get_ulong( &args );
ULONG *retlen = get_ptr( &args );
return NtSystemDebugControl( command, in_buf, in_len, out_buf, out_len, retlen );
}
/**********************************************************************
* wow64_NtUnloadDriver
*/
NTSTATUS WINAPI wow64_NtUnloadDriver( UINT *args )
{
UNICODE_STRING32 *str32 = get_ptr( &args );
UNICODE_STRING str;
return NtUnloadDriver( unicode_str_32to64( &str, str32 ));
}

View file

@ -3947,6 +3947,7 @@ NTSYSAPI NTSTATUS WINAPI NtQuerySection(HANDLE,SECTION_INFORMATION_CLASS,PVOID,
NTSYSAPI NTSTATUS WINAPI NtQuerySemaphore(HANDLE,SEMAPHORE_INFORMATION_CLASS,PVOID,ULONG,PULONG);
NTSYSAPI NTSTATUS WINAPI NtQuerySymbolicLinkObject(HANDLE,PUNICODE_STRING,PULONG);
NTSYSAPI NTSTATUS WINAPI NtQuerySystemEnvironmentValue(PUNICODE_STRING,PWCHAR,ULONG,PULONG);
NTSYSAPI NTSTATUS WINAPI NtQuerySystemEnvironmentValueEx(PUNICODE_STRING,GUID*,void*,ULONG*,ULONG*);
NTSYSAPI NTSTATUS WINAPI NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG,PULONG);
NTSYSAPI NTSTATUS WINAPI NtQuerySystemInformationEx(SYSTEM_INFORMATION_CLASS,void*,ULONG,void*,ULONG,ULONG*);
NTSYSAPI NTSTATUS WINAPI NtQuerySystemTime(PLARGE_INTEGER);