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: Zhiyi Zhang zzhang@codeweavers.com --- dlls/winex11.drv/settings.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/dlls/winex11.drv/settings.c b/dlls/winex11.drv/settings.c index a64d1de6500..2d1fc7220de 100644 --- a/dlls/winex11.drv/settings.c +++ b/dlls/winex11.drv/settings.c @@ -501,6 +501,7 @@ static LONG get_display_settings(struct x11drv_display_setting **new_displays,
if (!dev_mode) { + memset(®istry_mode, 0, sizeof(registry_mode)); registry_mode.dmSize = sizeof(registry_mode); if (!EnumDisplaySettingsExW(display_device.DeviceName, ENUM_REGISTRY_SETTINGS, ®istry_mode, 0)) goto done; @@ -512,6 +513,7 @@ static LONG get_display_settings(struct x11drv_display_setting **new_displays, displays[display_idx].desired_mode = *dev_mode; if (!(dev_mode->dmFields & DM_POSITION)) { + memset(¤t_mode, 0, sizeof(current_mode)); current_mode.dmSize = sizeof(current_mode); if (!EnumDisplaySettingsExW(display_device.DeviceName, ENUM_CURRENT_SETTINGS, ¤t_mode, 0)) goto done; @@ -522,6 +524,7 @@ static LONG get_display_settings(struct x11drv_display_setting **new_displays, } else { + memset(¤t_mode, 0, sizeof(current_mode)); current_mode.dmSize = sizeof(current_mode); if (!EnumDisplaySettingsExW(display_device.DeviceName, ENUM_CURRENT_SETTINGS, ¤t_mode, 0)) goto done;