Commit 04d1a184 authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

user32: Zero initialize DEVMODE before passing it to EnumDisplaySettings().

EnumDisplaySettings() on Wine does not write beyond the end of DEVMODE because it doesn't use dmDriverExtra currently, but this implementation detail should not be relied on. Signed-off-by: 's avatarZhiyi Zhang <zzhang@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 6d68c38c
......@@ -3369,6 +3369,7 @@ LONG WINAPI ChangeDisplaySettingsExW( LPCWSTR devname, LPDEVMODEW devmode, HWND
if (def_mode)
{
memset(&dm, 0, sizeof(dm));
dm.dmSize = sizeof(dm);
if (!EnumDisplaySettingsExW(devname, ENUM_REGISTRY_SETTINGS, &dm, 0))
{
......@@ -3428,6 +3429,8 @@ BOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName, DWORD iModeNum,
if (lpszDeviceName) RtlCreateUnicodeStringFromAsciiz(&nameW, lpszDeviceName);
else nameW.Buffer = NULL;
memset(&devmodeW, 0, sizeof(devmodeW));
devmodeW.dmSize = sizeof(devmodeW);
ret = EnumDisplaySettingsExW(nameW.Buffer,iModeNum,&devmodeW,dwFlags);
if (ret)
{
......@@ -4808,6 +4811,7 @@ LONG WINAPI QueryDisplayConfig(UINT32 flags, UINT32 *numpathelements, DISPLAYCON
&type, (BYTE *)device_name, sizeof(device_name), NULL, 0))
goto done;
memset(&devmode, 0, sizeof(devmode));
devmode.dmSize = sizeof(devmode);
if (!EnumDisplaySettingsW(device_name, ENUM_CURRENT_SETTINGS, &devmode))
goto done;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment