Kurapica Posted July 20 Share Posted July 20 I would like to ask if anyone has noticed this issue, started this July on some Windows machines. The using of "EnumDisplayDevices" either Ansi or Unicode versions : Example code : https://stackoverflow.com/questions/9524309/enumdisplaydevices-function-not-working-for-me #include <windows.h> #include <stdio.h> #pragma comment(lib, "user32.lib") void DumpDevice(const DISPLAY_DEVICE& dd, size_t nSpaceCount ) { printf("%*sDevice Name: %s\n", nSpaceCount, "", dd.DeviceName ); printf("%*sDevice String: %s\n", nSpaceCount, "", dd.DeviceString ); printf("%*sState Flags: %x\n", nSpaceCount, "", dd.StateFlags ); printf("%*sDeviceID: %s\n", nSpaceCount, "", dd.DeviceID ); printf("%*sDeviceKey: ...%s\n\n", nSpaceCount, "", dd.DeviceKey+42 ); } int main() { DISPLAY_DEVICE dd; dd.cb = sizeof(DISPLAY_DEVICE); DWORD deviceNum = 0; while( EnumDisplayDevices(NULL, deviceNum, &dd, 0) ){ DumpDevice( dd, 0 ); DISPLAY_DEVICE newdd = {0}; newdd.cb = sizeof(DISPLAY_DEVICE); DWORD monitorNum = 0; while ( EnumDisplayDevices(dd.DeviceName, monitorNum, &newdd, 0)) { DumpDevice( newdd, 4 ); monitorNum++; } puts(""); deviceNum++; } return 0; } The problems seems to be related to the drivers or some other recent Windows update, The value of "dd.DeviceString" will have a random suffix : "NVIDIA GeForce GTX 1060 6GB#0x1e00303a45ed6a6a#" The expected value is "NVIDIA GeForce GTX 1060 6GB" but it adds this "#0x1e00303a45ed6a6a#" value which seems to be a formatted memory address or something else, anyway it is not supposed to be there and it is definitely not related to forgetting to Zero-fill the buffer before calling the API. This value seems to be added in registry too after a fresh driver install and a Windows reboot. Anyone noticed this weird issue lately with nVidia or AMD ? 1 Link to comment
Progman Posted July 20 Share Posted July 20 According to https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enumdisplaydevicesa " To obtain information on a display monitor, first call EnumDisplayDevices with lpDevice set to NULL. Then call EnumDisplayDevices with lpDevice set to DISPLAY_DEVICE.DeviceName from the first call to EnumDisplayDevices and with iDevNum set to zero. Then DISPLAY_DEVICE.DeviceString is the monitor name. To query all monitor devices associated with an adapter, call EnumDisplayDevices in a loop with lpDevice set to the adapter name, iDevNum set to start at 0, and iDevNum set to increment until the function fails. Note that DISPLAY_DEVICE.DeviceName changes with each call for monitor information, so you must save the adapter name. The function fails when there are no more monitors for the adapter." Seems like documented behavior? 1 Link to comment
adoxa Posted July 21 Share Posted July 21 I haven't updated for a while (10.0.19045.3086) and I've got an old card, but it's fine here. Device String: NVIDIA GeForce GT 710 If I can remember I'll try again after I eventually update... 1 Link to comment
Teddy Rogers Posted July 21 Share Posted July 21 In Windows use the "System Information" tool, have a look under "Components -> Display" to see if it is outputting the same string? If it is the same I will assume it is driver related. This is how I generally list the (active) display devices... While EnumDisplayDevices_(#Null, iDevNum, @lpDisplayDevice, #Null) If lpDisplayDevice\StateFlags & #DISPLAY_DEVICE_ACTIVE Debug PeekS(@lpDisplayDevice\DeviceName) Debug PeekS(@lpDisplayDevice\DeviceString) Debug PeekS(@lpDisplayDevice\DeviceID) Debug PeekS(@lpDisplayDevice\DeviceKey) EndIf iDevNum + 1 Wend Seems to be no change on Arc and Radeon cards... Ted. 1 Link to comment
Kurapica Posted July 21 Author Share Posted July 21 nvd.mp4 This is how it works on a system without this bug, when it calls the "NtUserEnumDisplayDevices", the buffer is filled with values, so it is definitely not a buffer handling or unicode/ascii drama. 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now