Author: rharabien
Date: Fri Mar 25 21:58:39 2011
New Revision: 51137
URL:
http://svn.reactos.org/svn/reactos?rev=51137&view=rev
Log:
[USER32]
Fix bug causing no NULL termination of strings after conversion in EnumDisplayDevicesA.
Fixes one usr32:monitor winetest
Modified:
trunk/reactos/dll/win32/user32/misc/display.c
Modified: trunk/reactos/dll/win32/user32/misc/display.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/disp…
==============================================================================
--- trunk/reactos/dll/win32/user32/misc/display.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/misc/display.c [iso-8859-1] Fri Mar 25 21:58:39 2011
@@ -71,24 +71,20 @@
dwFlags );
if (rc)
{
- /* Copy result from DisplayDeviceW to lpDisplayDevice */
+ /* Copy result from DisplayDeviceW to lpDisplayDevice. Buffers have the same size
so result is always NULL terminated. */
lpDisplayDevice->StateFlags = DisplayDeviceW.StateFlags;
- WideCharToMultiByte(CP_ACP,0,
- DisplayDeviceW.DeviceName,wcslen(DisplayDeviceW.DeviceName),
- lpDisplayDevice->DeviceName,sizeof(lpDisplayDevice->DeviceName) /
sizeof(lpDisplayDevice->DeviceName[0]),
- NULL,NULL);
- WideCharToMultiByte(CP_ACP,0,
- DisplayDeviceW.DeviceString,wcslen(DisplayDeviceW.DeviceString),
- lpDisplayDevice->DeviceString,sizeof(lpDisplayDevice->DeviceString) /
sizeof(lpDisplayDevice->DeviceString[0]),
- NULL,NULL);
- WideCharToMultiByte(CP_ACP,0,
- DisplayDeviceW.DeviceID,wcslen(DisplayDeviceW.DeviceID),
- lpDisplayDevice->DeviceID,sizeof(lpDisplayDevice->DeviceID) /
sizeof(lpDisplayDevice->DeviceID[0]),
- NULL,NULL);
- WideCharToMultiByte(CP_ACP,0,
- DisplayDeviceW.DeviceKey,wcslen(DisplayDeviceW.DeviceKey),
- lpDisplayDevice->DeviceKey,sizeof(lpDisplayDevice->DeviceKey) /
sizeof(lpDisplayDevice->DeviceKey[0]),
- NULL,NULL);
+ WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceName, -1,
+ lpDisplayDevice->DeviceName, sizeof(lpDisplayDevice->DeviceName) /
sizeof(lpDisplayDevice->DeviceName[0]),
+ NULL, NULL);
+ WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceString, -1,
+ lpDisplayDevice->DeviceString, sizeof(lpDisplayDevice->DeviceString) /
sizeof(lpDisplayDevice->DeviceString[0]),
+ NULL, NULL);
+ WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceID, -1,
+ lpDisplayDevice->DeviceID, sizeof(lpDisplayDevice->DeviceID) /
sizeof(lpDisplayDevice->DeviceID[0]),
+ NULL, NULL);
+ WideCharToMultiByte(CP_ACP, 0, DisplayDeviceW.DeviceKey, -1,
+ lpDisplayDevice->DeviceKey, sizeof(lpDisplayDevice->DeviceKey) /
sizeof(lpDisplayDevice->DeviceKey[0]),
+ NULL, NULL);
}
RtlFreeUnicodeString ( &Device );