This commit is contained in:
DavidXanatos 2023-10-21 11:32:05 +02:00
parent d31aa80b8f
commit 1f5ba4040a
2 changed files with 48 additions and 27 deletions

View File

@ -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));

View File

@ -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;
}
}