This commit is contained in:
DavidXanatos 2022-09-22 16:53:13 +02:00
parent 13c6263178
commit aadd97d81f
3 changed files with 60 additions and 10 deletions

View File

@ -7,6 +7,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [1.3.5 / 5.58.5] - 2022-09-19 ## [1.3.5 / 5.58.5] - 2022-09-19
### Changed
- improved recovery window behavioure [#2266](https://github.com/sandboxie-plus/Sandboxie/issues/2266)
### Fixed ### Fixed
- fixed issues with stale data in Sandboxie-Plus.ini [#2248](https://github.com/sandboxie-plus/Sandboxie/pull/2248) (thanks okrc) - fixed issues with stale data in Sandboxie-Plus.ini [#2248](https://github.com/sandboxie-plus/Sandboxie/pull/2248) (thanks okrc)
- fixed issue with dummy manifests [#2252](https://github.com/sandboxie-plus/Sandboxie/issues/2252) - fixed issue with dummy manifests [#2252](https://github.com/sandboxie-plus/Sandboxie/issues/2252)

View File

@ -346,8 +346,9 @@ bool CSettingsWindow::eventFilter(QObject *source, QEvent *event)
Qt::CheckState CSettingsWindow__IsContextMenu() Qt::CheckState CSettingsWindow__IsContextMenu()
{ {
QSettings settings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\PackagedCom\\Package", QSettings::NativeFormat); //QSettings Package("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\PackagedCom\\Package", QSettings::NativeFormat);
foreach(const QString & Key, settings.childGroups()) { QSettings Package("HKEY_CURRENT_USER\\Software\\Classes\\PackagedCom\\Package", QSettings::NativeFormat);
foreach(const QString & Key, Package.childGroups()) {
if (Key.indexOf("SandboxieShell") == 0) if (Key.indexOf("SandboxieShell") == 0)
return Qt::Checked; return Qt::Checked;
} }
@ -362,11 +363,15 @@ Qt::CheckState CSettingsWindow__IsContextMenu()
void CSettingsWindow__AddContextMenu(bool bAlwaysClassic) void CSettingsWindow__AddContextMenu(bool bAlwaysClassic)
{ {
QSettings settings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", QSettings::NativeFormat); QSettings CurrentVersion("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", QSettings::NativeFormat);
if (settings.value("CurrentBuild").toInt() >= 22000 && !bAlwaysClassic) // Windows 11 if (CurrentVersion.value("CurrentBuild").toInt() >= 22000 && !bAlwaysClassic) // Windows 11
{ {
QSettings MyReg("HKEY_CURRENT_USER\\SOFTWARE\\Xanasoft\\Sandboxie-Plus\\SbieShellExt\\Lang", QSettings::NativeFormat);
MyReg.setValue("Open Sandboxed", CSettingsWindow::tr("Open Sandboxed"));
MyReg.setValue("Explore Sandboxed", CSettingsWindow::tr("Explore Sandboxed"));
QDir::setCurrent(QCoreApplication::applicationDirPath());
QProcess Proc; QProcess Proc;
Proc.setWorkingDirectory(QCoreApplication::applicationDirPath());
Proc.execute("rundll32.exe", QStringList() << "SbieShellExt.dll,RegisterPackage"); Proc.execute("rundll32.exe", QStringList() << "SbieShellExt.dll,RegisterPackage");
Proc.waitForFinished(); Proc.waitForFinished();
return; return;
@ -379,11 +384,11 @@ void CSettingsWindow__AddContextMenu(bool bAlwaysClassic)
void CSettingsWindow__RemoveContextMenu() void CSettingsWindow__RemoveContextMenu()
{ {
QSettings settings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", QSettings::NativeFormat); QSettings CurrentVersion("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", QSettings::NativeFormat);
if (settings.value("CurrentBuild").toInt() >= 22000) // Windows 11 if (CurrentVersion.value("CurrentBuild").toInt() >= 22000) // Windows 11
{ {
QDir::setCurrent(QCoreApplication::applicationDirPath());
QProcess Proc; QProcess Proc;
Proc.setWorkingDirectory(QCoreApplication::applicationDirPath());
Proc.execute("rundll32.exe", QStringList() << "SbieShellExt.dll,RemovePackage"); Proc.execute("rundll32.exe", QStringList() << "SbieShellExt.dll,RemovePackage");
Proc.waitForFinished(); Proc.waitForFinished();
} }

View File

@ -14,6 +14,40 @@ using namespace Microsoft::WRL;
std::wstring g_path; std::wstring g_path;
LONG GetDWORDRegKey(HKEY hKey, const std::wstring& strValueName, DWORD& nValue)
{
DWORD dwBufferSize(sizeof(DWORD));
DWORD nResult(0);
LONG nError = ::RegQueryValueExW(hKey,
strValueName.c_str(),
0,
NULL,
reinterpret_cast<LPBYTE>(&nResult),
&dwBufferSize);
if (ERROR_SUCCESS == nError)
{
nValue = nResult;
}
return nError;
}
LONG GetStringRegKey(HKEY hKey, const std::wstring& strValueName, std::wstring& strValue)
{
WCHAR szBuffer[512];
DWORD dwBufferSize = sizeof(szBuffer);
ULONG nError;
nError = RegQueryValueExW(hKey, strValueName.c_str(), 0, NULL, (LPBYTE)szBuffer, &dwBufferSize);
if (ERROR_SUCCESS == nError)
{
strValue = szBuffer;
}
return nError;
}
std::wstring g_ExploreSandboxed = L"Explore Sandboxed";
std::wstring g_OpenSandboxed = L"Open Sandboxed";
BOOL APIENTRY DllMain( HMODULE hModule, BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call, DWORD ul_reason_for_call,
LPVOID lpReserved LPVOID lpReserved
@ -29,6 +63,14 @@ BOOL APIENTRY DllMain( HMODULE hModule,
*ptr = L'\0'; *ptr = L'\0';
g_path = std::wstring(path); g_path = std::wstring(path);
HKEY hKey;
LONG lRes = RegOpenKeyExW(HKEY_CURRENT_USER, L"SOFTWARE\\Xanasoft\\Sandboxie-Plus\\SbieShellExt\\Lang", 0, KEY_READ, &hKey);
bool bExistsAndSuccess(lRes == ERROR_SUCCESS);
bool bDoesNotExistsSpecifically(lRes == ERROR_FILE_NOT_FOUND);
GetStringRegKey(hKey, L"Explore Sandboxed", g_ExploreSandboxed);
GetStringRegKey(hKey, L"Open Sandboxed", g_OpenSandboxed);
CloseHandle(hKey);
break; break;
} }
case DLL_THREAD_ATTACH: case DLL_THREAD_ATTACH:
@ -154,14 +196,14 @@ protected:
class __declspec(uuid("EA3E972D-62C7-4309-8F15-883263041E99")) ExploreCommandHandler final : public TestExplorerCommandBase class __declspec(uuid("EA3E972D-62C7-4309-8F15-883263041E99")) ExploreCommandHandler final : public TestExplorerCommandBase
{ {
public: public:
const wchar_t* Title() override { return L"Explore Sandboxed"; } const wchar_t* Title() override { return g_ExploreSandboxed.c_str(); }
ECommand GetCommand() { return eExplore; } ECommand GetCommand() { return eExplore; }
}; };
class __declspec(uuid("3FD2D9EE-DAF9-404A-9B7E-13B2DCD63950")) OpenCommandHandler final : public TestExplorerCommandBase class __declspec(uuid("3FD2D9EE-DAF9-404A-9B7E-13B2DCD63950")) OpenCommandHandler final : public TestExplorerCommandBase
{ {
public: public:
const wchar_t* Title() override { return L"Open Sandboxed"; } const wchar_t* Title() override { return g_OpenSandboxed.c_str(); }
ECommand GetCommand() { return eOpen; } ECommand GetCommand() { return eOpen; }
}; };