mirror of
https://github.com/reactos/reactos.git
synced 2025-01-12 09:07:54 +00:00
- zero DISPLAY_DEVICEW struct before passing it to NtUserEnumDisplayDevices
- copy string the resulting strings on success but on failure - fix 2 memory leaks in EnumDisplayMonitors - fixes a user32_winetest error svn path=/trunk/; revision=33612
This commit is contained in:
parent
45a63ea020
commit
dd8f25a940
1 changed files with 6 additions and 2 deletions
|
@ -62,13 +62,14 @@ EnumDisplayDevicesA(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RtlZeroMemory(&DisplayDeviceW, sizeof(DISPLAY_DEVICEW));
|
||||||
DisplayDeviceW.cb = sizeof(DISPLAY_DEVICEW);
|
DisplayDeviceW.cb = sizeof(DISPLAY_DEVICEW);
|
||||||
rc = NtUserEnumDisplayDevices (
|
rc = NtUserEnumDisplayDevices (
|
||||||
&Device,
|
&Device,
|
||||||
iDevNum,
|
iDevNum,
|
||||||
&DisplayDeviceW,
|
&DisplayDeviceW,
|
||||||
dwFlags );
|
dwFlags );
|
||||||
if (!rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
/* Copy result from DisplayDeviceW to lpDisplayDevice */
|
/* Copy result from DisplayDeviceW to lpDisplayDevice */
|
||||||
lpDisplayDevice->StateFlags = DisplayDeviceW.StateFlags;
|
lpDisplayDevice->StateFlags = DisplayDeviceW.StateFlags;
|
||||||
|
@ -169,6 +170,8 @@ EnumDisplayMonitors(
|
||||||
if (iCount <= 0)
|
if (iCount <= 0)
|
||||||
{
|
{
|
||||||
/* FIXME: SetLastError() */
|
/* FIXME: SetLastError() */
|
||||||
|
HeapFree(hHeap, 0, hMonitorList);
|
||||||
|
HeapFree(hHeap, 0, pRectList);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +191,8 @@ EnumDisplayMonitors(
|
||||||
if (!lpfnEnum(hMonitor, hMonitorDC, pMonitorRect, dwData))
|
if (!lpfnEnum(hMonitor, hMonitorDC, pMonitorRect, dwData))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
HeapFree(hHeap, 0, hMonitorList);
|
||||||
|
HeapFree(hHeap, 0, pRectList);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue