Although RegSetValueExW will add a NULL character if it's missing, better do it right.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/setupapi/devinst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 46987c8eb9..cc21839049 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -1583,7 +1583,7 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(HDEVINFO devinfo, const WCHAR *name, const if (description) { SETUPDI_SetDeviceRegistryPropertyW(device, SPDRP_DEVICEDESC, - (const BYTE *)description, lstrlenW(description) * sizeof(WCHAR)); + (const BYTE *)description, (lstrlenW(description) + 1) * sizeof(WCHAR)); }
if (device_data)
On 2/27/19 8:44 AM, Zhiyi Zhang wrote:
Although RegSetValueExW will add a NULL character if it's missing, better do it right.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com
dlls/setupapi/devinst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 46987c8eb9..cc21839049 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -1583,7 +1583,7 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(HDEVINFO devinfo, const WCHAR *name, const if (description) { SETUPDI_SetDeviceRegistryPropertyW(device, SPDRP_DEVICEDESC,
(const BYTE *)description, lstrlenW(description) * sizeof(WCHAR));
(const BYTE *)description, (lstrlenW(description) + 1) * sizeof(WCHAR)); } if (device_data)
Is there any particular reason why this is better?
On 27/02/2019 23:49, Zebediah Figura wrote:
On 2/27/19 8:44 AM, Zhiyi Zhang wrote:
Although RegSetValueExW will add a NULL character if it's missing, better do it right.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com
dlls/setupapi/devinst.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index 46987c8eb9..cc21839049 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -1583,7 +1583,7 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(HDEVINFO devinfo, const WCHAR *name, const if (description) { SETUPDI_SetDeviceRegistryPropertyW(device, SPDRP_DEVICEDESC, - (const BYTE *)description, lstrlenW(description) * sizeof(WCHAR)); + (const BYTE *)description, (lstrlenW(description) + 1) * sizeof(WCHAR)); } if (device_data)
Is there any particular reason why this is better?
Just keeping it aligned with the documentations.