Skip to content

Commit

Permalink
1.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidXanatos committed Jul 4, 2023
1 parent b99dcc9 commit 417673e
Show file tree
Hide file tree
Showing 19 changed files with 398 additions and 37 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- [SbieHide.dll](https://github.com/VeroFess/SbieHide) - a third-party DLL to hide SbieDll.dll
- [LogAPI.dll](https://bsa.isoftware.nl/) - an API logging library used for Buster Sandbox Analyzer
- added option to set the update interval to 1, 7, 14 and 30 days
- added whants new dialog to sbiectrl.exe shown after instalation prising the new features of the plus ui

### Changed
- setup wizard has now a dedicated update configuration page
- split the support page into Sandboxie Support and Sandboxie Updater tabs
- when the troubleshooting.7z file is available, the script engine will be used to match compatibility templates
- this allows a better granularity in template selection by using the AppCompatibility.js script
- improved session agent startup to be mroe flexible
- improved SBIEMSG help handling

### Fixed
- fixed uninstall issue in the Sandboxie Classic installer [d1863ff](https://github.com/sandboxie-plus/Sandboxie/commit/d1863ffadfe105c695de71c9e841c2fd568116fe)
Expand Down
1 change: 1 addition & 0 deletions Installer/get_assets.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ copy %~dp0..\sandboxie\install\ParseVersion.bat %~dp0\Assets\Classic\install\
copy %~dp0..\sandboxie\install\Registry.nsh %~dp0\Assets\Classic\install\
copy %~dp0..\sandboxie\install\SandboxieVS.nsi %~dp0\Assets\Classic\install\
copy %~dp0..\sandboxie\install\Warning.ini %~dp0\Assets\Classic\install\
copy %~dp0..\sandboxie\install\whatsnew.html %~dp0\Assets\Classic\install\
mkdir %~dp0\Assets\Classic\msgs
mkdir %~dp0\Assets\Classic\msgs\SbieRelease
copy %~dp0..\sandboxie\msgs\SbieRelease\NsisText_Albanian.txt %~dp0\Assets\Classic\msgs\SbieRelease\
Expand Down
18 changes: 14 additions & 4 deletions Sandboxie/apps/common/RunBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,22 @@ void CRunBrowser::OpenHelp(CWnd *pParentWnd, const CString &topic)
CRunBrowser x(pParentWnd, GetTopicUrl(topic));
}


//---------------------------------------------------------------------------
// OpenForum
// EscapeForURL
//---------------------------------------------------------------------------


void CRunBrowser::OpenForum(CWnd *pParentWnd)
CString CRunBrowser::EscapeForURL(const CString& value)
{
CRunBrowser x(pParentWnd, L"https://sandboxie-plus.com/go.php?to=sbie-forum");
}
CString escapedValue;
DWORD bufferSize = (DWORD)(value.GetLength() * 3 + 1);
LPWSTR escapedBuffer = new WCHAR[bufferSize];

HRESULT hr = UrlEscapeW(value, escapedBuffer, &bufferSize, URL_ESCAPE_PERCENT | URL_ESCAPE_SEGMENT_ONLY);
if (hr == S_OK)
escapedValue = CString(escapedBuffer, bufferSize);

delete[] escapedBuffer;
return escapedValue;
}
2 changes: 1 addition & 1 deletion Sandboxie/apps/common/RunBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class CRunBrowser : public CDialog
static CString GetTopicUrl(const CString &topic);

static void OpenHelp(CWnd *pParentWnd, const CString &topic);
static void OpenForum(CWnd *pParentWnd);

static CString EscapeForURL(const CString& value);
};


