diff --git a/dlls/wow64/Makefile.in b/dlls/wow64/Makefile.in index 76e3ff97d6b..4ab1b088dff 100644 --- a/dlls/wow64/Makefile.in +++ b/dlls/wow64/Makefile.in @@ -5,5 +5,6 @@ IMPORTS = ntdll winecrt0 EXTRADLLFLAGS = -nodefaultlibs -mno-cygwin -Wl,--image-base,0x6f000000 C_SRCS = \ + registry.c \ sync.c \ syscall.c diff --git a/dlls/wow64/registry.c b/dlls/wow64/registry.c new file mode 100644 index 00000000000..435c7669c28 --- /dev/null +++ b/dlls/wow64/registry.c @@ -0,0 +1,251 @@ +/* + * WoW64 registry 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 + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" +#include "winnt.h" +#include "winternl.h" +#include "wow64_private.h" + + +/********************************************************************** + * wow64_NtCreateKey + */ +NTSTATUS WINAPI wow64_NtCreateKey( UINT *args ) +{ + ULONG *handle_ptr = get_ptr( &args ); + ACCESS_MASK access = get_ulong( &args ); + OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args ); + ULONG index = get_ulong( &args ); + UNICODE_STRING32 *class32 = get_ptr( &args ); + ULONG options = get_ulong( &args ); + ULONG *dispos = get_ptr( &args ); + + struct object_attr64 attr; + UNICODE_STRING class; + HANDLE handle = 0; + NTSTATUS status; + + *handle_ptr = 0; + status = NtCreateKey( &handle, access, objattr_32to64( &attr, attr32 ), index, + unicode_str_32to64( &class, class32 ), options, dispos ); + put_handle( handle_ptr, handle ); + return status; +} + + +/********************************************************************** + * wow64_NtCreateKeyTransacted + */ +NTSTATUS WINAPI wow64_NtCreateKeyTransacted( UINT *args ) +{ + ULONG *handle_ptr = get_ptr( &args ); + ACCESS_MASK access = get_ulong( &args ); + OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args ); + ULONG index = get_ulong( &args ); + UNICODE_STRING32 *class32 = get_ptr( &args ); + ULONG options = get_ulong( &args ); + HANDLE transacted = get_handle( &args ); + ULONG *dispos = get_ptr( &args ); + + struct object_attr64 attr; + UNICODE_STRING class; + HANDLE handle = 0; + NTSTATUS status; + + *handle_ptr = 0; + status = NtCreateKeyTransacted( &handle, access, objattr_32to64( &attr, attr32 ), index, + unicode_str_32to64( &class, class32 ), options, transacted, dispos ); + put_handle( handle_ptr, handle ); + return status; +} + + +/********************************************************************** + * wow64_NtDeleteKey + */ +NTSTATUS WINAPI wow64_NtDeleteKey( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + + return NtDeleteKey( handle ); +} + + +/********************************************************************** + * wow64_NtEnumerateKey + */ +NTSTATUS WINAPI wow64_NtEnumerateKey( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + ULONG index = get_ulong( &args ); + KEY_INFORMATION_CLASS class = get_ulong( &args ); + void *ptr = get_ptr( &args ); + ULONG len = get_ulong( &args ); + ULONG *retlen = get_ptr( &args ); + + return NtEnumerateKey( handle, index, class, ptr, len, retlen ); +} + + +/********************************************************************** + * wow64_NtOpenKey + */ +NTSTATUS WINAPI wow64_NtOpenKey( UINT *args ) +{ + ULONG *handle_ptr = get_ptr( &args ); + ACCESS_MASK access = get_ulong( &args ); + OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args ); + + struct object_attr64 attr; + HANDLE handle = 0; + NTSTATUS status; + + *handle_ptr = 0; + status = NtOpenKey( &handle, access, objattr_32to64( &attr, attr32 )); + put_handle( handle_ptr, handle ); + return status; +} + + +/********************************************************************** + * wow64_NtOpenKeyEx + */ +NTSTATUS WINAPI wow64_NtOpenKeyEx( UINT *args ) +{ + ULONG *handle_ptr = get_ptr( &args ); + ACCESS_MASK access = get_ulong( &args ); + OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args ); + ULONG options = get_ulong( &args ); + + struct object_attr64 attr; + HANDLE handle = 0; + NTSTATUS status; + + *handle_ptr = 0; + status = NtOpenKeyEx( &handle, access, objattr_32to64( &attr, attr32 ), options ); + put_handle( handle_ptr, handle ); + return status; +} + + +/********************************************************************** + * wow64_NtOpenKeyTransacted + */ +NTSTATUS WINAPI wow64_NtOpenKeyTransacted( UINT *args ) +{ + ULONG *handle_ptr = get_ptr( &args ); + ACCESS_MASK access = get_ulong( &args ); + OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args ); + HANDLE transaction = get_handle( &args ); + + struct object_attr64 attr; + HANDLE handle = 0; + NTSTATUS status; + + *handle_ptr = 0; + status = NtOpenKeyTransacted( &handle, access, objattr_32to64( &attr, attr32 ), transaction ); + put_handle( handle_ptr, handle ); + return status; +} + + +/********************************************************************** + * wow64_NtOpenKeyTransactedEx + */ +NTSTATUS WINAPI wow64_NtOpenKeyTransactedEx( UINT *args ) +{ + ULONG *handle_ptr = get_ptr( &args ); + ACCESS_MASK access = get_ulong( &args ); + OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args ); + ULONG options = get_ulong( &args ); + HANDLE transaction = get_handle( &args ); + + struct object_attr64 attr; + HANDLE handle = 0; + NTSTATUS status; + + *handle_ptr = 0; + status = NtOpenKeyTransactedEx( &handle, access, objattr_32to64( &attr, attr32 ), options, transaction ); + put_handle( handle_ptr, handle ); + return status; +} + + +/********************************************************************** + * wow64_NtQueryKey + */ +NTSTATUS WINAPI wow64_NtQueryKey( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + KEY_INFORMATION_CLASS class = get_ulong( &args ); + void *info = get_ptr( &args ); + ULONG len = get_ulong( &args ); + ULONG *retlen = get_ptr( &args ); + + return NtQueryKey( handle, class, info, len, retlen ); +} + + +/********************************************************************** + * wow64_NtRenameKey + */ +NTSTATUS WINAPI wow64_NtRenameKey( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + UNICODE_STRING32 *str32 = get_ptr( &args ); + + UNICODE_STRING str; + + return NtRenameKey( handle, unicode_str_32to64( &str, str32 )); +} + + +/********************************************************************** + * wow64_NtReplaceKey + */ +NTSTATUS WINAPI wow64_NtReplaceKey( UINT *args ) +{ + OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args ); + HANDLE handle = get_handle( &args ); + OBJECT_ATTRIBUTES32 *replace32 = get_ptr( &args ); + + struct object_attr64 attr, replace; + + return NtReplaceKey( objattr_32to64( &attr, attr32 ), handle, objattr_32to64( &replace, replace32 )); +} + + +/********************************************************************** + * wow64_NtSetInformationKey + */ +NTSTATUS WINAPI wow64_NtSetInformationKey( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + int class = get_ulong( &args ); + void *info = get_ptr( &args ); + ULONG len = get_ulong( &args ); + + return NtSetInformationKey( handle, class, info, len ); +} diff --git a/dlls/wow64/syscall.h b/dlls/wow64/syscall.h index e7b0353a90a..cf579576839 100644 --- a/dlls/wow64/syscall.h +++ b/dlls/wow64/syscall.h @@ -37,6 +37,8 @@ SYSCALL_ENTRY( NtCreateEvent ) \ SYSCALL_ENTRY( NtCreateIoCompletion ) \ SYSCALL_ENTRY( NtCreateJobObject ) \ + SYSCALL_ENTRY( NtCreateKey ) \ + SYSCALL_ENTRY( NtCreateKeyTransacted ) \ SYSCALL_ENTRY( NtCreateKeyedEvent ) \ SYSCALL_ENTRY( NtCreateMutant ) \ SYSCALL_ENTRY( NtCreatePort ) \ @@ -48,7 +50,9 @@ SYSCALL_ENTRY( NtDebugContinue ) \ SYSCALL_ENTRY( NtDelayExecution ) \ SYSCALL_ENTRY( NtDeleteAtom ) \ + SYSCALL_ENTRY( NtDeleteKey ) \ SYSCALL_ENTRY( NtDuplicateObject ) \ + SYSCALL_ENTRY( NtEnumerateKey ) \ SYSCALL_ENTRY( NtFindAtom ) \ SYSCALL_ENTRY( NtGetCurrentProcessorNumber ) \ SYSCALL_ENTRY( NtListenPort ) \ @@ -57,6 +61,10 @@ SYSCALL_ENTRY( NtOpenEvent ) \ SYSCALL_ENTRY( NtOpenIoCompletion ) \ SYSCALL_ENTRY( NtOpenJobObject ) \ + SYSCALL_ENTRY( NtOpenKey ) \ + SYSCALL_ENTRY( NtOpenKeyEx ) \ + SYSCALL_ENTRY( NtOpenKeyTransacted ) \ + SYSCALL_ENTRY( NtOpenKeyTransactedEx ) \ SYSCALL_ENTRY( NtOpenKeyedEvent ) \ SYSCALL_ENTRY( NtOpenMutant ) \ SYSCALL_ENTRY( NtOpenSection ) \ @@ -71,6 +79,7 @@ SYSCALL_ENTRY( NtQueryInformationAtom ) \ SYSCALL_ENTRY( NtQueryInstallUILanguage ) \ SYSCALL_ENTRY( NtQueryIoCompletion ) \ + SYSCALL_ENTRY( NtQueryKey ) \ SYSCALL_ENTRY( NtQueryMutant ) \ SYSCALL_ENTRY( NtQueryObject ) \ SYSCALL_ENTRY( NtQueryPerformanceCounter ) \ @@ -82,6 +91,8 @@ SYSCALL_ENTRY( NtReleaseKeyedEvent ) \ SYSCALL_ENTRY( NtReleaseMutant ) \ SYSCALL_ENTRY( NtReleaseSemaphore ) \ + SYSCALL_ENTRY( NtRenameKey ) \ + SYSCALL_ENTRY( NtReplaceKey ) \ SYSCALL_ENTRY( NtReplyWaitReceivePort ) \ SYSCALL_ENTRY( NtRequestWaitReplyPort ) \ SYSCALL_ENTRY( NtResetEvent ) \ @@ -90,6 +101,7 @@ SYSCALL_ENTRY( NtSetDefaultUILanguage ) \ SYSCALL_ENTRY( NtSetEvent ) \ SYSCALL_ENTRY( NtSetInformationDebugObject ) \ + SYSCALL_ENTRY( NtSetInformationKey ) \ SYSCALL_ENTRY( NtSetInformationObject ) \ SYSCALL_ENTRY( NtSetIoCompletion ) \ SYSCALL_ENTRY( NtSetPowerRequest ) \