2021-10-12 16:42:35 +02:00
|
|
|
/*
|
|
|
|
* WoW64 User functions
|
|
|
|
*
|
|
|
|
* Copyright 2021 Jacek Caban for CodeWeavers
|
|
|
|
*
|
|
|
|
* 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 "ntuser.h"
|
|
|
|
#include "wow64win_private.h"
|
|
|
|
|
2021-10-14 15:20:42 +02:00
|
|
|
|
|
|
|
NTSTATUS WINAPI wow64_NtUserCreateWindowStation( UINT *args )
|
|
|
|
{
|
|
|
|
OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
|
|
|
|
ACCESS_MASK access = get_ulong( &args );
|
|
|
|
ULONG arg3 = get_ulong( &args );
|
|
|
|
ULONG arg4 = get_ulong( &args );
|
|
|
|
ULONG arg5 = get_ulong( &args );
|
|
|
|
ULONG arg6 = get_ulong( &args );
|
|
|
|
ULONG arg7 = get_ulong( &args );
|
|
|
|
|
|
|
|
struct object_attr64 attr;
|
|
|
|
|
|
|
|
return HandleToUlong( NtUserCreateWindowStation( objattr_32to64( &attr, attr32 ), access,
|
|
|
|
arg3, arg4, arg5, arg6, arg7 ));
|
|
|
|
}
|
|
|
|
|
2021-10-14 15:20:56 +02:00
|
|
|
NTSTATUS WINAPI wow64_NtUserOpenWindowStation( UINT *args )
|
|
|
|
{
|
|
|
|
OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
|
|
|
|
ACCESS_MASK access = get_ulong( &args );
|
|
|
|
|
|
|
|
struct object_attr64 attr;
|
|
|
|
|
|
|
|
return HandleToUlong( NtUserOpenWindowStation( objattr_32to64( &attr, attr32 ), access ));
|
|
|
|
}
|
|
|
|
|
2021-10-12 16:42:35 +02:00
|
|
|
NTSTATUS WINAPI wow64_NtUserCloseWindowStation( UINT *args )
|
|
|
|
{
|
|
|
|
HWINSTA handle = get_handle( &args );
|
|
|
|
|
|
|
|
return NtUserCloseWindowStation( handle );
|
|
|
|
}
|
2021-10-13 14:52:53 +02:00
|
|
|
|
|
|
|
NTSTATUS WINAPI wow64_NtUserGetProcessWindowStation( UINT *args )
|
|
|
|
{
|
|
|
|
return HandleToUlong( NtUserGetProcessWindowStation() );
|
|
|
|
}
|
2021-10-13 14:53:22 +02:00
|
|
|
|
|
|
|
NTSTATUS WINAPI wow64_NtUserSetProcessWindowStation( UINT *args )
|
|
|
|
{
|
|
|
|
HWINSTA handle = get_handle( &args );
|
|
|
|
|
|
|
|
return NtUserSetProcessWindowStation( handle );
|
|
|
|
}
|
2021-10-13 14:53:36 +02:00
|
|
|
|
2021-10-14 15:21:15 +02:00
|
|
|
NTSTATUS WINAPI wow64_NtUserCreateDesktopEx( UINT *args )
|
|
|
|
{
|
|
|
|
OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
|
|
|
|
UNICODE_STRING32 *device32 = get_ptr( &args );
|
|
|
|
DEVMODEW *devmode = get_ptr( &args );
|
|
|
|
DWORD flags = get_ulong( &args );
|
|
|
|
ACCESS_MASK access = get_ulong( &args );
|
|
|
|
ULONG heap_size = get_ulong( &args );
|
|
|
|
|
|
|
|
struct object_attr64 attr;
|
|
|
|
UNICODE_STRING device;
|
|
|
|
HANDLE ret;
|
|
|
|
|
|
|
|
ret = NtUserCreateDesktopEx( objattr_32to64( &attr, attr32 ),
|
|
|
|
unicode_str_32to64( &device, device32 ),
|
|
|
|
devmode, flags, access, heap_size );
|
|
|
|
return HandleToUlong( ret );
|
|
|
|
}
|
|
|
|
|
2021-10-14 15:21:33 +02:00
|
|
|
NTSTATUS WINAPI wow64_NtUserOpenDesktop( UINT *args )
|
|
|
|
{
|
|
|
|
OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
|
|
|
|
DWORD flags = get_ulong( &args );
|
|
|
|
ACCESS_MASK access = get_ulong( &args );
|
|
|
|
|
|
|
|
struct object_attr64 attr;
|
|
|
|
HANDLE ret;
|
|
|
|
|
|
|
|
ret = NtUserOpenDesktop( objattr_32to64( &attr, attr32 ), flags, access );
|
|
|
|
return HandleToUlong( ret );
|
|
|
|
}
|
|
|
|
|
2021-10-13 14:53:36 +02:00
|
|
|
NTSTATUS WINAPI wow64_NtUserCloseDesktop( UINT *args )
|
|
|
|
{
|
|
|
|
HDESK handle = get_handle( &args );
|
|
|
|
|
|
|
|
return NtUserCloseDesktop( handle );
|
|
|
|
}
|
2021-10-13 14:54:00 +02:00
|
|
|
|
|
|
|
NTSTATUS WINAPI wow64_NtUserGetThreadDesktop( UINT *args )
|
|
|
|
{
|
|
|
|
DWORD thread = get_ulong( &args );
|
|
|
|
|
|
|
|
return HandleToUlong( NtUserGetThreadDesktop( thread ));
|
|
|
|
}
|
2021-10-13 14:54:21 +02:00
|
|
|
|
|
|
|
NTSTATUS WINAPI wow64_NtUserSetThreadDesktop( UINT *args )
|
|
|
|
{
|
|
|
|
HDESK handle = get_handle( &args );
|
|
|
|
|
|
|
|
return NtUserSetThreadDesktop( handle );
|
|
|
|
}
|
2021-10-13 14:54:56 +02:00
|
|
|
|
|
|
|
NTSTATUS WINAPI wow64_NtUserOpenInputDesktop( UINT *args )
|
|
|
|
{
|
|
|
|
DWORD flags = get_ulong( &args );
|
|
|
|
BOOL inherit = get_ulong( &args );
|
|
|
|
ACCESS_MASK access = get_ulong( &args );
|
|
|
|
|
|
|
|
return HandleToUlong( NtUserOpenInputDesktop( flags, inherit, access ));
|
|
|
|
}
|
2021-10-13 14:55:30 +02:00
|
|
|
|
|
|
|
NTSTATUS WINAPI wow64_NtUserGetObjectInformation( UINT *args )
|
|
|
|
{
|
|
|
|
HANDLE handle = get_handle( &args );
|
|
|
|
INT index = get_ulong( &args );
|
|
|
|
void *info = get_ptr( &args );
|
|
|
|
DWORD len = get_ulong( &args );
|
|
|
|
DWORD *needed = get_ptr( &args );
|
|
|
|
|
|
|
|
return NtUserGetObjectInformation( handle, index, info, len, needed );
|
|
|
|
}
|
2021-10-13 14:56:22 +02:00
|
|
|
|
|
|
|
NTSTATUS WINAPI wow64_NtUserSetObjectInformation( UINT *args )
|
|
|
|
{
|
|
|
|
HANDLE handle = get_handle( &args );
|
|
|
|
INT index = get_ulong( &args );
|
|
|
|
void *info = get_ptr( &args );
|
|
|
|
DWORD len = get_ulong( &args );
|
|
|
|
|
|
|
|
return NtUserSetObjectInformation( handle, index, info, len );
|
|
|
|
}
|
2021-11-08 14:48:28 +01:00
|
|
|
|
2021-11-08 14:48:45 +01:00
|
|
|
NTSTATUS WINAPI wow64_NtUserGetProp( UINT *args )
|
|
|
|
{
|
|
|
|
HWND hwnd = get_handle( &args );
|
|
|
|
const WCHAR *str = get_ptr( &args );
|
|
|
|
|
|
|
|
return HandleToUlong( NtUserGetProp( hwnd, str ));
|
|
|
|
}
|
|
|
|
|
2021-11-08 14:48:37 +01:00
|
|
|
NTSTATUS WINAPI wow64_NtUserSetProp( UINT *args )
|
|
|
|
{
|
|
|
|
HWND hwnd = get_handle( &args );
|
|
|
|
const WCHAR *str = get_ptr( &args );
|
|
|
|
HANDLE handle = get_handle( &args );
|
|
|
|
|
|
|
|
return NtUserSetProp( hwnd, str, handle );
|
|
|
|
}
|
|
|
|
|
2021-11-08 14:48:55 +01:00
|
|
|
NTSTATUS WINAPI wow64_NtUserRemoveProp( UINT *args )
|
|
|
|
{
|
|
|
|
HWND hwnd = get_handle( &args );
|
|
|
|
const WCHAR *str = get_ptr( &args );
|
|
|
|
|
|
|
|
return HandleToUlong( NtUserRemoveProp( hwnd, str ));
|
|
|
|
}
|
|
|
|
|
2021-11-08 14:48:28 +01:00
|
|
|
NTSTATUS WINAPI wow64_NtUserGetLayeredWindowAttributes( UINT *args )
|
|
|
|
{
|
|
|
|
HWND hwnd = get_handle( &args );
|
|
|
|
COLORREF *key = get_ptr( &args );
|
|
|
|
BYTE *alpha = get_ptr( &args );
|
|
|
|
DWORD *flags = get_ptr( &args );
|
|
|
|
|
|
|
|
return NtUserGetLayeredWindowAttributes( hwnd, key, alpha, flags );
|
|
|
|
}
|
2021-11-12 12:53:28 +01:00
|
|
|
|
|
|
|
NTSTATUS WINAPI wow64_NtUserGetClipboardFormatName( UINT *args )
|
|
|
|
{
|
|
|
|
UINT format = get_ulong( &args );
|
|
|
|
WCHAR *buffer = get_ptr( &args );
|
|
|
|
INT maxlen = get_ulong( &args );
|
|
|
|
|
|
|
|
return NtUserGetClipboardFormatName( format, buffer, maxlen );
|
|
|
|
}
|
2021-11-12 12:53:50 +01:00
|
|
|
|
|
|
|
NTSTATUS WINAPI wow64_NtUserGetClipboardOwner( UINT *args )
|
|
|
|
{
|
|
|
|
return HandleToUlong( NtUserGetClipboardOwner() );
|
|
|
|
}
|
2021-11-12 12:53:59 +01:00
|
|
|
|
2021-11-16 12:36:26 +01:00
|
|
|
NTSTATUS WINAPI wow64_NtUserGetOpenClipboardWindow( UINT *args )
|
|
|
|
{
|
|
|
|
return HandleToUlong( NtUserGetOpenClipboardWindow() );
|
|
|
|
}
|
|
|
|
|
2021-11-12 12:54:29 +01:00
|
|
|
NTSTATUS WINAPI wow64_NtUserGetClipboardSequenceNumber( UINT *args )
|
|
|
|
{
|
|
|
|
return NtUserGetClipboardSequenceNumber();
|
|
|
|
}
|
|
|
|
|
2021-11-12 12:53:59 +01:00
|
|
|
NTSTATUS WINAPI wow64_NtUserGetClipboardViewer( UINT *args )
|
|
|
|
{
|
|
|
|
return HandleToUlong( NtUserGetClipboardViewer() );
|
|
|
|
}
|
2021-11-12 12:54:45 +01:00
|
|
|
|
|
|
|
NTSTATUS WINAPI wow64_NtUserAddClipboardFormatListener( UINT *args )
|
|
|
|
{
|
|
|
|
HWND hwnd = get_handle( &args );
|
|
|
|
|
|
|
|
return NtUserAddClipboardFormatListener( hwnd );
|
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS WINAPI wow64_NtUserRemoveClipboardFormatListener( UINT *args )
|
|
|
|
{
|
|
|
|
HWND hwnd = get_handle( &args );
|
|
|
|
|
|
|
|
return NtUserRemoveClipboardFormatListener( hwnd );
|
|
|
|
}
|
2021-11-16 12:32:55 +01:00
|
|
|
|
2021-12-03 12:55:44 +01:00
|
|
|
NTSTATUS WINAPI wow64_NtUserGetCursor( UINT *args )
|
|
|
|
{
|
|
|
|
return HandleToUlong( NtUserGetCursor() );
|
|
|
|
}
|
|
|
|
|
2021-11-16 12:32:55 +01:00
|
|
|
NTSTATUS WINAPI wow64_NtUserAttachThreadInput( UINT *args )
|
|
|
|
{
|
|
|
|
DWORD from = get_ulong( &args );
|
|
|
|
DWORD to = get_ulong( &args );
|
|
|
|
BOOL attach = get_ulong( &args );
|
|
|
|
|
|
|
|
return NtUserAttachThreadInput( from, to, attach );
|
|
|
|
}
|
2021-11-16 12:33:09 +01:00
|
|
|
|
|
|
|
NTSTATUS WINAPI wow64_NtUserGetKeyState( UINT *args )
|
|
|
|
{
|
|
|
|
INT vkey = get_ulong( &args );
|
|
|
|
|
|
|
|
return NtUserGetKeyState( vkey );
|
|
|
|
}
|
2021-11-16 12:33:23 +01:00
|
|
|
|
2021-11-17 17:27:40 +01:00
|
|
|
NTSTATUS WINAPI wow64_NtUserGetKeyboardLayout( UINT *args )
|
|
|
|
{
|
|
|
|
DWORD tid = get_ulong( &args );
|
|
|
|
|
|
|
|
return HandleToUlong( NtUserGetKeyboardLayout( tid ));
|
|
|
|
}
|
|
|
|
|
2021-12-03 12:56:05 +01:00
|
|
|
NTSTATUS WINAPI wow64_NtUserGetKeyboardLayoutName( UINT *args )
|
|
|
|
{
|
|
|
|
WCHAR *name = get_ptr( &args );
|
|
|
|
|
|
|
|
return NtUserGetKeyboardLayoutName( name );
|
|
|
|
}
|
|
|
|
|
2021-11-16 12:33:23 +01:00
|
|
|
NTSTATUS WINAPI wow64_NtUserGetKeyboardState( UINT *args )
|
|
|
|
{
|
|
|
|
BYTE *state = get_ptr( &args );
|
|
|
|
|
|
|
|
return NtUserGetKeyboardState( state );
|
|
|
|
}
|
2021-11-16 12:33:36 +01:00
|
|
|
|
|
|
|
NTSTATUS WINAPI wow64_NtUserSetKeyboardState( UINT *args )
|
|
|
|
{
|
|
|
|
BYTE *state = get_ptr( &args );
|
|
|
|
|
|
|
|
return NtUserSetKeyboardState( state );
|
|
|
|
}
|
2021-11-17 12:48:53 +01:00
|
|
|
|
|
|
|
NTSTATUS WINAPI wow64_NtUserGetMouseMovePointsEx( UINT *args )
|
|
|
|
{
|
|
|
|
UINT size = get_ulong( &args );
|
|
|
|
MOUSEMOVEPOINT *ptin = get_ptr( &args );
|
|
|
|
MOUSEMOVEPOINT *ptout = get_ptr( &args );
|
|
|
|
int count = get_ulong( &args );
|
|
|
|
DWORD resolution = get_ulong( &args );
|
|
|
|
|
|
|
|
return NtUserGetMouseMovePointsEx( size, ptin, ptout, count, resolution );
|
|
|
|
}
|