From 1f5ba4040a91c04f3e05541d4f0b598862dad2f8 Mon Sep 17 00:00:00 2001 From: DavidXanatos <3890945+DavidXanatos@users.noreply.github.com> Date: Sat, 21 Oct 2023 11:32:05 +0200 Subject: [PATCH] 1.12.0 --- Sandboxie/apps/start/aboutdlg.cpp | 38 ++++++++++++------- .../SandMan/Windows/SupportDialog.cpp | 37 +++++++++++------- 2 files changed, 48 insertions(+), 27 deletions(-) diff --git a/Sandboxie/apps/start/aboutdlg.cpp b/Sandboxie/apps/start/aboutdlg.cpp index 47b39e4f..96c23dcf 100644 --- a/Sandboxie/apps/start/aboutdlg.cpp +++ b/Sandboxie/apps/start/aboutdlg.cpp @@ -307,21 +307,33 @@ bool DoAboutDialog(bool bReminder) if (Days < 40) return true; - int Interval; - if (Days > 730) Interval = 5 * 24; - else if (Days > 365) Interval = 10 * 24; - else if (Days > 180) Interval = 20 * 24; - else Interval = 30 * 24; + int Interval = 30 * 24; // in hours - USHORT ReminderShedule[2*11]; - if (NT_SUCCESS(SbieApi_Call(API_GET_SECURE_PARAM, 3, L"ReminderShedule", (ULONG_PTR)&ReminderShedule, sizeof(ReminderShedule)))) { - for (USHORT* Cur = ReminderShedule; (ULONG_PTR)Cur < (ULONG_PTR)ReminderShedule + sizeof(ReminderShedule) && *Cur != 0; Cur += 2) { - if (Days > Cur[0]) { - if (Cur[1] < Interval) Interval = Cur[1]; - break; - } - } + USHORT ReminderShedule[2 * 11] = { + // days, itnerval, + 730, 1 * 24, + 365, 5 * 24, + 182, 10 * 24, + 30, 30 * 24, + 0 + }; + USHORT CurReminderRevision = 1; + + USHORT ReminderRevision = 0; + SbieApi_Call(API_GET_SECURE_PARAM, 3, L"ReminderRevision", (ULONG_PTR)&ReminderRevision, sizeof(ReminderRevision)); + if (ReminderRevision < CurReminderRevision) { + SbieApi_Call(API_SET_SECURE_PARAM, 3, L"ReminderShedule", (ULONG_PTR)&ReminderShedule, sizeof(ReminderShedule)); + SbieApi_Call(API_SET_SECURE_PARAM, 3, L"ReminderRevision", (ULONG_PTR)&ReminderRevision, sizeof(ReminderRevision)); } + else if (ReminderRevision > CurReminderRevision) + SbieApi_Call(API_GET_SECURE_PARAM, 3, L"ReminderShedule", (ULONG_PTR)&ReminderShedule, sizeof(ReminderShedule)); + + for (USHORT* Cur = ReminderShedule; (ULONG_PTR)Cur < (ULONG_PTR)ReminderShedule + sizeof(ReminderShedule) && *Cur != 0; Cur += 2) { + if (Days > Cur[0]) { + if (Cur[1] < Interval) Interval = Cur[1]; + break; + } + } time_t LastReminder = 0; SbieApi_Call(API_GET_SECURE_PARAM, 3, L"LastReminder", (ULONG_PTR)&LastReminder, sizeof(LastReminder)); diff --git a/SandboxiePlus/SandMan/Windows/SupportDialog.cpp b/SandboxiePlus/SandMan/Windows/SupportDialog.cpp index ea7614a5..e8348769 100644 --- a/SandboxiePlus/SandMan/Windows/SupportDialog.cpp +++ b/SandboxiePlus/SandMan/Windows/SupportDialog.cpp @@ -95,22 +95,31 @@ bool CSupportDialog::CheckSupport(bool bOnRun) { // Note: the old sandboxie showed a message after 30 days every 12 hours for 5 seconds - int Interval; - if (Days > 730) Interval = 5 * 24; - else if (Days > 365) Interval = 10 * 24; - else if (Days > 180) Interval = 20 * 24; - else Interval = 30 * 24; + int Interval = 30 * 24; // in hours - //USHORT ReminderRevision = 0; - //theAPI->GetSecureParam("ReminderRevision", &ReminderRevision, sizeof(ReminderRevision)); + USHORT ReminderShedule[2 * 11] = { + // days, itnerval, + 730, 1 * 24, + 365, 5 * 24, + 182, 10 * 24, + 30, 30 * 24, + 0 + }; + USHORT CurReminderRevision = 1; - USHORT ReminderShedule[2*11]; - if (theAPI->GetSecureParam("ReminderShedule", &ReminderShedule, sizeof(ReminderShedule))) { - for (USHORT* Cur = ReminderShedule; (ULONG_PTR)Cur < (ULONG_PTR)ReminderShedule + sizeof(ReminderShedule) && *Cur != 0; Cur += 2) { - if (Days > Cur[0]) { - if (Cur[1] < Interval) Interval = Cur[1]; - break; - } + USHORT ReminderRevision = 0; + theAPI->GetSecureParam("ReminderRevision", &ReminderRevision, sizeof(ReminderRevision)); + if (ReminderRevision < CurReminderRevision) { + theAPI->SetSecureParam("ReminderShedule", &ReminderShedule, sizeof(ReminderShedule)); + theAPI->SetSecureParam("ReminderRevision", &CurReminderRevision, sizeof(CurReminderRevision)); + } + else if (ReminderRevision > CurReminderRevision) + theAPI->GetSecureParam("ReminderShedule", &ReminderShedule, sizeof(ReminderShedule)); + + for (USHORT* Cur = ReminderShedule; (ULONG_PTR)Cur < (ULONG_PTR)ReminderShedule + sizeof(ReminderShedule) && *Cur != 0; Cur += 2) { + if (Days > Cur[0]) { + if (Cur[1] < Interval) Interval = Cur[1]; + break; } }