This commit is contained in:
DavidXanatos 2022-05-15 12:27:33 +02:00
parent 829e6f305d
commit d493e9ed99
9 changed files with 73 additions and 29 deletions

View File

@ -15,7 +15,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [1.0.22 / 5.55.22] - 2022-05-xx
### Added
- added auto update download and silent install option to sandman.exe
- added auto update download and silent install option to sandman.exe [#917](https://github.com/sandboxie-plus/Sandboxie/issues/917)
- trace monitor mode can now also save to file [#1851](https://github.com/sandboxie-plus/Sandboxie/issues/1851)
- trace log now shows ipc object type information
### Fixed
- fixed sandman crash issue [#1846](https://github.com/sandboxie-plus/Sandboxie/issues/1846)

View File

@ -1062,7 +1062,15 @@ _FX NTSTATUS Ipc_CheckGenericObject(
}
RtlStringCbPrintfW(access_str, sizeof(access_str), L"(I%c) %08X", letter, GrantedAccess);
Log_Debug_Msg(mon_type, access_str, Name->Buffer);
//Log_Debug_Msg(mon_type, access_str, Name->Buffer);
if (Session_MonitorCount) {
POBJECT_TYPE ObjectType = pObGetObjectType(Object);
const WCHAR* strings[4] = { Name->Buffer, access_str, ObjectType ? ObjectType->Name.Buffer : NULL, NULL };
Session_MonitorPutEx(mon_type, strings, NULL, PsGetCurrentProcessId(), PsGetCurrentThreadId());
}
}
}

View File

@ -706,6 +706,9 @@ _FX NTSTATUS Session_Api_MonitorPut2(PROCESS *proc, ULONG64 *parms)
ULONG log_type;
WCHAR *log_data;
WCHAR *name;
const WCHAR *type_pipe = L"Pipe";
const WCHAR *type_file = L"File";
const WCHAR *type_name = NULL;
NTSTATUS status;
ULONG log_len;
@ -783,8 +786,10 @@ _FX NTSTATUS Session_Api_MonitorPut2(PROCESS *proc, ULONG64 *parms)
Obj_ObjectTypes[i], KernelMode, NULL,
&object);
if (status != STATUS_OBJECT_TYPE_MISMATCH)
if (status != STATUS_OBJECT_TYPE_MISMATCH) {
type_name = Obj_ObjectTypes[i]->Name.Buffer;
break;
}
}
// DbgPrint("IPC Status = %08X Object = %08X for Open <%S>\n", status, object, name);
@ -795,7 +800,7 @@ _FX NTSTATUS Session_Api_MonitorPut2(PROCESS *proc, ULONG64 *parms)
// to get the name assigned to it at time of creation
//
if ((log_type & MONITOR_TYPE_MASK) == MONITOR_PIPE) {
else if ((log_type & MONITOR_TYPE_MASK) == MONITOR_PIPE) {
OBJECT_ATTRIBUTES objattrs;
IO_STATUS_BLOCK IoStatusBlock;
@ -834,6 +839,8 @@ _FX NTSTATUS Session_Api_MonitorPut2(PROCESS *proc, ULONG64 *parms)
status = STATUS_OBJECT_NAME_NOT_FOUND;
}
type_name = type_pipe;
//DbgPrint("PIPE Status3 = %08X Object = %08X for Open <%S>\n", status, object, name);
}
@ -885,7 +892,7 @@ _FX NTSTATUS Session_Api_MonitorPut2(PROCESS *proc, ULONG64 *parms)
name[1] = L'\0';
}*/
const WCHAR* strings[2] = { name, NULL };
const WCHAR* strings[4] = { name, L"", type_name, NULL };
Session_MonitorPutEx(log_type | MONITOR_USER, strings, NULL, proc->pid, PsGetCurrentThreadId());
}

View File

@ -143,7 +143,7 @@ void CPanelView::RecursiveCopyPanel(const QModelIndex& ModelIndex, QList<QString
}
}
void CPanelView::OnCopyPanel()
QList<QStringList> CPanelView::DumpPanel()
{
QAbstractItemModel* pModel = GetModel();
@ -153,7 +153,13 @@ void CPanelView::OnCopyPanel()
QModelIndex ModelIndex = pModel->index(i, 0);
RecursiveCopyPanel(ModelIndex, Rows);
}
FormatAndCopy(Rows);
return Rows;
}
void CPanelView::OnCopyPanel()
{
FormatAndCopy(DumpPanel());
}
void CPanelView::FormatAndCopy(QList<QStringList> Rows, bool Headder)