Expand Down
10 changes: 7 additions & 3 deletions Sandboxie/apps/control/MessageDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,9 +644,13 @@ void CMessageDialog::DiscardMessages(

void CMessageDialog::OnHelp()
{
CString sbie = GetSBIExxxx(NULL, NULL);
if (! sbie.IsEmpty())
CRunBrowser::OpenHelp(this, sbie);
CString Detail;
CString sbie = GetSBIExxxx(NULL, &Detail);
if (!sbie.IsEmpty()) {
CString url = L"https://sandboxie-plus.com/go.php?to=sbie-" + sbie + "&detail=" + CRunBrowser::EscapeForURL(Detail);
CRunBrowser x(this, url);
//CRunBrowser::OpenHelp(this, sbie);
}
}


Expand Down
5 changes: 4 additions & 1 deletion Sandboxie/apps/control/MyApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,15 @@ BOOL CMyApp::InitInstance()

BOOL ForceVisible = FALSE;
BOOL ForceSync = FALSE;
BOOL PostSetup = FALSE;
WCHAR *CommandLine = GetCommandLine();
if (CommandLine) {
if (wcsstr(CommandLine, L"/open"))
ForceVisible = TRUE;
if (wcsstr(CommandLine, L"/sync"))
ForceSync = TRUE;
if (wcsstr(CommandLine, L"/postsetup"))
PostSetup = TRUE;
if (wcsstr(CommandLine, L"/uninstall")) {
CShellDialog::Sync(TRUE);
return TRUE;
Expand Down Expand Up @@ -259,7 +262,7 @@ BOOL CMyApp::InitInstance()
// create main window
//

m_pMainWnd = new CMyFrame(ForceVisible, ForceSync);
m_pMainWnd = new CMyFrame(ForceVisible, ForceSync, PostSetup);
m_pMainWnd->UpdateWindow();

return TRUE;
Expand Down
57 changes: 55 additions & 2 deletions Sandboxie/apps/control/MyFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ BEGIN_MESSAGE_MAP(CMyFrame, CFrameWnd)
ON_COMMAND(ID_HELP_FORUM, OnCmdHelpForum)
ON_COMMAND(ID_HELP_UPDATE, OnCmdHelpUpdate)
ON_COMMAND(ID_HELP_UPGRADE, OnCmdHelpUpgrade)
ON_COMMAND(ID_HELP_WHATSNEW, OnCmdHelpWhatsNew)
ON_COMMAND(ID_HELP_MIGRATION, OnCmdHelpMigrate)
ON_COMMAND(ID_HELP_GET_CERT, OnCmdHelpGetCert)
ON_COMMAND(ID_HELP_SET_CERT, OnCmdHelpSetCert)
Expand Down Expand Up @@ -196,14 +197,15 @@ IMPLEMENT_MENUXP(CMyFrame, CFrameWnd)
//---------------------------------------------------------------------------


CMyFrame::CMyFrame(BOOL ForceVisible, BOOL ForceSync)
CMyFrame::CMyFrame(BOOL ForceVisible, BOOL ForceSync, BOOL PostSetup)
{
m_mondlg = NULL;
m_msgdlg = NULL;
m_finder = NULL;
m_view = m_view_old = 0;
m_hidden = FALSE;

m_ShowWhatsNew = PostSetup;
//CUserSettings::GetInstance().GetBool(_ShowWelcome, m_ShowWelcome, TRUE);
CUserSettings::GetInstance().GetBool(_AlwaysOnTop, m_AlwaysOnTop, FALSE);

Expand Down Expand Up @@ -998,6 +1000,7 @@ void CMyFrame::OnCmdHelpSupport()
CRunBrowser x(this, L"https://sandboxie-plus.com/go.php?to=donate");
}


//---------------------------------------------------------------------------
// OnCmdHelpContribution
//---------------------------------------------------------------------------
Expand All @@ -1008,6 +1011,7 @@ void CMyFrame::OnCmdHelpContribution()
CRunBrowser x(this, L"https://sandboxie-plus.com/go.php?to=sbie-contribute");
}


//---------------------------------------------------------------------------
// OnCmdHelpTopics
//---------------------------------------------------------------------------
Expand All @@ -1018,6 +1022,7 @@ void CMyFrame::OnCmdHelpTopics()
CRunBrowser::OpenHelp(this, L"HelpTopics");
}


//---------------------------------------------------------------------------
// OnCmdHelpTutorial
//---------------------------------------------------------------------------
Expand All @@ -1039,7 +1044,7 @@ void CMyFrame::OnCmdHelpTutorial()

void CMyFrame::OnCmdHelpForum()
{
CRunBrowser::OpenForum(this);
CRunBrowser x(this, L"https://sandboxie-plus.com/go.php?to=sbie-forum");
}

//---------------------------------------------------------------------------
Expand All @@ -1063,6 +1068,33 @@ void CMyFrame::OnCmdHelpUpgrade()
CRunBrowser x(this, L"https://sandboxie-plus.com/go.php?to=sbie-plus&tip=upgrade");
}


//---------------------------------------------------------------------------
// OnCmdHelpWhatsNew
//---------------------------------------------------------------------------

extern "C" void OpenWebView(const WCHAR * url, const WCHAR * title);

