Applied ZeroMemory to DEVMODE struct n Win32 to prevent Uninitialized Read.

Set dmDriverExtra for EnumDisplaySettings. Reverted unneeded ZeroMemory for DEVMODE.
This commit is contained in:
Anthony 2017-08-11 15:32:44 -04:00 committed by Lukas Dürrenberger
parent a2f448ab4c
commit 23a345512d

View File

@ -42,6 +42,7 @@ std::vector<VideoMode> VideoModeImpl::getFullscreenModes()
// Enumerate all available video modes for the primary display adapter
DEVMODE win32Mode;
win32Mode.dmSize = sizeof(win32Mode);
win32Mode.dmDriverExtra = 0;
for (int count = 0; EnumDisplaySettings(NULL, count, &win32Mode); ++count)
{
// Convert to sf::VideoMode
@ -61,6 +62,7 @@ VideoMode VideoModeImpl::getDesktopMode()
{
DEVMODE win32Mode;
win32Mode.dmSize = sizeof(win32Mode);
win32Mode.dmDriverExtra = 0;
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &win32Mode);
return VideoMode(win32Mode.dmPelsWidth, win32Mode.dmPelsHeight, win32Mode.dmBitsPerPel);