1.11.1
This commit is contained in:
parent
0ebe5845e0
commit
f357d1ce97
|
@ -18,6 +18,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||
- fixed Text cut-off in box creation wizard [#3226](https://github.com/sandboxie-plus/Sandboxie/issues/3226)
|
||||
- fixed windows 7 compatybility issue with ImBox.exe
|
||||
- fixed issue with UseNewSymlinkResolver=y
|
||||
- fixed SandMan v1.10.5-1.11.0e crashed in Vintage view [#3264](https://github.com/sandboxie-plus/Sandboxie/issues/3264)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -95,8 +95,10 @@
|
|||
|
||||
struct _FILE_DRIVE;
|
||||
struct _FILE_LINK;
|
||||
struct _FILE_GUID;
|
||||
typedef struct _FILE_LINK FILE_LINK;
|
||||
typedef struct _FILE_DRIVE FILE_DRIVE;
|
||||
typedef struct _FILE_GUID FILE_GUID;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -423,6 +423,9 @@ _FX BOOLEAN File_InitDrives(ULONG DriveMask)
|
|||
File_TempLinks = Dll_Alloc(sizeof(LIST));
|
||||
List_Init(File_TempLinks);
|
||||
|
||||
File_GuidLinks = Dll_Alloc(sizeof(LIST));
|
||||
List_Init(File_GuidLinks);
|
||||
|
||||
CallInitLinks = TRUE;
|
||||
|
||||
} else
|
||||
|
@ -702,6 +705,22 @@ _FX void File_InitLinks(THREAD_DATA *TlsData)
|
|||
MOUNTMGR_VOLUME_PATHS *Output2;
|
||||
ULONG index1;
|
||||
WCHAR save_char;
|
||||
FILE_GUID* guid;
|
||||
ULONG alloc_len;
|
||||
|
||||
//
|
||||
// cleanup old guid entries
|
||||
//
|
||||
|
||||
EnterCriticalSection(File_DrivesAndLinks_CritSec);
|
||||
guid = List_Head(File_GuidLinks);
|
||||
while (guid) {
|
||||
FILE_LINK *next_guid = List_Next(guid);
|
||||
List_Remove(File_GuidLinks, guid);
|
||||
Dll_Free(guid);
|
||||
guid = next_guid;
|
||||
}
|
||||
LeaveCriticalSection(File_DrivesAndLinks_CritSec);
|
||||
|
||||
//
|
||||
// open mount point manager device
|
||||
|
@ -757,11 +776,31 @@ _FX void File_InitLinks(THREAD_DATA *TlsData)
|
|||
ULONG VolumeNameLen =
|
||||
MountPoint->SymbolicLinkNameLength / sizeof(WCHAR);
|
||||
|
||||
WCHAR text[256];
|
||||
Sbie_snwprintf(text, 256, L"Found mountpoint: %.*s <-> %.*s", VolumeNameLen, VolumeName, DeviceNameLen, DeviceName);
|
||||
SbieApi_MonitorPut2(MONITOR_DRIVE | MONITOR_TRACE, text, FALSE);
|
||||
|
||||
if (VolumeNameLen != 48 && VolumeNameLen != 49)
|
||||
continue;
|
||||
if (_wcsnicmp(VolumeName, L"\\??\\Volume{", 11) != 0)
|
||||
continue;
|
||||
|
||||
//
|
||||
// store guid to nt device association
|
||||
//
|
||||
|
||||
alloc_len = sizeof(FILE_GUID)
|
||||
+ (VolumeNameLen + 1) * sizeof(WCHAR);
|
||||
guid = Dll_Alloc(alloc_len);
|
||||
wmemcpy(guid->guid, &VolumeName[10], 38);
|
||||
guid->guid[38] = 0;
|
||||
guid->len = DeviceNameLen;
|
||||
wmemcpy(guid->path, DeviceName, DeviceNameLen);
|
||||
guid->path[DeviceNameLen] = 0;
|
||||
EnterCriticalSection(File_DrivesAndLinks_CritSec);
|
||||
List_Insert_Before(File_GuidLinks, NULL, guid);
|
||||
LeaveCriticalSection(File_DrivesAndLinks_CritSec);
|
||||
|
||||
//
|
||||
// get all the DOS paths where the volume is mounted
|
||||
//
|
||||
|
|
|
@ -50,6 +50,15 @@ struct _FILE_LINK {
|
|||
|
||||
};
|
||||
|
||||
struct _FILE_GUID {
|
||||
|
||||
LIST_ELEM list_elem;
|
||||
WCHAR guid[38 + 1];
|
||||
ULONG len; // in characters, excluding NULL
|
||||
WCHAR path[0];
|
||||
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Functions
|
||||
|
@ -99,6 +108,7 @@ static FILE_DRIVE **File_Drives = NULL;
|
|||
|
||||
static LIST *File_PermLinks = NULL;
|
||||
static LIST *File_TempLinks = NULL;
|
||||
static LIST *File_GuidLinks = NULL;
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -248,6 +258,60 @@ _FX FILE_DRIVE *File_GetDriveForLetter(WCHAR drive_letter)
|
|||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// File_GetLinkForGuid
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
_FX FILE_GUID *File_GetLinkForGuid(const WCHAR* guid_str)
|
||||
{
|
||||
FILE_GUID *guid;
|
||||
|
||||
EnterCriticalSection(File_DrivesAndLinks_CritSec);
|
||||
|
||||
guid = List_Head(File_GuidLinks);
|
||||
while (guid) {
|
||||
if (_wcsnicmp(guid->guid, guid_str, 38) == 0)
|
||||
break;
|
||||
guid = List_Next(guid);
|
||||
}
|
||||
|
||||
if(!guid)
|
||||
LeaveCriticalSection(File_DrivesAndLinks_CritSec);
|
||||
|
||||
return guid;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// File_TranslateGuidToNtPath
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
_FX WCHAR* File_TranslateGuidToNtPath(const WCHAR* input_str)
|
||||
{
|
||||
ULONG len;
|
||||
WCHAR* NtPath;
|
||||
|
||||
if (_wcsnicmp(input_str, L"\\??\\Volume{", 11) != 0)
|
||||
return NULL;
|
||||
|
||||
FILE_GUID* guid = File_GetLinkForGuid(&input_str[10]);
|
||||
if (guid) {
|
||||
|
||||
input_str += 48;
|
||||
len = wcslen(input_str) + 1;
|
||||
NtPath = Dll_Alloc((guid->len + len) * sizeof(WCHAR));
|
||||
wmemcpy(NtPath, guid->path, guid->len);
|
||||
wmemcpy(NtPath + guid->len, input_str, len);
|
||||
|
||||
LeaveCriticalSection(File_DrivesAndLinks_CritSec);
|
||||
|
||||
return NtPath;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// File_AddLink
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -924,7 +988,9 @@ _FX FILE_LINK *File_AddTempLink(WCHAR *path)
|
|||
if (NT_SUCCESS(status)) {
|
||||
|
||||
WCHAR* input_str = reparseDataBuffer->MountPointReparseBuffer.PathBuffer;
|
||||
if (_wcsnicmp(input_str, File_BQQB, 4) == 0)
|
||||
if (_wcsnicmp(input_str, L"\\??\\Volume{", 11) == 0)
|
||||
input_str = File_TranslateGuidToNtPath(reparseDataBuffer->MountPointReparseBuffer.PathBuffer);
|
||||
else if (_wcsnicmp(input_str, File_BQQB, 4) == 0)
|
||||
input_str = File_TranslateDosToNtPath(reparseDataBuffer->MountPointReparseBuffer.PathBuffer + 4);
|
||||
|
||||
if (input_str) {
|
||||
|
|
|
@ -1117,19 +1117,23 @@ QString CSandBoxPlus::MakeBoxCommand(const QString& FileName)
|
|||
return BoxFileName.replace(m_FilePath, "%BoxRoot%", Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
QString CSandBoxPlus::GetCommandFile(const QString& Command)
|
||||
QString CSandBoxPlus::GetCommandFile(const QString& Command, QString* Arguments)
|
||||
{
|
||||
QString Path = Command;
|
||||
int End;
|
||||
if (Path.left(1) == "\"") {
|
||||
int End = Path.indexOf("\"", 1);
|
||||
End = Path.indexOf("\"", 1);
|
||||
if (End != -1) Path = Path.mid(1, End - 1);
|
||||
}
|
||||
else {
|
||||
int End = Path.indexOf(" ");
|
||||
End = Path.indexOf(" ");
|
||||
if (End != -1) Path.truncate(End);
|
||||
}
|
||||
//if (Path.left(1) == "\\")
|
||||
// Path.prepend(m_FilePath);
|
||||
|
||||
if (Arguments && End != -1) *Arguments = Command.mid(End + 1);
|
||||
|
||||
return Path.replace("%BoxRoot%", m_FilePath, Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ public:
|
|||
virtual void SetSuspendRecovery(bool bSet = true) { m_SuspendRecovery = bSet; }
|
||||
|
||||
virtual QString MakeBoxCommand(const QString& FileName);
|
||||
virtual QString GetCommandFile(const QString& Command);
|
||||
virtual QString GetCommandFile(const QString& Command, QString* Arguments = NULL);
|
||||
virtual QString GetFullCommand(const QString& Command);
|
||||
|
||||
const QSet<QString>& GetRecentPrograms() { return m_RecentPrograms; }
|
||||
|
|
|
@ -393,6 +393,8 @@ void CSbieView::CreateOldMenu()
|
|||
m_pMenuMarkForced = NULL;
|
||||
m_pMenuMarkLinger = NULL;
|
||||
m_pMenuMarkLeader = NULL;
|
||||
m_pMenuSuspend = NULL;
|
||||
m_pMenuResume = NULL;
|
||||
}
|
||||
|
||||
void CSbieView::CreateGroupMenu()
|
||||
|
@ -670,8 +672,8 @@ void CSbieView::UpdateProcMenu(const CBoxedProcessPtr& pProcess, int iProcessCou
|
|||
m_pMenuMarkLeader->setChecked(pProcess.objectCast<CSbieProcess>()->IsLeaderProgram());
|
||||
}
|
||||
|
||||
m_pMenuSuspend->setEnabled(iProcessCount > iSuspendedCount);
|
||||
m_pMenuResume->setEnabled(iSuspendedCount > 0);
|
||||
if (m_pMenuSuspend) m_pMenuSuspend->setEnabled(iProcessCount > iSuspendedCount);
|
||||
if (m_pMenuResume) m_pMenuResume->setEnabled(iSuspendedCount > 0);
|
||||
}
|
||||
|
||||
bool CSbieView::UpdateMenu()
|
||||
|
@ -1887,11 +1889,13 @@ void CSbieView::OnMenuContextMenu(const QPoint& point)
|
|||
QStringList RunOptions = pBoxPlus->GetTextList("RunCommand", true);
|
||||
|
||||
QString FoundPin;
|
||||
QString FileName = pBoxPlus->GetCommandFile(LinkTarget);
|
||||
QString Arguments;
|
||||
QString FileName = pBoxPlus->GetCommandFile(LinkTarget, &Arguments);
|
||||
foreach(const QString& RunOption, RunOptions) {
|
||||
QVariantMap Entry = GetRunEntry(RunOption);
|
||||
QString CmdFile = pBoxPlus->GetCommandFile(Entry["Command"].toString());
|
||||
if(CmdFile.compare(FileName, Qt::CaseInsensitive) == 0) {
|
||||
QString CurArgs;
|
||||
QString CmdFile = pBoxPlus->GetCommandFile(Entry["Command"].toString(), &CurArgs);
|
||||
if(CmdFile.compare(FileName, Qt::CaseInsensitive) == 0 && Arguments == CurArgs) {
|
||||
FoundPin = RunOption;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue