Skip to content

Commit

Permalink
Merge pull request #4039 from love-code-yeyixiao/Shell
Browse files Browse the repository at this point in the history
Shell
  • Loading branch information
DavidXanatos authored Jul 13, 2024
2 parents e1bb1e0 + 5a7881b commit 48897a6
Show file tree
Hide file tree
Showing 9 changed files with 322 additions and 203 deletions.
14 changes: 9 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [1.1x.x / 5.xx.x] - 2024-07-0x

### Added
- added UI options for "ForceRestartAll" and "UseCreateToken" in OptionWindow
- added an optional context menu option to make folder/file forced quickly
- You can also use "Sandman.exe /add_force program_path" to do it

## [1.14.4 / 5.69.4] - 2024-07-13

Expand All @@ -16,9 +22,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- added hwid display





## [1.14.3 / 5.69.3] - 2024-07-01

### Changed
Expand Down Expand Up @@ -49,8 +52,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- added template "BlockLocalConnect" to prevent sandboxed processes from sending network packets to localhost to breakout sandbox
- added new option "AllowCoverTaskbar" for [#3975](https://github.com/sandboxie-plus/Sandboxie/issues/3975)
- added RPC Port message filter mechanism to block unsafe RDP calls via the driver [#3930](https://github.com/sandboxie-plus/Sandboxie/issues/3930)
- usage: "RpcPortFilter=Port,ID,Label" label is optional
- added "Job Object" options page to collect all job object related options
- Usage: "RpcPortFilter=Port,ID,Label" label is optional
- added "Job Object" Options page to colelct all job object related options


### Changed
- extend "Temp Template" to make it could delete local template section
Expand Down
36 changes: 36 additions & 0 deletions SandboxiePlus/QSbieAPI/SbieUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,42 @@ void CSbieUtils::RemoveContextMenu2()
RegDeleteTreeW(HKEY_CURRENT_USER, L"software\\classes\\*\\shell\\unbox");
}

bool CSbieUtils::HasContextMenu3()
{
const wchar_t* key = L"Software\\Classes\\*\\shell\\addforce\\command";
//const wchar_t* key2 = L"Software\\Classes\\*\\Folder\\addforce\\command";
HKEY hkey,hKey2;
LONG rc = RegOpenKeyEx(HKEY_CURRENT_USER, key, 0, KEY_READ, &hkey);
if (rc != 0)
return false;

RegCloseKey(hkey);


/*rc = RegOpenKeyEx(HKEY_CURRENT_USER, key2, 0, KEY_READ, &hkey2);
if (rc != 0)
return false;
RegCloseKey(hkey2);*/

return true;
}

void CSbieUtils::AddContextMenu3(const QString& StartPath, const QString& RunStr, const QString& IconPath)
{
std::wstring start_path = L"\"" + StartPath.toStdWString() + L"\"";
std::wstring icon_path = L"\"" + (IconPath.isEmpty() ? StartPath : IconPath).toStdWString() + L"\"";

CreateShellEntry(L"*", L"addforce", RunStr.toStdWString(), icon_path, start_path + L" /add_force \"%1\" %*");
CreateShellEntry(L"Folder", L"addforce", RunStr.toStdWString(), icon_path, start_path + L" /add_force \"%1\" %*");
}

void CSbieUtils::RemoveContextMenu3()
{
RegDeleteTreeW(HKEY_CURRENT_USER, L"software\\classes\\*\\shell\\addforce");
RegDeleteTreeW(HKEY_CURRENT_USER, L"software\\classes\\folder\\shell\\addforce");
}

//////////////////////////////////////////////////////////////////////////////
// Shortcuts

Expand Down
4 changes: 4 additions & 0 deletions SandboxiePlus/QSbieAPI/SbieUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class QSBIEAPI_EXPORT CSbieUtils
static void AddContextMenu2(const QString& StartPath, const QString& RunStr, const QString& IconPath = QString());
static void RemoveContextMenu2();

static bool HasContextMenu3();
static void AddContextMenu3(const QString& StartPath, const QString& RunStr, const QString& IconPath = QString());
static void RemoveContextMenu3();

static bool CreateShortcut(const QString& StartExe, QString LinkPath, const QString &LinkName, const QString &boxname, const QString &arguments, const QString &iconPath = QString(), int iconIndex = 0, const QString &workdir = QString(), bool bRunElevated = false);
static bool GetStartMenuShortcut(class CSbieAPI* pApi, QString &BoxName, QString &LinkPath, QString &IconPath, quint32& IconIndex, QString &WorkDir);

Expand Down
28 changes: 21 additions & 7 deletions SandboxiePlus/SandMan/Forms/OptionsWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<enum>QTabWidget::North</enum>
</property>
<property name="currentIndex">
<number>5</number>
<number>9</number>
</property>
<widget class="QWidget" name="tabGeneral">
<attribute name="title">
Expand Down Expand Up @@ -1095,7 +1095,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="tabsSecurity">
<property name="currentIndex">
<number>3</number>
<number>4</number>
</property>
<widget class="QWidget" name="tabHarden">
<attribute name="title">
Expand Down Expand Up @@ -1739,7 +1739,7 @@
</property>
</widget>
</item>
<item row="9" column="2">
<item row="10" column="2">
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
Expand Down Expand Up @@ -1769,6 +1769,13 @@
</property>
</widget>
</item>
<item row="9" column="1" colspan="2">
<widget class="QCheckBox" name="chkCreateToken">
<property name="text">
<string>Create a new sandboxed token instead of setting down default token</string>
</property>
</widget>
</item>
<item row="4" column="4">
<widget class="QLabel" name="label_65">
<property name="font">
Expand Down Expand Up @@ -4089,7 +4096,14 @@ The process match level has a higher priority than the specificity and describes
</property>
</widget>
</item>
<item row="7" column="0">
<item row="7" column="1">
<widget class="QCheckBox" name="chkForceRestart">
<property name="text">
<string>Restart force process before they begin to execute</string>
</property>
</widget>
</item>
<item row="8" column="0">
<spacer name="verticalSpacer_28">
<property name="orientation">
<enum>Qt::Vertical</enum>
Expand Down Expand Up @@ -4130,7 +4144,7 @@ The process match level has a higher priority than the specificity and describes
</property>
</widget>
</item>
<item row="7" column="1">
<item row="8" column="1">
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Horizontal</enum>
Expand Down Expand Up @@ -5079,8 +5093,8 @@ instead of &quot;*&quot;.</string>
<rect>
<x>0</x>
<y>0</y>
<width>98</width>
<height>28</height>
<width>75</width>
<height>16</height>
</rect>
</property>
<layout class="QGridLayout" name="dbgLayout">
Expand Down
Loading

0 comments on commit 48897a6

Please sign in to comment.