void CMyFrame::OnCmdHelpWhatsNew()
{
CString url;
url.Format(L"https://sandboxie-plus.com/go.php?to=sbie-whatsnew&language=%d&version=%S", SbieDll_GetLanguage(NULL), MY_VERSION_STRING);

WCHAR path[MAX_PATH];
GetModuleFileName(NULL, path, sizeof(path) / sizeof(WCHAR) - 4);
WCHAR* ptr = wcsrchr(path, L'\\');
if (ptr) ptr[1] = L'\0';
CString file = CString(path) + L"whatsnew.html";
if (PathFileExists(file)) {
file.Replace(L"\\", L"/");
url = L"file:///" + file;
}

CMyMsg text(MSG_3469);
OpenWebView(url, text);
}


//---------------------------------------------------------------------------
// OnCmdHelpMigrate
//---------------------------------------------------------------------------
Expand All @@ -1073,6 +1105,15 @@ void CMyFrame::OnCmdHelpMigrate()
{
CString url;
url.Format(L"https://sandboxie-plus.com/go.php?to=sbie-migration&language=%d", SbieDll_GetLanguage(NULL));

/*WCHAR path[MAX_PATH];
GetModuleFileName(NULL, path, sizeof(path) / sizeof(WCHAR) - 4);
WCHAR* ptr = wcsrchr(path, L'\\');
if (ptr) ptr[1] = L'\0';
CString url = L"file:///" + CString(path);
url.Replace(L"\\", L"/");
url.Append(L"static/plus-migration.html");*/

CMyMsg text(MSG_3468);
OpenWebView(url, text);
}
Expand Down Expand Up @@ -2105,6 +2146,18 @@ void CMyFrame::OnTimer(UINT_PTR nIDEvent)
return;
}*/

//
// show whats new
//

if (m_ShowWhatsNew && (! inModalState)) {

m_ShowWhatsNew = FALSE;

OnCmdHelpWhatsNew();
return;
}

//
// resync shortcuts? usually Sandboxie Control does not resync
// the Run Sandboxed shortcuts on startup, except when the
Expand Down
4 changes: 3 additions & 1 deletion Sandboxie/apps/control/MyFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class CMyFrame : public CFrameWnd
CPoint m_TrayPoint;

BOOL m_hidden;
BOOL m_ShowWhatsNew;
//BOOL m_ShowWelcome;
BOOL m_ReSyncShortcuts;
BOOL m_AutoRunSoftCompat;
Expand Down Expand Up @@ -126,6 +127,7 @@ class CMyFrame : public CFrameWnd
afx_msg void OnCmdHelpForum();
afx_msg void OnCmdHelpUpdate();
afx_msg void OnCmdHelpUpgrade();
afx_msg void OnCmdHelpWhatsNew();
afx_msg void OnCmdHelpMigrate();
afx_msg void OnCmdHelpGetCert();
afx_msg void OnCmdHelpSetCert();
Expand Down Expand Up @@ -161,7 +163,7 @@ class CMyFrame : public CFrameWnd

public:

CMyFrame(BOOL ForceVisible, BOOL ForceSync);
CMyFrame(BOOL ForceVisible, BOOL ForceSync, BOOL PostSetup);
~CMyFrame();

static CWnd *m_GettingStartedWindow;
Expand Down
3 changes: 2 additions & 1 deletion Sandboxie/apps/control/SbieControl.rc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ BEGIN
MENUITEM SEPARATOR
MENUITEM "3452", ID_HELP_TOPICS
MENUITEM "3453", ID_HELP_TUTORIAL
MENUITEM "3468", ID_HELP_MIGRATION
MENUITEM "3469", ID_HELP_WHATSNEW
//MENUITEM "3468", ID_HELP_MIGRATION
MENUITEM "3457", ID_HELP_FORUM
MENUITEM SEPARATOR
MENUITEM "3454", ID_HELP_UPDATE
Expand Down
57 changes: 54 additions & 3 deletions Sandboxie/apps/control/Updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
#include "common/my_version.h"
#include "common/json/JSON.h"
#include "common/win32_ntddk.h"
#include "core/drv/api_defs.h"

#define UPDATE_INTERVAL (7 * 24 * 60 * 60)

//---------------------------------------------------------------------------
// Variables
Expand Down Expand Up @@ -269,10 +271,59 @@ BOOLEAN CUpdater::QueryUpdateData(UPDATER_DATA* Context)
#endif
StrLang, Context->Manual ? L"0" : L"1");

