252 lines
7.3 KiB
C
252 lines
7.3 KiB
C
![]() |
/*
|
||
|
* 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 <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"
|
||
|
|
||
|
|
||
|
/**********************************************************************
|
||
|
* 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 );
|
||
|
}
|