diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e7d6315..e19d08c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,16 @@ This project adheres to [Semantic Versioning](http://semver.org/). -## [1.3.0 / 5.58.0] - 2022-07-? +## [1.2.7 / 5.57.7] - 2022-07-?? ### Changed +- SandboxieLogon is now disabled by default as it was not compatible with 3rd party antimalware tools [#2025](https://github.com/sandboxie-plus/Sandboxie/issues/2025) - the access view list now adds in display the tailing * to file and key paths the same way the driver does [2039](https://github.com/sandboxie-plus/Sandboxie/issues/2039) +- setup of shell integration is now done by sandman, no longer by the installer +- uninstaler can now remove the sandbox folders [#1235](https://github.com/sandboxie-plus/Sandboxie/pull/1235) + + + ## [1.2.6 / 5.57.6] - 2022-07-25 diff --git a/Installer/Sandboxie-Plus.iss b/Installer/Sandboxie-Plus.iss index 7833aede..0e1424a9 100644 --- a/Installer/Sandboxie-Plus.iss +++ b/Installer/Sandboxie-Plus.iss @@ -42,16 +42,16 @@ PrivilegesRequiredOverridesAllowed=commandline [Tasks] Name: "DesktopIcon"; Description: "{cm:CreateDesktopIcon}"; MinVersion: 0.0,5.0; Check: not IsPortable -Name: "DesktopIcon2"; Description: "{cm:AddSandboxedBrowser}"; MinVersion: 0.0,5.0; Check: not IsPortable -Name: "AutoStartEntry"; Description: "{cm:AutoStartProgram,{#MyAppName}}"; MinVersion: 0.0,5.0; Check: not IsPortable -Name: "AddRunSandboxed"; Description: "{cm:AddSandboxedMenu}"; MinVersion: 0.0,5.0; Check: not IsPortable +;Name: "DesktopIcon2"; Description: "{cm:AddSandboxedBrowser}"; MinVersion: 0.0,5.0; Check: not IsPortable +;Name: "AutoStartEntry"; Description: "{cm:AutoStartProgram,{#MyAppName}}"; MinVersion: 0.0,5.0; Check: not IsPortable +;Name: "AddRunSandboxed"; Description: "{cm:AddSandboxedMenu}"; MinVersion: 0.0,5.0; Check: not IsPortable [Files] ; Both portable and install. Source: ".\Release\{#MyAppSrc}\*"; DestDir: "{app}"; MinVersion: 0.0,5.0; Flags: recursesubdirs ignoreversion; Excludes: "*.pdb" ; include the driver pdb -;Source: ".\Release\{#MyAppSrc}\SbieDrv.pdb"; DestDir: "{app}"; MinVersion: 0.0,5.0; Flags: ignoreversion +Source: ".\Release\{#MyAppSrc}\SbieDrv.pdb"; DestDir: "{app}"; MinVersion: 0.0,5.0; Flags: ignoreversion ; Only if portable. Source: ".\Sandboxie.ini"; DestDir: "{app}"; Flags: ignoreversion onlyifdoesntexist; Check: IsPortable @@ -66,7 +66,7 @@ Name: "{group}\{cm:SandboxieStartMenu1}"; Filename: "{app}\Start.exe"; Parameter Name: "{group}\{cm:SandboxieStartMenu2}"; Filename: "{app}\Start.exe"; Parameters: "default_browser"; MinVersion: 0.0,5.0 Name: "{group}\{cm:SandboxieStartMenu3}"; Filename: "{app}\Start.exe"; Parameters: "/box:__ask__ start_menu"; MinVersion: 0.0,5.0 Name: "{userdesktop}\Sandboxie-Plus"; Filename: "{app}\SandMan.exe"; Tasks: DesktopIcon; MinVersion: 0.0,5.0 -Name: "{userdesktop}\{cm:SandboxedBrowser}"; Filename: "{app}\Start.exe"; Parameters: "default_browser"; Tasks: DesktopIcon2; MinVersion: 0.0,5.0 +;Name: "{userdesktop}\{cm:SandboxedBrowser}"; Filename: "{app}\Start.exe"; Parameters: "default_browser"; Tasks: DesktopIcon2; MinVersion: 0.0,5.0 [INI] @@ -81,23 +81,25 @@ Type: files; Name: "{app}\translations\sandman_zh-CN.qm" Type: files; Name: "{app}\translations\sandman_zh-TW.qm" Type: files; Name: "{app}\translations\sandman_pt.qm" Type: files; Name: "{app}\translations\sandman_ua.qm" +Type: files; Name: "{app}\SbieDrv.sys.w10" +Type: files; Name: "{app}\SbieDrv.sys.rc4" [Registry] ; Autostart Sandman. -Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueName: "SandboxiePlus_AutoRun"; ValueType: string; ValueData: """{app}\SandMan.exe"" -autorun"; Flags: uninsdeletevalue; Tasks: AutoStartEntry +;Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueName: "SandboxiePlus_AutoRun"; ValueType: string; ValueData: """{app}\SandMan.exe"" -autorun"; Flags: uninsdeletevalue; Tasks: AutoStartEntry ; AddRunSandboxed all files. -Root: HKCU; Subkey: "Software\Classes\*\shell"; Flags: uninsdeletekeyifempty; Tasks: AddRunSandboxed -Root: HKCU; Subkey: "Software\Classes\*\shell\sandbox"; ValueName: ""; ValueType: string; ValueData: "{cm:RunSandboxedMenu}"; Flags: uninsdeletekey; Tasks: AddRunSandboxed -Root: HKCU; Subkey: "Software\Classes\*\shell\sandbox"; ValueName: "Icon"; ValueType: string; ValueData: """{app}\start.exe"""; Tasks: AddRunSandboxed -Root: HKCU; Subkey: "Software\Classes\*\shell\sandbox\command"; ValueName: ""; ValueType: string; ValueData: """{app}\SandMan.exe"" /box:__ask__ ""%1"" %*"; Tasks: AddRunSandboxed +;Root: HKCU; Subkey: "Software\Classes\*\shell"; Flags: uninsdeletekeyifempty; Tasks: AddRunSandboxed +;Root: HKCU; Subkey: "Software\Classes\*\shell\sandbox"; ValueName: ""; ValueType: string; ValueData: "{cm:RunSandboxedMenu}"; Flags: uninsdeletekey; Tasks: AddRunSandboxed +;Root: HKCU; Subkey: "Software\Classes\*\shell\sandbox"; ValueName: "Icon"; ValueType: string; ValueData: """{app}\start.exe"""; Tasks: AddRunSandboxed +;Root: HKCU; Subkey: "Software\Classes\*\shell\sandbox\command"; ValueName: ""; ValueType: string; ValueData: """{app}\SandMan.exe"" /box:__ask__ ""%1"" %*"; Tasks: AddRunSandboxed ; AddRunSandboxed folder. -Root: HKCU; Subkey: "Software\Classes\Folder\shell"; Flags: uninsdeletekeyifempty; Tasks: AddRunSandboxed -Root: HKCU; Subkey: "Software\Classes\Folder\shell\sandbox"; ValueName: ""; ValueType: string; ValueData: "{cm:RunSandboxedMenu}"; Flags: uninsdeletekey; Tasks: AddRunSandboxed -Root: HKCU; Subkey: "Software\Classes\Folder\shell\sandbox"; ValueName: "Icon"; ValueType: string; ValueData: """{app}\start.exe"""; Tasks: AddRunSandboxed -Root: HKCU; Subkey: "Software\Classes\Folder\shell\sandbox\command"; ValueName: ""; ValueType: string; ValueData: """{app}\SandMan.exe"" /box:__ask__ ""%1"" %*"; Tasks: AddRunSandboxed +;Root: HKCU; Subkey: "Software\Classes\Folder\shell"; Flags: uninsdeletekeyifempty; Tasks: AddRunSandboxed +;Root: HKCU; Subkey: "Software\Classes\Folder\shell\sandbox"; ValueName: ""; ValueType: string; ValueData: "{cm:RunSandboxedMenu}"; Flags: uninsdeletekey; Tasks: AddRunSandboxed +;Root: HKCU; Subkey: "Software\Classes\Folder\shell\sandbox"; ValueName: "Icon"; ValueType: string; ValueData: """{app}\start.exe"""; Tasks: AddRunSandboxed +;Root: HKCU; Subkey: "Software\Classes\Folder\shell\sandbox\command"; ValueName: ""; ValueType: string; ValueData: """{app}\SandMan.exe"" /box:__ask__ ""%1"" %*"; Tasks: AddRunSandboxed ; External manifest for Sbie service. Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Services\SbieSvc"; ValueName: "PreferExternalManifest"; ValueType: dword; ValueData: "1"; Check: not IsPortable @@ -122,8 +124,6 @@ Filename: "{app}\SandMan.exe"; StatusMsg: "Launch SandMan UI..."; Flags: postins [UninstallDelete] -Type: files; Name: "{app}\SbieDrv.sys.w10" -Type: files; Name: "{app}\SbieDrv.sys.rc4" Type: dirifempty; Name: "{app}" Type: dirifempty; Name: "{localappdata}\{#MyAppName}" @@ -465,8 +465,8 @@ begin exit; // Require Sandman.exe to continue. - if not FileExists(ExpandConstant('{app}\Sandman.exe')) then - exit; + //if not FileExists(ExpandConstant('{app}\Sandman.exe')) then + // exit; // Make a list. Paths := TStringList.Create; @@ -513,14 +513,14 @@ begin IDNO: TaskRet := 2; end; - if TaskRet > 1 then begin - Log('Debug: Taskkill /IM Sandman.exe /F'); - Exec(ExpandConstant('{sys}\taskkill.exe'), '/IM Sandman.exe /F', '', SW_HIDE, ewWaitUntilTerminated, ExecRet); + if TaskRet > 2 then begin + Log('Debug: Start terminate_all'); + Exec(ExpandConstant('{app}\start.exe'), 'terminate_all', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ExecRet); end; if TaskRet > 2 then begin - Log('Debug: Sandman /RemoveSandboxes'); - Exec(ExpandConstant('{app}\Sandman.exe'), '/RemoveSandboxes', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ExecRet); + Log('Debug: Start delete_all_sandboxes'); + Exec(ExpandConstant('{app}\start.exe'), 'delete_all_sandboxes', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ExecRet); end; if TaskRet > 1 then begin @@ -536,6 +536,20 @@ begin Paths.Free; end; +procedure ShellUninstall(); +var + ExecRet: Integer; +begin + + if FileExists(ExpandConstant('{app}\Sandman.exe')) then begin + Log('Debug: SandMan /ShellUninstall'); + Exec(ExpandConstant('{app}\Sandman.exe'), '/ShellUninstall', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ExecRet); + end else begin + Log('Debug: SbieCtrl /uninstall'); + Exec(ExpandConstant('{app}\sbiectrl.exe'), '/uninstall', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ExecRet); + end; +end; + ////////////////////////////////////////////////////// // Uninstallation Events @@ -551,7 +565,7 @@ begin // User to confirm extra files to remove. if not UninstallSilent then - UninstallCleanup(2); + UninstallCleanup(3); // Shutdown service, driver and processes. if (ShutdownSbie() = False) then @@ -559,4 +573,8 @@ begin Abort(); exit; end; + + // remove shell integration. + ShellUninstall(); + end; diff --git a/Sandboxie/apps/control/DeleteDialog.cpp b/Sandboxie/apps/control/DeleteDialog.cpp index 9c85e3ad..334dfe73 100644 --- a/Sandboxie/apps/control/DeleteDialog.cpp +++ b/Sandboxie/apps/control/DeleteDialog.cpp @@ -429,7 +429,7 @@ void CDeleteDialog::OnOK() WCHAR cmd[64]; wcscpy(cmd, L"delete_sandbox"); //if (m_AutoDelete) - //wcscat(cmd, L"_silent"); + // wcscat(cmd, L"_silent"); CMyApp::RunStartExe(cmd, BoxName, TRUE); box.GetBoxFile().RebuildSkeletonTree(); diff --git a/Sandboxie/apps/control/MyApp.cpp b/Sandboxie/apps/control/MyApp.cpp index 37b54ea1..e7484246 100644 --- a/Sandboxie/apps/control/MyApp.cpp +++ b/Sandboxie/apps/control/MyApp.cpp @@ -89,6 +89,10 @@ BOOL CMyApp::InitInstance() ForceVisible = TRUE; if (wcsstr(CommandLine, L"/sync")) ForceSync = TRUE; + if (wcsstr(CommandLine, L"/uninstall")) { + CShellDialog::Sync(TRUE); + return TRUE; + } } // diff --git a/Sandboxie/apps/control/ShellDialog.cpp b/Sandboxie/apps/control/ShellDialog.cpp index d66a15b7..cd45dd78 100644 --- a/Sandboxie/apps/control/ShellDialog.cpp +++ b/Sandboxie/apps/control/ShellDialog.cpp @@ -275,7 +275,7 @@ void CShellDialog::OnCloseOrCancel() //--------------------------------------------------------------------------- -void CShellDialog::Sync() +void CShellDialog::Sync(BOOL bUninstall) { // // initialize Shell exports (Visual C++ 6.0) @@ -295,11 +295,11 @@ void CShellDialog::Sync() // sync // - SyncRunLogon(); - SyncBrowserIcon(_AddDesktopIcon, CSIDL_DESKTOPDIRECTORY, CString()); - SyncBrowserIcon(_AddQuickLaunchIcon, CSIDL_APPDATA, _QuickLaunch); - SyncContextMenu(); - SyncSendToMenu(); + SyncRunLogon(bUninstall); + SyncBrowserIcon(_AddDesktopIcon, CSIDL_DESKTOPDIRECTORY, CString(), bUninstall); + SyncBrowserIcon(_AddQuickLaunchIcon, CSIDL_APPDATA, _QuickLaunch, bUninstall); + SyncContextMenu(bUninstall); + SyncSendToMenu(bUninstall); } @@ -308,7 +308,7 @@ void CShellDialog::Sync() //--------------------------------------------------------------------------- -void CShellDialog::SyncRunLogon() +void CShellDialog::SyncRunLogon(BOOL bUninstall) { static const WCHAR *_RunKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; @@ -318,8 +318,9 @@ void CShellDialog::SyncRunLogon() // query ini setting and actual registry information // - BOOL ini; - CUserSettings::GetInstance().GetBool(_EnableLogonStart, ini, TRUE); + BOOL ini = FALSE; + if(!bUninstall) + CUserSettings::GetInstance().GetBool(_EnableLogonStart, ini, TRUE); HKEY hkey; LONG rc = RegOpenKeyEx(HKEY_CURRENT_USER, _RunKey, 0, KEY_READ, &hkey); @@ -377,7 +378,7 @@ void CShellDialog::SyncRunLogon() //--------------------------------------------------------------------------- -void CShellDialog::SyncContextMenu() +void CShellDialog::SyncContextMenu(BOOL bUninstall) { static const WCHAR *_star = L"*"; static const WCHAR *_folder = L"Folder"; @@ -386,8 +387,9 @@ void CShellDialog::SyncContextMenu() // query ini setting and actual registry information // - BOOL ini; - CUserSettings::GetInstance().GetBool(_AddContextMenu, ini, TRUE); + BOOL ini = FALSE; + if(!bUninstall) + CUserSettings::GetInstance().GetBool(_AddContextMenu, ini, TRUE); BOOL reg = FALSE; ULONG type; @@ -718,14 +720,15 @@ void CShellDialog::DeleteAssoc(WCHAR *path, const WCHAR *classname) void CShellDialog::SyncBrowserIcon( - const CString &setting, int nFolder, const CString &subdir) + const CString &setting, int nFolder, const CString &subdir, BOOL bUninstall) { // // query ini setting and actual filesystem information // - BOOL ini; - CUserSettings::GetInstance().GetBool(setting, ini, TRUE); + BOOL ini = FALSE; + if(!bUninstall) + CUserSettings::GetInstance().GetBool(setting, ini, TRUE); WCHAR path[512]; HRESULT hr = SHGetFolderPathW( @@ -774,15 +777,16 @@ void CShellDialog::SyncBrowserIcon( //--------------------------------------------------------------------------- -void CShellDialog::SyncSendToMenu() +void CShellDialog::SyncSendToMenu(BOOL bUninstall) { if (CMyApp::m_WindowsVista) { SyncSendToMenuVista(); return; } - BOOL ini; - CUserSettings::GetInstance().GetBool(_AddSendToMenu, ini, TRUE); + BOOL ini = FALSE; + if(!bUninstall) + CUserSettings::GetInstance().GetBool(_AddSendToMenu, ini, TRUE); WCHAR path[512]; HRESULT hr = SHGetFolderPathW( diff --git a/Sandboxie/apps/control/ShellDialog.h b/Sandboxie/apps/control/ShellDialog.h index 874a8794..3751158f 100644 --- a/Sandboxie/apps/control/ShellDialog.h +++ b/Sandboxie/apps/control/ShellDialog.h @@ -38,14 +38,14 @@ class CShellDialog : public CBaseDialog afx_msg void OnCloseOrCancel(); - static void SyncRunLogon(); + static void SyncRunLogon(BOOL bUninstall = FALSE); static void SyncSendToMenuVista(); static void CreateAssoc(WCHAR *path, const WCHAR *classname); static void DeleteAssoc(WCHAR *path, const WCHAR *classname); static void SyncBrowserIcon( - const CString &setting, int nFolder, const CString &subdir); + const CString &setting, int nFolder, const CString &subdir, BOOL bUninstall = FALSE); static BOOL GetStartMenuShortcut( CString &BoxName, CString &LinkPath, @@ -68,9 +68,9 @@ public: CShellDialog(CWnd *pParentWnd); ~CShellDialog(); - static void Sync(); - static void SyncContextMenu(); - static void SyncSendToMenu(); + static void Sync(BOOL bUninstall = FALSE); + static void SyncContextMenu(BOOL bUninstall = FALSE); + static void SyncSendToMenu(BOOL bUninstall = FALSE); static void CreateShortcut(CString BoxName, CString LinkPath); diff --git a/Sandboxie/apps/start/delete.cpp b/Sandboxie/apps/start/delete.cpp index 5cf6cc70..5096a24d 100644 --- a/Sandboxie/apps/start/delete.cpp +++ b/Sandboxie/apps/start/delete.cpp @@ -27,6 +27,15 @@ #include "core/dll/sbiedll.h" #include "msgs/msgs.h" #include "common/my_version.h" +#include "core/svc/SbieIniWire.h" +#include +#include +#include "resource.h" +#include "apps/common/CommonUtils.h" +#define INITGUID +#include +#include +#include "apps/common/MyGdi.h" //--------------------------------------------------------------------------- @@ -61,6 +70,198 @@ static bool g_Logoff; static bool g_Silent; static HANDLE g_event_handle = NULL; +static HICON hProgramIcon; +static HBITMAP hLogoBitmap; +static BOOL initialized = FALSE; +extern BOOLEAN layout_rtl; +static HWND status_wnd = NULL; +static BOOL processing = TRUE; + +//--------------------------------------------------------------------------- +// StatusDialogProc +//--------------------------------------------------------------------------- + + +INT_PTR StatusDialogProc( + HWND hwnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + switch (uMsg) { + + // + // initialize dialog + // + + case WM_INITDIALOG: + { + RECT rc; + + status_wnd = hwnd; + + // + // position window in the middle of the screen + // + + GetClientRect(GetDesktopWindow(), &rc); + int x = (rc.left + rc.right) / 3; + int y = (rc.top + rc.bottom) / 3; + GetClientRect(hwnd, &rc); + x -= rc.right / 2; + y -= rc.bottom / 2; + SetWindowPos(hwnd, HWND_TOP, x, y, 0, 0, SWP_NOSIZE); + + // + // set window title + // + + SetWindowText(hwnd, SbieDll_FormatMessage0(MSG_3315)); + + // + // set info text + // + + //WCHAR* info = (WCHAR *)HeapAlloc(GetProcessHeap(), 0, 2048); + + + //SetDlgItemText(hwnd, ID_STATUS_INFO, info); + //HeapFree(GetProcessHeap(), 0, info); + + // + // end dialog initialization + // + + SetForegroundWindow(hwnd); // explicitly go to foreground + + return FALSE; // don't set focus, we already did + } + + // + // handle buttons + // + + case WM_COMMAND: + + if (LOWORD(wParam) == IDCANCEL) { + + int rc = MessageBox(hwnd, + SbieDll_FormatMessage0(MSG_3316), + SbieDll_FormatMessage0(MSG_3315), + MB_ICONQUESTION | MB_YESNO | + (layout_rtl ? MB_RTLREADING | MB_RIGHT : 0)); + + if (rc == IDYES) + processing = 0; + + } + + break; + } + + return FALSE; +} + + +//--------------------------------------------------------------------------- +// DoStatusDialog +//--------------------------------------------------------------------------- + + +_FX ULONG DoStatusDialog(void *arg) +{ + HINSTANCE hInstance = GetModuleHandle(NULL); + INITCOMMONCONTROLSEX icc; + INT_PTR r; + + if (! initialized) { + + icc.dwSize = sizeof(INITCOMMONCONTROLSEX); + icc.dwICC = ICC_USEREX_CLASSES | ICC_TAB_CLASSES; + InitCommonControlsEx(&icc); + + hProgramIcon = (HICON)LoadImage( + hInstance, MAKEINTRESOURCE(IDICON), IMAGE_ICON, + 0, 0, LR_DEFAULTSIZE); + + MyGdi_Init(); + + hLogoBitmap = MyGdi_CreateFromResource(L"MASTHEADLOGO"); + + initialized = TRUE; + } + + if (layout_rtl) { + + LPCDLGTEMPLATE tmpl = (LPCDLGTEMPLATE)Common_DlgTmplRtl( + hInstance, MAKEINTRESOURCE(STATUS_DIALOG)); + r = DialogBoxIndirectParam(hInstance, tmpl, + NULL, StatusDialogProc, (LPARAM)hInstance); + + } else { + + r = DialogBoxParam(hInstance, MAKEINTRESOURCE(STATUS_DIALOG), + NULL, StatusDialogProc, (LPARAM)hInstance); + } + + status_wnd = NULL; + + return (r == IDOK); +} + + +//--------------------------------------------------------------------------- +// StartStatusDialog +//--------------------------------------------------------------------------- + + +void StartStatusDialog() +{ + CreateThread(NULL, 0, DoStatusDialog, 0, 0, NULL); + + for(int i=0; i < 100 && !status_wnd; i++) + Sleep(100); +} + + +//--------------------------------------------------------------------------- +// StopStatusDialog +//--------------------------------------------------------------------------- + + +void StopStatusDialog() +{ + if (status_wnd) + EndDialog(status_wnd, IDOK); +} + + +//--------------------------------------------------------------------------- +// SetStatusInfo +//--------------------------------------------------------------------------- + + +void SetStatusInfo(const WCHAR* info) +{ + if(status_wnd) + SetDlgItemText(status_wnd, ID_STATUS_INFO, info); +} + + +//--------------------------------------------------------------------------- +// SetStatusMsg +//--------------------------------------------------------------------------- + + +void SetStatusMsg(ULONG msg, const WCHAR* info) +{ + if(status_wnd) { + WCHAR* str = SbieDll_FormatMessage1(msg, info); + SetDlgItemText(status_wnd, ID_STATUS_INFO, str); + LocalFree(str); + } +} + //--------------------------------------------------------------------------- // Error @@ -283,7 +484,7 @@ void LaunchProgram(WCHAR *cmdSrc, bool bWait) ZeroMemory(&si, sizeof(STARTUPINFO)); si.cb = sizeof(STARTUPINFO); si.dwFlags = STARTF_FORCEOFFFEEDBACK | STARTF_USESHOWWINDOW; - si.wShowWindow = SW_HIDE; + si.wShowWindow = bWait ? SW_HIDE : SW_SHOWNORMAL; ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); BOOL ok = CreateProcess( @@ -337,6 +538,9 @@ NOINLINE void LaunchPhase2(void) NOINLINE void DeleteFiles(void) { + //if(!g_Silent) + // StartStatusDialog(); + WCHAR boxname[48]; int index = -1; while (1) { @@ -346,6 +550,9 @@ NOINLINE void DeleteFiles(void) g_BoxName = boxname; DeleteFilesInBox(boxname); } + + //if(!g_Silent) + // StopStatusDialog(); } @@ -420,10 +627,12 @@ void DeleteFilesInBox(const WCHAR *boxname) // files, junction points, and paths that are too long // + SetStatusMsg(MSG_3317, BoxFolder); WaitForFolder(BoxFolder, 10); ProcessFiles(BoxFolder); + SetStatusMsg(MSG_3318, BoxFolder); WaitForFolder(BoxFolder, 10); // @@ -763,13 +972,15 @@ mainloop: PATHELEM *elem_next = AllocPathElem(heap, BoxPath, L""); - while (1) { + while (processing) { PATHELEM *elem = elem_next; if (! elem) break; elem_next = elem->next; + SetStatusInfo(elem->path); + WCHAR *search_path = AllocPathElem(heap, elem->path, L"*")->path; WIN32_FIND_DATA data; HANDLE hFind = FindFirstFile(search_path, &data); @@ -777,7 +988,7 @@ mainloop: continue; bool firstTime = true; - while (1) { + while (processing) { if (firstTime) firstTime = false; else { @@ -933,3 +1144,64 @@ ALIGNED WCHAR *GetBoxFilePath(const WCHAR *boxname, ULONG extra) return path; } + + +//--------------------------------------------------------------------------- +// Delete_All_Sandboxes +//--------------------------------------------------------------------------- + + +int Delete_All_Sandboxes() +{ + std::set dirs_to_remove; + + int index = -1; + WCHAR BoxName[34]; + while (1) { + index = SbieApi_EnumBoxes(index, BoxName); + if (index == -1) + break; + WCHAR* buf = GetBoxFilePath(BoxName, 0); + + while(*buf) + { + std::wstring test_path = buf; + size_t pos = test_path.find_last_of(L'\\'); + test_path.erase(pos+1); + test_path.append(L"DONT-USE.TXT"); + + if (PathFileExists(test_path.c_str())) + buf[pos] = L'\0'; + else + break; + } + + dirs_to_remove.insert(buf); + HeapFree(GetProcessHeap(), 0, buf); + } + + StartStatusDialog(); + + for (auto I = dirs_to_remove.begin(); I != dirs_to_remove.end() && processing; ++I) { + + const WCHAR* BoxFolder = I->c_str(); + + SetStatusMsg(MSG_3317, BoxFolder); + WaitForFolder(BoxFolder, 10); + + ProcessFiles(BoxFolder); + + SetStatusMsg(MSG_3318, BoxFolder); + WaitForFolder(BoxFolder, 10); + + WCHAR cmd[1536]; + wcscpy(cmd, L"%SystemRoot%\\System32\\cmd.exe /c rmdir /s /q \""); + wcscat(cmd, BoxFolder); + wcscat(cmd, L"\""); + LaunchProgram(cmd, TRUE); + } + + StopStatusDialog(); + + return processing == 1 ? EXIT_SUCCESS : EXIT_FAILURE; +} \ No newline at end of file diff --git a/Sandboxie/apps/start/resource.h b/Sandboxie/apps/start/resource.h index 74755dc7..b7bae44e 100644 --- a/Sandboxie/apps/start/resource.h +++ b/Sandboxie/apps/start/resource.h @@ -33,6 +33,9 @@ #define IDBOXLIST 1002 #define BOX_DIALOG 10002 +#define STATUS_DIALOG 10004 +#define ID_STATUS_INFO 108 + // Next default values for new objects // #ifdef APSTUDIO_INVOKED diff --git a/Sandboxie/apps/start/resource.rc b/Sandboxie/apps/start/resource.rc index f63f19f5..718831da 100644 --- a/Sandboxie/apps/start/resource.rc +++ b/Sandboxie/apps/start/resource.rc @@ -75,6 +75,13 @@ BEGIN END +STATUS_DIALOG DIALOGEX 0, 0, 230, 50 +STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + CTEXT "",ID_STATUS_INFO,15,5,200,40 +END + ///////////////////////////////////////////////////////////////////////////// // // Version diff --git a/Sandboxie/apps/start/start.cpp b/Sandboxie/apps/start/start.cpp index 34f1cad2..2261e89f 100644 --- a/Sandboxie/apps/start/start.cpp +++ b/Sandboxie/apps/start/start.cpp @@ -49,6 +49,7 @@ void List_Process_Ids(void); int Terminate_All_Processes(BOOL all_boxes); +int Delete_All_Sandboxes(); extern WCHAR *DoRunDialog(HINSTANCE hInstance); extern WCHAR *DoBoxDialog(void); @@ -393,6 +394,7 @@ BOOL Parse_Command_Line(void) static const WCHAR *auto_run = L"auto_run"; static const WCHAR *mount_hive = L"mount_hive"; static const WCHAR *delete_sandbox = L"delete_sandbox"; + static const WCHAR *delete_all_sandboxes = L"delete_all_sandboxes"; static const WCHAR *_logoff = L"_logoff"; static const WCHAR *_silent = L"_silent"; static const WCHAR *_phase = L"_phase"; @@ -852,6 +854,12 @@ BOOL Parse_Command_Line(void) return TRUE; + // if rest is exactly "delete_all_sandboxes", do that processing + + } else if (wcsncmp(cmd, delete_all_sandboxes, wcslen(delete_all_sandboxes)) == 0) { + + return die(Delete_All_Sandboxes()); + // // if rest is exactly "disable_force" or "disable_force_off" // then process accordingly diff --git a/Sandboxie/common/my_version.h b/Sandboxie/common/my_version.h index 5a28173b..6e165203 100644 --- a/Sandboxie/common/my_version.h +++ b/Sandboxie/common/my_version.h @@ -21,8 +21,8 @@ #ifndef _MY_VERSION_H #define _MY_VERSION_H -#define MY_VERSION_BINARY 5,57,6 -#define MY_VERSION_STRING "5.57.6" +#define MY_VERSION_BINARY 5,57,7 +#define MY_VERSION_STRING "5.57.7" #define MY_VERSION_COMPAT "5.57.1" // this refers to the driver ABI compatibility // These #defines are used by either Resource Compiler or NSIS installer diff --git a/Sandboxie/core/svc/DriverAssistSid.cpp b/Sandboxie/core/svc/DriverAssistSid.cpp index 7484a851..c258473b 100644 --- a/Sandboxie/core/svc/DriverAssistSid.cpp +++ b/Sandboxie/core/svc/DriverAssistSid.cpp @@ -108,7 +108,7 @@ UCHAR SandboxieSid[12] = { // S-1-5-100- bool DriverAssist::GetSandboxieSID(const WCHAR* boxname, UCHAR* pSID, DWORD dwSidSize) { - if (!SbieApi_QueryConfBool(boxname, L"SandboxieLogon", TRUE)) + if (!SbieApi_QueryConfBool(boxname, L"SandboxieLogon", FALSE)) return false; WCHAR szUserName[256], szDomainName[256]; diff --git a/Sandboxie/install/SandboxieVS.nsi b/Sandboxie/install/SandboxieVS.nsi index a304be24..8d8acfaf 100644 --- a/Sandboxie/install/SandboxieVS.nsi +++ b/Sandboxie/install/SandboxieVS.nsi @@ -1043,7 +1043,8 @@ WriteLoop: File /oname=${SANDBOXIE}WUAU.exe "${BIN_ROOT}\SandboxieWUAU.exe" File /oname=${START_EXE} "${BIN_ROOT}\Start.exe" - + File /oname=${START_EXE}.sig "${BIN_ROOT}\Start.exe.sig" + File /oname=${SBIECTRL_EXE} "${BIN_ROOT}\SbieCtrl.exe" File /oname=${SBIECTRL_EXE}.sig "${BIN_ROOT}\SbieCtrl.exe.sig" @@ -1155,6 +1156,7 @@ Function DeleteProgramFiles Delete "$INSTDIR\${SANDBOXIE}RpcSs.exe" Delete "$INSTDIR\${START_EXE}" + Delete "$INSTDIR\${START_EXE}.sig" Delete "$INSTDIR\${SBIECTRL_EXE}" Delete "$INSTDIR\${SBIECTRL_EXE}.sig" diff --git a/Sandboxie/msgs/Sbie-English-1033.txt b/Sandboxie/msgs/Sbie-English-1033.txt index c67d720a..beb6c2fd 100644 --- a/Sandboxie/msgs/Sbie-English-1033.txt +++ b/Sandboxie/msgs/Sbie-English-1033.txt @@ -494,7 +494,7 @@ SBIE2224 Sandboxed program has crashed: %2 . 2225;pop;wrn;01 -SBIE2225 An attempt was made to access an EFS file: %2 +SBIE2225 Tried to access an EFS file: %2 . #---------------------------------------------------------------------------- @@ -1029,6 +1029,22 @@ Unknown user, configuration settings will not be saved An error occurred while applying default settings for sandbox '%2' . +3315;txt;01 +Deleting Sandbox contents +. + +3316;txt;01 +Do you want to abort the operation? +. + +3317;txt;01 +Preparing to delete: %2 +. + +3318;txt;01 +Deleting: %2 +. + # 3321;txt;01 # - Logon session is sandboxed # . diff --git a/SandboxiePlus/SandMan/Windows/OptionsAccess.cpp b/SandboxiePlus/SandMan/Windows/OptionsAccess.cpp index 19d81d68..e544b765 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsAccess.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsAccess.cpp @@ -308,7 +308,12 @@ void COptionsWindow::AddAccessEntry(EAccessType Type, EAccessMode Mode, QString pItem->setText(2, GetAccessModeStr(Mode)); pItem->setData(2, Qt::UserRole, (int)Mode); - pItem->setText(3, Path); + QString sPath = Path; + if (Type == eFile || Type == eKey) { + if (sPath.left(1) != "|" && !sPath.contains("*") && sPath.right(1) != "*") + sPath.append("*"); + } + pItem->setText(3, sPath); pItem->setData(3, Qt::UserRole, Path); if(Template.isEmpty()) diff --git a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp index 87d81d0d..1b9b97dc 100644 --- a/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/SettingsWindow.cpp @@ -371,7 +371,7 @@ void CSettingsWindow::LoadSettings() ui.chkWFP->setChecked(theAPI->GetGlobalSettings()->GetBool("NetworkEnableWFP", false)); ui.chkObjCb->setChecked(theAPI->GetGlobalSettings()->GetBool("EnableObjectFiltering", true)); ui.chkWin32k->setChecked(theAPI->GetGlobalSettings()->GetBool("EnableWin32kHooks", true)); - ui.chkSbieLogon->setChecked(theAPI->GetGlobalSettings()->GetBool("SandboxieLogon", true)); + ui.chkSbieLogon->setChecked(theAPI->GetGlobalSettings()->GetBool("SandboxieLogon", false)); ui.chkAdminOnly->setChecked(theAPI->GetGlobalSettings()->GetBool("EditAdminOnly", false)); ui.chkPassRequired->setChecked(!theAPI->GetGlobalSettings()->GetText("EditPassword", "").isEmpty()); @@ -592,7 +592,7 @@ void CSettingsWindow::SaveSettings() WriteAdvancedCheck(ui.chkWFP, "NetworkEnableWFP", "y", ""); WriteAdvancedCheck(ui.chkObjCb, "EnableObjectFiltering", "", "n"); WriteAdvancedCheck(ui.chkWin32k, "EnableWin32kHooks", "", "n"); - WriteAdvancedCheck(ui.chkSbieLogon, "SandboxieLogon", "", "n"); + WriteAdvancedCheck(ui.chkSbieLogon, "SandboxieLogon", "y", ""); if (m_FeaturesChanged) { m_FeaturesChanged = false; diff --git a/SandboxiePlus/version.h b/SandboxiePlus/version.h index 547807c5..2681c256 100644 --- a/SandboxiePlus/version.h +++ b/SandboxiePlus/version.h @@ -2,7 +2,7 @@ #define VERSION_MJR 1 #define VERSION_MIN 2 -#define VERSION_REV 6 +#define VERSION_REV 7 #define VERSION_UPD 0 #ifndef STR