On 11/25/21 9:07 AM, Zhiyi Zhang wrote:
 
 
+static BOOL update_display_cache(void)
+{
+    struct device_manager_ctx ctx = { 0 };
+
+    user_driver->pUpdateDisplayDevices( &device_manager, FALSE, &ctx );
+    release_display_manager_ctx( &ctx );
+
+    if (update_display_cache_from_registry()) return TRUE;
+    if (ctx.gpu_count)
+    {
+        ERR( "driver reported devices, but we failed to read them\n" );
+        return FALSE;
+    }
+
+    user_driver->pUpdateDisplayDevices( &device_manager, TRUE, &ctx );
+    if (!ctx.gpu_count)
+    {
+        static const struct gdi_monitor default_monitor =
+        {
+            .rc_work.right = 1024,
+            .rc_work.bottom = 768,
+            .rc_monitor.right = 1024,
+            .rc_monitor.bottom = 768,
+            .state_flags = DISPLAY_DEVICE_ACTIVE,

You probably should add DISPLAY_DEVICE_ATTACHED as well.

Yes, I will add it in v2.

And there should be a name, e.g., "Generic Non-PnP Monitor".

Similar to GPU, default name is handled by add_monitor.

Thanks,

Jacek