diff --git a/src/win32_monitor.c b/src/win32_monitor.c index 9f333e71..830f432a 100644 --- a/src/win32_monitor.c +++ b/src/win32_monitor.c @@ -31,6 +31,7 @@ #if defined(_GLFW_WIN32) +#include #include #include #include @@ -58,6 +59,13 @@ static char * getAccurateMonitorName(const WCHAR *deviceName) i = 0; rc = 0; + if(QueryDisplayConfig == NULL) + return NULL; + + // If QueryDisplayConfig is present then GetDisplayConfigBufferSizes and DisplayConfigGetDeviceInfo also should be present. + assert(GetDisplayConfigBufferSizes != NULL); + assert(DisplayConfigGetDeviceInfo != NULL); + do { rc = GetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS, &pathCount, &modeCount); @@ -83,7 +91,7 @@ static char * getAccurateMonitorName(const WCHAR *deviceName) DISPLAYCONFIG_TARGET_DEVICE_NAME targetName; ZeroMemory(&sourceName, sizeof(sourceName)); - sourceName.header.adapterId = paths[i].targetInfo.adapterId; + sourceName.header.adapterId = paths[i].sourceInfo.adapterId; sourceName.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME; sourceName.header.size = sizeof (sourceName); sourceName.header.id = paths[i].sourceInfo.id;