View File

@ -14,6 +14,8 @@ public:
static void SetMaxCellWidth(int iMaxWidth) { m_MaxCellWidth = iMaxWidth; }
static void SetCellSeparator(const QString& Sep) { m_CellSeparator = Sep; }
virtual QList<QStringList> DumpPanel();
static QString m_CopyCell;
static QString m_CopyRow;
static QString m_CopyPanel;

View File

@ -65,6 +65,7 @@ CTraceEntry::CTraceEntry(quint32 ProcessId, quint32 ThreadId, quint32 Type, cons
m_ThreadId = ThreadId;
m_Name = LogData.length() > 0 ? LogData.at(0) : QString("(empty)");
m_Message = LogData.length() > 1 ? LogData.at(1) : QString();
m_SubType = LogData.length() > 2 ? LogData.at(2) : QString();
m_Type.Flags = Type;
m_TimeStamp = QDateTime::currentDateTime(); // ms resolution
@ -136,6 +137,9 @@ QString CTraceEntry::GetTypeStr() const
if(Type.isEmpty())
Type = "Unknown: " + QString::number(m_Type.Type);
if(!m_SubType.isEmpty())
Type.append("/" + m_SubType);
if (m_Type.User)
Type.append(" (U)");
else

View File

@ -67,6 +67,7 @@ public:
protected:
QString m_Name;
QString m_Message;
QString m_SubType;
quint32 m_ProcessId;
quint32 m_ThreadId;
QDateTime m_TimeStamp;

View File

@ -361,9 +361,15 @@ bool CSbieUtils::CreateShortcut(CSbieAPI* pApi, QString LinkPath, const QString
QString StartArgs;
if (bRunElevated)
StartArgs += "/elevated ";
StartArgs += "/box:" + boxname;
if (!arguments.isEmpty())
StartArgs += " \"" + arguments + "\"";
if (!boxname.isEmpty())
StartArgs += "/box:" + boxname;
if (!arguments.isEmpty()) {
if (!StartArgs.isEmpty()) StartArgs += " ";
if(arguments.contains(" "))
StartArgs += "\"" + arguments + "\"";
else
StartArgs += arguments;
}
IUnknown *pUnknown;
HRESULT hr = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC, IID_IUnknown, (void **)&pUnknown);
@ -381,7 +387,7 @@ bool CSbieUtils::CreateShortcut(CSbieAPI* pApi, QString LinkPath, const QString
if (!workdir.isEmpty())
pShellLink->SetWorkingDirectory(workdir.toStdWString().c_str());
if (!LinkName.isEmpty()) {
QString desc = QString("%1 [%2]").arg(LinkName).arg(boxname);
QString desc = QString("%1 [%2]").arg(LinkName).arg(boxname.isEmpty() ? "DefaultBox" : boxname);
pShellLink->SetDescription(desc.toStdWString().c_str());
}

View File

@ -455,7 +455,6 @@ void CTraceView::OnSetMode()
m_pTraceTree->setEnabled(!m_pMonitorMode->isChecked());
m_pTraceStatus->setEnabled(!m_pMonitorMode->isChecked());
m_pSaveToFile->setEnabled(!m_pMonitorMode->isChecked());
m_FullRefresh = true;
@ -556,27 +555,36 @@ void CTraceView::SaveToFile()
return;
}
QVector<CTraceEntryPtr> ResourceLog = theAPI->GetTrace();
for (int i = 0; i < ResourceLog.count(); i++)
if (m_pMonitorMode->isChecked())
{
CTraceEntryPtr pEntry = ResourceLog.at(i);
QList<QStringList> Rows = m_pMonitor->DumpPanel();
foreach(const QStringList& Row, Rows)
File.write(Row.join("\t").toLatin1() + "\n");
}
else
{
QVector<CTraceEntryPtr> 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;
//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->GetName());
Line.append(pEntry->GetMessage());
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->GetName());
Line.append(pEntry->GetMessage());
File.write(Line.join("\t").toLatin1() + "\n");
File.write(Line.join("\t").toLatin1() + "\n");
}
}
File.close();