hidclass.sys: Use wide-char string literals.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2020-11-15 23:11:21 +01:00 committed by Alexandre Julliard
parent d8b26261e9
commit f073d9a9d3
2 changed files with 7 additions and 14 deletions

View File

@ -38,9 +38,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(hid);
WINE_DECLARE_DEBUG_CHANNEL(hid_report);
static const WCHAR device_name_fmtW[] = {'\\','D','e','v','i','c','e',
'\\','H','I','D','#','%','p','&','%','p',0};
NTSTATUS HID_CreateDevice(DEVICE_OBJECT *native_device, HID_MINIDRIVER_REGISTRATION *driver, DEVICE_OBJECT **device)
{
WCHAR dev_name[255];
@ -48,7 +45,7 @@ NTSTATUS HID_CreateDevice(DEVICE_OBJECT *native_device, HID_MINIDRIVER_REGISTRAT
NTSTATUS status;
BASE_DEVICE_EXTENSION *ext;
swprintf(dev_name, ARRAY_SIZE(dev_name), device_name_fmtW, driver->DriverObject, native_device);
swprintf(dev_name, ARRAY_SIZE(dev_name), L"\\Device\\HID#%p&%p", driver->DriverObject, native_device);
RtlInitUnicodeString( &nameW, dev_name );
TRACE("Create base hid device %s\n", debugstr_w(dev_name));
@ -76,7 +73,6 @@ NTSTATUS HID_CreateDevice(DEVICE_OBJECT *native_device, HID_MINIDRIVER_REGISTRAT
NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device)
{
static const WCHAR backslashW[] = {'\\',0};
WCHAR device_instance_id[MAX_DEVICE_ID_LEN];
SP_DEVINFO_DATA Data;
UNICODE_STRING nameW;
@ -91,7 +87,7 @@ NTSTATUS HID_LinkDevice(DEVICE_OBJECT *device)
RtlInitUnicodeString( &nameW, ext->device_name);
lstrcpyW(device_instance_id, ext->device_id);
lstrcatW(device_instance_id, backslashW);
lstrcatW(device_instance_id, L"\\");
lstrcatW(device_instance_id, ext->instance_id);
devinfo = SetupDiCreateDeviceInfoList(&GUID_DEVCLASS_HIDCLASS, NULL);

View File

@ -30,9 +30,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(hid);
static const WCHAR device_enumeratorW[] = {'H','I','D',0};
static const WCHAR separator_W[] = {'\\',0};
static NTSTATUS WINAPI internalComplete(DEVICE_OBJECT *deviceObject, IRP *irp,
void *context)
{
@ -193,8 +190,8 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
lstrcpyW(ext->instance_id, instance_id);
lstrcpyW(ext->device_id, device_enumeratorW);
lstrcatW(ext->device_id, separator_W);
lstrcpyW(ext->device_id, L"HID");
lstrcatW(ext->device_id, L"\\");
lstrcatW(ext->device_id, wcschr(device_id, '\\') + 1);
HID_LinkDevice(device);
@ -264,7 +261,7 @@ NTSTATUS WINAPI HID_PNP_Dispatch(DEVICE_OBJECT *device, IRP *irp)
/* Device instance ID */
lstrcpyW(ptr, ext->device_id);
ptr += lstrlenW(ext->device_id);
lstrcpyW(ptr, separator_W);
lstrcpyW(ptr, L"\\");
ptr += 1;
lstrcpyW(ptr, ext->instance_id);
ptr += lstrlenW(ext->instance_id) + 1;
@ -272,8 +269,8 @@ NTSTATUS WINAPI HID_PNP_Dispatch(DEVICE_OBJECT *device, IRP *irp)
lstrcpyW(ptr, ext->device_id);
ptr += lstrlenW(ext->device_id) + 1;
/* Bus ID */
lstrcpyW(ptr, device_enumeratorW);
ptr += lstrlenW(device_enumeratorW) + 1;
lstrcpyW(ptr, L"HID");
ptr += lstrlenW(L"HID") + 1;
*ptr = 0;
irp->IoStatus.Information = (ULONG_PTR)id;
rc = STATUS_SUCCESS;