if (!Context->Manual)
Path.AppendFormat(L"&interval=%d", UPDATE_INTERVAL);

CString update_key;
CSbieIni::GetInstance().GetText(_GlobalSettings, L"UpdateKey", update_key);
//CSbieIni::GetInstance().GetText(_GlobalSettings, L"UpdateKey", update_key);

WCHAR CertPath[MAX_PATH];
SbieApi_GetHomePath(NULL, 0, CertPath, MAX_PATH);
wcscat(CertPath, L"\\Certificate.dat");
HANDLE hFile = CreateFile(CertPath, FILE_GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE) {
char CertData[0x1000];
DWORD bytesRead = 0;
if (ReadFile(hFile, CertData, sizeof(CertData), &bytesRead, NULL)) {
CertData[bytesRead] = 0;

CString sCertData = CString(CertData);
int pos = sCertData.Find(L"UPDATEKEY:");
if (pos != -1) {
pos += 10;
int end = sCertData.Find(L"\n", pos);
if (end == -1) end = sCertData.GetLength();
update_key = sCertData.Mid(pos, end - pos).Trim();
}
}
CloseHandle(hFile);
}

if (!update_key.IsEmpty())
Path += L"&update_key=" + update_key;
update_key += "-";

QWORD RandID = 0;
SbieApi_Call(API_GET_SECURE_PARAM, 3, L"RandID", (ULONG_PTR)&RandID, sizeof(RandID));
if (RandID == 0) {
srand(GetTickCount());
RandID = QWORD(rand() & 0xFFFF) | (QWORD(rand() & 0xFFFF) << 16) | (QWORD(rand() & 0xFFFF) << 32) | (QWORD(rand() & 0xFFFF) << 48);
SbieApi_Call(API_SET_SECURE_PARAM, 3, L"RandID", (ULONG_PTR)&RandID, sizeof(RandID));
}

CString Section;
CString UserName;
BOOL IsAdmin;
CSbieIni::GetInstance().GetUser(Section, UserName, IsAdmin);
DWORD Hash = wcstoul(Section.Mid(13), NULL, 16);

QWORD HashID = RandID ^ (QWORD((Hash & 0xFFFF) ^ ((Hash >> 16) & 0xFFFF)) << 48); // fold the hash in half and xor it with the first 16 bit of RandID

wchar_t sHash[17];
wsprintf(sHash, L"%08X%08X", DWORD(HashID >> 32), DWORD(HashID));

update_key += sHash;

Path += L"&update_key=" + update_key;

if (!DownloadUpdateData(L"sandboxie-plus.com", Path, &jsonString, NULL)) {
Context->ErrorCode = GetLastError();
Expand Down Expand Up @@ -507,7 +558,7 @@ ULONG CUpdater::UpdaterServiceThread(void *lpParameter)
__int64 NextUpdateCheck;
CUserSettings::GetInstance().GetNum64(_NextUpdateCheck, NextUpdateCheck, 0);
if (NextUpdateCheck != -1)
CUserSettings::GetInstance().SetNum64(_NextUpdateCheck, time(NULL) + 7 * 24 * 60 * 60);
CUserSettings::GetInstance().SetNum64(_NextUpdateCheck, time(NULL) + UPDATE_INTERVAL);

if (pContext->Manual)
CMyApp::MsgBox(NULL, MSG_3629, MB_OK);
Expand Down
1 change: 1 addition & 0 deletions Sandboxie/apps/control/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#define ID_HELP_UPDATE 40044
#define ID_HELP_UPGRADE 40046
#define ID_HELP_MIGRATION 40047
#define ID_HELP_WHATSNEW 40049
#define ID_HELP_CONTRIBUTION 40048
#define ID_HELP_GET_CERT 40054
#define ID_HELP_SET_CERT 40055
Expand Down
4 changes: 4 additions & 0 deletions Sandboxie/apps/start/start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ BOOL Parse_Command_Line(void)
if (_wcsnicmp(cmd, L"open_agent:", 11) == 0) {
cmd += 11;
tmp = Eat_String(cmd);
if (*cmd == L'\"') {
cmd++;
tmp--;
}
ULONG len = ULONG(tmp - cmd) * sizeof(WCHAR);
memcpy((WCHAR*)&buffer[req.length], cmd, len);
req.length += len;
Expand Down
Loading

0 comments on commit 417673e

Please sign in to comment.