This commit is contained in:
DavidXanatos 2024-05-12 16:25:53 +02:00
parent 4cca2a4c0f
commit 77cd2c9249
7 changed files with 48 additions and 4 deletions

View File

@ -31,6 +31,8 @@
#include "wsa_defs.h"
#include "common/pattern.h"
#include "common/str_util.h"
#include "core/drv/api_defs.h"
#include "core/drv/verify.h"
//---------------------------------------------------------------------------
@ -192,6 +194,15 @@ _FX BOOLEAN WSA_InitNetDnsFilter(HMODULE module)
map_init(&WSA_LookupMap, Dll_Pool);
}
SCertInfo CertInfo = { 0 };
if (!NT_SUCCESS(SbieApi_Call(API_QUERY_DRIVER_INFO, 3, -1, (ULONG_PTR)&CertInfo, sizeof(CertInfo))) || !CERT_IS_ADVANCED(CertInfo)) {
const WCHAR* strings[] = { L"NetworkDnsFilter" , NULL };
SbieApi_LogMsgExt(-1, 6009, strings);
WSA_FilterEnabled = FALSE;
}
//
// Setup DNS hooks
//

View File

@ -33,6 +33,8 @@
#include "wsa_defs.h"
#include "core/svc/sbieiniwire.h"
#include "common/base64.c"
#include "core/drv/api_defs.h"
#include "core/drv/verify.h"
//---------------------------------------------------------------------------
@ -1324,6 +1326,15 @@ _FX BOOLEAN WSA_InitNetProxy()
return FALSE;
}
SCertInfo CertInfo = { 0 };
if (!NT_SUCCESS(SbieApi_Call(API_QUERY_DRIVER_INFO, 3, -1, (ULONG_PTR)&CertInfo, sizeof(CertInfo))) || !CERT_IS_ADVANCED(CertInfo)) {
const WCHAR* strings[] = { L"NetworkUseProxy" , NULL };
SbieApi_LogMsgExt(-1, 6009, strings);
return FALSE;
}
return TRUE;
}

View File

@ -86,6 +86,7 @@ enum ECertLevel {
#define CERT_IS_TYPE(cert,t) ((cert.type & 0b11100) == (unsigned long)(t))
#define CERT_IS_SUBSCRIPTION(cert) (CERT_IS_TYPE(cert, eCertBusiness) || CERT_IS_TYPE(cert, eCertHome) || cert.type == eCertEntryPatreon || CERT_IS_TYPE(cert, eCertEvaluation))
#define CERT_IS_INSIDER(cert) (CERT_IS_TYPE(cert, eCertEternal) || cert.type == eCertGreatPatreon)
#define CERT_IS_ADVANCED(cert) (CERT_IS_TYPE(cert, eCertEternal) || (CERT_IS_LEVEL(cert, eCertAdvanced) && cert.type != eCertPatreon))
#define CERT_IS_LEVEL(cert,l) (cert.active && cert.level >= (unsigned long)(l))
#ifdef KERNEL_MODE

View File

@ -2968,13 +2968,21 @@ void CSandMan::SaveMessageLog(QIODevice* pFile)
bool CSandMan::CheckCertificate(QWidget* pWidget, int iType)
{
QString Message;
if (iType == 1)
if (iType == 1 || iType == 2)
{
if (iType == 1) {
if (CERT_IS_LEVEL(g_CertInfo, eCertAdvanced))
return true;
}
else {
if (CERT_IS_ADVANCED(g_CertInfo))
return true;
}
Message = tr("The selected feature requires an <b>advanced</b> supporter certificate.");
if(g_CertInfo.active)
if (iType == 2 && CERT_IS_TYPE(g_CertInfo, eCertPatreon))
Message.append(tr("<br />you need to be on the Great Patreon level or higher to unlock this feature."));
else if (g_CertInfo.active)
Message.append(tr("<br /><a href=\"https://sandboxie-plus.com/go.php?to=sbie-upgrade-cert\">Upgrade your Certificate</a> to unlock advanced features."));
else
Message.append(tr("<br /><a href=\"https://sandboxie-plus.com/go.php?to=sbie-get-cert\">Become a project supporter</a>, and receive a <a href=\"https://sandboxie-plus.com/go.php?to=sbie-cert\">supporter certificate</a>"));

View File

@ -60,6 +60,13 @@ void COptionsWindow::CreateNetwork()
connect(ui.chkBlockDns, SIGNAL(clicked(bool)), this, SLOT(OnBlockDns()));
connect(ui.chkBlockSamba, SIGNAL(clicked(bool)), this, SLOT(OnBlockSamba()));
connect(ui.tabsInternet, SIGNAL(currentChanged(int)), this, SLOT(OnInternetTab()));
if (!CERT_IS_ADVANCED(g_CertInfo)) {
ui.tabDNS->setEnabled(false);
ui.tabNetProxy->setEnabled(false);
}
ui.chkProxyResolveHostnames->setVisible(false);
}

View File

@ -1206,6 +1206,11 @@ void COptionsWindow::UpdateCurrentTab()
{
LoadBlockINet();
}
else if (m_pCurrentTab == ui.tabDNS || m_pCurrentTab == ui.tabNetProxy)
{
if (!m_pCurrentTab->isEnabled())
theGUI->CheckCertificate(this, 2);
}
else if (m_pCurrentTab == ui.tabCOM) {
CheckOpenCOM();
}

View File

@ -238,6 +238,7 @@ private slots:
void OnTab() { OnTab(ui.tabs->currentWidget()); }
void OnAccessTab() { OnTab(ui.tabsAccess->currentWidget()); }
void OnInternetTab() { OnTab(ui.tabsInternet->currentWidget()); }
void OnGeneralChanged();
void OnPSTChanged();