diff --git a/Sandboxie/common/my_version.h b/Sandboxie/common/my_version.h index eb5983dd..8b09b8e9 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,53,0 -#define MY_VERSION_STRING "5.53.0" +#define MY_VERSION_BINARY 5,53,1 +#define MY_VERSION_STRING "5.53.1" #define MY_VERSION_COMPAT "5.53.0" // this refers to the driver ABI compatibility // These #defines are used by either Resource Compiler, or by NSIC installer diff --git a/Sandboxie/core/dll/gui.c b/Sandboxie/core/dll/gui.c index d57ad8f9..01683f54 100644 --- a/Sandboxie/core/dll/gui.c +++ b/Sandboxie/core/dll/gui.c @@ -1311,7 +1311,7 @@ _FX HWND Gui_CreateWindowExW( TlsData->gui_hooks_installed = TRUE; } - Taskbar_SetProcessAppUserModelId(); + //Taskbar_SetProcessAppUserModelId(); } hwndResult = __sys_CreateWindowExW( @@ -1419,7 +1419,7 @@ _FX HWND Gui_CreateWindowExA( TlsData->gui_hooks_installed = TRUE; } - Taskbar_SetProcessAppUserModelId(); + //Taskbar_SetProcessAppUserModelId(); } hwndResult = __sys_CreateWindowExA( diff --git a/Sandboxie/core/dll/taskbar.c b/Sandboxie/core/dll/taskbar.c index 2791e272..8e7e8e65 100644 --- a/Sandboxie/core/dll/taskbar.c +++ b/Sandboxie/core/dll/taskbar.c @@ -499,49 +499,50 @@ _FX WCHAR *Taskbar_CreateAppUserModelId(const WCHAR *AppId) // Taskbar_SetProcessAppUserModelId //--------------------------------------------------------------------------- + //extern ULONG Dll_Windows; -_FX void Taskbar_SetProcessAppUserModelId(void) -{ - static BOOLEAN _done = FALSE; - - P_SetCurrentProcessExplicitAppUserModelID - SetCurrentProcessExplicitAppUserModelID; - - if ((Dll_OsBuild < 7600) || (! Dll_InitComplete)) - return; - - if (Taskbar_SavedAppUserModelId || _done) - return; - - // - // make sure the necessary function from shell32 is available - // -// if(Dll_Windows < 10) { - SetCurrentProcessExplicitAppUserModelID = - (P_SetCurrentProcessExplicitAppUserModelID) Ldr_GetProcAddrNew(DllName_shell32, L"SetCurrentProcessExplicitAppUserModelID","SetCurrentProcessExplicitAppUserModelID"); - - // } - /* - else { - - SetCurrentProcessExplicitAppUserModelID = (P_SetCurrentProcessExplicitAppUserModelID) - GetProcAddress(LoadLibraryW(DllName_shell32),"SetCurrentProcessExplicitAppUserModelID"); - } - */ - if (! SetCurrentProcessExplicitAppUserModelID) - return; - - // - // override AppUserModelId - // - - _done = TRUE; - - if (Taskbar_ShouldOverrideAppUserModelId()) { - - SetCurrentProcessExplicitAppUserModelID(Dll_ImageName); - } -} +//_FX void Taskbar_SetProcessAppUserModelId(void) +//{ +// static BOOLEAN _done = FALSE; +// +// P_SetCurrentProcessExplicitAppUserModelID +// SetCurrentProcessExplicitAppUserModelID; +// +// if ((Dll_OsBuild < 7600) || (! Dll_InitComplete)) +// return; +// +// if (Taskbar_SavedAppUserModelId || _done) +// return; +// +// // +// // make sure the necessary function from shell32 is available +// // +//// if(Dll_Windows < 10) { +// SetCurrentProcessExplicitAppUserModelID = +// (P_SetCurrentProcessExplicitAppUserModelID) Ldr_GetProcAddrNew(DllName_shell32, L"SetCurrentProcessExplicitAppUserModelID","SetCurrentProcessExplicitAppUserModelID"); +// +// // } +// /* +// else { +// +// SetCurrentProcessExplicitAppUserModelID = (P_SetCurrentProcessExplicitAppUserModelID) +// GetProcAddress(LoadLibraryW(DllName_shell32),"SetCurrentProcessExplicitAppUserModelID"); +// } +// */ +// if (! SetCurrentProcessExplicitAppUserModelID) +// return; +// +// // +// // override AppUserModelId +// // +// +// _done = TRUE; +// +// if (Taskbar_ShouldOverrideAppUserModelId()) { +// +// SetCurrentProcessExplicitAppUserModelID(Dll_ImageName); +// } +//} //--------------------------------------------------------------------------- @@ -590,9 +591,15 @@ _FX void Taskbar_SetWindowAppUserModelId(HWND hwnd) // set explicit AppUserModelID for the window // + // Note: without the right value we may end up with multiple window groups + // so don't do anythign if we dont have Taskbar_SavedAppUserModelId + // see also disabled Taskbar_SetProcessAppUserModelId + if (!Taskbar_SavedAppUserModelId) + return; + AppId = Taskbar_SavedAppUserModelId; - if (! AppId) - AppId = Dll_ImageName; + //if (! AppId) + // AppId = Dll_ImageName; v.vt = VT_BSTR; v.bstrVal = Taskbar_AllocBSTR(AppId); diff --git a/Sandboxie/core/dll/taskbar.h b/Sandboxie/core/dll/taskbar.h index efdcbb55..1649d331 100644 --- a/Sandboxie/core/dll/taskbar.h +++ b/Sandboxie/core/dll/taskbar.h @@ -31,7 +31,7 @@ BOOLEAN Taskbar_Init(HMODULE); -void Taskbar_SetProcessAppUserModelId(void); +//void Taskbar_SetProcessAppUserModelId(void); void Taskbar_SetWindowAppUserModelId(HWND hwnd); diff --git a/Sandboxie/core/svc/sbieiniserver.cpp b/Sandboxie/core/svc/sbieiniserver.cpp index 19daa864..f3ef054b 100644 --- a/Sandboxie/core/svc/sbieiniserver.cpp +++ b/Sandboxie/core/svc/sbieiniserver.cpp @@ -830,21 +830,8 @@ ULONG SbieIniServer::CacheConfig() if (hFile == INVALID_HANDLE_VALUE) { DWORD err = GetLastError(); - if (err == ERROR_FILE_NOT_FOUND) { - - m_pConfigIni = new SConfigIni; - m_pConfigIni->Encoding = 0; - - // set a ini header with a descriptive comment - m_pConfigIni->Sections.push_back(SIniSection{ L"" }); - m_pConfigIni->Sections.back().Entries.push_back(SIniEntry{ L"", L"#" }); - m_pConfigIni->Sections.back().Entries.push_back(SIniEntry{ L"", L"# Sandboxie-Plus configuration file" }); - m_pConfigIni->Sections.back().Entries.push_back(SIniEntry{ L"", L"#" }); - - m_pConfigIni->Sections.push_back(SIniSection{ L"GlobalSettings" }); - + if (err == ERROR_FILE_NOT_FOUND) status = STATUS_SUCCESS; // the file does not exist that's ok - } else SbieApi_LogEx(m_session_id, 2322, L"[23 / %d]", err); goto finish; @@ -855,7 +842,7 @@ ULONG SbieIniServer::CacheConfig() // LARGE_INTEGER fileSize; - if (!GetFileSizeEx(hFile, &fileSize) || fileSize.QuadPart >= CONF_LINE_LEN * CONF_MAX_LINES) { + if (!GetFileSizeEx(hFile, &fileSize) || fileSize.QuadPart >= CONF_LINE_LEN * 2 * CONF_MAX_LINES) { status = STATUS_INSUFFICIENT_RESOURCES; SbieApi_LogEx(m_session_id, 2322, L"[24 / %d]", status); goto finish; @@ -940,6 +927,20 @@ finish: HeapFree(GetProcessHeap(), 0, IniPath); + if (NT_SUCCESS(status) && m_pConfigIni == NULL) { + + m_pConfigIni = new SConfigIni; + m_pConfigIni->Encoding = 0; + + // set a ini header with a descriptive comment + m_pConfigIni->Sections.push_back(SIniSection{ L"" }); + m_pConfigIni->Sections.back().Entries.push_back(SIniEntry{ L"", L"#" }); + m_pConfigIni->Sections.back().Entries.push_back(SIniEntry{ L"", L"# Sandboxie-Plus configuration file" }); + m_pConfigIni->Sections.back().Entries.push_back(SIniEntry{ L"", L"#" }); + + m_pConfigIni->Sections.push_back(SIniSection{ L"GlobalSettings" }); + } + return status; } diff --git a/SandboxiePlus/QSbieAPI/SbieAPI.cpp b/SandboxiePlus/QSbieAPI/SbieAPI.cpp index 9a1bc6f9..9ceecc82 100644 --- a/SandboxiePlus/QSbieAPI/SbieAPI.cpp +++ b/SandboxiePlus/QSbieAPI/SbieAPI.cpp @@ -1195,7 +1195,7 @@ QString CSbieAPI::SbieIniGet(const QString& Section, const QString& Setting, qui WCHAR out_buffer[CONF_LINE_LEN] = { 0 }; - __declspec(align(8)) UNICODE_STRING64 Output = { 0, CONF_LINE_LEN - 4 , (ULONG64)out_buffer }; + __declspec(align(8)) UNICODE_STRING64 Output = { 0, sizeof(out_buffer) - 4 , (ULONG64)out_buffer }; __declspec(align(8)) ULONG64 parms[API_NUM_ARGS]; memset(parms, 0, sizeof(parms)); diff --git a/SandboxiePlus/SandMan/Resources/Actions/all.png b/SandboxiePlus/SandMan/Resources/Actions/all.png new file mode 100644 index 00000000..6210b576 Binary files /dev/null and b/SandboxiePlus/SandMan/Resources/Actions/all.png differ diff --git a/SandboxiePlus/SandMan/Resources/Actions/save.png b/SandboxiePlus/SandMan/Resources/Actions/save.png new file mode 100644 index 00000000..634b362e Binary files /dev/null and b/SandboxiePlus/SandMan/Resources/Actions/save.png differ diff --git a/SandboxiePlus/SandMan/Resources/SandMan.qrc b/SandboxiePlus/SandMan/Resources/SandMan.qrc index 71ef08a3..3fcff942 100644 --- a/SandboxiePlus/SandMan/Resources/SandMan.qrc +++ b/SandboxiePlus/SandMan/Resources/SandMan.qrc @@ -63,6 +63,8 @@ Actions/Duplicate.png Actions/Up.png Actions/Down.png + Actions/All.png + Actions/Save.png Boxes/sandbox-b-empty.png diff --git a/SandboxiePlus/SandMan/Views/TraceView.cpp b/SandboxiePlus/SandMan/Views/TraceView.cpp index 8843b4e2..96cc3a66 100644 --- a/SandboxiePlus/SandMan/Views/TraceView.cpp +++ b/SandboxiePlus/SandMan/Views/TraceView.cpp @@ -103,9 +103,15 @@ CTraceView::CTraceView(QWidget* parent) : CPanelWidget(parent) connect(m_pTraceStatus, SIGNAL(currentIndexChanged(int)), this, SLOT(OnSetFilter())); m_pTraceToolBar->addWidget(m_pTraceStatus); - m_pAllBoxes = new QCheckBox(tr("Show All Boxes")); - connect(m_pAllBoxes, SIGNAL(stateChanged(int)), this, SLOT(OnSetFilter())); - m_pTraceToolBar->addWidget(m_pAllBoxes); + m_pAllBoxes = m_pTraceToolBar->addAction(CSandMan::GetIcon("All"), tr("Show All Boxes"), this, SLOT(OnSetFilter())); + m_pAllBoxes->setCheckable(true); + m_pAllBoxes->setChecked(theConf->GetBool("Options/UseLogTree")); + + m_pTraceToolBar->addSeparator(); + + m_pSaveToFile = m_pTraceToolBar->addAction(CSandMan::GetIcon("Save"), tr("Save to file"), this, SLOT(SaveToFile())); + m_pSaveToFile->setCheckable(true); + m_pSaveToFile->setChecked(theConf->GetBool("Options/UseLogTree")); m_pMainLayout->setSpacing(0); @@ -325,3 +331,37 @@ void CTraceView::OnSetFilter() } +void CTraceView::SaveToFile() +{ + QString Path = QFileDialog::getSaveFileName(this, tr("Save trace log to file"), "", QString("Log files (*.log)")).replace("/", "\\"); + + QFile File(Path); + if (!File.open(QFile::WriteOnly)) { + QMessageBox::critical(this, "Sandboxie-Plus", tr("Failed to open log file for writing")); + return; + } + + QVector ResourceLog = theAPI->GetTrace(); + for (int i = 0; i < ResourceLog.count(); i++) + { + CTraceEntryPtr pEntry = ResourceLog.at(i); + + //int iFilter = CTraceView__Filter(pEntry, this); + //if (!iFilter) + // continue; + + QStringList Line; + Line.append(pEntry->GetTimeStamp().toString("hh:mm:ss.zzz")); + QString Name = pEntry->GetProcessName(); + Line.append(Name.isEmpty() ? tr("Unknown") : Name); + Line.append(QString("%1").arg(pEntry->GetProcessId())); + Line.append(QString("%1").arg(pEntry->GetThreadId())); + Line.append(pEntry->GetTypeStr()); + Line.append(pEntry->GetStautsStr()); + Line.append(pEntry->GetMessage()); + + File.write(Line.join("\t").toLatin1() + "\n"); + } + + File.close(); +} \ No newline at end of file diff --git a/SandboxiePlus/SandMan/Views/TraceView.h b/SandboxiePlus/SandMan/Views/TraceView.h index 50e83dd6..6b8ddcf5 100644 --- a/SandboxiePlus/SandMan/Views/TraceView.h +++ b/SandboxiePlus/SandMan/Views/TraceView.h @@ -28,6 +28,8 @@ private slots: void SetFilter(const QRegExp& Exp, bool bHighLight = false, int Col = -1); // -1 = any void SelectNext(); + void SaveToFile(); + protected: friend int CTraceView__Filter(const CTraceEntryPtr& pEntry, void* params); CTraceModel* m_pTraceModel; @@ -45,10 +47,11 @@ protected: QToolBar* m_pTraceToolBar; QAction* m_pTraceTree; - QCheckBox* m_pAllBoxes; QComboBox* m_pTracePid; QComboBox* m_pTraceTid; QComboBox* m_pTraceType; QComboBox* m_pTraceStatus; + QAction* m_pAllBoxes; + QAction* m_pSaveToFile; }; \ No newline at end of file diff --git a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp index f461bb4e..320c43df 100644 --- a/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp +++ b/SandboxiePlus/SandMan/Windows/OptionsWindow.cpp @@ -597,14 +597,16 @@ void COptionsWindow::LoadIniSection() { QString Section; - /* - m_Settings = m_pBox->GetIniSection(NULL, m_Template); - - for (QList>::const_iterator I = m_Settings.begin(); I != m_Settings.end(); ++I) - Section += I->first + "=" + I->second + "\n"; - */ + // Note: the service only caches sandboxie.ini not templates. ini hence for global tempaltes we need to load the section through the driver + if (m_Template && m_pBox->GetName().mid(9, 6).compare("Local_", Qt::CaseInsensitive) != 0) + { + m_Settings = m_pBox->GetIniSection(NULL, m_Template); - Section = m_pBox->GetAPI()->SbieIniGetEx(m_pBox->GetName(), ""); + for (QList>::const_iterator I = m_Settings.begin(); I != m_Settings.end(); ++I) + Section += I->first + "=" + I->second + "\n"; + } + else + Section = m_pBox->GetAPI()->SbieIniGetEx(m_pBox->GetName(), ""); ui.txtIniSection->setPlainText(Section); } diff --git a/SandboxiePlus/version.h b/SandboxiePlus/version.h index faf774aa..858d597b 100644 --- a/SandboxiePlus/version.h +++ b/SandboxiePlus/version.h @@ -3,7 +3,7 @@ #define VERSION_MJR 0 #define VERSION_MIN 9 #define VERSION_REV 8 -#define VERSION_UPD 0 +#define VERSION_UPD 2 #ifndef STR #define STR2(X) #X