I’m trying to run a program in a virtual machine, this program try to fetch my display information trought Windows WMI with a query:
var success = true;
List<Display> displays = new List<Display>();
// Query WmiMonitorBasicDisplayParams to retrieve display parameters
using (var searcher = new ManagementObjectSearcher(@"RootWMI", "SELECT * FROM
WmiMonitorBasicDisplayParams"))
using (var results = searcher.Get())
for some reason Windows WMI fail to fetch the display information of my virtual display and the program crash throwing this exception:
Unhandled exception. System.Management.ManagementException: Not supported
at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
at System.Management.ManagementObjectCollection.ManagementObjectEnumerator.MoveNext()
this happen in EVERY virtual machine, and the display is always classified as a NON PnP device.
So how do i emulate a real internal display? (like a laptop display) so that Windows WMI doesn’t make crash the program? Otherwise is there a way to intercept and modify the result of a WMI query and then return it to the program c# code?