From: Zebediah Figura Subject: [PATCH v3 4/4] user32: Merge rawinput.c into input.c. Message-Id: Date: Tue, 28 Jun 2022 16:54:53 +0000 In-Reply-To: References: From: Zebediah Figura --- dlls/user32/Makefile.in | 1 - dlls/user32/input.c | 49 +++++++++++++++++++++++ dlls/user32/rawinput.c | 88 ----------------------------------------- 3 files changed, 49 insertions(+), 89 deletions(-) delete mode 100644 dlls/user32/rawinput.c diff --git a/dlls/user32/Makefile.in b/dlls/user32/Makefile.in index 79821929390..3a01810991d 100644 --- a/dlls/user32/Makefile.in +++ b/dlls/user32/Makefile.in @@ -34,7 +34,6 @@ C_SRCS = \ nonclient.c \ painting.c \ property.c \ - rawinput.c \ resource.c \ scroll.c \ static.c \ diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 52d4414b673..106f890da7a 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -6,6 +6,8 @@ * Copyright 1997 David Faure * Copyright 1998 Morten Welinder * Copyright 1998 Ulrich Weigand + * Copyright 2012 Henri Verbeet + * Copyright 2018 Zebediah Figura for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -623,3 +625,50 @@ BOOL WINAPI UnregisterDeviceNotification( HDEVNOTIFY handle ) return I_ScUnregisterDeviceNotification( handle ); } + +/*********************************************************************** + * GetRawInputDeviceInfoA (USER32.@) + */ +UINT WINAPI GetRawInputDeviceInfoA( HANDLE device, UINT command, void *data, UINT *size ) +{ + TRACE( "device %p, command %#x, data %p, size %p.\n", device, command, data, size ); + + /* RIDI_DEVICENAME size is in chars, not bytes */ + if (command == RIDI_DEVICENAME) + { + WCHAR *nameW; + UINT ret, sizeW; + + if (!size) return ~0U; + + sizeW = *size; + + if (data && sizeW > 0) + nameW = HeapAlloc( GetProcessHeap(), 0, sizeof(WCHAR) * sizeW ); + else + nameW = NULL; + + ret = NtUserGetRawInputDeviceInfo( device, command, nameW, &sizeW ); + + if (ret && ret != ~0U) + WideCharToMultiByte( CP_ACP, 0, nameW, -1, data, *size, NULL, NULL ); + + *size = sizeW; + + HeapFree( GetProcessHeap(), 0, nameW ); + + return ret; + } + + return NtUserGetRawInputDeviceInfo( device, command, data, size ); +} + +/*********************************************************************** + * DefRawInputProc (USER32.@) + */ +LRESULT WINAPI DefRawInputProc( RAWINPUT **data, INT data_count, UINT header_size ) +{ + FIXME( "data %p, data_count %d, header_size %u stub!\n", data, data_count, header_size ); + + return 0; +} diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c deleted file mode 100644 index 98854d75690..00000000000 --- a/dlls/user32/rawinput.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Raw Input - * - * Copyright 2012 Henri Verbeet - * Copyright 2018 Zebediah Figura 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 - -#include "ntstatus.h" -#define WIN32_NO_STATUS -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winioctl.h" -#include "winnls.h" -#include "winreg.h" -#include "winuser.h" -#include "ddk/hidclass.h" -#include "wine/debug.h" -#include "wine/server.h" -#include "wine/hid.h" - -#include "user_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(rawinput); - -/*********************************************************************** - * GetRawInputDeviceInfoA (USER32.@) - */ -UINT WINAPI GetRawInputDeviceInfoA(HANDLE device, UINT command, void *data, UINT *data_size) -{ - TRACE("device %p, command %#x, data %p, data_size %p.\n", - device, command, data, data_size); - - /* RIDI_DEVICENAME data_size is in chars, not bytes */ - if (command == RIDI_DEVICENAME) - { - WCHAR *nameW; - UINT ret, nameW_sz; - - if (!data_size) return ~0U; - - nameW_sz = *data_size; - - if (data && nameW_sz > 0) - nameW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * nameW_sz); - else - nameW = NULL; - - ret = NtUserGetRawInputDeviceInfo( device, command, nameW, &nameW_sz ); - - if (ret && ret != ~0U) - WideCharToMultiByte(CP_ACP, 0, nameW, -1, data, *data_size, NULL, NULL); - - *data_size = nameW_sz; - - HeapFree(GetProcessHeap(), 0, nameW); - - return ret; - } - - return NtUserGetRawInputDeviceInfo( device, command, data, data_size ); -} - -/*********************************************************************** - * DefRawInputProc (USER32.@) - */ -LRESULT WINAPI DefRawInputProc(RAWINPUT **data, INT data_count, UINT header_size) -{ - FIXME("data %p, data_count %d, header_size %u stub!\n", data, data_count, header_size); - - return 0; -} -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/313