From f073d9a9d32a4e762ce4ece527195f1134a4e448 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Sun, 15 Nov 2020 23:11:21 +0100 Subject: [PATCH] hidclass.sys: Use wide-char string literals. Signed-off-by: Michael Stefaniuc Signed-off-by: Alexandre Julliard --- dlls/hidclass.sys/device.c | 8 ++------ dlls/hidclass.sys/pnp.c | 13 +++++-------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/dlls/hidclass.sys/device.c b/dlls/hidclass.sys/device.c index 0e905c8322f..fc1dfd07db1 100644 --- a/dlls/hidclass.sys/device.c +++ b/dlls/hidclass.sys/device.c @@ -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); diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c index 1c130e8dd80..27de1e1b04b 100644 --- a/dlls/hidclass.sys/pnp.c +++ b/dlls/hidclass.sys/pnp.c @@ -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;