disable auto restore from db if system is up more than 5 min

This commit is contained in:
Kang Yu 2025-04-28 14:10:41 -07:00
parent cce0f7f52d
commit f34fffa574
2 changed files with 6 additions and 0 deletions

View file

@ -1082,6 +1082,9 @@ namespace PersistentWindows.Common
}
else if (db_exist && autoRestoreLiveWindowsFromDb)
{
var ticks = Kernel32.GetTickCount64();
if (ticks > 600000) //system up 5min
return true;
Log.Event("auto restore from db");
restoringFromDB = true;
autoInitialRestoreFromDB = true;

View file

@ -624,6 +624,9 @@ namespace PersistentWindows.Common.WinApiBridge
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool CloseHandle(IntPtr hHandle);
[DllImport("kernel32")]
public static extern UInt64 GetTickCount64();
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr OpenProcess(
ProcessAccessFlags processAccess,