From 61124974bc73a9703f53eb671b44fa819605b1da Mon Sep 17 00:00:00 2001 From: DavidXanatos Date: Thu, 18 Jun 2020 17:44:29 +0200 Subject: [PATCH] Build 0.2.1 / 5.41.1 --- CHANGELOG.md | 23 +++ Sandboxie/apps/start/start.cpp | 6 +- Sandboxie/common/my_version.h | 2 +- Sandboxie/core/dll/debug.h | 2 +- Sandboxie/core/dll/gui.c | 5 + Sandboxie/core/dll/ldr_init.c | 16 ++ Sandboxie/core/dll/proc.c | 3 + Sandboxie/core/dll/scm_create.c | 8 +- Sandboxie/core/drv/conf.c | 4 +- Sandboxie/core/drv/key_flt.c | 1 - Sandboxie/core/drv/process.c | 4 +- Sandboxie/core/drv/syscall_open.c | 4 + Sandboxie/core/drv/thread_token.c | 5 +- Sandboxie/core/drv/token.c | 20 +++ Sandboxie/core/svc/ProcessServer.cpp | 13 ++ Sandboxie/install/SandboxieVS.nsi | 11 +- Sandboxie/install/kmdutil/kmdutil.c | 34 +++++ Sandboxie/install/kmdutil/kmdutil.vcxproj | 7 + Sandboxie/install/kmdutil/rc4.cpp | 49 +++++++ Sandboxie/install/kmdutil/rc4.h | 24 +++ .../install/release/SandboxieInstall.vcxproj | 4 +- Sandboxie/msgs/Sbie-English-1033.txt | Bin 160434 -> 160642 bytes Sandboxie/msgs/Text-German-1031.txt | Bin 163870 -> 164110 bytes SandboxiePlus/MiscHelpers/Common/Common.cpp | 25 +++- SandboxiePlus/MiscHelpers/Common/Common.h | 4 + SandboxiePlus/MiscHelpers/Common/qRC4.cpp | 63 ++++++++ SandboxiePlus/MiscHelpers/Common/qRC4.h | 18 +++ SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj | 2 + .../MiscHelpers/MiscHelpers.vcxproj.filters | 6 + .../QSbieAPI/Sandboxie/BoxedProcess.cpp | 2 +- .../QSbieAPI/Sandboxie/BoxedProcess.h | 5 +- .../QSbieAPI/Sandboxie/IniSection.cpp | 111 +++++++++++++- SandboxiePlus/QSbieAPI/Sandboxie/IniSection.h | 9 +- SandboxiePlus/QSbieAPI/Sandboxie/SandBox.cpp | 17 ++- SandboxiePlus/QSbieAPI/Sandboxie/SandBox.h | 9 +- SandboxiePlus/QSbieAPI/SbieAPI.cpp | 123 ++++------------ SandboxiePlus/QSbieAPI/SbieAPI.h | 13 +- SandboxiePlus/SandMan/Models/SbieModel.cpp | 29 ++-- SandboxiePlus/SandMan/Models/SbieModel.h | 31 +++- .../Resources/Boxes/sandbox-b-empty.png | Bin 0 -> 1157 bytes .../Resources/Boxes/sandbox-b-full.png | Bin 0 -> 1150 bytes .../Resources/Boxes/sandbox-c-empty.png | Bin 0 -> 1203 bytes .../Resources/Boxes/sandbox-c-full.png | Bin 0 -> 1193 bytes .../Resources/Boxes/sandbox-g-empty.png | Bin 0 -> 1175 bytes .../Resources/Boxes/sandbox-g-full.png | Bin 0 -> 1167 bytes .../Resources/Boxes/sandbox-m-empty.png | Bin 0 -> 1208 bytes .../Resources/Boxes/sandbox-m-full.png | Bin 0 -> 1217 bytes .../Resources/Boxes/sandbox-o-empty.png | Bin 0 -> 1187 bytes .../Resources/Boxes/sandbox-o-full.png | Bin 0 -> 1191 bytes .../Resources/Boxes/sandbox-r-empty.png | Bin 0 -> 1138 bytes .../Resources/Boxes/sandbox-r-full.png | Bin 0 -> 1119 bytes .../Resources/Boxes/sandbox-y-empty.png | Bin 0 -> 1367 bytes .../Resources/Boxes/sandbox-y-full.png | Bin 0 -> 1376 bytes SandboxiePlus/SandMan/Resources/SandMan.qrc | 16 ++ SandboxiePlus/SandMan/SandMan.cpp | 31 +++- SandboxiePlus/SandMan/SandMan.h | 12 +- SandboxiePlus/SandMan/SandMan.vcxproj | 2 + SandboxiePlus/SandMan/SandMan.vcxproj.filters | 6 + SandboxiePlus/SandMan/SbiePlusAPI.cpp | 47 ++++++ SandboxiePlus/SandMan/SbiePlusAPI.h | 40 +++++ SandboxiePlus/SandMan/Views/SbieView.cpp | 15 ++ SandboxiePlus/SandMan/Views/SbieView.h | 4 + SandboxiePlus/SandMan/main.cpp | 137 ++++++++++++++++++ SandboxiePlus/SandMan/stdafx.h | 2 +- 64 files changed, 868 insertions(+), 156 deletions(-) create mode 100644 Sandboxie/install/kmdutil/rc4.cpp create mode 100644 Sandboxie/install/kmdutil/rc4.h create mode 100644 SandboxiePlus/MiscHelpers/Common/qRC4.cpp create mode 100644 SandboxiePlus/MiscHelpers/Common/qRC4.h create mode 100644 SandboxiePlus/SandMan/Resources/Boxes/sandbox-b-empty.png create mode 100644 SandboxiePlus/SandMan/Resources/Boxes/sandbox-b-full.png create mode 100644 SandboxiePlus/SandMan/Resources/Boxes/sandbox-c-empty.png create mode 100644 SandboxiePlus/SandMan/Resources/Boxes/sandbox-c-full.png create mode 100644 SandboxiePlus/SandMan/Resources/Boxes/sandbox-g-empty.png create mode 100644 SandboxiePlus/SandMan/Resources/Boxes/sandbox-g-full.png create mode 100644 SandboxiePlus/SandMan/Resources/Boxes/sandbox-m-empty.png create mode 100644 SandboxiePlus/SandMan/Resources/Boxes/sandbox-m-full.png create mode 100644 SandboxiePlus/SandMan/Resources/Boxes/sandbox-o-empty.png create mode 100644 SandboxiePlus/SandMan/Resources/Boxes/sandbox-o-full.png create mode 100644 SandboxiePlus/SandMan/Resources/Boxes/sandbox-r-empty.png create mode 100644 SandboxiePlus/SandMan/Resources/Boxes/sandbox-r-full.png create mode 100644 SandboxiePlus/SandMan/Resources/Boxes/sandbox-y-empty.png create mode 100644 SandboxiePlus/SandMan/Resources/Boxes/sandbox-y-full.png create mode 100644 SandboxiePlus/SandMan/SbiePlusAPI.cpp create mode 100644 SandboxiePlus/SandMan/SbiePlusAPI.h diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c2c97aa..a1238934 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,29 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [0.2.1 / 5.41.1] - 2020-06-18 + +### Added +- added different sandbox icons for different types +-- Red LogAPI/BSA enabled +-- More to come :D +- Added progress window for async operations that take time +- added DPI awareness +- the driver file is now obfuscated to avoid false positives +- additional debug options to sandboxie.ini OpenToken=y that combines UnrestrictedToken=y and UnfilteredToken=y +-- Note: using these options weekens the sandboxing, they are intended for debugging and may be used for better application virtualization later + +### Changed +- SbieDll.dll when processinh InjectDll now looks in the SbieHome folder for the Dll's if the entered path starts with a backslash +-- i.e. "InjectDll=\LogAPI\i386\logapi32v.dll" or "InjectDll64=\LogAPI\amd64\logapi64v.dll" + +### Fixed +- IniWatcher did not work in portable mode +- service path fix broke other services, now properly fixed, may be +- found workaround for the msi installer issue + + + ## [0.2 / 5.41.0] - 2020-06-08 ### Added diff --git a/Sandboxie/apps/start/start.cpp b/Sandboxie/apps/start/start.cpp index 1375d999..e6766124 100644 --- a/Sandboxie/apps/start/start.cpp +++ b/Sandboxie/apps/start/start.cpp @@ -925,7 +925,11 @@ int Program_Start(void) expanded = MyHeapAlloc(8192 * sizeof(WCHAR)); ExpandEnvironmentStrings(cmdline, expanded, 8192); - if (wcsstr(expanded, L" ") && !wcsstr(expanded, L"\"")) + // + // If the comman contains a space but no ", try to fix it + // + + if (wcsstr(expanded, L" ") && !wcsstr(expanded, L"\"") && _waccess(expanded, 0) != -1) { wmemmove(expanded + 1, expanded, wcslen(expanded) + 1); expanded[0] = L'\"'; diff --git a/Sandboxie/common/my_version.h b/Sandboxie/common/my_version.h index 5c63de2c..690c2607 100644 --- a/Sandboxie/common/my_version.h +++ b/Sandboxie/common/my_version.h @@ -22,7 +22,7 @@ #define MY_VERSION_BINARY 5,41 #define MY_VERSION_STRING "5.41" -#define MY_VERSION_STRING_EX "5.41.0" +#define MY_VERSION_STRING_EX "5.41.1" // These #defines are used by either Resource Compiler, or by NSIC installer #define SBIE_INSTALLER_PATH "..\\Bin\\" diff --git a/Sandboxie/core/dll/debug.h b/Sandboxie/core/dll/debug.h index 2f34f52b..b8e6872c 100644 --- a/Sandboxie/core/dll/debug.h +++ b/Sandboxie/core/dll/debug.h @@ -37,7 +37,7 @@ #ifdef WITH_DEBUG //#define BREAK_IMAGE_1 L"java.exe" // L"jp2launcher.exe" -#define BREAK_IMAGE_1 L"TestTarget.exe" // L"jp2launcher.exe" +#define BREAK_IMAGE_1 L"TestTarget.exe" int Debug_Init(void); diff --git a/Sandboxie/core/dll/gui.c b/Sandboxie/core/dll/gui.c index c26759cc..bf20269d 100644 --- a/Sandboxie/core/dll/gui.c +++ b/Sandboxie/core/dll/gui.c @@ -952,6 +952,11 @@ _FX BOOLEAN Gui_ConnectToWindowStationAndDesktop(HMODULE User32) rc = (ULONG_PTR)NtCurrentThread(); + // OpenBox1 BEGIN + if (SbieApi_QueryConfBool(NULL, L"OriginalToken", FALSE)) + rc = 0; + else + // OpenBox1 END if (__sys_NtSetInformationThread) { rc = __sys_NtSetInformationThread(NtCurrentThread(), diff --git a/Sandboxie/core/dll/ldr_init.c b/Sandboxie/core/dll/ldr_init.c index e64d72bc..6109ea84 100644 --- a/Sandboxie/core/dll/ldr_init.c +++ b/Sandboxie/core/dll/ldr_init.c @@ -181,6 +181,9 @@ _FX void Ldr_LoadInjectDlls(BOOLEAN bHostInject) WCHAR *dllname = Dll_AllocTemp(MAX_PATH * 2 * sizeof(WCHAR)); ULONG index = 0; + WCHAR *path = Dll_AllocTemp(1024 * sizeof(WCHAR)); + SbieApi_GetHomePath(NULL, 0, path, 1020); + if (!__sys_LdrLoadDll) __sys_LdrLoadDll = (P_LdrLoadDll)GetProcAddress(Dll_Ntdll, "LdrLoadDll"); @@ -196,6 +199,18 @@ _FX void Ldr_LoadInjectDlls(BOOLEAN bHostInject) break; } + // + // For expidient use we allow to enter the dll name without a path + // starting with \ in that case the DLL is looked for in %SbieHome% + // + + if (dllname[0] == L'\\' && wcslen(path) + wcslen(dllname) + 1 < MAX_PATH * 2) + { + wmemmove(dllname + wcslen(path), dllname, wcslen(dllname) + 1); + wmemcpy(dllname, path, wcslen(path)); + } + + // // we have to prevent invocation of Ldr_CallDllCallbacks while // loading the DLL here, otherwise we will end up our per-dll @@ -225,6 +240,7 @@ _FX void Ldr_LoadInjectDlls(BOOLEAN bHostInject) } Dll_Free(dllname); + Dll_Free(path); } diff --git a/Sandboxie/core/dll/proc.c b/Sandboxie/core/dll/proc.c index 12b07145..cedc074c 100644 --- a/Sandboxie/core/dll/proc.c +++ b/Sandboxie/core/dll/proc.c @@ -1106,6 +1106,9 @@ _FX BOOL Proc_CreateProcessInternalW_RS5( err = GetLastError(); } + // OpenBox1 BEGIN + if (!SbieApi_QueryConfBool(NULL, L"OriginalToken", FALSE)) + // OpenBox1 END if (ok) { // diff --git a/Sandboxie/core/dll/scm_create.c b/Sandboxie/core/dll/scm_create.c index eaeb233f..7df25cd1 100644 --- a/Sandboxie/core/dll/scm_create.c +++ b/Sandboxie/core/dll/scm_create.c @@ -1304,8 +1304,12 @@ _FX BOOL Scm_StartServiceCtrlDispatcherX( args[2] = NULL; } - if (_wcsicmp(ServiceName, Scm_MsiServer) == 0) - Scm_IsMsiServer = TRUE; + if (_wcsicmp(ServiceName, Scm_MsiServer) == 0) { + if (Dll_OsBuild >= 17763 && SbieApi_QueryConfBool(NULL, L"AnonymousLogon", TRUE) == TRUE) { + SbieApi_Log(2194, L""); + } + Scm_IsMsiServer = TRUE; + } if (! CreateThread(NULL, 0, Scm_ServiceMainThread, args, 0, &ThreadId)) Scm_Stopped = TRUE; diff --git a/Sandboxie/core/drv/conf.c b/Sandboxie/core/drv/conf.c index 919fe10b..f19480b8 100644 --- a/Sandboxie/core/drv/conf.c +++ b/Sandboxie/core/drv/conf.c @@ -1230,7 +1230,7 @@ _FX NTSTATUS Conf_Api_Reload(PROCESS *proc, ULONG64 *parms) Conf_Data.pool = NULL; List_Init(&Conf_Data.sections); - Conf_Data.home = TRUE; // = FALSE; + Conf_Data.home = FALSE; ExReleaseResourceLite(Conf_Lock); KeLowerIrql(irql); @@ -1371,7 +1371,7 @@ _FX BOOLEAN Conf_Init(void) { Conf_Data.pool = NULL; List_Init(&Conf_Data.sections); - Conf_Data.home = TRUE; // = FALSE; + Conf_Data.home = FALSE; if (! Mem_GetLockResource(&Conf_Lock, TRUE)) return FALSE; diff --git a/Sandboxie/core/drv/key_flt.c b/Sandboxie/core/drv/key_flt.c index 8f037a1c..592ea84a 100644 --- a/Sandboxie/core/drv/key_flt.c +++ b/Sandboxie/core/drv/key_flt.c @@ -222,7 +222,6 @@ _FX NTSTATUS Key_Callback(void *Context, void *Arg1, void *Arg2) } } - if (status != STATUS_SUCCESS) return status; diff --git a/Sandboxie/core/drv/process.c b/Sandboxie/core/drv/process.c index 955f8583..e5cffa12 100644 --- a/Sandboxie/core/drv/process.c +++ b/Sandboxie/core/drv/process.c @@ -1248,8 +1248,8 @@ _FX void Process_NotifyImage( if (ok) ok = Process_Low_InitConsole(proc); - if (ok) - ok = Token_ReplacePrimary(proc); + if (ok) + ok = Token_ReplacePrimary(proc); if (ok) ok = Thread_InitProcess(proc); diff --git a/Sandboxie/core/drv/syscall_open.c b/Sandboxie/core/drv/syscall_open.c index 1dbcd27e..c3e63255 100644 --- a/Sandboxie/core/drv/syscall_open.c +++ b/Sandboxie/core/drv/syscall_open.c @@ -19,6 +19,7 @@ // Syscall Management //--------------------------------------------------------------------------- +#include "conf.h" //--------------------------------------------------------------------------- // Functions @@ -643,6 +644,9 @@ _FX NTSTATUS Syscall_DuplicateHandle_2( // thread_token.c has a function for this specific case. // + // OpenBox2 BEGIN + if (!(Conf_Get_Boolean(proc->box->name, L"OpenToken", 0, FALSE) || Conf_Get_Boolean(proc->box->name, L"UnfilteredToken", 0, FALSE))) + // OpenBox2 END status = Thread_CheckTokenObject( proc, OpenedObject, HandleInfo.GrantedAccess); } diff --git a/Sandboxie/core/drv/thread_token.c b/Sandboxie/core/drv/thread_token.c index dad9e6ef..892ad583 100644 --- a/Sandboxie/core/drv/thread_token.c +++ b/Sandboxie/core/drv/thread_token.c @@ -21,7 +21,7 @@ #include "common/my_version.h" - +#include "conf.h" //--------------------------------------------------------------------------- // Defines @@ -1243,6 +1243,9 @@ _FX NTSTATUS Thread_SetInformationThread_ImpersonationToken( MyTokenHandle, TOKEN_IMPERSONATE, *SeTokenObjectType, UserMode, &TokenObject, NULL); + // OpenBox2 BEGIN + if (!(Conf_Get_Boolean(proc->box->name, L"OpenToken", 0, FALSE) || Conf_Get_Boolean(proc->box->name, L"UnfilteredToken", 0, FALSE))) + // OpenBox2 END if (NT_SUCCESS(status)) { status = Thread_CheckTokenForImpersonation( diff --git a/Sandboxie/core/drv/token.c b/Sandboxie/core/drv/token.c index 9fd3274a..0466b772 100644 --- a/Sandboxie/core/drv/token.c +++ b/Sandboxie/core/drv/token.c @@ -433,6 +433,12 @@ _FX void *Token_FilterPrimary(PROCESS *proc, void *ProcessObject) return NULL; } + // OpenBox2 BEGIN + if (Conf_Get_Boolean(proc->box->name, L"OpenToken", 0, FALSE) || Conf_Get_Boolean(proc->box->name, L"UnfilteredToken", 0, FALSE)) { + return PrimaryToken; + } + // OpenBox2 END + // DbgPrint(" Process Token %08X - %d <%S>\n", PrimaryToken, proc->pid, proc->image_name); proc->drop_rights = @@ -775,6 +781,15 @@ _FX void *Token_Restrict( TOKEN_PRIVILEGES *privs; TOKEN_USER *user; void *NewTokenObject; + + // OpenBox2 BEGIN + if (Conf_Get_Boolean(proc->box->name, L"OpenToken", 0, FALSE) || Conf_Get_Boolean(proc->box->name, L"UnrestrictedToken", 0, FALSE)) { + SeFilterToken(TokenObject, 0, NULL, NULL, NULL, &NewTokenObject); + return NewTokenObject; + //ObReferenceObject(TokenObject); + //return TokenObject; + } + // OpenBox2 END groups = Token_Query(TokenObject, TokenGroups, proc->box->session_id); privs = Token_Query(TokenObject, TokenPrivileges, proc->box->session_id); @@ -1648,6 +1663,11 @@ _FX BOOLEAN Token_ReplacePrimary(PROCESS *proc) NTSTATUS status; BOOLEAN ok = FALSE; + // OpenBox1 BEGIN + if (Conf_Get_Boolean(proc->box->name, L"OriginalToken", 0, FALSE)) + return TRUE; + // OpenBox1 END + // // lookup the process object to get the old primary token // diff --git a/Sandboxie/core/svc/ProcessServer.cpp b/Sandboxie/core/svc/ProcessServer.cpp index ad6a9b0c..918092c3 100644 --- a/Sandboxie/core/svc/ProcessServer.cpp +++ b/Sandboxie/core/svc/ProcessServer.cpp @@ -719,6 +719,19 @@ HANDLE ProcessServer::RunSandboxedGetToken( CloseHandle(ThreadHandle); + // OpenBox1 BEGIN + if (!ok && SbieApi_QueryConfBool(NULL, L"OriginalToken", FALSE)) + { + ThreadHandle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, + PipeServer::GetCallerProcessId()); + + ok = OpenProcessToken( + ThreadHandle, TOKEN_RIGHTS, &OldTokenHandle); + + CloseHandle(ThreadHandle); + } + // OpenBox1 END + if (! ok) { SetLastError(LastError); return NULL; diff --git a/Sandboxie/install/SandboxieVS.nsi b/Sandboxie/install/SandboxieVS.nsi index b5534f96..ff83f5ea 100644 --- a/Sandboxie/install/SandboxieVS.nsi +++ b/Sandboxie/install/SandboxieVS.nsi @@ -35,6 +35,7 @@ SetCompressor /SOLID /FINAL lzma !define BIN_ROOT_BASE "${SBIE_INSTALLER_PATH}" +!define SBIEDRV_SYS4 "${SBIEDRV_SYS}.rc4" !define OUTFILE_BOTH "${PRODUCT_NAME}Install.exe" !define NAME_Win32 "${PRODUCT_FULL_NAME} ${VERSION} (32-bit)" @@ -428,7 +429,7 @@ InstDir_Check_Suffix: Push -12 Pop $2 StrCpy $1 $0 "" $2 - StrCmp $1 "\${SBIEDRV_SYS}" InstDir_Suffix_Good + StrCmp $1 "\${SBIEDRV_SYS4}" InstDir_Suffix_Good Goto InstDir_ProgramFiles @@ -463,7 +464,7 @@ InstDir_Done: StrCmp "$EXEDIR" "$WINDIR\Installer\" InstType_Remove StrCmp "$EXEDIR\" "$WINDIR\Installer" InstType_Remove - IfFileExists $INSTDIR\${SBIEDRV_SYS} InstType_Upgrade + IfFileExists $INSTDIR\${SBIEDRV_SYS4} InstType_Upgrade IfFileExists $INSTDIR\${SBIESVC_EXE} InstType_Upgrade IfFileExists $INSTDIR\${SBIEDLL_DLL} InstType_Upgrade @@ -967,7 +968,7 @@ WriteLoop: File /oname=${SBIEMSG_DLL} "${BIN_ROOT}\SbieMsg.dll" - File /oname=${SBIEDRV_SYS} "${BIN_ROOT}\SbieDrv.sys" + File /oname=${SBIEDRV_SYS4} "${BIN_ROOT}\SbieDrv.sys.rc4" File /oname=SboxHostDll.dll "${BIN_ROOT}\SboxHostDll.dll" @@ -1072,7 +1073,7 @@ Function DeleteProgramFiles Delete "$INSTDIR\${SBIEMSG_DLL}" - Delete "$INSTDIR\${SBIEDRV_SYS}" + Delete "$INSTDIR\${SBIEDRV_SYS4}" Delete "$INSTDIR\${SANDBOXIE}WUAU.exe" Delete "$INSTDIR\${SANDBOXIE}EventSys.exe" @@ -1422,7 +1423,7 @@ Driver_Silent: ; For Install and Upgrade, install the driver ; - StrCpy $0 'install ${SBIEDRV} "$INSTDIR\${SBIEDRV_SYS}" type=kernel start=demand "msgfile=$INSTDIR\${SBIEMSG_DLL}" altitude=${FILTER_ALTITUDE}' + StrCpy $0 'install ${SBIEDRV} "$INSTDIR\${SBIEDRV_SYS4}" type=kernel start=demand "msgfile=$INSTDIR\${SBIEMSG_DLL}" altitude=${FILTER_ALTITUDE}' Push $0 Call KmdUtil diff --git a/Sandboxie/install/kmdutil/kmdutil.c b/Sandboxie/install/kmdutil/kmdutil.c index 2fb32929..3f26b412 100644 --- a/Sandboxie/install/kmdutil/kmdutil.c +++ b/Sandboxie/install/kmdutil/kmdutil.c @@ -25,6 +25,7 @@ #include #include "common/defines.h" #include "common/my_version.h" +#include "rc4.h" extern void Kmd_ScanDll(BOOLEAN silent); @@ -714,6 +715,39 @@ int __stdcall WinMain( &Options)) return EXIT_FAILURE; + if (Driver_Path) + { + int path_len = wcslen(Driver_Path); + if (path_len > 8 && wcscmp(Driver_Path + path_len - 8, L".sys.rc4") == 0) + { + FILE* inFile = _wfopen(Driver_Path, L"rb"); + if (inFile) + { + Driver_Path[path_len - 4] = L'\0'; + FILE* outFile = _wfopen(Driver_Path, L"wb"); + if (outFile) + { + fseek(inFile, 0, SEEK_END); + DWORD fileSize = ftell(inFile); + fseek(inFile, 0, SEEK_SET); + + void* buffer = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, fileSize); + fread(buffer, 1, fileSize, inFile); + + char key[] = "default_key"; + rc4_sbox_t sbox; + rc4_init(&sbox, key, strlen(key)); + rc4_transform(&sbox, buffer, fileSize); + + fwrite(buffer, 1, fileSize, outFile); + + fclose(outFile); + } + fclose(inFile); + } + } + } + ScMgr = OpenSCManager( NULL, SERVICES_ACTIVE_DATABASE, SC_MANAGER_CREATE_SERVICE); diff --git a/Sandboxie/install/kmdutil/kmdutil.vcxproj b/Sandboxie/install/kmdutil/kmdutil.vcxproj index d94d736c..d5d70d9f 100644 --- a/Sandboxie/install/kmdutil/kmdutil.vcxproj +++ b/Sandboxie/install/kmdutil/kmdutil.vcxproj @@ -123,6 +123,12 @@ + + NotUsing + NotUsing + NotUsing + NotUsing + @@ -133,6 +139,7 @@ + diff --git a/Sandboxie/install/kmdutil/rc4.cpp b/Sandboxie/install/kmdutil/rc4.cpp new file mode 100644 index 00000000..ad51eadb --- /dev/null +++ b/Sandboxie/install/kmdutil/rc4.cpp @@ -0,0 +1,49 @@ +#include "rc4.h" + +void +rc4_swap(unsigned char &a, unsigned char &b) +{ + unsigned char c = a; + a = b; + b = c; +} + +void +rc4_init(rc4_sbox_t *rc4_sbox, const unsigned char *key_ptr, unsigned int key_len) +{ + rc4_sbox->x = 0; + rc4_sbox->y = 0; + + // Initialisation of the permutation + unsigned int i; + for(i = 0; i < 256; i++) + rc4_sbox->state[i] = (char)i; + + // Mixing permutation + unsigned int j = 0; + unsigned int k; + for(i = 0; i < 256; i++) + { + k = i % key_len; + + j = (key_ptr[k] + rc4_sbox->state[i] + j) & 0xff; + rc4_swap(rc4_sbox->state[i], rc4_sbox->state[j]); + } +} + +void +rc4_transform(rc4_sbox_t *rc4_sbox, unsigned char *buffer_ptr, unsigned int buffer_len) +{ + unsigned int i; + for(i = 0; i < buffer_len; i ++) + { + // The pseudo-random generation algorithm + rc4_sbox->x = (rc4_sbox->x + 1) & 0xff; + rc4_sbox->y = (rc4_sbox->y + rc4_sbox->state[rc4_sbox->x]) & 0xff; + rc4_swap(rc4_sbox->state[rc4_sbox->x], rc4_sbox->state[rc4_sbox->y]); + unsigned char keyChar = rc4_sbox->state[(rc4_sbox->state[rc4_sbox->x] + rc4_sbox->state[rc4_sbox->y]) & 0xff]; + + if(buffer_ptr) // NULL when seeking + buffer_ptr[i] ^= keyChar; + } +} \ No newline at end of file diff --git a/Sandboxie/install/kmdutil/rc4.h b/Sandboxie/install/kmdutil/rc4.h new file mode 100644 index 00000000..cb97b1d6 --- /dev/null +++ b/Sandboxie/install/kmdutil/rc4.h @@ -0,0 +1,24 @@ +#ifndef rc4_INCLUDED +# define rc4_INCLUDED + +typedef struct rc4_sbox_s +{ + unsigned char state[256]; + unsigned int x; + unsigned int y; +} rc4_sbox_t; + +#ifdef __cplusplus +extern "C" +{ +#endif + +void rc4_init(rc4_sbox_t *rc4_sbox, const unsigned char *key_ptr, unsigned int key_len); + +void rc4_transform(rc4_sbox_t *rc4_sbox, unsigned char *buffer_ptr, unsigned int buffer_len); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif + +#endif /* rc4_INCLUDED */ diff --git a/Sandboxie/install/release/SandboxieInstall.vcxproj b/Sandboxie/install/release/SandboxieInstall.vcxproj index c52a5c41..b2a7c837 100644 --- a/Sandboxie/install/release/SandboxieInstall.vcxproj +++ b/Sandboxie/install/release/SandboxieInstall.vcxproj @@ -28,7 +28,7 @@ - ..\ + ..\..\bin\ @@ -38,7 +38,7 @@ %(AdditionalDependencies) - ..\$(TargetName)$(TargetExt) + ..\..\bin\$(TargetName)$(TargetExt) RequireAdministrator diff --git a/Sandboxie/msgs/Sbie-English-1033.txt b/Sandboxie/msgs/Sbie-English-1033.txt index d1d4e70f5b87cd83e5564e6b2e2b97826e4e8531..3ebe665f492dde560e1335ae69f2212fe014d54a 100644 GIT binary patch delta 147 zcmdn=l(XqM=LQoSMw7`Ojn%m=8B7=y7h<8FGPiDMK-X50Fj=i`fFj6@aV)h7zC-kSYZrD<4QE0nJeWs!g4os3tu5 d!vhxPOa{Hl51quD4Q$#CY#6s2*f2Gj0RSaXBR~KE delta 22 dcmZpA&bjF+=LQp-W)|Ca7F)*cEVfK_W&mY>2W|iW diff --git a/Sandboxie/msgs/Text-German-1031.txt b/Sandboxie/msgs/Text-German-1031.txt index 54e5d36794829344c60426ff694bd27cb5de5b98..8f2ed2d49960f783a6405a3307aefbf1ef4fe794 100644 GIT binary patch delta 189 zcmbQ&z}45pwIR=r(PVO?hVo0InKU4&Yp35oITS9M*w3G2rB>p diff --git a/SandboxiePlus/MiscHelpers/Common/Common.cpp b/SandboxiePlus/MiscHelpers/Common/Common.cpp index dfddd2c5..efa861f1 100644 --- a/SandboxiePlus/MiscHelpers/Common/Common.cpp +++ b/SandboxiePlus/MiscHelpers/Common/Common.cpp @@ -318,4 +318,27 @@ QAction* MakeAction(QActionGroup* pGroup, QMenu* pParent, const QString& Text, c pAction->setActionGroup(pGroup); pParent->addAction(pAction); return pAction; -} \ No newline at end of file +} + +////////////////////////////////////////////////////////////////////////////////////////// +// +// + +#ifdef WIN32 +#include +#include +#include + +bool InitConsole(bool bCreateIfNeeded) +{ + if (AttachConsole(ATTACH_PARENT_PROCESS) == FALSE) + { + if (!bCreateIfNeeded) + return false; + AllocConsole(); + } + freopen("CONOUT$", "w", stdout); + printf("\r\n"); + return true; +} +#endif \ No newline at end of file diff --git a/SandboxiePlus/MiscHelpers/Common/Common.h b/SandboxiePlus/MiscHelpers/Common/Common.h index 3cbaae45..808c845d 100644 --- a/SandboxiePlus/MiscHelpers/Common/Common.h +++ b/SandboxiePlus/MiscHelpers/Common/Common.h @@ -90,3 +90,7 @@ MISCHELPERS_EXPORT QMenu* MakeMenu(QMenu* pParent, const QString& Text, const QS MISCHELPERS_EXPORT QAction* MakeAction(QMenu* pParent, const QString& Text, const QString& IconFile = ""); MISCHELPERS_EXPORT QAction* MakeAction(QActionGroup* pGroup, QMenu* pParent, const QString& Text, const QVariant& Data); + +#ifdef WIN32 +MISCHELPERS_EXPORT bool InitConsole(bool bCreateIfNeeded = true); +#endif \ No newline at end of file diff --git a/SandboxiePlus/MiscHelpers/Common/qRC4.cpp b/SandboxiePlus/MiscHelpers/Common/qRC4.cpp new file mode 100644 index 00000000..54da5bda --- /dev/null +++ b/SandboxiePlus/MiscHelpers/Common/qRC4.cpp @@ -0,0 +1,63 @@ +#include "stdafx.h" +#include "qRC4.h" +#include + +void +rc4_swap(unsigned char &a, unsigned char &b) +{ + unsigned char c = a; + a = b; + b = c; +} + +void +rc4_init(rc4_sbox_t *rc4_sbox, const unsigned char *key_ptr, unsigned int key_len) +{ + rc4_sbox->x = 0; + rc4_sbox->y = 0; + + // Initialisation of the permutation + unsigned int i; + for (i = 0; i < 256; i++) + rc4_sbox->state[i] = (char)i; + + // Mixing permutation + unsigned int j = 0; + unsigned int k; + for (i = 0; i < 256; i++) + { + k = i % key_len; + + j = (key_ptr[k] + rc4_sbox->state[i] + j) & 0xff; + rc4_swap(rc4_sbox->state[i], rc4_sbox->state[j]); + } +} + +void +rc4_transform(rc4_sbox_t *rc4_sbox, unsigned char *buffer_ptr, unsigned int buffer_len) +{ + unsigned int i; + for (i = 0; i < buffer_len; i++) + { + // The pseudo-random generation algorithm + rc4_sbox->x = (rc4_sbox->x + 1) & 0xff; + rc4_sbox->y = (rc4_sbox->y + rc4_sbox->state[rc4_sbox->x]) & 0xff; + rc4_swap(rc4_sbox->state[rc4_sbox->x], rc4_sbox->state[rc4_sbox->y]); + unsigned char keyChar = rc4_sbox->state[(rc4_sbox->state[rc4_sbox->x] + rc4_sbox->state[rc4_sbox->y]) & 0xff]; + + if (buffer_ptr) // NULL when seeking + buffer_ptr[i] ^= keyChar; + } +} + +void MISCHELPERS_EXPORT rc4_init(rc4_sbox_t *rc4_sbox, const QByteArray& Key) +{ + rc4_init(rc4_sbox, (unsigned char*)Key.data(), Key.size()); +} + +QByteArray MISCHELPERS_EXPORT rc4_transform(rc4_sbox_t *rc4_sbox, const QByteArray& Data) +{ + QByteArray Temp = Data; + rc4_transform(rc4_sbox, (unsigned char*)Temp.data(), Temp.size()); + return Temp; +} \ No newline at end of file diff --git a/SandboxiePlus/MiscHelpers/Common/qRC4.h b/SandboxiePlus/MiscHelpers/Common/qRC4.h new file mode 100644 index 00000000..3ddc440b --- /dev/null +++ b/SandboxiePlus/MiscHelpers/Common/qRC4.h @@ -0,0 +1,18 @@ +#pragma once + +#include "../mischelpers_global.h" + +typedef struct MISCHELPERS_EXPORT rc4_sbox_s +{ + unsigned char state[256]; + unsigned int x; + unsigned int y; +} rc4_sbox_t; + +void MISCHELPERS_EXPORT rc4_init(rc4_sbox_t *rc4_sbox, const unsigned char *key_ptr, unsigned int key_len); + +void MISCHELPERS_EXPORT rc4_transform(rc4_sbox_t *rc4_sbox, unsigned char *buffer_ptr, unsigned int buffer_len); + +void MISCHELPERS_EXPORT rc4_init(rc4_sbox_t *rc4_sbox, const QByteArray& Key); + +QByteArray MISCHELPERS_EXPORT rc4_transform(rc4_sbox_t *rc4_sbox, const QByteArray& Data); \ No newline at end of file diff --git a/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj b/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj index 5c109c91..d3e878c5 100644 --- a/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj +++ b/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj @@ -186,6 +186,7 @@ + @@ -227,6 +228,7 @@ + diff --git a/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj.filters b/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj.filters index 4cecefc0..e5ea6c3b 100644 --- a/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj.filters +++ b/SandboxiePlus/MiscHelpers/MiscHelpers.vcxproj.filters @@ -87,6 +87,9 @@ Common + + Common + @@ -119,6 +122,9 @@ Common + + Common + diff --git a/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.cpp b/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.cpp index 192903e3..78bc5860 100644 --- a/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.cpp +++ b/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.cpp @@ -52,7 +52,7 @@ CBoxedProcess::~CBoxedProcess() //delete m; } -void CBoxedProcess::UpdateProcessInfo() +void CBoxedProcess::InitProcessInfo() { HANDLE ProcessHandle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, (DWORD)m_ProcessId); if (ProcessHandle != INVALID_HANDLE_VALUE) diff --git a/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.h b/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.h index c5761535..00566208 100644 --- a/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.h +++ b/SandboxiePlus/QSbieAPI/Sandboxie/BoxedProcess.h @@ -18,17 +18,18 @@ #pragma once #include +#include "../qsbieapi_global.h" #include "../SbieError.h" -class CBoxedProcess : public QObject +class QSBIEAPI_EXPORT CBoxedProcess : public QObject { Q_OBJECT public: CBoxedProcess(quint64 ProcessId, class CSandBox* pBox); virtual ~CBoxedProcess(); - virtual void UpdateProcessInfo(); + virtual void InitProcessInfo(); virtual quint64 GetProcessId() const { return m_ProcessId; } virtual quint64 GetParendPID() const { return m_ParendPID; } diff --git a/SandboxiePlus/QSbieAPI/Sandboxie/IniSection.cpp b/SandboxiePlus/QSbieAPI/Sandboxie/IniSection.cpp index cf093d8c..44034550 100644 --- a/SandboxiePlus/QSbieAPI/Sandboxie/IniSection.cpp +++ b/SandboxiePlus/QSbieAPI/Sandboxie/IniSection.cpp @@ -18,6 +18,11 @@ #include "stdafx.h" #include "IniSection.h" #include "../SbieAPI.h" + +#include +#define WIN32_NO_STATUS +typedef long NTSTATUS; + #include "..\..\Sandboxie\core\drv\api_flags.h" CIniSection::CIniSection(const QString& Section, class CSbieAPI* pAPI, QObject* parent) : QObject(parent) @@ -54,7 +59,8 @@ SB_STATUS CIniSection::SetBool(const QString& Setting, bool Value) QString CIniSection::GetText(const QString& Setting, const QString& Default) const { - QString Value = m_pAPI->SbieIniGet(m_Name, Setting, CONF_GET_NO_GLOBAL | CONF_GET_NO_EXPAND); + int flags = (m_Name.isEmpty() ? 0 : CONF_GET_NO_GLOBAL) | CONF_GET_NO_EXPAND; + QString Value = m_pAPI->SbieIniGet(m_Name, Setting, flags); if (Value.isNull()) Value = Default; return Value; } @@ -87,6 +93,25 @@ bool CIniSection::GetBool(const QString& Setting, bool Default) const return Default; } +QStringList CIniSection::GetTextList(const QString &Setting, bool withBrackets) +{ + QStringList TextList; + + int flags = (m_Name.isEmpty() ? 0 : CONF_GET_NO_GLOBAL) | CONF_GET_NO_EXPAND; + if (withBrackets) + flags |= CONF_GET_NO_TEMPLS; + + for(int index = 0; ; index++) + { + QString Value = m_pAPI->SbieIniGet(m_Name, Setting, index | flags); + if (Value.isNull()) + break; + TextList.append(Value); + } + + return TextList; +} + SB_STATUS CIniSection::InsertText(const QString& Setting, const QString& Value) { return m_pAPI->SbieIniSet(m_Name, Setting, Value, CSbieAPI::eIniInsert); @@ -100,4 +125,88 @@ SB_STATUS CIniSection::AppendText(const QString& Setting, const QString& Value) SB_STATUS CIniSection::DelValue(const QString& Setting, const QString& Value) { return m_pAPI->SbieIniSet(m_Name, Setting, Value, CSbieAPI::eIniDelete); +} + + +SB_STATUS CIniSection::RenameSection( const QString& NewName, bool deleteOld) // Note: deleteOld is used when duplicating a box +{ + if (m_Name.isEmpty() || NewName.isEmpty()) + return SB_ERR(); + bool SameName = (bool)(NewName.compare(m_Name, Qt::CaseInsensitive) == 0); + + qint32 status = STATUS_SUCCESS; + + // Get all Settigns + QList> Settings; + for (int setting_index = 0; ; setting_index++) + { + QString setting_name = m_pAPI->SbieIniGet(m_Name, NULL, setting_index | CONF_GET_NO_TEMPLS | CONF_GET_NO_EXPAND, &status); + if (status == STATUS_RESOURCE_NAME_NOT_FOUND) { + status = STATUS_SUCCESS; + break; + } + if (status != STATUS_SUCCESS) + break; + + for (int value_index = 0; ; value_index++) + { + QString setting_value = m_pAPI->SbieIniGet(m_Name, setting_name, value_index | CONF_GET_NO_GLOBAL | CONF_GET_NO_TEMPLS | CONF_GET_NO_EXPAND, &status); + if (status == STATUS_RESOURCE_NAME_NOT_FOUND) { + status = STATUS_SUCCESS; + break; + } + if (status != STATUS_SUCCESS) + break; + + Settings.append(qMakePair(setting_name, setting_value)); + } + + if (status != STATUS_SUCCESS) + break; + } + + if (status != STATUS_SUCCESS) + return SB_ERR(CSbieAPI::tr("Failed to copy configuration from sandbox %1: %2").arg(m_Name).arg(status, 8, 16), status); + + // check if such a box already exists + if (!SameName) + { + m_pAPI->SbieIniGet(NewName, NULL, CONF_GET_NO_EXPAND, &status); + if (status != STATUS_RESOURCE_NAME_NOT_FOUND) + return SB_ERR(CSbieAPI::tr("A sandbox of the name %1 already exists").arg(NewName)); + } + + // if the name is the same we first delete than write, + // else we first write and than delete, fro safety reasons + if (deleteOld && SameName) + goto do_delete; + +do_write: + // Apply all Settigns + for (QList>::iterator I = Settings.begin(); I != Settings.end(); ++I) + { + SB_STATUS Status = m_pAPI->SbieIniSet(NewName, I->first, I->second); + if (Status.IsError()) + return Status; + } + +do_delete: + // Selete ini section + if (deleteOld) + { + SB_STATUS Status = m_pAPI->SbieIniSet(m_Name, "*", ""); + if (Status.IsError()) + return SB_ERR(CSbieAPI::tr("Failed to delete sandbox %1: %2").arg(m_Name).arg(Status.GetStatus(), 8, 16), Status.GetStatus()); + deleteOld = false; + + if (SameName) + goto do_write; + } + + return SB_OK; +} + +SB_STATUS CIniSection::RemoveSection() +{ + return m_pAPI->SbieIniSet(m_Name, "*", ""); } \ No newline at end of file diff --git a/SandboxiePlus/QSbieAPI/Sandboxie/IniSection.h b/SandboxiePlus/QSbieAPI/Sandboxie/IniSection.h index af5d96af..bcd80c53 100644 --- a/SandboxiePlus/QSbieAPI/Sandboxie/IniSection.h +++ b/SandboxiePlus/QSbieAPI/Sandboxie/IniSection.h @@ -1,9 +1,11 @@ #pragma once #include +#include "../qsbieapi_global.h" + #include "../SbieError.h" -class CIniSection: public QObject +class QSBIEAPI_EXPORT CIniSection: public QObject { Q_OBJECT public: @@ -20,11 +22,16 @@ public: virtual __int64 GetNum64(const QString& Setting, __int64 Default = 0) const; virtual bool GetBool(const QString& Setting, bool Default = false) const; + virtual QStringList GetTextList(const QString &Setting, bool withBrackets = false); + virtual SB_STATUS InsertText(const QString& Setting, const QString& Value); virtual SB_STATUS AppendText(const QString& Setting, const QString& Value); virtual SB_STATUS DelValue(const QString& Setting, const QString& Value); + virtual SB_STATUS RenameSection(const QString& NewName, bool deleteOld = true); + virtual SB_STATUS RemoveSection(); + protected: QString m_Name; diff --git a/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.cpp b/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.cpp index 25454c7e..b67dd9a3 100644 --- a/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.cpp +++ b/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.cpp @@ -60,6 +60,10 @@ CSandBox::~CSandBox() //delete m; } +void CSandBox::UpdateDetails() +{ +} + SB_STATUS CSandBox::RunStart(const QString& Command) { return m_pAPI->RunStart(m_Name, Command); @@ -80,19 +84,26 @@ SB_STATUS CSandBox::CleanBox() SB_STATUS Status = m_pAPI->TerminateAll(m_Name); if (Status.IsError()) return Status; - return m_pAPI->CleanBox(m_Name); + + QProcess* pProcess = new QProcess(this); + connect(pProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SIGNAL(BoxCleaned())); + + // ToDo-later: do that manually + Status = m_pAPI->RunStart(m_Name, "delete_sandbox", pProcess); + + return Status; } SB_STATUS CSandBox::RenameBox(const QString& NewName) { if (QDir(m_pAPI->Nt2DosPath(m_FilePath)).exists()) return SB_ERR("A sandbox must be emptied before it can be renamed."); - return m_pAPI->RenameBox(m_Name, NewName); + return RenameSection(NewName); } SB_STATUS CSandBox::RemoveBox() { if (QDir(m_pAPI->Nt2DosPath(m_FilePath)).exists()) return SB_ERR("A sandbox must be emptied before it can be deleted."); - return m_pAPI->RemoveBox(m_Name); + return RemoveSection(); } diff --git a/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.h b/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.h index 0dc6bcbd..b4d55624 100644 --- a/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.h +++ b/SandboxiePlus/QSbieAPI/Sandboxie/SandBox.h @@ -18,16 +18,20 @@ #pragma once #include +#include "../qsbieapi_global.h" + #include "BoxedProcess.h" #include "IniSection.h" -class CSandBox : public CIniSection +class QSBIEAPI_EXPORT CSandBox : public CIniSection { Q_OBJECT public: CSandBox(const QString& BoxName, class CSbieAPI* pAPI); virtual ~CSandBox(); + virtual void UpdateDetails(); + virtual QString GetName() const { return m_Name; } virtual QMap GetProcessList() const { return m_ProcessList; } @@ -42,6 +46,9 @@ public: class CSbieAPI* Api() { return m_pAPI; } +signals: + void BoxCleaned(); + protected: friend class CSbieAPI; diff --git a/SandboxiePlus/QSbieAPI/SbieAPI.cpp b/SandboxiePlus/QSbieAPI/SbieAPI.cpp index cb6e1d88..a006a4f2 100644 --- a/SandboxiePlus/QSbieAPI/SbieAPI.cpp +++ b/SandboxiePlus/QSbieAPI/SbieAPI.cpp @@ -122,6 +122,16 @@ CSbieAPI::~CSbieAPI() delete m; } +CSandBox* CSbieAPI::NewSandBox(const QString& BoxName, class CSbieAPI* pAPI) +{ + return new CSandBox(BoxName, pAPI); +} + +CBoxedProcess* CSbieAPI::NewBoxedProcess(quint64 ProcessId, class CSandBox* pBox) +{ + return new CBoxedProcess(ProcessId, pBox); +} + SB_STATUS CSbieAPI::Connect(bool takeOver, bool andLoad) { if (IsConnected()) @@ -575,7 +585,7 @@ QString CSbieAPI::GetIniPath(bool* IsHome) const return IniPath; } -SB_STATUS CSbieAPI::RunStart(const QString& BoxName, const QString& Command) +SB_STATUS CSbieAPI::RunStart(const QString& BoxName, const QString& Command, QProcess* pProcess) { if (m_SbiePath.isEmpty()) return SB_ERR(tr("Can't find Sandboxie instal path.")); @@ -583,12 +593,14 @@ SB_STATUS CSbieAPI::RunStart(const QString& BoxName, const QString& Command) QStringList Arguments; Arguments.append("/box:" + BoxName); Arguments.append(Command); - QProcess::startDetached(m_SbiePath + "//" + QString::fromWCharArray(SBIESTART_EXE), Arguments); - + if (pProcess) + pProcess->start(m_SbiePath + "//" + QString::fromWCharArray(SBIESTART_EXE), Arguments); + else + QProcess::startDetached(m_SbiePath + "//" + QString::fromWCharArray(SBIESTART_EXE), Arguments); return SB_OK; } -SB_STATUS CSbieAPI::ReloadBoxes() +SB_STATUS CSbieAPI::ReloadBoxes(bool bFull) { QMap OldSandBoxes = m_SandBoxes; @@ -603,11 +615,15 @@ SB_STATUS CSbieAPI::ReloadBoxes() CSandBoxPtr pBox = OldSandBoxes.take(BoxName); if (!pBox) { - pBox = CSandBoxPtr(new CSandBox(BoxName, this)); + pBox = CSandBoxPtr(NewSandBox(BoxName, this)); m_SandBoxes.insert(BoxName, pBox); SetBoxPaths(pBox); } + else if (!bFull) + continue; + + pBox->UpdateDetails(); // todo: } @@ -701,96 +717,6 @@ SB_STATUS CSbieAPI::CreateBox(const QString& BoxName) return SbieIniSet(BoxName, "Enabled", "y"); } -SB_STATUS CSbieAPI::CleanBox(const QString& BoxName) -{ - // ToDo-later: do that manually - return RunStart(BoxName, "delete_sandbox"); -} - -SB_STATUS CSbieAPI::RenameBox(const QString& OldName, const QString& NewName, bool deleteOld) // Note: deleteOld is used when duplicating a box -{ - if (OldName.isEmpty() || NewName.isEmpty()) - return SB_ERR(); - bool SameName = (bool)(NewName.compare(OldName, Qt::CaseInsensitive) == 0); - - qint32 status = STATUS_SUCCESS; - - // Get all Settigns - QList> Settings; - for (int setting_index = 0; ; setting_index++) - { - QString setting_name = SbieIniGet(OldName, NULL, setting_index | CONF_GET_NO_TEMPLS | CONF_GET_NO_EXPAND, &status); - if (status == STATUS_RESOURCE_NAME_NOT_FOUND) { - status = STATUS_SUCCESS; - break; - } - if (status != STATUS_SUCCESS) - break; - - for (int value_index = 0; ; value_index++) - { - QString setting_value = SbieIniGet(OldName, setting_name, value_index | CONF_GET_NO_GLOBAL | CONF_GET_NO_TEMPLS | CONF_GET_NO_EXPAND, &status); - if (status == STATUS_RESOURCE_NAME_NOT_FOUND) { - status = STATUS_SUCCESS; - break; - } - if (status != STATUS_SUCCESS) - break; - - Settings.append(qMakePair(setting_name, setting_value)); - } - - if (status != STATUS_SUCCESS) - break; - } - - if (status != STATUS_SUCCESS) - return SB_ERR(CSbieAPI::tr("Failed to copy configuration from sandbox %1: %2").arg(OldName).arg(status, 8, 16), status); - - // check if such a box already exists - if (!SameName) - { - SbieIniGet(NewName, NULL, CONF_GET_NO_EXPAND, &status); - if (status != STATUS_RESOURCE_NAME_NOT_FOUND) - return SB_ERR(CSbieAPI::tr("A sandbox of the name %1 already exists").arg(NewName)); - } - - // if the name is the same we first delete than write, - // else we first write and than delete, fro safety reasons - if (deleteOld && SameName) - goto do_delete; - -do_write: - // Apply all Settigns - for (QList>::iterator I = Settings.begin(); I != Settings.end(); ++I) - { - SB_STATUS Status = SbieIniSet(NewName, I->first, I->second); - if (Status.IsError()) - return Status; - } - -do_delete: - // Selete ini section - if (deleteOld) - { - SB_STATUS Status = SbieIniSet(OldName, "*", ""); - if (Status.IsError()) - return SB_ERR(CSbieAPI::tr("Failed to delete sandbox %1: %2").arg(OldName).arg(Status.GetStatus(), 8, 16), Status.GetStatus()); - deleteOld = false; - - if (SameName) - goto do_write; - } - - return SB_OK; -} - -SB_STATUS CSbieAPI::RemoveBox(const QString& BoxName) -{ - // Note: SandBox must be emptied at this point - return SbieIniSet(BoxName, "*", ""); -} - SB_STATUS CSbieAPI::UpdateProcesses(bool bKeep) { foreach(const CSandBoxPtr& pBox, m_SandBoxes) @@ -827,13 +753,13 @@ SB_STATUS CSbieAPI::UpdateProcesses(bool bKeep, const CSandBoxPtr& pBox) CBoxedProcessPtr pProcess = OldProcessList.take(ProcessId); if (!pProcess) { - pProcess = CBoxedProcessPtr(new CBoxedProcess(ProcessId, pBox.data())); + pProcess = CBoxedProcessPtr(NewBoxedProcess(ProcessId, pBox.data())); //pProcess->m_pBox = pBox; pBox->m_ProcessList.insert(ProcessId, pProcess); m_BoxedProxesses.insert(ProcessId, pProcess); SetProcessInfo(pProcess); - pProcess->UpdateProcessInfo(); + pProcess->InitProcessInfo(); } // todo: @@ -1194,6 +1120,9 @@ SB_STATUS CSbieAPI::ReloadConfig(quint32 SessionId) return SB_ERR(status); emit LogMessage("Sandboxie config has been reloaded."); + + ReloadBoxes(true); + return SB_OK; } diff --git a/SandboxiePlus/QSbieAPI/SbieAPI.h b/SandboxiePlus/QSbieAPI/SbieAPI.h index 83402e92..88edb4ea 100644 --- a/SandboxiePlus/QSbieAPI/SbieAPI.h +++ b/SandboxiePlus/QSbieAPI/SbieAPI.h @@ -27,7 +27,7 @@ #include "./Sandboxie/SandBox.h" #include "./Sandboxie/BoxedProcess.h" -class CResLogEntry : public QSharedData +class QSBIEAPI_EXPORT CResLogEntry : public QSharedData { public: CResLogEntry(quint64 ProcessId, quint32 Type, const QString& Value); @@ -77,7 +77,7 @@ public: virtual void UpdateDriveLetters(); virtual QString Nt2DosPath(QString NtPath) const; - virtual SB_STATUS ReloadBoxes(); + virtual SB_STATUS ReloadBoxes(bool bFull = false); virtual SB_STATUS CreateBox(const QString& BoxName); virtual SB_STATUS UpdateProcesses(bool bKeep); @@ -122,14 +122,13 @@ protected: friend class CSandBox; friend class CBoxedProcess; + virtual CSandBox* NewSandBox(const QString& BoxName, class CSbieAPI* pAPI); + virtual CBoxedProcess* NewBoxedProcess(quint64 ProcessId, class CSandBox* pBox); + virtual QString GetSbieHome() const; virtual QString GetIniPath(bool* IsHome) const; - virtual SB_STATUS RunStart(const QString& BoxName, const QString& Command); - - virtual SB_STATUS CleanBox(const QString& BoxName); - virtual SB_STATUS RenameBox(const QString& OldName, const QString& NewName, bool deleteOld = true); - virtual SB_STATUS RemoveBox(const QString& BoxName); + virtual SB_STATUS RunStart(const QString& BoxName, const QString& Command, QProcess* pProcess = NULL); virtual bool GetLog(); virtual bool GetMonitor(); diff --git a/SandboxiePlus/SandMan/Models/SbieModel.cpp b/SandboxiePlus/SandMan/Models/SbieModel.cpp index 8f812fd9..27d72b7f 100644 --- a/SandboxiePlus/SandMan/Models/SbieModel.cpp +++ b/SandboxiePlus/SandMan/Models/SbieModel.cpp @@ -7,8 +7,11 @@ CSbieModel::CSbieModel(QObject *parent) :CTreeItemModel(parent) { - m_BoxEmpty = QIcon(":/BoxEmpty"); - m_BoxInUse = QIcon(":/BoxInUse"); + for (int i = 0; i < eMaxColor; i++) + m_BoxIcons[(EBoxColors)i] = qMakePair(QIcon(QString(":/Boxes/Empty%1").arg(i)), QIcon(QString(":/Boxes/Full%1").arg(i))); + + //m_BoxEmpty = QIcon(":/BoxEmpty"); + //m_BoxInUse = QIcon(":/BoxInUse"); m_ExeIcon = QIcon(":/exeIcon32"); m_Root = MkNode(QVariant()); @@ -91,6 +94,8 @@ QList CSbieModel::Sync(const QMap& BoxList) Index = Find(m_Root, pNode); } + CSandBoxPlus* pBoxEx = qobject_cast(pBox.data()); + int Col = 0; bool State = false; int Changed = 0; @@ -98,11 +103,16 @@ QList CSbieModel::Sync(const QMap& BoxList) QMap ProcessList = pBox->GetProcessList(); bool HasActive = Sync(pBox, ProcessList, New, Old, Added); - - if (pNode->inUse != (HasActive ? 1 : 0)) + int inUse = (HasActive ? 1 : 0); + int boxType = pBoxEx && pBoxEx->HasLogApi() ? eLogApi : eNormal; + if (pBoxEx && pBoxEx->IsOpenBox()) + boxType = eOpenBox;// : eOpenInSys; + if (pNode->inUse != inUse || pNode->boxType != boxType) { - pNode->inUse = (HasActive ? 1 : 0); - pNode->Icon = pNode->inUse ? m_BoxInUse : m_BoxEmpty; + pNode->inUse = inUse; + pNode->boxType = boxType; + //pNode->Icon = pNode->inUse ? m_BoxInUse : m_BoxEmpty; + pNode->Icon = pNode->inUse ? m_BoxIcons[(EBoxColors)boxType].second : m_BoxIcons[(EBoxColors)boxType].first; Changed = 1; // set change for first column } @@ -115,6 +125,7 @@ QList CSbieModel::Sync(const QMap& BoxList) switch(section) { case eName: Value = pBox->GetName(); break; + case eStatus: Value = boxType; break; } SSandBoxNode::SValue& ColValue = pNode->Values[section]; @@ -125,10 +136,10 @@ QList CSbieModel::Sync(const QMap& BoxList) Changed = 1; ColValue.Raw = Value; - /*switch (section) + switch (section) { - - }*/ + case eStatus: ColValue.Formated = boxType == eLogApi ? tr("LogApi Enabled") : tr("Normal"); break; // todo: add more + } } if(State != (Changed != 0)) diff --git a/SandboxiePlus/SandMan/Models/SbieModel.h b/SandboxiePlus/SandMan/Models/SbieModel.h index 66ed32c1..0640d4cf 100644 --- a/SandboxiePlus/SandMan/Models/SbieModel.h +++ b/SandboxiePlus/SandMan/Models/SbieModel.h @@ -1,6 +1,6 @@ #pragma once #include -#include "../../QSbieAPI/Sandboxie/SandBox.h" +#include "../SbiePlusAPI.h" #include "../../MiscHelpers/Common/TreeItemModel.h" @@ -36,10 +36,11 @@ protected: struct SSandBoxNode: STreeNode { - SSandBoxNode(const QVariant& Id) : STreeNode(Id) { inUse = -1; } + SSandBoxNode(const QVariant& Id) : STreeNode(Id) { inUse = -1; boxType = -1; } CSandBoxPtr pBox; int inUse; + int boxType; CBoxedProcessPtr pProcess; }; @@ -53,7 +54,29 @@ protected: //virtual QVariant GetDefaultIcon() const; private: - QIcon m_BoxEmpty; - QIcon m_BoxInUse; + enum EBoxColors + { + eYelow = 0, + eRed, + eGreen, + eBlue, + eCyan, + eMagenta, + eOrang, + eMaxColor, + + eNormal = eYelow, + eLogApi = eRed, + eOpenLogApi = eCyan, + eOpenBox = eGreen, + // = eMagenta, + // = eOrang, + eAnonBox = eBlue + }; + + QMap > m_BoxIcons; + + //QIcon m_BoxEmpty; + //QIcon m_BoxInUse; QIcon m_ExeIcon; }; \ No newline at end of file diff --git a/SandboxiePlus/SandMan/Resources/Boxes/sandbox-b-empty.png b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-b-empty.png new file mode 100644 index 0000000000000000000000000000000000000000..5a0d03af16fd4786fe63ad779d5b1f0d8f14a8d7 GIT binary patch literal 1157 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 RF1i2!002ovPDHLkV1g2(5xf8Z literal 0 HcmV?d00001 diff --git a/SandboxiePlus/SandMan/Resources/Boxes/sandbox-c-full.png b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-c-full.png new file mode 100644 index 0000000000000000000000000000000000000000..2a60113aed79f491055fcacb44fde8e91805a546 GIT binary patch literal 1193 zcmV;a1XlZrP)N2bZe?^J zG%hhNF=Hy6O8@`_CrLy>R9Hv7muYBJR~UxRy|ZK{%OqxZqK(FiMa>UUOT#$gUh4uz zyI2ZAX~k+w5uw=rDxpYA!Ist~B8b=`h(aa#qdydk0X2)M8kg26{WBPw8nvxU8e6}< z-?_PG&YihqCLQAk4`J^1zURH)Ip;=XP}!gzG=LgV4ovV|Y73wQ-UlxOKQO?E)JH&x zj$Tr$8({8(HJ}oBz%#3LKna!CZJ@bLEmYCmP1Q}ODfsy=-30R`h=MGTQ5tUo^gJN@e9GSaqZIHdddd6K9U?&vd>y|_LT6$WX>6f_S@U%h zC&3iJuf({UcJxYNTg25sXP=^^vzJQIA9MB|)=hMS*FY(7OxMqV zx-eM3!x678>^paxyby3R;5~mgiM-aERDGmHH^J~s;#s0zi99iB?M9l=79&5J$~K_H zSy&TyGvK-KhbvxCdg=yM)kJj@+!rqbX@Ux?r%9*W(Jan_i2_oXM|R-lIPO> zBognlj|VWIvW3fZ6JG!}A-?4UIUjF*x&esW!e-ZBWa6Rb<%bU34Cv>J+I!qgh!y<9 z%pWCFNM*ot9wUc%;&J0@zrxLceqNl8k=S>Pf@3Oe0|RWJ7|0a7OWsIrfFsAq6OS9e z3@BU;Xy?Nxu29a3ck~3l0U`)w3c@sH3bOgQ=?33BM=xW){2)m{T>B?2c-i*MbHvZP z=-WUplPU#~8zN6DQs9o4O^5eBC~jVPlx*O}(6G1>S)hyW1aASJjthGoDO)uTV!MI!uyF8&>; z1r;D^Z{QTBf@VNs>U8-k+zceWh7{sPL7^?&4|s5#au}rC9odAHf?>#pOxu7Ge@w+Y z4w9$5!WQoX-0i%>js{QNnw=?(9WPTz*FYf_8WuNl@@(-K*ant@GLY7HK|BS(DWqe7 zjY@I!&)~fm0k3q6K?xYv2Wvcql5+X*lubA&9@y}Sd~Na`A=<#FU^XZM!~R-M>V;GW zl(;3#oCTY~Ob`P9`j#JPChS}9!ag1`7}a|o;jFM$9Uk#ejH8b5$KFcFNHI2Rk> z6nI|S;`;&brlo0;`rMBuTfs7up00000NkvXX Hu0mjff>s!B literal 0 HcmV?d00001 diff --git a/SandboxiePlus/SandMan/Resources/Boxes/sandbox-g-empty.png b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-g-empty.png new file mode 100644 index 0000000000000000000000000000000000000000..c38c22ae1078c50f9dcccd4671a6f675991d8f6d GIT binary patch literal 1175 zcmV;I1Zew-P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y9E-_;&oJ#-z1PDn)K~z{ry_Zjj8&w>~XOc-a*+0{4vdR8K zYg1*5x`$E}WU1`3r7Bi%u~kGUii)j@h!^!F9z+pD{M)m7DHSa3sTV<65NU5#ysYA7 zF}rJ5tzBzv)#vB;X7c7uW)gQz*B3q{nKyag?|kR?-kUgGv|cy^N8mOXfeidF?Riiw z9D-XR4=!v$)m_m`LMg*ajZ_Yr6x?kE^p))%!`W7RW8<0# zs6lMHz69pP;=9FIytZ)e9OA1U*fqPT);&il9?qa_AIv@ik3^(d*cMONzG&wnLWf>^=-e;TuN8O?nz&+@;HQ@e% z@D&E5;PmV77UZ~vh_eRT;_twHa1F$k=O~3dw}Q=OLk60ncJycAT8PBohB+9A#NHq& z+zg+Ca&`r`BF(^h#oe-r{SwHVr z>F$IoZ0LbCN?{}zyloMN;)NFq`nKucIL>K!5pIVHZ1`z8Q48%181X<@_!6FjTfm3^ z{7g6nK?-}r6l?>$dcWssX)14v%lXg3F6c^JT9iUDOu;t5G|P^~mey176zqfn==#5b z3=q}AOpt=N=4tWF7Pj9={3JX9a(+K_E#7P<1#iOBDd+{JU@BcW0gu6rAm?8-acMGd zgA~{)i+k9|dFOkRWAF&(V5AHhMm0X9usni!B2WL`JLKLFXw>mYwdH?_$k pA|_-bc^%}5c0XJPIq0G}&Of0AvBla^SJD6g002ovPDHLkV1krc8v+0T literal 0 HcmV?d00001 diff --git a/SandboxiePlus/SandMan/Resources/Boxes/sandbox-g-full.png b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-g-full.png new file mode 100644 index 0000000000000000000000000000000000000000..aea1a97452e2775148185c9d441f8900e5ae8a97 GIT binary patch literal 1167 zcmV;A1aSL_P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y9E-_;&oJ#-z1OQ1yK~z{ry_ZX9TvZ&#?`tMAdE8EBGLskD zc3MeMvnWMDLM0)^2UalDR-{l`RBTm5+^8#YA&Ma4vukxD3W~0}5tM+4?yR^;#Z7RM z*w|OBwN;P5|G6{go;!1=PMpU7@FV2jJLmh(cV2g#E~*#4h2wA=jDQFKOFaXsiKB2U zWWj|EsVBjRj?RtR281;@44c7+YgUhd5gIu*qGsl2)cC@q$^LRnkTZ4;5?^C*cX$1nW-YUNDUf&JC)ixJ^3uKlv5i1!L{2C~woCKL)xCh~4sHWzp zRADxe#usoC$dIJgG?*`hv!M!)gY;N>xPk$M8zQL&R=HQFyi!(`g^HT~XxcWh0Cz(L z63g{@Fc0S6$|vHrg)^rSUky?X1ZTM3#K6x3YI1(kHX+DLl2u}cMBkWrY(i~Y+@`WM zgzE;3xCo!7(Ykn=0sowzN^mYvl^-jry1Qzdka@8kvDk#J zYWzH`wbJ~(#`WBCP7UuJwoSYQV#0Y{F7&se1aX0h~K#J%5B40P}jad!_x5R1PJ4}dI3U2zKF9&+0naQ`6AD>U|3 z)VT9^6LQ@`#MuLF@i$=~TnCBmIZh$VP;j`c%Rocaj{YQE53%?gFbCt%ayCc`H^Y~p zoL$jSq#0-#hBo4E(ZqfUq;rz;7_>bd#YB{X8%@ZL4K#$WIBMvFA?1&o3AYL|+vS8E zg{vOT$rQFmDRgR}SSxCAcfj;~5nhFRU>G`jFNjkBNud)1VpNM~jreyUJKbGShIPHL z#wmPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y9E-_;&oJ#-z1Sv^GK~z{rz1L4{6jdAt@Hexw!)~G5f3%b~ zQd=}NRt`<0iD_zRwgHVbu~9UJq`{z3&=})IJQ)u}V`7Yo^ekQoBoH|DLZaD(7`<7- zWg%QP>~`q_r3;i6`1$?5I*+%zvkP^pFZm?ho!R;R<~MKVO;sJE0sew1co90mh5u!I z4pQbrcmaHHU`@s+U_vK0PuK-e5%xe2MBuTF_rV11>)a=)(UhdS({gs(Sved(Y!^Y_ zzzD2^y1MZem;>{S&ulm&*>%|x7uqi9LiRTAwTqa6kD&=x-Hq4aL2%22oNPWR*+f=y ze$JTnXN_DeC+GUk$&vUGy9oLUdclK-j-6nBoNQ0ZiG~v^A<-52XkM;*S1VkJUePj% zjHHHBl59@eMf?T>z)KQ3w!?$qL{g>_Q~Hb`S!e|JJND|`*FL7 zG`s>GP;$F|31-Jb@k1r;wS(uPb5igMp#@y?u2s0)cv({0Qg#uhS{{H=v z*_x58zjB@Ja0btL)x&8%G9S*Hmx~=2Wu$M!E`syoDbPj8VC$f+lrx&)3=9k5SzY(8 z>jU42+>m0VSmBO(yXvm_el|8M;01R-^B-w&*U@>VQ6L1l!?@&Z1EsPWJYU%E+{umY#S|P{0xk z*a*4{yS!aB3kW;wC1=Sf4<~#3`L6S_d;M;^1K)#+gYJT>T-^muzMzPp^=$i1_hv!7u+Rs(=9ngC;CGNAHKZ>^SOJe3-s-dl!Hd9?W0$+2>gvcMbQc`u z=m{BCK&|j)wJb+B9+mD$cMx6x&UUV_o1x~?T+)SJ)vLQuUO;(xP(ZddtHT?e#vnWc z-@&V}2_EUaz;uDwg|GtbaAKhh_Z>e7{~P$Edl}kcRWGcj3!SP{AH3Qm48jk@4(Q9q z-@u>n1-t}puv%viyTQ~>rTipe&lwV;|_%FbYdHS^ literal 0 HcmV?d00001 diff --git a/SandboxiePlus/SandMan/Resources/Boxes/sandbox-m-full.png b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-m-full.png new file mode 100644 index 0000000000000000000000000000000000000000..d132924b8460c03170915f0fc23279c079a586ee GIT binary patch literal 1217 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 FV1n{z92Nio literal 0 HcmV?d00001 diff --git a/SandboxiePlus/SandMan/Resources/Boxes/sandbox-r-empty.png b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-r-empty.png new file mode 100644 index 0000000000000000000000000000000000000000..9b229cdf2602af51b924d60b26788bb5ca37ad3c GIT binary patch literal 1138 zcmV-&1daQNP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02p*dSaefwW^{L9 za%BK;VQFr3E^cLXAT%y9E-_;&oJ#-z1LH|VK~z{ry_ZX9TvZ&#C-3+BouJV~iL_=> zih_icgcctd!Q!KoLa}Jk+9J|T+m&=tDuRgik#%)bT4<>&H-Zun(VdE$v~&}kB(~MI zsm7%3@%J6?IdkUb&Lrt19{7>D_ni5E-~Hx1Zc+ubYWNYx;ThCPqiiWKWOzZg9|?uBr-6h!0^HDxjb= zUI$-TPyBUltw~o@WO2Er#Tt3Du`x99GaP^hSaljNK}NW#$y}s(y1w2_mzR5H0;Ve~ z%`bg@=JTa#9EC@r6qaqzf&cQ>wl;I2y81tnvNFpo+$b$w!tdM{Q<$6>8Zuk6)A$B9 zf_{?3HUb%8ij0GvSmLuH5)erSu5;fpi}A_!c5{AYBs4JzFF-qFE!Pjg4?IbPVZ5R6 zH3=k$i$4bpp~Rm;(rp`@$SHYndo_;zuznS;M#NZbiZT!j5;mTQ8E)XTbPVt`V}mw*1Wh;b{OSKuMY+Maz19O(9NS&acF7{<M*JtxPWL>t!Kz+ZeG0tl+Tyt;p%XvMUay}`-+>?C2yB5CSoPcT zlDUw}fD_l)i0|PbJOykk5B^R#1U7|dBcafM#IN$UG{n}eF%cU7KCp-i6Ib&o@WG}K z8qhN9#+3RaIA>D(VH4CrLE>sE;OD|9D1|werNkRBqx%tG!rP$nwNS9QYd(bmgq4EC zD@j22A}+yOumLoF&BWETZfy!WDYtQs>o3=ibFc@VfJ#`G=2M9A1?+~$Vco>lWI!os zT|4nJptHOW^v~$JHfQWm@CcMa0WFpK7x#&=#c#3esQ>@~07*qoM6N<$ Ef=A*HhyVZp literal 0 HcmV?d00001 diff --git a/SandboxiePlus/SandMan/Resources/Boxes/sandbox-r-full.png b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-r-full.png new file mode 100644 index 0000000000000000000000000000000000000000..f5321110db130e4da930a442e039008a41199093 GIT binary patch literal 1119 zcmV-l1fctgP)N2bZe?^J zG%hhNF=Hy6O8@`^-AP12R9Hv7mr00JM*xQ3?29v_vv0U$R7PA55+cZ;%%HfSLI#tF z2%@N{QAE6`C&?is2q7eHXOoL4D0=cDC<7vTQ^{o%FGG5qxMz&JmG3X#tFC_YT6=8A zf{*U5SFirR{#VQEAdgZB*Weh;hZZP=&r^@aBZzQL+7cQ8Z%g0>bUDMSYB>!c669OMyBxtd;!Jq!Lk(G z&5Ifv&FRX@cOoSvmLYghTxnWCNf{Ea3{ivmZQpjfDQ79g-e_l}FNHXAGA3*0kOinM=mom@*Hid5) zWi|tLV={O?EfPek3wl=elq@@+|D+Co_Q($e_6g2r{B6{wMUa>!gxWH@f$pvlO zD`k-HAv#6Zg54%v3N{8%Bw};DU3`Bx{?3_ks5~$CR-=P=UVZ_;> z6lTLEFkgZmMUsK|W5_06r?z~;bI{;8oXlo^29F;``X^_1JU|T!sCx5b9ynZ_6X*LN)`DxY~wXfj#gQu&sRj zJ7E{t6qbZSz5$8f;ccmlty^tE)P6Uxi1HIxaVhY{rr;aUGHb(>u7_~W1Uq0ZR6}0k zD(b+^g&t4}!z@dQkH?JaL(aigQ2Q##TRbW*g-(Q(g2c;7Ky@K!VKdAGwf|(|Dq6QT z1)Y?OImh+M?}(GI5oSO+j7f1R#P}1|!*m!kaTOU*3R>5Z_;Ju#-U0eEI;KUNh)n1p lIS6{A{RXB$3FJ|N;D4>qz9bm?W>)|J002ovPDHLkV1n!|0DAxc literal 0 HcmV?d00001 diff --git a/SandboxiePlus/SandMan/Resources/Boxes/sandbox-y-empty.png b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-y-empty.png new file mode 100644 index 0000000000000000000000000000000000000000..79301033818232047b424b0cb89ccbb8221981a1 GIT binary patch literal 1367 zcmV-d1*rOoP)%g8xO{ zNG9NI!Y!l4RaNsSDq4yf?!poJvdY@3EjcRJL6M0Z469n0CAN?FKZo21qbJ-B4FFLTwJ-5kBu9L6jJ`jq8LA6tT0iGr?cCGSXhuq5U^@h5I&!z^n1Nl zoH>()J9nnEp`6H?SpX-N>e||LoIV{e6`&HzFBFiL79zK+giOxO?~e@fcydr)Ziy1X z0w~nbl9MB%wRJN#ZF*$t0b{>LZX6c~h*9KfU*w;;-7+3hb~t<1jwer)rMkp#*Am`i zFO-&A(AX%N3b5HiaaJ3bBwK4F=N1Y@1h`!5P+RN4jT>IAtAXFzp|1ZHp4{nlprBw- zA<|sVR~6AgXeKmK8yU&R`Sbsf`*nez5IT7}{%JXy7cw(}p&|9x`u{rd&X%_*In|F6c7E5Q((*H{E6h-wbD&Q1rmY#E3XV6(}l-gYk_C9nD4nbaXLjxHnW(Y zS6*_yzhxkIBc?7$l-YGJ@IzOZ16#NL87Ck%*k)!ViW{yQW+@*iFL?*zs))B@-T`Nk zpkOsCNM6^xke5eQW}k#LYZ3=xD5R1%G+0qz@6&|+26aVs6FB~#!K7L?6A%{*+qd^8 z6fiZVlGoMgmC`SSFWGs7M}&E-uqG@fTw*UAK1@+`T|!n?Bp7)mjE=6x$&&$ecl)(( zI>VMT`CrM%lL^qhV5hsgcOBTdvtJi5I4Gl}M8d>`9#h{Fz9IYswfb2|MxIOnzuT|MO9(=YyAWFwwnGP+-BeYlXh`t(x7hFZxFba;w;Chl~e6f3UipY Z{{WO(`{aCZ8-@S?002ovPDHLkV1hGMd;$Of literal 0 HcmV?d00001 diff --git a/SandboxiePlus/SandMan/Resources/Boxes/sandbox-y-full.png b/SandboxiePlus/SandMan/Resources/Boxes/sandbox-y-full.png new file mode 100644 index 0000000000000000000000000000000000000000..884d6a54ba0e679a5032007892368da7dc46fbe2 GIT binary patch literal 1376 zcmV-m1)utfP)3!pF?qduP7y zo;mlNa|NuvttHq9zZ0$#h6s}c|4Ke0tdjg)LQO>9IYKv~hpf9E7J4-+GO583 zfF&#ZTaGECd|g^HVQ9#Ts;XYxzpq(?cS||J&QoFucoT}_1c}pe{5Wv*C?JaN;7SA9 ziX|ypz|6E!yZ8Ar;dBb*8wDsXZd1FNoSpa&){EeF@$TzZZ>XaEB9fNwmVCNi`1#H`vg)3Kbv2o*oOv?ZGR$x zv%3})VJ?>uXU=5c&YcN$hyz(83*f*~SzVoq)2F?01+a-lG4Nage!mbUVDaD3B&XAY z(o#d12o^xDh9-+eM04|IY})iFrU2)hBon5khZ8KhLmSEK6{7^`#~qFU9#V8Td)9;} zPvot-%%j#Rk;Zi!lYvKa=EDo72JxmOUW?k0)Aye%x+fhw5r4ZrpIGU3ENa zg0lacc!f5b6?u96@@iF+^Hl+*z|`<$=Zgw0vD?s4F3z9-hs>`D{DjcX0@zC|suj}H zfq?-DMx&^a>IJ-HipaJ} z$$2Yy^#a%muMs{X?Ax(}@@b0%lSzmYkg_IxnSNhv^8Nb-%*@E09RIIIkjrmHCL!h?c3S7aA6jsqcX<~l#;C#O8GVkU22XcK(oSz4M10ygw#|d zC4h?)n@yx(GmZIqc@D?>TRL(FBI<%z^?+ste(311V(ZpF6AGA`lE`nkZkVQcAdhnf z;;M*KF=xPO#3)$f6(p~#R>;YrDzisIT3T!;^!pX^x;i6jYu)Ov_zlXA>LjrL&mvB> z98W-$FKpl58&kleU|Pf)6# zg+%0u1n}5q)fWyN0B+utU^WXB*S*-YN2K(s{Z=M!3I6k8DCdJ0axl@Xke6q`wQKpv z%zS`dy9Bu1+V`7vE9c{xJ6ZB%1aP9tXDg7|_Z>WFLTl@y?D@g=72#V#S8(NStgt0> zG75_ey7mR(hamaLYRFe2fTJTHRxSnmIJENlfwvr=0X<24XVn6@s9OUiUB5x#T8g6_ ihgJ@?%Sn7AZu<}KI0Eyw23Owz0000Actions/Advanced.png Actions/Service.png + + Boxes/sandbox-b-empty.png + Boxes/sandbox-b-full.png + Boxes/sandbox-c-empty.png + Boxes/sandbox-c-full.png + Boxes/sandbox-g-empty.png + Boxes/sandbox-g-full.png + Boxes/sandbox-m-empty.png + Boxes/sandbox-m-full.png + Boxes/sandbox-r-empty.png + Boxes/sandbox-r-full.png + Boxes/sandbox-y-empty.png + Boxes/sandbox-y-full.png + Boxes/sandbox-o-empty.png + Boxes/sandbox-o-full.png + diff --git a/SandboxiePlus/SandMan/SandMan.cpp b/SandboxiePlus/SandMan/SandMan.cpp index 3fe6ec6c..85f41cbc 100644 --- a/SandboxiePlus/SandMan/SandMan.cpp +++ b/SandboxiePlus/SandMan/SandMan.cpp @@ -10,7 +10,7 @@ #include "./Dialogs/MultiErrorDialog.h" #include "../QSbieAPI/SbieUtils.h" -CSbieAPI* theAPI = NULL; +CSbiePlusAPI* theAPI = NULL; #if defined(Q_OS_WIN) #include @@ -67,6 +67,8 @@ public: HWND MainWndHandle = NULL; #endif +CSandMan* theGUI = NULL; + CSandMan::CSandMan(QWidget *parent) : QMainWindow(parent) { @@ -76,9 +78,11 @@ CSandMan::CSandMan(QWidget *parent) QApplication::instance()->installNativeEventFilter(new CNativeEventFilter); #endif + theGUI = this; + m_bExit = false; - theAPI = new CSbieAPI(this); + theAPI = new CSbiePlusAPI(this); connect(theAPI, SIGNAL(StatusChanged()), this, SLOT(OnStatusChanged())); QString appTitle = tr("Sandboxie-Plus v%1").arg(GetVersion()); @@ -327,23 +331,25 @@ CSandMan::CSandMan(QWidget *parent) m_pPanelSplitter->restoreState(theConf->GetBlob("MainWindow/Panel_Splitter")); m_pLogTabs->setCurrentIndex(theConf->GetInt("GUI/LogTab", 0)); + if (theConf->GetBool("Options/NoStatusBar", false)) + statusBar()->hide(); + else if (theConf->GetBool("Options/NoSizeGrip", false)) + statusBar()->setSizeGripEnabled(false); bool bIsMonitoring = theAPI->IsMonitoring(); m_pResourceLog->setEnabled(bIsMonitoring); m_pEnableMonitoring->setChecked(bIsMonitoring); - m_pKeepTerminated->setChecked(theConf->GetBool("Options/pKeepTerminated")); + m_pKeepTerminated->setChecked(theConf->GetBool("Options/KeepTerminated")); + m_pProgressDialog = new CProgressDialog("Maintenance operation progress...", this); + m_pProgressDialog->setWindowModality(Qt::ApplicationModal); connect(theAPI, SIGNAL(LogMessage(const QString&)), this, SLOT(OnLogMessage(const QString&))); if (CSbieUtils::IsRunning(CSbieUtils::eAll) || theConf->GetBool("Options/StartIfStopped", true)) ConnectSbie(); - if (theConf->GetBool("Options/WatchIni", true)) - theAPI->WatchIni(); - - m_uTimerID = startTimer(250); } @@ -366,6 +372,8 @@ CSandMan::~CSandMan() theConf->SetValue("GUI/LogTab", m_pLogTabs->currentIndex()); theAPI = NULL; + + theGUI = NULL; } void CSandMan::OnExit() @@ -457,6 +465,7 @@ void CSandMan::OnMessage(const QString& Message) if (m_bConnectPending) theAPI->Connect(true); } + m_pProgressDialog->hide(); m_bConnectPending = false; m_bStopPending = false; } @@ -536,10 +545,15 @@ void CSandMan::OnStatusChanged() OnLogMessage(tr("Sbie Directory: %1").arg(theAPI->GetSbiePath())); OnLogMessage(tr("Loaded Config: %1").arg(theAPI->GetIniPath())); + + if (theConf->GetBool("Options/WatchIni", true)) + theAPI->WatchIni(true); } else { appTitle.append(tr(" - Driver NOT connected").arg(theAPI->GetVersion())); + + theAPI->WatchIni(false); } this->setWindowTitle(appTitle); } @@ -716,6 +730,7 @@ void CSandMan::OnMaintenance() if (Status.GetStatus() == OP_ASYNC) { statusBar()->showMessage(tr("Executing maintenance operation, please wait...")); + m_pProgressDialog->show(); return; } @@ -739,7 +754,7 @@ void CSandMan::OnCleanUp() void CSandMan::OnSetKeep() { - theConf->SetValue("Options/pKeepTerminated", m_pKeepTerminated->isChecked()); + theConf->SetValue("Options/KeepTerminated", m_pKeepTerminated->isChecked()); } void CSandMan::OnEditIni() diff --git a/SandboxiePlus/SandMan/SandMan.h b/SandboxiePlus/SandMan/SandMan.h index dff98bfa..06fb9f66 100644 --- a/SandboxiePlus/SandMan/SandMan.h +++ b/SandboxiePlus/SandMan/SandMan.h @@ -5,15 +5,17 @@ #include "../MiscHelpers/Common/Settings.h" #include "../MiscHelpers/Common/TreeViewEx.h" #include "../MiscHelpers/Common/PanelView.h" +#include "../MiscHelpers/Common/ProgressDialog.h" #include "Models/ResMonModel.h" #define VERSION_MJR 0 #define VERSION_MIN 2 -#define VERSION_REV 0 +#define VERSION_REV 1 #define VERSION_UPD 0 -#include "../QSbieAPI/SbieAPI.h" +//#include "../QSbieAPI/SbieAPI.h" +#include "SbiePlusAPI.h" class CSbieView; class CApiLog; @@ -26,6 +28,8 @@ public: CSandMan(QWidget *parent = Q_NULLPTR); virtual ~CSandMan(); + CProgressDialog* GetProgressDialog() { return m_pProgressDialog; } + static QString GetVersion(); static void CheckResults(QList Results); @@ -145,4 +149,8 @@ private: bool m_bIconEmpty; bool m_bExit; + + CProgressDialog* m_pProgressDialog; }; + +extern CSandMan* theGUI; \ No newline at end of file diff --git a/SandboxiePlus/SandMan/SandMan.vcxproj b/SandboxiePlus/SandMan/SandMan.vcxproj index f081bead..232e5294 100644 --- a/SandboxiePlus/SandMan/SandMan.vcxproj +++ b/SandboxiePlus/SandMan/SandMan.vcxproj @@ -197,6 +197,7 @@ + Create Create @@ -213,6 +214,7 @@ + diff --git a/SandboxiePlus/SandMan/SandMan.vcxproj.filters b/SandboxiePlus/SandMan/SandMan.vcxproj.filters index 5ad8c298..a237d557 100644 --- a/SandboxiePlus/SandMan/SandMan.vcxproj.filters +++ b/SandboxiePlus/SandMan/SandMan.vcxproj.filters @@ -61,6 +61,9 @@ Dialogs + + SandMan + @@ -89,6 +92,9 @@ Dialogs + + SandMan + diff --git a/SandboxiePlus/SandMan/SbiePlusAPI.cpp b/SandboxiePlus/SandMan/SbiePlusAPI.cpp new file mode 100644 index 00000000..c9ad6893 --- /dev/null +++ b/SandboxiePlus/SandMan/SbiePlusAPI.cpp @@ -0,0 +1,47 @@ +#include "stdafx.h" +#include "SbiePlusAPI.h" + + +CSbiePlusAPI::CSbiePlusAPI(QObject* parent) : CSbieAPI(parent) +{ + +} + +CSbiePlusAPI::~CSbiePlusAPI() +{ +} + +CSandBox* CSbiePlusAPI::NewSandBox(const QString& BoxName, class CSbieAPI* pAPI) +{ + return new CSandBoxPlus(BoxName, pAPI); +} + +CBoxedProcess* CSbiePlusAPI::NewBoxedProcess(quint64 ProcessId, class CSandBox* pBox) +{ + return new CBoxedProcess(ProcessId, pBox); +} + + +/////////////////////////////////////////////////////////////////////////////// +// CSandBox +// + +CSandBoxPlus::CSandBoxPlus(const QString& BoxName, class CSbieAPI* pAPI) : CSandBox(BoxName, pAPI) +{ + m_bLogApiFound = false; + m_bIsOpenBox = false; +} + +CSandBoxPlus::~CSandBoxPlus() +{ +} + +void CSandBoxPlus::UpdateDetails() +{ + QStringList List = GetTextList("OpenPipePath"); + m_bLogApiFound = List.contains("\\Device\\NamedPipe\\LogAPI"); + + m_bIsOpenBox = GetBool("OpenToken") || GetBool("UnrestrictedToken") || GetBool("UnfilteredToken") || GetBool("OriginalToken"); + + CSandBox::UpdateDetails(); +} \ No newline at end of file diff --git a/SandboxiePlus/SandMan/SbiePlusAPI.h b/SandboxiePlus/SandMan/SbiePlusAPI.h new file mode 100644 index 00000000..23a72bdf --- /dev/null +++ b/SandboxiePlus/SandMan/SbiePlusAPI.h @@ -0,0 +1,40 @@ +#pragma once + +#include "../QSbieAPI/SbieAPI.h" + + +class CSbiePlusAPI : public CSbieAPI +{ + Q_OBJECT +public: + CSbiePlusAPI(QObject* parent); + virtual ~CSbiePlusAPI(); + + +protected: + virtual CSandBox* NewSandBox(const QString& BoxName, class CSbieAPI* pAPI); + virtual CBoxedProcess* NewBoxedProcess(quint64 ProcessId, class CSandBox* pBox); + +}; + +/////////////////////////////////////////////////////////////////////////////// +// CSandBox +// + +class CSandBoxPlus : public CSandBox +{ + Q_OBJECT +public: + CSandBoxPlus(const QString& BoxName, class CSbieAPI* pAPI); + virtual ~CSandBoxPlus(); + + virtual void UpdateDetails(); + + virtual bool HasLogApi() const { return m_bLogApiFound; } + virtual bool IsOpenBox() const { return m_bIsOpenBox; } + +protected: + bool m_bLogApiFound; + bool m_bIsOpenBox; + +}; \ No newline at end of file diff --git a/SandboxiePlus/SandMan/Views/SbieView.cpp b/SandboxiePlus/SandMan/Views/SbieView.cpp index 59e27176..44e45886 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.cpp +++ b/SandboxiePlus/SandMan/Views/SbieView.cpp @@ -168,8 +168,15 @@ void CSbieView::OnSandBoxAction() if (QMessageBox("Sandboxie-Plus", tr("Do you really want delete teh content of the sellected sandboxes?"), QMessageBox::Warning, QMessageBox::Yes, QMessageBox::No | QMessageBox::Default | QMessageBox::Escape, QMessageBox::NoButton).exec() != QMessageBox::Yes) return; + theGUI->GetProgressDialog()->show(); + + m_BoxesToClean = 0; foreach(const CSandBoxPtr& pBox, SandBoxes) + { + m_BoxesToClean++; Results.append(pBox->CleanBox()); + connect(pBox.data(), SIGNAL(BoxCleaned()), this, SLOT(OnBoxCleaned())); + } } else if (Action == m_pMenuEmptyBox) { @@ -180,6 +187,14 @@ void CSbieView::OnSandBoxAction() CSandMan::CheckResults(Results); } +void CSbieView::OnBoxCleaned() +{ + disconnect(sender(), SIGNAL(BoxCleaned()), this, SLOT(OnBoxCleaned())); + + if(--m_BoxesToClean <= 0) + theGUI->GetProgressDialog()->hide(); +} + void CSbieView::OnProcessAction() { QList Results; diff --git a/SandboxiePlus/SandMan/Views/SbieView.h b/SandboxiePlus/SandMan/Views/SbieView.h index bcb1b625..574fcbb1 100644 --- a/SandboxiePlus/SandMan/Views/SbieView.h +++ b/SandboxiePlus/SandMan/Views/SbieView.h @@ -24,6 +24,8 @@ private slots: void OnSandBoxAction(); void OnProcessAction(); + void OnBoxCleaned(); + protected: virtual void OnMenu(const QPoint& Point); virtual QTreeView* GetView() { return m_pSbieTree; } @@ -52,4 +54,6 @@ private: QAction* m_pMenuSuspend; QAction* m_pMenuResume; int m_iMenuProc; + + int m_BoxesToClean; }; \ No newline at end of file diff --git a/SandboxiePlus/SandMan/main.cpp b/SandboxiePlus/SandMan/main.cpp index 388eb1c4..825baf67 100644 --- a/SandboxiePlus/SandMan/main.cpp +++ b/SandboxiePlus/SandMan/main.cpp @@ -4,13 +4,33 @@ #include "../QSbieAPI/SbieAPI.h" #include "../QtSingleApp/src/qtsingleapplication.h" #include "../QSbieAPI/SbieUtils.h" +#include "../MiscHelpers/Common/qRC4.h" +#include "../MiscHelpers/Common/Common.h" +#include CSettings* theConf = NULL; +void PackDriver(); +void UnPackDrivers(); + int main(int argc, char *argv[]) { +#ifdef Q_OS_WIN + SetProcessDPIAware(); +#endif // Q_OS_WIN + + //QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + //QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling); + QtSingleApplication app(argc, argv); + //InitConsole(false); + if (app.arguments().contains("-rc4")) + { + PackDriver(); + return 0; + } + SB_STATUS Status = CSbieUtils::DoAssist(); if (Status.GetStatus()) { app.sendMessage("Status:" + Status.GetText()); @@ -22,6 +42,8 @@ int main(int argc, char *argv[]) theConf = new CSettings("Sandboxie-Plus"); + UnPackDrivers(); + //QThreadPool::globalInstance()->setMaxThreadCount(theConf->GetInt("Options/MaxThreadPool", 10)); CSandMan* pWnd = new CSandMan(); @@ -38,3 +60,118 @@ int main(int argc, char *argv[]) return ret; } + +bool TransformFile(const QString& InName, const QString& OutName, const QString& Key = "default_key") +{ + QFile InFile(InName); + QFile OutFile(OutName); + if (InFile.open(QIODevice::ReadOnly)) + { + if (OutFile.open(QIODevice::WriteOnly)) + { + rc4_sbox_s sbox; + rc4_init(&sbox, Key.toLatin1()); + OutFile.write(rc4_transform(&sbox, InFile.readAll())); + OutFile.flush(); + return true; + } + } + return false; +} + +bool TestFile(const QString& OutName) +{ + QThread::sleep(3); + return QFile::exists(OutName); +} + +void PackDriver() +{ + int pos = QCoreApplication::arguments().indexOf("-rc4"); + QString InName = QCoreApplication::arguments().at(pos + 1); + QString OutName = InName; + if (OutName.right(4) == ".rc4") + OutName.truncate(OutName.length() - 4); + else + OutName.append(".rc4"); + + if (TransformFile(InName, OutName)) + printf("success\r\n"); + else + printf("failed\r\n"); +} + +bool NotifyCert() +{ + QString Caption = QObject::tr( + "

Important Notie

" + ); + QString Text = QObject::tr( + "

Sandboxie requires a driver to operate (SbieDrv.sys), Windows however denies loading a driver file that has not been digitally signed using an expensive EV-Code Signing Certificate. " + "Such certificates cost upwards of 1000$ per year!

" + "

Luckily brave hackers have Leaked a few of these Certificates over the years, one of them was found by the author of this software and put to good use.

" + "

Unfortunately, such certificates have been abused by malware authors resulting in many Anti Malware Fools being Lazy and flagging Everything signed with them Wrongfully as Malware. " + "This Prejudice is Damaging the Open Source Ecosystem as most nonprofit developers can't afford to waste this kind of money every year only to pay that Windows Kernel \"Tax\".

" + "

Therefore, the required driver is provided in an obfuscated form and before use must be unpacked. " + "When doing so said said Anti Virus Ass's will complain and attempt to destroy the freshly created file. " + "Please be aware that this is a false positive caused by the necessary use of a compromitted certificate. " + "If this happens you will be notified and offered the option to repeat the unpacking operation, for the operation to succeed you will need to configure an aproproate exemption.

" + + "

" + "

If you want the project to obtain a genuine EV-Code Signing Certificate please visit the Homepage and please donate.

" + "

" + + "

If you want to proceed with the unpacking of the driver pres YES.

" + ); + QMessageBox *msgBox = new QMessageBox(NULL); + msgBox->setAttribute(Qt::WA_DeleteOnClose); + msgBox->setWindowTitle("Sandboxie-Plus"); + msgBox->setText(Caption); + msgBox->setInformativeText(Text); + msgBox->setStandardButtons(QMessageBox::Yes); + msgBox->addButton(QMessageBox::No); + msgBox->setDefaultButton(QMessageBox::Yes); + + QIcon ico(QLatin1String(":/SandMan.png")); + msgBox->setIconPixmap(ico.pixmap(64, 64)); + + return msgBox->exec() == QMessageBox::Yes; +} + +void UnPackDrivers() +{ + bool notifyNotOk = false; + QDir appDir(QApplication::applicationDirPath()); + foreach(const QString& FileName, appDir.entryList(QStringList("*.sys.rc4"), QDir::Files)) + { + QString InName = QApplication::applicationDirPath() + "/" + FileName; + QString OutName = InName.mid(0, InName.length() - 4); + + QFileInfo InInfo(InName); + QFileInfo OutInfo(OutName); + if (InInfo.size() != OutInfo.size() || InInfo.lastModified() > OutInfo.lastModified()) + { + if (theConf->GetBool("Options/NotifyUnPack", true)) { + if (!NotifyCert()) { + notifyNotOk = true; + break; + } + theConf->SetValue("Options/NotifyUnPack", false); + } + + retry: + if (!TransformFile(InName, OutName)) + QMessageBox::warning(NULL, "Sandboxie-Plus", QObject::tr("Failed to decrypt %1 ensure app directory is writable.").arg(FileName)); + else if (!TestFile(OutName)) + { + if (QMessageBox("Sandboxie-Plus", + QObject::tr("The decrypted file %1 seam to have been removed. Retry file extraction?").arg(FileName), + QMessageBox::Information, QMessageBox::Yes | QMessageBox::Default, QMessageBox::Cancel, QMessageBox::NoButton).exec() == QMessageBox::Yes) + goto retry; + notifyNotOk = true; + } + } + } + if (notifyNotOk) + QMessageBox::warning(NULL, "Sandboxie-Plus", QObject::tr("Without the Driver Sandboxie-Plus wont be able to run properly.")); +} \ No newline at end of file diff --git a/SandboxiePlus/SandMan/stdafx.h b/SandboxiePlus/SandMan/stdafx.h index 99e826a6..9a4bac2c 100644 --- a/SandboxiePlus/SandMan/stdafx.h +++ b/SandboxiePlus/SandMan/stdafx.h @@ -133,4 +133,4 @@ using namespace std; #define USE_QEXTWIDGETS extern class CSettings* theConf; -extern class CSbieAPI* theAPI; \ No newline at end of file +extern class CSbiePlusAPI* theAPI; \ No newline at end of file