diff --git a/Sandboxie/apps/start/aboutdlg.cpp b/Sandboxie/apps/start/aboutdlg.cpp index 47b39e4f71..96c23dcf95 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; - - 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; - } - } + int Interval = 30 * 24; // in hours + + 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 ea7614a505..e834876954 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; - - //USHORT ReminderRevision = 0; - //theAPI->GetSecureParam("ReminderRevision", &ReminderRevision, sizeof(ReminderRevision)); - - 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; - } + int Interval = 30 * 24; // in hours + + 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; + 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; } }