From 0095fa01e62e233f71b2c1d19ac73f969310904b Mon Sep 17 00:00:00 2001 From: hap Date: Mon, 26 Oct 2015 04:38:18 +0100 Subject: [PATCH] windows rawinput: allow nameless input devices --- src/osd/windows/input.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/osd/windows/input.c b/src/osd/windows/input.c index 6afca302c27..3099f5e5f20 100644 --- a/src/osd/windows/input.c +++ b/src/osd/windows/input.c @@ -1826,13 +1826,13 @@ static device_info *rawinput_device_create(running_machine &machine, device_info { device_info *devinfo = NULL; TCHAR *tname = NULL; - INT name_length; + INT name_length = 0; - // determine the length of the device name, allocate it, and fetch it + // determine the length of the device name, allocate it, and fetch it if not nameless if ((*get_rawinput_device_info)(device->hDevice, RIDI_DEVICENAME, NULL, &name_length) != 0) goto error; - tname = global_alloc_array(TCHAR, name_length); - if ((*get_rawinput_device_info)(device->hDevice, RIDI_DEVICENAME, tname, &name_length) == -1) + tname = global_alloc_array_clear(TCHAR, name_length+1); + if (name_length != 1 && (*get_rawinput_device_info)(device->hDevice, RIDI_DEVICENAME, tname, &name_length) == -1) goto error; // if this is an RDP name, skip it