Jacek Caban : user32: Invalidate cache in update_monitor_cache when modification time matches current time.

Alexandre Julliard julliard at winehq.org
Tue Nov 30 16:18:51 CST 2021


Module: wine
Branch: master
Commit: d7133c97d91a0dbc746a4c9711831f45704c8b43
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d7133c97d91a0dbc746a4c9711831f45704c8b43

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Nov 30 13:26:56 2021 +0100

user32: Invalidate cache in update_monitor_cache when modification time matches current time.

Also preserve last error.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/sysparams.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c
index 92c62d815ba..82dd0f4c664 100644
--- a/dlls/user32/sysparams.c
+++ b/dlls/user32/sysparams.c
@@ -3804,14 +3804,14 @@ static BOOL update_monitor_cache(void)
     BOOL ret = FALSE;
     BOOL is_replica;
     DWORD i = 0, j;
-    DWORD type;
+    DWORD type, error = GetLastError();
 
     /* Update monitor cache from SetupAPI if it's outdated */
     if (!video_key && RegOpenKeyW( HKEY_LOCAL_MACHINE, L"HARDWARE\\DEVICEMAP\\VIDEO", &video_key ))
         return FALSE;
     if (RegQueryInfoKeyW( video_key, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, &filetime ))
         return FALSE;
-    if (CompareFileTime( &filetime, &last_query_monitors_time ) < 1)
+    if (CompareFileTime( &filetime, &last_query_monitors_time ) < 0)
         return TRUE;
 
     mutex = get_display_device_init_mutex();
@@ -3879,6 +3879,7 @@ fail:
     SetupDiDestroyDeviceInfoList( devinfo );
     LeaveCriticalSection( &monitors_section );
     release_display_device_init_mutex( mutex );
+    SetLastError( error );
     return ret;
 }
 




More information about the wine-cvs mailing list