File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -687,9 +687,18 @@ bool CVideoModeManager::GetCurrentAdapterRect(LPRECT pOutRect)
687687// /////////////////////////////////////////////////////////////
688688SString CVideoModeManager::GetCurrentAdapterDeviceName ()
689689{
690- MONITORINFOEX monitorInfo;
690+ if (!m_hCurrentMonitor)
691+ return " " ;
692+
693+ MONITORINFOEX monitorInfo{};
691694 monitorInfo.cbSize = sizeof (MONITORINFOEX);
692- if (GetMonitorInfo (m_hCurrentMonitor, &monitorInfo))
693- return monitorInfo.szDevice ;
695+
696+ if (GetMonitorInfoA (m_hCurrentMonitor, &monitorInfo))
697+ {
698+ // Ensure null termination for x86 safety
699+ monitorInfo.szDevice [sizeof (monitorInfo.szDevice ) - 1 ] = ' \0 ' ;
700+ return std::string (monitorInfo.szDevice );
701+ }
702+
694703 return " " ;
695704}
Original file line number Diff line number Diff line change 11#pragma once
22
3+ #ifdef __INTELLISENSE__
4+ #pragma diag_suppress 842
5+ #endif
6+
37#include < type_traits>
48#include < variant>
59
You can’t perform that action at this time.
0 commit comments