This commit is contained in:
parent
6065ada677
commit
357be6fb2f
33
CHANGELOG.md
33
CHANGELOG.md
|
@ -7,6 +7,39 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [0.6.5 / 5.47.0] - 2021-01-31
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- added detection for waterfox.exe, Palemoon.exe, basilisk.exe and brave.exe firefox forks
|
||||||
|
- added bluetooth API support, IPC port can be opened with "OpenBluetooth=y"
|
||||||
|
-- this should resolve issues with many unity games hanging on startup for a long time
|
||||||
|
- added enchanced RPC/IPC interface tracing
|
||||||
|
- when DefaultBox is not found its by the SandMan UI its now recreated
|
||||||
|
- added Disable Forces Process time is now savedand reloaded
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- reduced sandman cpu usage
|
||||||
|
- sandboxie.ini and templates.ini can now be UTF8 encoded
|
||||||
|
-- this feature is experimental, files without a UTF-8 Signature should be recognized also
|
||||||
|
-- "ByteOrderMark=yes" is obsolete sandboxie.ini is now always saved with a BOM/Signature
|
||||||
|
- legacy language files can now be UTF8 encoded
|
||||||
|
- reworked file migration behavioure, removed hard coded lists in favoure of templates
|
||||||
|
-- you can now use "CopyAlways=", "DontCopy=" and "CopyEmpty=" that suppores teh same syntax as "OpenFilePath="
|
||||||
|
-- "CopyBlockDenyWrite=program.exe,y" makes an write open call to a file that wont't be copied fail instead of turing it read only
|
||||||
|
- removed hardcoded ShipHook list in favoure of templates
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- fixed old memory pool leak in the sbie drvier
|
||||||
|
- fixed issue with item selection in the access restrictions ui
|
||||||
|
- fixed updater crash in sbiectrl.exe
|
||||||
|
- fixed issues wih RPC calls introduced in sbie 5.33.1
|
||||||
|
- fixed recently broken terminate all command
|
||||||
|
- fixed a coupel minor UI issues with Sandman UI
|
||||||
|
- fixed IPC issue with windows 7 and 8 resulting in process termination
|
||||||
|
- fixed "recover to" functionality
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [0.6.0 / 5.46.5] - 2021-01-25
|
## [0.6.0 / 5.46.5] - 2021-01-25
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 15.0.28307.1022
|
VisualStudioVersion = 16.0.30804.86
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SboxDrv", "core\drv\SboxDrv.vcxproj", "{4019C5EB-8D1E-40E4-B7D1-5601B4B27288}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SboxDrv", "core\drv\SboxDrv.vcxproj", "{4019C5EB-8D1E-40E4-B7D1-5601B4B27288}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -123,7 +123,7 @@ void CRunBrowser::OnYes()
|
||||||
void CRunBrowser::OnNo()
|
void CRunBrowser::OnNo()
|
||||||
{
|
{
|
||||||
ShellExecute(
|
ShellExecute(
|
||||||
m_pParentWnd->m_hWnd, NULL, m_url, NULL, NULL, SW_SHOWNORMAL);
|
m_pParentWnd ? m_pParentWnd->m_hWnd : NULL , NULL, m_url, NULL, NULL, SW_SHOWNORMAL);
|
||||||
EndDialog(0);
|
EndDialog(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -146,7 +147,7 @@ CAppPage::CAppPage(TMPL_INFO *info, const CString &BoxName)
|
||||||
|
|
||||||
if (m_tmpl_info.ClassModifier & MODIF_IEXPLORE)
|
if (m_tmpl_info.ClassModifier & MODIF_IEXPLORE)
|
||||||
m_titleForPage = L"Internet Explorer";
|
m_titleForPage = L"Internet Explorer";
|
||||||
if (m_tmpl_info.ClassModifier & MODIF_EDGE)
|
if (m_tmpl_info.ClassModifier & MODIF_EDGE)
|
||||||
m_titleForPage = "Microsoft Edge";
|
m_titleForPage = "Microsoft Edge";
|
||||||
if (m_tmpl_info.ClassModifier & MODIF_FIREFOX)
|
if (m_tmpl_info.ClassModifier & MODIF_FIREFOX)
|
||||||
m_titleForPage = L"Firefox";
|
m_titleForPage = L"Firefox";
|
||||||
|
@ -540,26 +541,26 @@ void CAppPage::Template_Filter()
|
||||||
POSITION old_pos = pos;
|
POSITION old_pos = pos;
|
||||||
CString name = m_tmpl_sections.GetNext(pos);
|
CString name = m_tmpl_sections.GetNext(pos);
|
||||||
BOOL ie = (name.Find(L"IExplore_") != -1);
|
BOOL ie = (name.Find(L"IExplore_") != -1);
|
||||||
BOOL edge = (name.Find(L"Edge_") != -1);
|
BOOL edge = (name.Find(L"Edge_") != -1);
|
||||||
BOOL ff = (name.Find(L"Firefox_") != -1)
|
BOOL ff = (name.Find(L"Firefox_") != -1)
|
||||||
|| (name.Find(L"Waterfox_") != -1)
|
|| (name.Find(L"Waterfox_") != -1)
|
||||||
|| (name.Find(L"PaleMoon_") != -1)
|
|| (name.Find(L"PaleMoon_") != -1)
|
||||||
|| (name.Find(L"SeaMonkey_") != -1);
|
|| (name.Find(L"SeaMonkey_") != -1);
|
||||||
BOOL ch = (name.Find(L"Chrome_") != -1);
|
BOOL ch = (name.Find(L"Chrome_") != -1);
|
||||||
BOOL other = (name.Find(L"Dragon_") != -1)
|
BOOL other = (name.Find(L"Dragon_") != -1)
|
||||||
|| (name.Find(L"Iron_") != -1)
|
|| (name.Find(L"Iron_") != -1)
|
||||||
|| (name.Find(L"Ungoogled_") != -1)
|
|| (name.Find(L"Ungoogled_") != -1)
|
||||||
|| (name.Find(L"Vivaldi_") != -1)
|
|| (name.Find(L"Vivaldi_") != -1)
|
||||||
|| (name.Find(L"Brave_") != -1)
|
|| (name.Find(L"Brave_") != -1)
|
||||||
|| (name.Find(L"Maxthon_6_") != -1)
|
|| (name.Find(L"Maxthon_6_") != -1)
|
||||||
|| (name.Find(L"Opera_") != -1)
|
|| (name.Find(L"Opera_") != -1)
|
||||||
|| (name.Find(L"Yandex_") != -1);
|
|| (name.Find(L"Yandex_") != -1);
|
||||||
|
|
||||||
BOOL keep = FALSE;
|
BOOL keep = FALSE;
|
||||||
|
|
||||||
if ((modif & MODIF_IEXPLORE) && ie)
|
if ((modif & MODIF_IEXPLORE) && ie)
|
||||||
keep = TRUE;
|
keep = TRUE;
|
||||||
else if ((modif & MODIF_EDGE) && edge)
|
else if ((modif & MODIF_EDGE) && edge)
|
||||||
keep = TRUE;
|
keep = TRUE;
|
||||||
else if ((modif & MODIF_FIREFOX) && ff)
|
else if ((modif & MODIF_FIREFOX) && ff)
|
||||||
keep = TRUE;
|
keep = TRUE;
|
||||||
|
@ -1569,5 +1570,18 @@ void CAppPage::SetDefaultTemplates6(CBox &box)
|
||||||
void CAppPage::SetDefaultTemplates7(CBox &box)
|
void CAppPage::SetDefaultTemplates7(CBox &box)
|
||||||
{
|
{
|
||||||
box.EnableTemplate(L"BlockPorts", TRUE);
|
box.EnableTemplate(L"BlockPorts", TRUE);
|
||||||
|
//box.EnableTemplate(L"WindowsFontCache", TRUE); // since 5.46.3 open by driver
|
||||||
box.EnableTemplate(L"qWave", TRUE);
|
box.EnableTemplate(L"qWave", TRUE);
|
||||||
|
SetDefaultTemplates8(box);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// SetDefaultTemplates8
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void CAppPage::SetDefaultTemplates8(CBox& box)
|
||||||
|
{
|
||||||
|
box.EnableTemplate(L"FileCppy", TRUE);
|
||||||
|
box.EnableTemplate(L"SkipHook", TRUE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,6 +126,7 @@ public:
|
||||||
|
|
||||||
static void SetDefaultTemplates6(CBox &box);
|
static void SetDefaultTemplates6(CBox &box);
|
||||||
static void SetDefaultTemplates7(CBox &box);
|
static void SetDefaultTemplates7(CBox &box);
|
||||||
|
static void SetDefaultTemplates8(CBox& box);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -226,18 +226,23 @@ void CBox::SetDefaultSettings()
|
||||||
int cfglvl;
|
int cfglvl;
|
||||||
ini.GetNum(m_name, _ConfigLevel, cfglvl);
|
ini.GetNum(m_name, _ConfigLevel, cfglvl);
|
||||||
|
|
||||||
if (cfglvl >= 7)
|
if (cfglvl >= 8)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BOOL ok = TRUE;
|
BOOL ok = TRUE;
|
||||||
|
|
||||||
if (cfglvl >= 1) {
|
if (cfglvl >= 1) {
|
||||||
|
|
||||||
ok = ini.SetNum(m_name, _ConfigLevel, 7);
|
ok = ini.SetNum(m_name, _ConfigLevel, 8);
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
|
|
||||||
if (cfglvl == 6) {
|
if (cfglvl == 7) {
|
||||||
|
|
||||||
|
CAppPage::SetDefaultTemplates8(*this);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (cfglvl == 6) {
|
||||||
|
|
||||||
CAppPage::SetDefaultTemplates7(*this);
|
CAppPage::SetDefaultTemplates7(*this);
|
||||||
|
|
||||||
|
@ -250,7 +255,7 @@ void CBox::SetDefaultSettings()
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ok = ini.SetNum(m_name, _ConfigLevel, 7);
|
ok = ini.SetNum(m_name, _ConfigLevel, 8);
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -90,6 +91,7 @@ typedef enum {
|
||||||
WPAD_PORT,
|
WPAD_PORT,
|
||||||
GAME_CONFIG_STORE_PORT,
|
GAME_CONFIG_STORE_PORT,
|
||||||
SMART_CARD_PORT,
|
SMART_CARD_PORT,
|
||||||
|
BT_PORT,
|
||||||
NUM_DYNAMIC_PORTS
|
NUM_DYNAMIC_PORTS
|
||||||
} ENUM_DYNAMIC_PORT_TYPE;
|
} ENUM_DYNAMIC_PORT_TYPE;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -21,8 +21,8 @@
|
||||||
#ifndef _MY_VERSION_H
|
#ifndef _MY_VERSION_H
|
||||||
#define _MY_VERSION_H
|
#define _MY_VERSION_H
|
||||||
|
|
||||||
#define MY_VERSION_BINARY 5,46,5
|
#define MY_VERSION_BINARY 5,47,0
|
||||||
#define MY_VERSION_STRING "5.46.5"
|
#define MY_VERSION_STRING "5.47.0"
|
||||||
#define MY_VERSION_COMPAT "5.46.0" // this refers to the driver ABI compatibility
|
#define MY_VERSION_COMPAT "5.46.0" // this refers to the driver ABI compatibility
|
||||||
|
|
||||||
// These #defines are used by either Resource Compiler, or by NSIC installer
|
// These #defines are used by either Resource Compiler, or by NSIC installer
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -35,6 +36,7 @@ struct STREAM {
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
UCHAR *data_ptr;
|
UCHAR *data_ptr;
|
||||||
ULONG data_len;
|
ULONG data_len;
|
||||||
|
ULONG encoding;
|
||||||
__declspec(align(8)) UCHAR data[0];
|
__declspec(align(8)) UCHAR data[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -71,6 +73,7 @@ __declspec(align(16)) NTSTATUS Stream_Open(
|
||||||
|
|
||||||
stream->data_len = 0;
|
stream->data_len = 0;
|
||||||
stream->data_ptr = &stream->data[0];
|
stream->data_ptr = &stream->data[0];
|
||||||
|
stream->encoding = 0;
|
||||||
*out_stream = stream;
|
*out_stream = stream;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -145,6 +148,7 @@ __declspec(align(16)) NTSTATUS Stream_Open(
|
||||||
|
|
||||||
stream->data_len = 0;
|
stream->data_len = 0;
|
||||||
stream->data_ptr = &stream->data[0];
|
stream->data_ptr = &stream->data[0];
|
||||||
|
stream->encoding = 0;
|
||||||
*out_stream = stream;
|
*out_stream = stream;
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
@ -351,3 +355,203 @@ NTSTATUS Stream_Write_Long(
|
||||||
STREAM_PUT_BYTE(b[3]);
|
STREAM_PUT_BYTE(b[3]);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Stream_Read_BOM
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
NTSTATUS Stream_Read_BOM(
|
||||||
|
IN STREAM* stream,
|
||||||
|
ULONG* encoding)
|
||||||
|
{
|
||||||
|
if (stream->data_len == 0)
|
||||||
|
{
|
||||||
|
NTSTATUS status = Stream_Read_More(stream);
|
||||||
|
if (!NT_SUCCESS(status))
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stream->data_len >= 3 && stream->data[0] == 0xEF && stream->data[1] == 0xBB && stream->data[2] == 0xBF)
|
||||||
|
{
|
||||||
|
stream->data_ptr += 3;
|
||||||
|
stream->data_len -= 3;
|
||||||
|
|
||||||
|
stream->encoding = 1;
|
||||||
|
//DbgPrint("sbie read ini, found UTF-8 Signature\n");
|
||||||
|
}
|
||||||
|
else if (stream->data_len >= 2 && stream->data[0] == 0xFF && stream->data[1] == 0xFE)
|
||||||
|
{
|
||||||
|
stream->data_ptr += 2;
|
||||||
|
stream->data_len -= 2;
|
||||||
|
|
||||||
|
stream->encoding = 0;
|
||||||
|
//DbgPrint("sbie read ini, found Unicode (UTF-16 LE) BOM\n");
|
||||||
|
}
|
||||||
|
else if (stream->data_len >= 2 && stream->data[0] == 0xFE && stream->data[1] == 0xFF)
|
||||||
|
{
|
||||||
|
stream->data_ptr += 2;
|
||||||
|
stream->data_len -= 2;
|
||||||
|
|
||||||
|
stream->encoding = 2;
|
||||||
|
//DbgPrint("sbie read ini, found Unicode (UTF-16 BE) BOM\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If there is no BOM/Signature try to detect the file type
|
||||||
|
// Unicode Litle Endian (windows wchar_t) will have the n*2+1 bytes 0 as long, as no higher unicode chrakters are used
|
||||||
|
BOOLEAN LooksUnicodeLE = TRUE;
|
||||||
|
// similrly Unicode Big Endian (byte swaped) will have the n*2 bytes 0 as long
|
||||||
|
BOOLEAN LooksUnicodeBE = TRUE;
|
||||||
|
// UTF-8 shouldn't have null bytes
|
||||||
|
for (ULONG pos = 0; (pos + 1) < min(stream->data_len, 16); pos += 2) // check first 8 char16's
|
||||||
|
{
|
||||||
|
if (stream->data[pos] != 0)
|
||||||
|
LooksUnicodeBE = FALSE;
|
||||||
|
if (stream->data[pos + 1] != 0)
|
||||||
|
LooksUnicodeLE = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!LooksUnicodeLE && !LooksUnicodeBE)
|
||||||
|
{
|
||||||
|
stream->encoding = 1;
|
||||||
|
//DbgPrint("sbie read ini, looks UTF-8 encoded\n");
|
||||||
|
}
|
||||||
|
else if (!LooksUnicodeLE && LooksUnicodeBE)
|
||||||
|
{
|
||||||
|
stream->encoding = 2;
|
||||||
|
//DbgPrint("sbie read ini, looks Unicode (UTF-16 BE) encoded\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stream->encoding = 0;
|
||||||
|
//if (LooksUnicodeLE && !LooksUnicodeBE)
|
||||||
|
// DbgPrint("sbie read ini, looks Unicode (UTF-16 LE) encoded\n");
|
||||||
|
//else
|
||||||
|
// DbgPrint("sbie read ini, encoding looks broken, assuming (UTF-16 LE)\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encoding) *encoding = stream->encoding;
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Stream_Read_Wchar
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
NTSTATUS Stream_Read_Wchar(
|
||||||
|
IN STREAM* stream,
|
||||||
|
OUT USHORT* v)
|
||||||
|
{
|
||||||
|
if (stream->encoding == 0) // Unicode Litle Endian
|
||||||
|
{
|
||||||
|
UCHAR* b = (UCHAR*)v;
|
||||||
|
STREAM_GET_BYTE(b[0]);
|
||||||
|
STREAM_GET_BYTE(b[1]);
|
||||||
|
}
|
||||||
|
else if (stream->encoding == 2) // Unicode Big Endian
|
||||||
|
{
|
||||||
|
UCHAR* b = (UCHAR*)v;
|
||||||
|
STREAM_GET_BYTE(b[1]);
|
||||||
|
STREAM_GET_BYTE(b[0]);
|
||||||
|
}
|
||||||
|
else if (stream->encoding == 1) // utf 8
|
||||||
|
{
|
||||||
|
UCHAR cur_byte;
|
||||||
|
|
||||||
|
read_next:
|
||||||
|
STREAM_GET_BYTE(cur_byte);
|
||||||
|
|
||||||
|
//Figure out the current code unit to determine the range. It is split into 6 main groups, each of which handles the data
|
||||||
|
//differently from one another.
|
||||||
|
if (cur_byte < 0x80) {
|
||||||
|
//0..127, the ASCII range.
|
||||||
|
|
||||||
|
//We directly plug in the values to the UTF-16 code unit.
|
||||||
|
*v = (wchar_t)(cur_byte);
|
||||||
|
}
|
||||||
|
else if (cur_byte < 0xC0) {
|
||||||
|
//0x80..0xBF, we ignore. These are reserved for UTF-8 encoding.
|
||||||
|
goto read_next;
|
||||||
|
}
|
||||||
|
else if (cur_byte < 0xE0) {
|
||||||
|
//128..2047, the extended ASCII range, and into the Basic Multilingual Plane.
|
||||||
|
|
||||||
|
//Work on the first code unit.
|
||||||
|
wchar_t highShort = (wchar_t)(cur_byte & 0x1F);
|
||||||
|
//Increment the current code unit pointer to the next code unit
|
||||||
|
STREAM_GET_BYTE(cur_byte);
|
||||||
|
//Work on the second code unit.
|
||||||
|
wchar_t lowShort = (wchar_t)(cur_byte & 0x3F);
|
||||||
|
|
||||||
|
//Create the UTF-16 code unit, then increment the iterator
|
||||||
|
int unicode = (highShort << 8) | lowShort;
|
||||||
|
|
||||||
|
//Check to make sure the "unicode" is in the range [0..D7FF] and [E000..FFFF].
|
||||||
|
if ((0 <= unicode && unicode <= 0xD7FF) || (0xE000 <= unicode && unicode <= 0xFFFF)) {
|
||||||
|
//Directly set the value to the UTF-16 code unit.
|
||||||
|
*v = (wchar_t)unicode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (cur_byte < 0xF0) {
|
||||||
|
//2048..65535, the remaining Basic Multilingual Plane.
|
||||||
|
|
||||||
|
//Work on the UTF-8 code units one by one.
|
||||||
|
//If drawn out, it would be 1110aaaa 10bbbbcc 10ccdddd
|
||||||
|
//Where a is 4th byte, b is 3rd byte, c is 2nd byte, and d is 1st byte.
|
||||||
|
wchar_t fourthChar = (wchar_t)(cur_byte & 0xF);
|
||||||
|
STREAM_GET_BYTE(cur_byte);
|
||||||
|
wchar_t thirdChar = (wchar_t)(cur_byte & 0x3C) >> 2;
|
||||||
|
wchar_t secondCharHigh = (wchar_t)(cur_byte & 0x3);
|
||||||
|
STREAM_GET_BYTE(cur_byte);
|
||||||
|
wchar_t secondCharLow = (wchar_t)(cur_byte & 0x30) >> 4;
|
||||||
|
wchar_t firstChar = (wchar_t)(cur_byte & 0xF);
|
||||||
|
|
||||||
|
//Create the resulting UTF-16 code unit, then increment the iterator.
|
||||||
|
int unicode = (fourthChar << 12) | (thirdChar << 8) | (secondCharHigh << 6) | (secondCharLow << 4) | firstChar;
|
||||||
|
|
||||||
|
//Check to make sure the "unicode" is in the range [0..D7FF] and [E000..FFFF].
|
||||||
|
//According to math, UTF-8 encoded "unicode" should always fall within these two ranges.
|
||||||
|
if ((0 <= unicode && unicode <= 0xD7FF) || (0xE000 <= unicode && unicode <= 0xFFFF)) {
|
||||||
|
//Directly set the value to the UTF-16 code unit.
|
||||||
|
*v = (wchar_t)unicode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (cur_byte < 0xF8) {
|
||||||
|
//65536..10FFFF, the Unicode UTF range
|
||||||
|
|
||||||
|
//Work on the UTF-8 code units one by one.
|
||||||
|
//If drawn out, it would be 11110abb 10bbcccc 10ddddee 10eeffff
|
||||||
|
//Where a is 6th byte, b is 5th byte, c is 4th byte, and so on.
|
||||||
|
wchar_t sixthChar = (wchar_t)(cur_byte & 0x4) >> 2;
|
||||||
|
wchar_t fifthCharHigh = (wchar_t)(cur_byte & 0x3);
|
||||||
|
STREAM_GET_BYTE(cur_byte);
|
||||||
|
wchar_t fifthCharLow = (wchar_t)(cur_byte & 0x30) >> 4;
|
||||||
|
wchar_t fourthChar = (wchar_t)(cur_byte & 0xF);
|
||||||
|
STREAM_GET_BYTE(cur_byte);
|
||||||
|
wchar_t thirdChar = (wchar_t)(cur_byte & 0x3C) >> 2;
|
||||||
|
wchar_t secondCharHigh = (wchar_t)(cur_byte & 0x3);
|
||||||
|
STREAM_GET_BYTE(cur_byte);
|
||||||
|
wchar_t secondCharLow = (wchar_t)(cur_byte & 0x30) >> 4;
|
||||||
|
wchar_t firstChar = (wchar_t)(cur_byte & 0xF);
|
||||||
|
|
||||||
|
int unicode = (sixthChar << 4) | (fifthCharHigh << 2) | fifthCharLow | (fourthChar << 12) | (thirdChar << 8) | (secondCharHigh << 6) | (secondCharLow << 4) | firstChar;
|
||||||
|
wchar_t highSurrogate = (unicode - 0x10000) / 0x400 + 0xD800;
|
||||||
|
wchar_t lowSurrogate = (unicode - 0x10000) % 0x400 + 0xDC00;
|
||||||
|
|
||||||
|
//Set the UTF-16 code units
|
||||||
|
//*v1 = lowSurrogate;
|
||||||
|
//*v2 = highSurrogate;
|
||||||
|
|
||||||
|
*v = L'_';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
goto read_next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -83,6 +84,14 @@ NTSTATUS Stream_Write_Long(
|
||||||
IN STREAM *stream,
|
IN STREAM *stream,
|
||||||
IN ULONG v);
|
IN ULONG v);
|
||||||
|
|
||||||
|
NTSTATUS Stream_Read_BOM(
|
||||||
|
IN STREAM* stream,
|
||||||
|
ULONG* encoding);
|
||||||
|
|
||||||
|
NTSTATUS Stream_Read_Wchar(
|
||||||
|
IN STREAM* stream,
|
||||||
|
OUT USHORT* v);
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
#endif // _MY_STREAM_H
|
#endif // _MY_STREAM_H
|
||||||
|
|
|
@ -186,6 +186,12 @@
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|x64'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|x64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\common\stream.c">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|x64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|x64'">true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="acscmonitor.c" />
|
<ClCompile Include="acscmonitor.c" />
|
||||||
<ClCompile Include="advapi.c">
|
<ClCompile Include="advapi.c">
|
||||||
<ShowIncludes Condition="'$(Configuration)|$(Platform)'=='SbieRelease|Win32'">false</ShowIncludes>
|
<ShowIncludes Condition="'$(Configuration)|$(Platform)'=='SbieRelease|Win32'">false</ShowIncludes>
|
||||||
|
@ -195,6 +201,7 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="callsvc.c" />
|
<ClCompile Include="callsvc.c" />
|
||||||
<ClCompile Include="com.c" />
|
<ClCompile Include="com.c" />
|
||||||
|
<ClCompile Include="config.c" />
|
||||||
<ClCompile Include="cred.c" />
|
<ClCompile Include="cred.c" />
|
||||||
<ClCompile Include="crypt.c" />
|
<ClCompile Include="crypt.c" />
|
||||||
<ClCompile Include="custom.c" />
|
<ClCompile Include="custom.c" />
|
||||||
|
@ -229,6 +236,12 @@
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|x64'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|x64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="file_copy.c">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|x64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|x64'">true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="file_pipe.c">
|
<ClCompile Include="file_pipe.c">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|Win32'">true</ExcludedFromBuild>
|
||||||
|
@ -354,7 +367,9 @@
|
||||||
</CustomBuild>
|
</CustomBuild>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\common\pattern.h" />
|
||||||
<ClInclude Include="..\..\common\pool.h" />
|
<ClInclude Include="..\..\common\pool.h" />
|
||||||
|
<ClInclude Include="..\..\common\stream.h" />
|
||||||
<ClInclude Include="advapi.h" />
|
<ClInclude Include="advapi.h" />
|
||||||
<ClInclude Include="debug.h" />
|
<ClInclude Include="debug.h" />
|
||||||
<ClInclude Include="dll.h" />
|
<ClInclude Include="dll.h" />
|
||||||
|
|
|
@ -173,6 +173,13 @@
|
||||||
<ClCompile Include="rpcrt.c">
|
<ClCompile Include="rpcrt.c">
|
||||||
<Filter>ipc</Filter>
|
<Filter>ipc</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\common\stream.c">
|
||||||
|
<Filter>common</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="config.c" />
|
||||||
|
<ClCompile Include="file_copy.c">
|
||||||
|
<Filter>file</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="advapi.h" />
|
<ClInclude Include="advapi.h" />
|
||||||
|
@ -215,6 +222,12 @@
|
||||||
<Filter>com</Filter>
|
<Filter>com</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="trace.h" />
|
<ClInclude Include="trace.h" />
|
||||||
|
<ClInclude Include="..\..\common\stream.h">
|
||||||
|
<Filter>common</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\common\pattern.h">
|
||||||
|
<Filter>common</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="resource.rc" />
|
<ResourceCompile Include="resource.rc" />
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -0,0 +1,331 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Config
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define NOGDI
|
||||||
|
#include "dll.h"
|
||||||
|
#include "common/pool.h"
|
||||||
|
#include "common\pattern.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Functions
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Variables
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern POOL* Dll_Pool;
|
||||||
|
extern POOL* Dll_PoolTemp;
|
||||||
|
|
||||||
|
static BOOLEAN Config_MatchImageGroup(
|
||||||
|
const WCHAR* group, ULONG group_len, const WCHAR* test_str,
|
||||||
|
ULONG depth);
|
||||||
|
|
||||||
|
static BOOLEAN Config_MatchImage(
|
||||||
|
const WCHAR* pat_str, ULONG pat_len, const WCHAR* test_str,
|
||||||
|
ULONG depth);
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Config_MatchImage
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
_FX BOOLEAN Config_MatchImage(
|
||||||
|
const WCHAR* pat_str, ULONG pat_len, const WCHAR* test_str,
|
||||||
|
ULONG depth)
|
||||||
|
{
|
||||||
|
PATTERN* pat;
|
||||||
|
WCHAR* tmp;
|
||||||
|
ULONG tmp_len;
|
||||||
|
BOOLEAN ok;
|
||||||
|
|
||||||
|
//
|
||||||
|
// if pat_len was specified, we should create the match pattern
|
||||||
|
// using only the first pat_len characters of pat_str
|
||||||
|
//
|
||||||
|
|
||||||
|
if (pat_len) {
|
||||||
|
|
||||||
|
tmp_len = (pat_len + 1) * sizeof(WCHAR);
|
||||||
|
tmp = Dll_AllocTemp(tmp_len);
|
||||||
|
if (!tmp)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
wcsncpy(tmp, pat_str, pat_len);
|
||||||
|
tmp[pat_len] = L'\0';
|
||||||
|
|
||||||
|
pat = Pattern_Create(Dll_PoolTemp, tmp, TRUE);
|
||||||
|
|
||||||
|
Dll_Free(tmp);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
pat = Pattern_Create(Dll_PoolTemp, pat_str, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pat)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
if (*pat_str == L'<') {
|
||||||
|
|
||||||
|
ok = Config_MatchImageGroup(
|
||||||
|
Pattern_Source(pat), 0, test_str, depth + 1);
|
||||||
|
|
||||||
|
Pattern_Free(pat);
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// create a lower-case copy of test_str
|
||||||
|
//
|
||||||
|
|
||||||
|
ok = FALSE;
|
||||||
|
|
||||||
|
tmp_len = (wcslen(test_str) + 1) * sizeof(WCHAR);
|
||||||
|
tmp = Dll_AllocTemp(tmp_len);
|
||||||
|
if (tmp) {
|
||||||
|
|
||||||
|
memcpy(tmp, test_str, tmp_len);
|
||||||
|
_wcslwr(tmp);
|
||||||
|
|
||||||
|
ok = Pattern_Match(pat, tmp, wcslen(tmp));
|
||||||
|
|
||||||
|
Dll_Free(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
Pattern_Free(pat);
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Config_MatchImageGroup
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
_FX BOOLEAN Config_MatchImageGroup(
|
||||||
|
const WCHAR* group, ULONG group_len, const WCHAR* test_str,
|
||||||
|
ULONG depth)
|
||||||
|
{
|
||||||
|
ULONG index;
|
||||||
|
BOOLEAN match = FALSE;
|
||||||
|
WCHAR conf_buf[2048];
|
||||||
|
|
||||||
|
if (!group_len)
|
||||||
|
group_len = wcslen(group);
|
||||||
|
|
||||||
|
for (index = 0; (!match); ++index) {
|
||||||
|
|
||||||
|
//
|
||||||
|
// get next process group setting, compare to passed group name.
|
||||||
|
// if the setting is <passed_group_name>= then we accept it.
|
||||||
|
//
|
||||||
|
|
||||||
|
NTSTATUS status = SbieApi_QueryConf(
|
||||||
|
NULL, L"ProcessGroup", index, conf_buf, sizeof(conf_buf) - 16 * sizeof(WCHAR));
|
||||||
|
if (!NT_SUCCESS(status))
|
||||||
|
break;
|
||||||
|
|
||||||
|
ULONG value_len;
|
||||||
|
const WCHAR* value = conf_buf;
|
||||||
|
|
||||||
|
value_len = wcslen(value);
|
||||||
|
if (value_len <= group_len + 1)
|
||||||
|
continue;
|
||||||
|
if (_wcsnicmp(value, group, group_len) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
value += group_len;
|
||||||
|
if (*value != L',')
|
||||||
|
continue;
|
||||||
|
++value;
|
||||||
|
|
||||||
|
//
|
||||||
|
// value now points at the comma-separated
|
||||||
|
// list of processes in this process group
|
||||||
|
//
|
||||||
|
|
||||||
|
while (*value) {
|
||||||
|
WCHAR* ptr = wcschr(value, L',');
|
||||||
|
if (ptr)
|
||||||
|
value_len = (ULONG)(ULONG_PTR)(ptr - value);
|
||||||
|
else
|
||||||
|
value_len = wcslen(value);
|
||||||
|
|
||||||
|
if (value_len) {
|
||||||
|
if (*value != L'<') {
|
||||||
|
match = Config_MatchImage(
|
||||||
|
value, value_len, test_str, depth + 1);
|
||||||
|
}
|
||||||
|
else if (depth < 6) {
|
||||||
|
match = Config_MatchImageGroup(
|
||||||
|
value, value_len, test_str, depth + 1);
|
||||||
|
}
|
||||||
|
if (match)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
value += value_len;
|
||||||
|
while (*value == L',')
|
||||||
|
++value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return match;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Config_MatchImageAndGetValue
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
_FX WCHAR* Config_MatchImageAndGetValue(WCHAR* value)
|
||||||
|
{
|
||||||
|
ULONG image_len = (wcslen(Dll_ImageName) + 1) * sizeof(WCHAR);
|
||||||
|
WCHAR* image_lwr = Dll_AllocTemp(image_len);
|
||||||
|
if (!image_lwr) {
|
||||||
|
SbieApi_Log(2305, NULL);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
memcpy(image_lwr, Dll_ImageName, image_len);
|
||||||
|
_wcslwr(image_lwr);
|
||||||
|
//image_len = wcslen(image_lwr);
|
||||||
|
|
||||||
|
//
|
||||||
|
// if the setting indicates an image name followed by a comma,
|
||||||
|
// then match the image name against the executing process.
|
||||||
|
//
|
||||||
|
|
||||||
|
WCHAR* tmp = wcschr(value, L',');
|
||||||
|
if (tmp) {
|
||||||
|
|
||||||
|
BOOLEAN inv, match;
|
||||||
|
|
||||||
|
//
|
||||||
|
// exclamation marks negates the matching
|
||||||
|
//
|
||||||
|
|
||||||
|
if (*value == L'!') {
|
||||||
|
inv = TRUE;
|
||||||
|
++value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
inv = FALSE;
|
||||||
|
|
||||||
|
ULONG len = (ULONG)(tmp - value);
|
||||||
|
if (len) {
|
||||||
|
match = Config_MatchImage(value, len, image_lwr, 1);
|
||||||
|
if (inv)
|
||||||
|
match = !match;
|
||||||
|
if (!match)
|
||||||
|
tmp = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = tmp ? tmp + 1 : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dll_Free(image_lwr);
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Config_InitPatternList
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
_FX BOOLEAN Config_InitPatternList(const WCHAR* setting, LIST* list)
|
||||||
|
{
|
||||||
|
WCHAR conf_buf[2048];
|
||||||
|
|
||||||
|
PATTERN* pat;
|
||||||
|
|
||||||
|
ULONG index = 0;
|
||||||
|
while (1) {
|
||||||
|
|
||||||
|
NTSTATUS status = SbieApi_QueryConf(
|
||||||
|
NULL, setting, index, conf_buf, sizeof(conf_buf) - 16 * sizeof(WCHAR));
|
||||||
|
if (!NT_SUCCESS(status))
|
||||||
|
break;
|
||||||
|
++index;
|
||||||
|
|
||||||
|
WCHAR* value = Config_MatchImageAndGetValue(conf_buf);
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
pat = Pattern_Create(Dll_Pool, value, TRUE);
|
||||||
|
|
||||||
|
List_Insert_After(list, NULL, pat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Config_GetSettingsForImageName
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
_FX NTSTATUS Config_GetSettingsForImageName(
|
||||||
|
const WCHAR* setting, WCHAR* value, ULONG value_size, const WCHAR* deftext)
|
||||||
|
{
|
||||||
|
WCHAR conf_buf[2048];
|
||||||
|
WCHAR* found_value = NULL;
|
||||||
|
|
||||||
|
ULONG index = 0;
|
||||||
|
while (1) {
|
||||||
|
|
||||||
|
NTSTATUS status = SbieApi_QueryConf(
|
||||||
|
NULL, setting, index, conf_buf, sizeof(conf_buf) - 16 * sizeof(WCHAR));
|
||||||
|
if (!NT_SUCCESS(status))
|
||||||
|
break;
|
||||||
|
++index;
|
||||||
|
|
||||||
|
WCHAR* value = Config_MatchImageAndGetValue(conf_buf);
|
||||||
|
if (!value)
|
||||||
|
continue;
|
||||||
|
if (found_value) {
|
||||||
|
SbieApi_Log(2302, L"%S - %S [%S]", setting, Dll_ImageName, Dll_BoxName);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
found_value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (found_value) wcscpy_s(value, value_size / sizeof(WCHAR), found_value);
|
||||||
|
else if (deftext) wcscpy_s(value, value_size / sizeof(WCHAR), deftext);
|
||||||
|
else value[0] = L'\0';
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -371,6 +371,8 @@ NTSTATUS Dll_GetCurrentSidString(UNICODE_STRING *SidString);
|
||||||
// Functions (dllhook)
|
// Functions (dllhook)
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
NTSTATUS Dll_GetSettingsForImageName(
|
||||||
|
const WCHAR* setting, WCHAR* value, ULONG value_size, const WCHAR* deftext);
|
||||||
|
|
||||||
BOOLEAN Dll_SkipHook(const WCHAR *HookName);
|
BOOLEAN Dll_SkipHook(const WCHAR *HookName);
|
||||||
|
|
||||||
|
@ -733,6 +735,20 @@ BOOLEAN DigitalGuardian_Init(HMODULE);
|
||||||
|
|
||||||
BOOLEAN ComDlg32_Init(HMODULE);
|
BOOLEAN ComDlg32_Init(HMODULE);
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Functions (Config)
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
WCHAR* Config_MatchImageAndGetValue(WCHAR* value);
|
||||||
|
|
||||||
|
BOOLEAN Config_InitPatternList(const WCHAR* setting, LIST* list);
|
||||||
|
|
||||||
|
NTSTATUS Config_GetSettingsForImageName(
|
||||||
|
const WCHAR* setting, WCHAR* value, ULONG value_size, const WCHAR* deftext);
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,6 @@
|
||||||
|
|
||||||
static void *SbieDll_Hook_CheckChromeHook(void *SourceFunc);
|
static void *SbieDll_Hook_CheckChromeHook(void *SourceFunc);
|
||||||
|
|
||||||
static WCHAR *Dll_GetSettingsForImageName(
|
|
||||||
const WCHAR *setting, const WCHAR *deftext);
|
|
||||||
|
|
||||||
ULONG_PTR DLL_FindWow64Target(ULONG_PTR address);
|
ULONG_PTR DLL_FindWow64Target(ULONG_PTR address);
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -585,13 +582,14 @@ _FX void *SbieDll_Hook_CheckChromeHook(void *SourceFunc)
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
_FX WCHAR *Dll_GetSettingsForImageName(
|
_FX NTSTATUS Dll_GetSettingsForImageName(
|
||||||
const WCHAR *setting, const WCHAR *deftext)
|
const WCHAR *setting, WCHAR* value, ULONG value_size, const WCHAR *deftext)
|
||||||
{
|
{
|
||||||
POOL *pool;
|
POOL *pool;
|
||||||
WCHAR *text, *image_lwr, *buf;
|
WCHAR *text, *image_lwr, *buf;
|
||||||
ULONG text_len, image_len;
|
ULONG text_len, image_len;
|
||||||
ULONG index;
|
ULONG index;
|
||||||
|
BOOLEAN match = FALSE;
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -648,8 +646,10 @@ _FX WCHAR *Dll_GetSettingsForImageName(
|
||||||
++index;
|
++index;
|
||||||
|
|
||||||
ptr = wcschr(buf, L',');
|
ptr = wcschr(buf, L',');
|
||||||
if (! ptr)
|
if (!ptr) {
|
||||||
continue;
|
ptr = buf;
|
||||||
|
goto skip_match; // if there is no L',' it means any image
|
||||||
|
}
|
||||||
*ptr = L'\0';
|
*ptr = L'\0';
|
||||||
|
|
||||||
if (buf[0] == L'/' && buf[1] == L'/' &&
|
if (buf[0] == L'/' && buf[1] == L'/' &&
|
||||||
|
@ -663,42 +663,51 @@ _FX WCHAR *Dll_GetSettingsForImageName(
|
||||||
image_pat = Pattern_Create(pool, buf_ptr, TRUE);
|
image_pat = Pattern_Create(pool, buf_ptr, TRUE);
|
||||||
if (Pattern_Match(image_pat, image_lwr, image_len)) {
|
if (Pattern_Match(image_pat, image_lwr, image_len)) {
|
||||||
|
|
||||||
|
match = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pattern_Free(image_pat);
|
||||||
|
|
||||||
|
if (!match)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (text_len)
|
||||||
|
*ptr = L','; // restore comma if text is not empty
|
||||||
|
else
|
||||||
|
++ptr; // or skip comma if text is empty
|
||||||
|
|
||||||
|
skip_match:
|
||||||
|
{
|
||||||
ULONG ptr_len;
|
ULONG ptr_len;
|
||||||
WCHAR *new_text;
|
WCHAR* new_text;
|
||||||
if (text_len)
|
|
||||||
*ptr = L','; // restore comma if text is not empty
|
|
||||||
else
|
|
||||||
++ptr; // or skip comma if text is empty
|
|
||||||
ptr_len = wcslen(ptr);
|
ptr_len = wcslen(ptr);
|
||||||
new_text = Pool_Alloc(pool,
|
new_text = Pool_Alloc(pool,
|
||||||
(text_len + ptr_len + 1) * sizeof(WCHAR));
|
(text_len + ptr_len + 1) * sizeof(WCHAR));
|
||||||
if (! new_text)
|
if (!new_text)
|
||||||
goto outofmem;
|
goto outofmem;
|
||||||
wmemcpy(new_text, text, text_len);
|
wmemcpy(new_text, text, text_len);
|
||||||
wmemcpy(new_text + text_len, ptr, ptr_len + 1);
|
wmemcpy(new_text + text_len, ptr, ptr_len + 1);
|
||||||
text = new_text;
|
text = new_text;
|
||||||
text_len = text_len + ptr_len;
|
text_len = text_len + ptr_len;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
Pattern_Free(image_pat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// finish
|
// finish
|
||||||
//
|
//
|
||||||
|
|
||||||
buf = Dll_Alloc((text_len + 1) * sizeof(WCHAR));
|
wcscpy_s(value, value_size / sizeof(WCHAR), text);
|
||||||
wmemcpy(buf, text, text_len + 1);
|
|
||||||
|
|
||||||
Pool_Delete(pool);
|
Pool_Delete(pool);
|
||||||
|
|
||||||
return buf;
|
return STATUS_SUCCESS;
|
||||||
|
|
||||||
outofmem:
|
outofmem:
|
||||||
|
|
||||||
SbieApi_Log(2305, NULL);
|
SbieApi_Log(2305, NULL);
|
||||||
ExitProcess(-1);
|
ExitProcess(-1);
|
||||||
return NULL;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -709,37 +718,26 @@ outofmem:
|
||||||
|
|
||||||
_FX BOOLEAN Dll_SkipHook(const WCHAR *HookName)
|
_FX BOOLEAN Dll_SkipHook(const WCHAR *HookName)
|
||||||
{
|
{
|
||||||
static WCHAR *HookText = NULL;
|
static WCHAR HookText[256];
|
||||||
|
static BOOLEAN HookTextInit = TRUE;
|
||||||
BOOLEAN found = FALSE;
|
BOOLEAN found = FALSE;
|
||||||
|
|
||||||
//
|
//
|
||||||
// initialize hook text based on image name
|
// initialize hook text based on image name
|
||||||
//
|
//
|
||||||
|
|
||||||
if (! HookName) {
|
if (HookTextInit) {
|
||||||
|
|
||||||
const WCHAR *deftext = NULL;
|
HookTextInit = FALSE;
|
||||||
|
|
||||||
if (_wcsicmp(Dll_ImageName, L"DragonSaga.exe") == 0)
|
|
||||||
deftext = L"ntqsi,enumwin,findwin";
|
|
||||||
|
|
||||||
if (_wcsicmp(Dll_ImageName, L"BatmanAC.exe") == 0)
|
|
||||||
deftext = L"enumwin,findwin";
|
|
||||||
|
|
||||||
if (_wcsicmp(Dll_ImageName, L"PotPlayer64.exe") == 0 ||
|
|
||||||
_wcsicmp(Dll_ImageName, L"PotPlayerMini64.exe") == 0 ||
|
|
||||||
_wcsicmp(Dll_ImageName, L"mpc-hc64.exe") == 0) {
|
|
||||||
|
|
||||||
deftext = L"cocreate";
|
|
||||||
}
|
|
||||||
|
|
||||||
HookText = Dll_GetSettingsForImageName(L"SkipHook", deftext);
|
|
||||||
|
|
||||||
|
Dll_GetSettingsForImageName(L"SkipHook", HookText, sizeof(HookText), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// query for a specific hook
|
// query for a specific hook
|
||||||
//
|
//
|
||||||
|
|
||||||
} else if (HookText) {
|
if (HookName && *HookText) {
|
||||||
|
|
||||||
ULONG len = wcslen(HookName);
|
ULONG len = wcslen(HookName);
|
||||||
WCHAR *ptr = HookText;
|
WCHAR *ptr = HookText;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -554,7 +554,12 @@ _FX void Dll_SelectImageType(void)
|
||||||
L"dllhost.exe", (WCHAR *)DLL_IMAGE_DLLHOST,
|
L"dllhost.exe", (WCHAR *)DLL_IMAGE_DLLHOST,
|
||||||
|
|
||||||
L"iexplore.exe", (WCHAR *)DLL_IMAGE_INTERNET_EXPLORER,
|
L"iexplore.exe", (WCHAR *)DLL_IMAGE_INTERNET_EXPLORER,
|
||||||
|
|
||||||
L"firefox.exe", (WCHAR *)DLL_IMAGE_MOZILLA_FIREFOX,
|
L"firefox.exe", (WCHAR *)DLL_IMAGE_MOZILLA_FIREFOX,
|
||||||
|
L"waterfox.exe", (WCHAR *)DLL_IMAGE_MOZILLA_FIREFOX,
|
||||||
|
L"palemoon.exe", (WCHAR *)DLL_IMAGE_MOZILLA_FIREFOX,
|
||||||
|
L"basilisk.exe", (WCHAR *)DLL_IMAGE_MOZILLA_FIREFOX,
|
||||||
|
L"brave.exe", (WCHAR *)DLL_IMAGE_MOZILLA_FIREFOX,
|
||||||
|
|
||||||
L"wmplayer.exe", (WCHAR *)DLL_IMAGE_WINDOWS_MEDIA_PLAYER,
|
L"wmplayer.exe", (WCHAR *)DLL_IMAGE_WINDOWS_MEDIA_PLAYER,
|
||||||
L"winamp.exe", (WCHAR *)DLL_IMAGE_NULLSOFT_WINAMP,
|
L"winamp.exe", (WCHAR *)DLL_IMAGE_NULLSOFT_WINAMP,
|
||||||
|
|
|
@ -47,9 +47,9 @@ static void *Dll_AllocFromPool(POOL *pool, ULONG size);
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
static POOL *Dll_Pool = NULL;
|
POOL *Dll_Pool = NULL;
|
||||||
static POOL *Dll_PoolTemp = NULL;
|
POOL *Dll_PoolTemp = NULL;
|
||||||
static POOL *Dll_PoolCode = NULL;
|
POOL *Dll_PoolCode = NULL;
|
||||||
|
|
||||||
static ULONG Dll_TlsIndex = TLS_OUT_OF_INDEXES;
|
static ULONG Dll_TlsIndex = TLS_OUT_OF_INDEXES;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
// File
|
// File
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define NOGDI
|
||||||
#include "dll.h"
|
#include "dll.h"
|
||||||
#include "obj.h"
|
#include "obj.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -201,9 +201,8 @@ static NTSTATUS File_MigrateFile(
|
||||||
const WCHAR *TruePath, const WCHAR *CopyPath,
|
const WCHAR *TruePath, const WCHAR *CopyPath,
|
||||||
BOOLEAN IsWritePath, BOOLEAN WithContents);
|
BOOLEAN IsWritePath, BOOLEAN WithContents);
|
||||||
|
|
||||||
static const BOOLEAN File_MigrateFile_ManualBypass(const WCHAR *TruePath, ULONGLONG file_size);
|
static const BOOLEAN File_MigrateFile_ManualBypass(
|
||||||
|
const WCHAR *TruePath, ULONGLONG file_size);
|
||||||
static const WCHAR *File_MigrateFile_ShouldBypass(const WCHAR *TruePath);
|
|
||||||
|
|
||||||
static NTSTATUS File_CopyShortName(
|
static NTSTATUS File_CopyShortName(
|
||||||
const WCHAR *TruePath, const WCHAR *CopyPath);
|
const WCHAR *TruePath, const WCHAR *CopyPath);
|
||||||
|
@ -352,9 +351,6 @@ static ULONG File_PublicUserLen = 0;
|
||||||
static WCHAR *File_HomeNtPath = NULL;
|
static WCHAR *File_HomeNtPath = NULL;
|
||||||
static ULONG File_HomeNtPathLen = 0;
|
static ULONG File_HomeNtPathLen = 0;
|
||||||
|
|
||||||
static ULONG File_CopyLimitKb = (80 * 1024); // 80 MB
|
|
||||||
static BOOLEAN File_CopyLimitSilent = FALSE;
|
|
||||||
|
|
||||||
static BOOLEAN File_Windows2000 = FALSE;
|
static BOOLEAN File_Windows2000 = FALSE;
|
||||||
|
|
||||||
static WCHAR *File_AltBoxPath = NULL;
|
static WCHAR *File_AltBoxPath = NULL;
|
||||||
|
@ -375,6 +371,7 @@ static ULONG File_Snapshot_Count = 0;
|
||||||
#include "file_pipe.c"
|
#include "file_pipe.c"
|
||||||
#include "file_dir.c"
|
#include "file_dir.c"
|
||||||
#include "file_misc.c"
|
#include "file_misc.c"
|
||||||
|
#include "file_copy.c"
|
||||||
#include "file_init.c"
|
#include "file_init.c"
|
||||||
|
|
||||||
|
|
||||||
|
@ -2864,39 +2861,6 @@ ReparseLoop:
|
||||||
status = STATUS_SUCCESS;
|
status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Internet Shortcuts (.url files) are consistently overwritten
|
|
||||||
// as part of their usage. If the shortcut exists only as a
|
|
||||||
// TruePath, then we pretend it's a read-only file
|
|
||||||
//
|
|
||||||
// apply similar handling to media files
|
|
||||||
//
|
|
||||||
|
|
||||||
if (FileType & TYPE_FILE) {
|
|
||||||
|
|
||||||
WCHAR *dot = wcsrchr(TruePath, L'.');
|
|
||||||
if (dot) {
|
|
||||||
|
|
||||||
static const WCHAR *_ReadOnlyFileTypes =
|
|
||||||
L".url.avi.wma.wmv.mpg.mp3.mp4";
|
|
||||||
const WCHAR *ptr = _ReadOnlyFileTypes;
|
|
||||||
|
|
||||||
WCHAR dot1 = towlower(dot[1]);
|
|
||||||
WCHAR dot2 = towlower(dot[2]);
|
|
||||||
WCHAR dot3 = towlower(dot[3]);
|
|
||||||
|
|
||||||
while (*ptr) {
|
|
||||||
|
|
||||||
if (dot1 == ptr[1] && dot2 == ptr[2] && dot3 == ptr[3]) {
|
|
||||||
FileType |= TYPE_READ_ONLY | TYPE_SYSTEM;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ptr += 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// we don't have CopyPath, but if we did find TruePath, and this
|
// we don't have CopyPath, but if we did find TruePath, and this
|
||||||
// is a read-only operation, then let the system handle it
|
// is a read-only operation, then let the system handle it
|
||||||
|
@ -3158,34 +3122,6 @@ ReparseLoop:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WithContents) {
|
|
||||||
|
|
||||||
//
|
|
||||||
// don't copy contents of Windows Explorer thumbcache
|
|
||||||
// (note that name was chaged to iconcache on Windows 8)
|
|
||||||
//
|
|
||||||
|
|
||||||
WCHAR *dot = wcsrchr(TruePath, L'.');
|
|
||||||
if (dot && _wcsicmp(dot + 1, L"db") == 0) {
|
|
||||||
|
|
||||||
WCHAR *ptr;
|
|
||||||
ULONG len = wcslen(TruePath) + 1;
|
|
||||||
WCHAR *TempPath = Dll_AllocTemp(len * sizeof(WCHAR));
|
|
||||||
wmemcpy(TempPath, TruePath, len);
|
|
||||||
_wcslwr(TempPath);
|
|
||||||
|
|
||||||
ptr = wcsstr(TempPath,
|
|
||||||
L"\\microsoft\\windows\\explorer\\");
|
|
||||||
if (ptr && ( wcsncmp(ptr + 28, L"thumbcache_", 11) == 0
|
|
||||||
|| wcsncmp(ptr + 28, L"iconcache_", 10) == 0)) {
|
|
||||||
|
|
||||||
WithContents = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Dll_Free(TempPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
WithContents = FALSE;
|
WithContents = FALSE;
|
||||||
|
@ -3990,296 +3926,6 @@ _FX NTSTATUS File_CreatePath(WCHAR *TruePath, WCHAR *CopyPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
// File_MigrateFile
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
_FX NTSTATUS File_MigrateFile(
|
|
||||||
const WCHAR *TruePath, const WCHAR *CopyPath,
|
|
||||||
BOOLEAN IsWritePath, BOOLEAN WithContents)
|
|
||||||
{
|
|
||||||
NTSTATUS status;
|
|
||||||
HANDLE TrueHandle, CopyHandle;
|
|
||||||
OBJECT_ATTRIBUTES objattrs;
|
|
||||||
UNICODE_STRING objname;
|
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
|
||||||
FILE_NETWORK_OPEN_INFORMATION open_info;
|
|
||||||
ULONGLONG file_size;
|
|
||||||
ACCESS_MASK DesiredAccess;
|
|
||||||
ULONG CreateOptions;
|
|
||||||
|
|
||||||
InitializeObjectAttributes(
|
|
||||||
&objattrs, &objname, OBJ_CASE_INSENSITIVE, NULL, Secure_NormalSD);
|
|
||||||
|
|
||||||
//
|
|
||||||
// open TruePath. if we get a sharing violation trying to open it,
|
|
||||||
// try to get the driver to open it bypassing share access. if even
|
|
||||||
// this fails, then we can't copy the data, but can still create an
|
|
||||||
// empty file
|
|
||||||
//
|
|
||||||
|
|
||||||
RtlInitUnicodeString(&objname, TruePath);
|
|
||||||
|
|
||||||
status = __sys_NtCreateFile(
|
|
||||||
&TrueHandle, FILE_GENERIC_READ, &objattrs, &IoStatusBlock,
|
|
||||||
NULL, 0, FILE_SHARE_VALID_FLAGS,
|
|
||||||
FILE_OPEN, FILE_SYNCHRONOUS_IO_NONALERT, NULL, 0);
|
|
||||||
|
|
||||||
if (IsWritePath && status == STATUS_ACCESS_DENIED)
|
|
||||||
status = STATUS_SHARING_VIOLATION;
|
|
||||||
|
|
||||||
if (status == STATUS_SHARING_VIOLATION) {
|
|
||||||
|
|
||||||
status = SbieApi_OpenFile(&TrueHandle, TruePath);
|
|
||||||
|
|
||||||
if (! NT_SUCCESS(status)) {
|
|
||||||
|
|
||||||
WithContents = FALSE;
|
|
||||||
|
|
||||||
status = __sys_NtCreateFile(
|
|
||||||
&TrueHandle, FILE_READ_ATTRIBUTES | SYNCHRONIZE,
|
|
||||||
&objattrs, &IoStatusBlock, NULL, 0, FILE_SHARE_VALID_FLAGS,
|
|
||||||
FILE_OPEN, FILE_SYNCHRONOUS_IO_NONALERT, NULL, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! NT_SUCCESS(status))
|
|
||||||
return status;
|
|
||||||
|
|
||||||
//
|
|
||||||
// query attributes and size of the TruePath file
|
|
||||||
//
|
|
||||||
|
|
||||||
status = __sys_NtQueryInformationFile(
|
|
||||||
TrueHandle, &IoStatusBlock, &open_info,
|
|
||||||
sizeof(FILE_NETWORK_OPEN_INFORMATION), FileNetworkOpenInformation);
|
|
||||||
|
|
||||||
if (! NT_SUCCESS(status)) {
|
|
||||||
NtClose(TrueHandle);
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (WithContents) {
|
|
||||||
|
|
||||||
static BOOLEAN _ReinitCopyLimit = FALSE;
|
|
||||||
if (_ReinitCopyLimit) {
|
|
||||||
_ReinitCopyLimit = FALSE;
|
|
||||||
File_InitCopyLimit();
|
|
||||||
}
|
|
||||||
|
|
||||||
file_size = open_info.EndOfFile.QuadPart;
|
|
||||||
|
|
||||||
if (File_CopyLimitKb != -1 && file_size > (File_CopyLimitKb * 1024)) {
|
|
||||||
|
|
||||||
const WCHAR *TruePathName =
|
|
||||||
File_MigrateFile_ShouldBypass(TruePath);
|
|
||||||
|
|
||||||
if (TruePathName && !File_MigrateFile_ManualBypass(TruePath, file_size)) {
|
|
||||||
|
|
||||||
NtClose(TrueHandle);
|
|
||||||
|
|
||||||
if (! File_CopyLimitSilent) {
|
|
||||||
|
|
||||||
ULONG TruePathNameLen = wcslen(TruePathName);
|
|
||||||
WCHAR *text = Dll_AllocTemp(
|
|
||||||
(TruePathNameLen + 64) * sizeof(WCHAR));
|
|
||||||
Sbie_snwprintf(text, (TruePathNameLen + 64), L"%s [%s / %I64u]",
|
|
||||||
TruePathName, Dll_BoxName, file_size);
|
|
||||||
|
|
||||||
SbieApi_Log(2102, text);
|
|
||||||
|
|
||||||
Dll_Free(text);
|
|
||||||
|
|
||||||
_ReinitCopyLimit = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return STATUS_BAD_INITIAL_PC;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else
|
|
||||||
|
|
||||||
file_size = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
// create the CopyPath file
|
|
||||||
//
|
|
||||||
|
|
||||||
RtlInitUnicodeString(&objname, CopyPath);
|
|
||||||
|
|
||||||
if (open_info.FileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
|
||||||
DesiredAccess = FILE_GENERIC_READ;
|
|
||||||
CreateOptions = FILE_DIRECTORY_FILE;
|
|
||||||
} else {
|
|
||||||
DesiredAccess = FILE_GENERIC_WRITE;
|
|
||||||
CreateOptions = FILE_NON_DIRECTORY_FILE;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = __sys_NtCreateFile(
|
|
||||||
&CopyHandle, DesiredAccess, &objattrs, &IoStatusBlock,
|
|
||||||
NULL, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_VALID_FLAGS,
|
|
||||||
FILE_CREATE, FILE_SYNCHRONOUS_IO_NONALERT | CreateOptions,
|
|
||||||
NULL, 0);
|
|
||||||
|
|
||||||
if (! NT_SUCCESS(status)) {
|
|
||||||
NtClose(TrueHandle);
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// copy the file, if so desired
|
|
||||||
//
|
|
||||||
|
|
||||||
if (file_size) {
|
|
||||||
|
|
||||||
ULONG Next_Status = GetTickCount() + 3000; // wait 3 seconds
|
|
||||||
|
|
||||||
void *buffer = Dll_AllocTemp(PAGE_SIZE);
|
|
||||||
if (! buffer) {
|
|
||||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
|
||||||
file_size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (file_size > 0) {
|
|
||||||
|
|
||||||
ULONG buffer_size =
|
|
||||||
(file_size > PAGE_SIZE) ? PAGE_SIZE : (ULONG)file_size;
|
|
||||||
|
|
||||||
status = NtReadFile(
|
|
||||||
TrueHandle, NULL, NULL, NULL, &IoStatusBlock,
|
|
||||||
buffer, buffer_size, NULL, NULL);
|
|
||||||
|
|
||||||
if (NT_SUCCESS(status)) {
|
|
||||||
|
|
||||||
buffer_size = (ULONG)IoStatusBlock.Information;
|
|
||||||
file_size -= (ULONGLONG)buffer_size;
|
|
||||||
|
|
||||||
status = NtWriteFile(
|
|
||||||
CopyHandle, NULL, NULL, NULL, &IoStatusBlock,
|
|
||||||
buffer, buffer_size, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! NT_SUCCESS(status))
|
|
||||||
break;
|
|
||||||
|
|
||||||
ULONG Cur_Ticks = GetTickCount();
|
|
||||||
if (Next_Status < Cur_Ticks) {
|
|
||||||
Next_Status = Cur_Ticks + 1000; // update prgress every second
|
|
||||||
|
|
||||||
WCHAR size_str[32];
|
|
||||||
Sbie_snwprintf(size_str, 32, L"%I64u", file_size);
|
|
||||||
const WCHAR* strings[] = { Dll_BoxName, TruePath, size_str, NULL };
|
|
||||||
SbieApi_LogMsgExt(2198, strings);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buffer)
|
|
||||||
Dll_Free(buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// set the short name on the file. we must do this before we copy
|
|
||||||
// its attributes, as this may make the file read-only
|
|
||||||
//
|
|
||||||
|
|
||||||
if (NT_SUCCESS(status)) {
|
|
||||||
|
|
||||||
status = File_CopyShortName(TruePath, CopyPath);
|
|
||||||
|
|
||||||
if (IsWritePath && status == STATUS_ACCESS_DENIED)
|
|
||||||
status = STATUS_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// set information on the CopyPath file
|
|
||||||
//
|
|
||||||
|
|
||||||
if (NT_SUCCESS(status)) {
|
|
||||||
|
|
||||||
FILE_BASIC_INFORMATION info;
|
|
||||||
|
|
||||||
info.CreationTime.QuadPart = open_info.CreationTime.QuadPart;
|
|
||||||
info.LastAccessTime.QuadPart = open_info.LastAccessTime.QuadPart;
|
|
||||||
info.LastWriteTime.QuadPart = open_info.LastWriteTime.QuadPart;
|
|
||||||
info.ChangeTime.QuadPart = open_info.ChangeTime.QuadPart;
|
|
||||||
info.FileAttributes = open_info.FileAttributes;
|
|
||||||
|
|
||||||
status = File_SetAttributes(CopyHandle, CopyPath, &info);
|
|
||||||
}
|
|
||||||
|
|
||||||
NtClose(TrueHandle);
|
|
||||||
NtClose(CopyHandle);
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
// File_MigrateFile_ManualBypass
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
_FX const BOOLEAN File_MigrateFile_ManualBypass(const WCHAR *TruePath, ULONGLONG file_size)
|
|
||||||
{
|
|
||||||
MAN_FILE_MIGRATION_REQ req;
|
|
||||||
MAN_FILE_MIGRATION_RPL *rpl = NULL;
|
|
||||||
BOOLEAN ok = FALSE;
|
|
||||||
|
|
||||||
req.msgid = MAN_FILE_MIGRATION;
|
|
||||||
req.file_size = file_size;
|
|
||||||
wcscpy(req.file_path, TruePath);
|
|
||||||
|
|
||||||
rpl = SbieDll_CallServerQueue(INTERACTIVE_QUEUE_NAME, &req, sizeof(req), sizeof(*rpl));
|
|
||||||
if (rpl)
|
|
||||||
{
|
|
||||||
ok = rpl->retval != 0;
|
|
||||||
Dll_Free(rpl);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
// File_MigrateFile_ShouldBypass
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
_FX const WCHAR *File_MigrateFile_ShouldBypass(const WCHAR *TruePath)
|
|
||||||
{
|
|
||||||
// todo: load this list from file
|
|
||||||
static const WCHAR *_names[] = {
|
|
||||||
// firefox
|
|
||||||
L"places.sqlite", L"xul.mfl",
|
|
||||||
// windows installer etc
|
|
||||||
L"qmgr0.dat", L"qmgr1.dat", L"infcache.1", L"cbs.log",
|
|
||||||
// explorer
|
|
||||||
L"thumbcache_32.db", L"thumbcache_96.db", L"thumbcache_256.db",
|
|
||||||
L"thumbcache_1024.db", L"thumbcache_idx.db", L"thumbcache_sr.db",
|
|
||||||
// internet explorer 10 web cache
|
|
||||||
L"webcachev01.dat", L"webcachev01.tmp",
|
|
||||||
L"webcachev24.dat", L"webcachev24.tmp",
|
|
||||||
// end of list
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
const WCHAR **nameptr;
|
|
||||||
|
|
||||||
const WCHAR *name = wcsrchr(TruePath, L'\\');
|
|
||||||
if (name)
|
|
||||||
++name;
|
|
||||||
else
|
|
||||||
name = TruePath;
|
|
||||||
|
|
||||||
for (nameptr = _names; *nameptr; ++nameptr)
|
|
||||||
if (_wcsicmp(name, *nameptr) == 0)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// File_CopyShortName
|
// File_CopyShortName
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
|
@ -0,0 +1,442 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// File (Copy)
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "common\pattern.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Functions
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void File_InitCopyLimit(void);
|
||||||
|
|
||||||
|
static BOOLEAN File_InitFileMigration(void);
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// Variables
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern POOL* Dll_Pool;
|
||||||
|
extern POOL* Dll_PoolTemp;
|
||||||
|
|
||||||
|
typedef enum { // Note: thisorder defines the config priority
|
||||||
|
FILE_DONT_COPY,
|
||||||
|
FILE_COPY_CONTENT,
|
||||||
|
FILE_COPY_EMPTY,
|
||||||
|
NUM_COPY_MODES
|
||||||
|
} ENUM_COPY_MODES;
|
||||||
|
|
||||||
|
static LIST File_MigrationOptions[NUM_COPY_MODES];
|
||||||
|
|
||||||
|
static BOOLEAN File_MigrationDenyWrite = FALSE;
|
||||||
|
|
||||||
|
static ULONG File_CopyLimitKb = (80 * 1024); // 80 MB
|
||||||
|
static BOOLEAN File_CopyLimitSilent = FALSE;
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// File_InitFileMigration
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
_FX BOOLEAN File_InitFileMigration(void)
|
||||||
|
{
|
||||||
|
//File_PathPool = Pool_Create();
|
||||||
|
//if (!File_PathPool) {
|
||||||
|
// SbieApi_Log(2305, NULL);
|
||||||
|
// return FALSE;
|
||||||
|
//}
|
||||||
|
|
||||||
|
for(ULONG i=0; i < NUM_COPY_MODES; i++)
|
||||||
|
List_Init(&File_MigrationOptions[i]);
|
||||||
|
|
||||||
|
Config_InitPatternList(L"CopyEmpty", &File_MigrationOptions[FILE_COPY_EMPTY]);
|
||||||
|
Config_InitPatternList(L"CopyAlways", &File_MigrationOptions[FILE_COPY_CONTENT]);
|
||||||
|
Config_InitPatternList(L"DontCopy", &File_MigrationOptions[FILE_DONT_COPY]);
|
||||||
|
|
||||||
|
WCHAR conf[16];
|
||||||
|
Config_GetSettingsForImageName(L"CopyBlockDenyWrite", conf, sizeof(conf), NULL);
|
||||||
|
if (*conf == L'y' || *conf == L'Y')
|
||||||
|
File_MigrationDenyWrite = TRUE;
|
||||||
|
|
||||||
|
File_InitCopyLimit();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// File_MigrateFile_GetMode
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
_FX ULONG File_MigrateFile_GetMode(const WCHAR* TruePath, ULONGLONG file_size)
|
||||||
|
{
|
||||||
|
ULONG mode = NUM_COPY_MODES;
|
||||||
|
|
||||||
|
ULONG path_len = (wcslen(TruePath) + 1) * sizeof(WCHAR);
|
||||||
|
WCHAR* path_lwr = Dll_AllocTemp(path_len);
|
||||||
|
if (!path_lwr) {
|
||||||
|
SbieApi_Log(2305, NULL);
|
||||||
|
return FILE_DONT_COPY;
|
||||||
|
}
|
||||||
|
memcpy(path_lwr, TruePath, path_len);
|
||||||
|
_wcslwr(path_lwr);
|
||||||
|
path_len = wcslen(path_lwr);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check what preset applyes to this file type/path
|
||||||
|
//
|
||||||
|
|
||||||
|
for (ULONG i = 0; i < NUM_COPY_MODES; i++)
|
||||||
|
{
|
||||||
|
PATTERN* pat = List_Head(&File_MigrationOptions[i]);
|
||||||
|
while (pat)
|
||||||
|
{
|
||||||
|
if (Pattern_Match(pat, path_lwr, path_len))
|
||||||
|
{
|
||||||
|
mode = i;
|
||||||
|
goto found_match;
|
||||||
|
}
|
||||||
|
pat = List_Next(pat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
found_match:
|
||||||
|
|
||||||
|
Dll_Free(path_lwr);
|
||||||
|
|
||||||
|
if (mode != NUM_COPY_MODES)
|
||||||
|
return mode;
|
||||||
|
|
||||||
|
//
|
||||||
|
// if tere is no configuration for this file type/path decide based on the file size
|
||||||
|
//
|
||||||
|
|
||||||
|
if (File_CopyLimitKb == -1 || file_size < (File_CopyLimitKb * 1024))
|
||||||
|
return FILE_COPY_CONTENT;
|
||||||
|
|
||||||
|
//
|
||||||
|
// ask the user to decide if the large file should be coped into the sandbox
|
||||||
|
//
|
||||||
|
|
||||||
|
MAN_FILE_MIGRATION_REQ req;
|
||||||
|
MAN_FILE_MIGRATION_RPL* rpl = NULL;
|
||||||
|
BOOLEAN ok = FALSE;
|
||||||
|
|
||||||
|
req.msgid = MAN_FILE_MIGRATION;
|
||||||
|
req.file_size = file_size;
|
||||||
|
wcscpy(req.file_path, TruePath);
|
||||||
|
|
||||||
|
rpl = SbieDll_CallServerQueue(INTERACTIVE_QUEUE_NAME, &req, sizeof(req), sizeof(*rpl));
|
||||||
|
if (rpl)
|
||||||
|
{
|
||||||
|
ok = rpl->retval != 0;
|
||||||
|
Dll_Free(rpl);
|
||||||
|
|
||||||
|
if(ok)
|
||||||
|
return FILE_COPY_CONTENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// issue apropriate message if so configured, and user wasn't asked
|
||||||
|
//
|
||||||
|
|
||||||
|
else if (!File_CopyLimitSilent)
|
||||||
|
{
|
||||||
|
const WCHAR* name = wcsrchr(TruePath, L'\\');
|
||||||
|
if (name)
|
||||||
|
++name;
|
||||||
|
else
|
||||||
|
name = TruePath;
|
||||||
|
|
||||||
|
ULONG TruePathNameLen = wcslen(name);
|
||||||
|
WCHAR* text = Dll_AllocTemp(
|
||||||
|
(TruePathNameLen + 64) * sizeof(WCHAR));
|
||||||
|
Sbie_snwprintf(text, (TruePathNameLen + 64), L"%s [%s / %I64u]",
|
||||||
|
name, Dll_BoxName, file_size);
|
||||||
|
|
||||||
|
SbieApi_Log(2102, text);
|
||||||
|
|
||||||
|
Dll_Free(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
return FILE_DONT_COPY;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// File_InitCopyLimit
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
_FX void File_InitCopyLimit(void)
|
||||||
|
{
|
||||||
|
static const WCHAR* _CopyLimitKb = L"CopyLimitKb";
|
||||||
|
static const WCHAR* _CopyLimitSilent = L"CopyLimitSilent";
|
||||||
|
NTSTATUS status;
|
||||||
|
WCHAR str[32];
|
||||||
|
|
||||||
|
//
|
||||||
|
// if this is one of SandboxieCrypto, SandboxieWUAU or WUAUCLT,
|
||||||
|
// or TrustedInstaller, then we don't impose a CopyLimit
|
||||||
|
//
|
||||||
|
|
||||||
|
BOOLEAN SetMaxCopyLimit = FALSE;
|
||||||
|
|
||||||
|
if (Dll_ImageType == DLL_IMAGE_SANDBOXIE_CRYPTO ||
|
||||||
|
Dll_ImageType == DLL_IMAGE_SANDBOXIE_WUAU ||
|
||||||
|
Dll_ImageType == DLL_IMAGE_WUAUCLT ||
|
||||||
|
Dll_ImageType == DLL_IMAGE_TRUSTED_INSTALLER) {
|
||||||
|
|
||||||
|
SetMaxCopyLimit = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SetMaxCopyLimit) {
|
||||||
|
|
||||||
|
File_CopyLimitKb = -1;
|
||||||
|
File_CopyLimitSilent = FALSE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// get configuration settings for CopyLimitKb and CopyLimitSilent
|
||||||
|
//
|
||||||
|
|
||||||
|
status = SbieApi_QueryConfAsIs(
|
||||||
|
NULL, _CopyLimitKb, 0, str, sizeof(str) - sizeof(WCHAR));
|
||||||
|
if (NT_SUCCESS(status)) {
|
||||||
|
ULONGLONG num = _wtoi64(str);
|
||||||
|
if (num)
|
||||||
|
File_CopyLimitKb = (num > 0x000000007fffffff) ? -1 : (ULONG)num;
|
||||||
|
else
|
||||||
|
SbieApi_Log(2207, _CopyLimitKb);
|
||||||
|
}
|
||||||
|
|
||||||
|
File_CopyLimitSilent =
|
||||||
|
SbieApi_QueryConfBool(NULL, _CopyLimitSilent, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// File_MigrateFile
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
_FX NTSTATUS File_MigrateFile(
|
||||||
|
const WCHAR* TruePath, const WCHAR* CopyPath,
|
||||||
|
BOOLEAN IsWritePath, BOOLEAN WithContents)
|
||||||
|
{
|
||||||
|
NTSTATUS status;
|
||||||
|
HANDLE TrueHandle, CopyHandle;
|
||||||
|
OBJECT_ATTRIBUTES objattrs;
|
||||||
|
UNICODE_STRING objname;
|
||||||
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
|
FILE_NETWORK_OPEN_INFORMATION open_info;
|
||||||
|
ULONGLONG file_size;
|
||||||
|
ACCESS_MASK DesiredAccess;
|
||||||
|
ULONG CreateOptions;
|
||||||
|
|
||||||
|
InitializeObjectAttributes(
|
||||||
|
&objattrs, &objname, OBJ_CASE_INSENSITIVE, NULL, Secure_NormalSD);
|
||||||
|
|
||||||
|
//
|
||||||
|
// open TruePath. if we get a sharing violation trying to open it,
|
||||||
|
// try to get the driver to open it bypassing share access. if even
|
||||||
|
// this fails, then we can't copy the data, but can still create an
|
||||||
|
// empty file
|
||||||
|
//
|
||||||
|
|
||||||
|
RtlInitUnicodeString(&objname, TruePath);
|
||||||
|
|
||||||
|
status = __sys_NtCreateFile(
|
||||||
|
&TrueHandle, FILE_GENERIC_READ, &objattrs, &IoStatusBlock,
|
||||||
|
NULL, 0, FILE_SHARE_VALID_FLAGS,
|
||||||
|
FILE_OPEN, FILE_SYNCHRONOUS_IO_NONALERT, NULL, 0);
|
||||||
|
|
||||||
|
if (IsWritePath && status == STATUS_ACCESS_DENIED)
|
||||||
|
status = STATUS_SHARING_VIOLATION;
|
||||||
|
|
||||||
|
if (status == STATUS_SHARING_VIOLATION) {
|
||||||
|
|
||||||
|
status = SbieApi_OpenFile(&TrueHandle, TruePath);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(status)) {
|
||||||
|
|
||||||
|
WithContents = FALSE;
|
||||||
|
|
||||||
|
status = __sys_NtCreateFile(
|
||||||
|
&TrueHandle, FILE_READ_ATTRIBUTES | SYNCHRONIZE,
|
||||||
|
&objattrs, &IoStatusBlock, NULL, 0, FILE_SHARE_VALID_FLAGS,
|
||||||
|
FILE_OPEN, FILE_SYNCHRONOUS_IO_NONALERT, NULL, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(status))
|
||||||
|
return status;
|
||||||
|
|
||||||
|
//
|
||||||
|
// query attributes and size of the TruePath file
|
||||||
|
//
|
||||||
|
|
||||||
|
status = __sys_NtQueryInformationFile(
|
||||||
|
TrueHandle, &IoStatusBlock, &open_info,
|
||||||
|
sizeof(FILE_NETWORK_OPEN_INFORMATION), FileNetworkOpenInformation);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(status)) {
|
||||||
|
NtClose(TrueHandle);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WithContents) {
|
||||||
|
|
||||||
|
file_size = open_info.EndOfFile.QuadPart;
|
||||||
|
|
||||||
|
ULONG mode = File_MigrateFile_GetMode(TruePath, file_size);
|
||||||
|
|
||||||
|
if (mode == FILE_COPY_EMPTY)
|
||||||
|
file_size = 0;
|
||||||
|
else if (mode == FILE_DONT_COPY)
|
||||||
|
{
|
||||||
|
NtClose(TrueHandle);
|
||||||
|
|
||||||
|
if (File_MigrationDenyWrite)
|
||||||
|
return STATUS_ACCESS_DENIED;
|
||||||
|
else
|
||||||
|
return STATUS_BAD_INITIAL_PC;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
file_size = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// create the CopyPath file
|
||||||
|
//
|
||||||
|
|
||||||
|
RtlInitUnicodeString(&objname, CopyPath);
|
||||||
|
|
||||||
|
if (open_info.FileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||||
|
DesiredAccess = FILE_GENERIC_READ;
|
||||||
|
CreateOptions = FILE_DIRECTORY_FILE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
DesiredAccess = FILE_GENERIC_WRITE;
|
||||||
|
CreateOptions = FILE_NON_DIRECTORY_FILE;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = __sys_NtCreateFile(
|
||||||
|
&CopyHandle, DesiredAccess, &objattrs, &IoStatusBlock,
|
||||||
|
NULL, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_VALID_FLAGS,
|
||||||
|
FILE_CREATE, FILE_SYNCHRONOUS_IO_NONALERT | CreateOptions,
|
||||||
|
NULL, 0);
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(status)) {
|
||||||
|
NtClose(TrueHandle);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// copy the file, if so desired
|
||||||
|
//
|
||||||
|
|
||||||
|
if (file_size) {
|
||||||
|
|
||||||
|
ULONG Next_Status = GetTickCount() + 3000; // wait 3 seconds
|
||||||
|
|
||||||
|
void* buffer = Dll_AllocTemp(PAGE_SIZE);
|
||||||
|
if (!buffer) {
|
||||||
|
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
file_size = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (file_size > 0) {
|
||||||
|
|
||||||
|
ULONG buffer_size =
|
||||||
|
(file_size > PAGE_SIZE) ? PAGE_SIZE : (ULONG)file_size;
|
||||||
|
|
||||||
|
status = NtReadFile(
|
||||||
|
TrueHandle, NULL, NULL, NULL, &IoStatusBlock,
|
||||||
|
buffer, buffer_size, NULL, NULL);
|
||||||
|
|
||||||
|
if (NT_SUCCESS(status)) {
|
||||||
|
|
||||||
|
buffer_size = (ULONG)IoStatusBlock.Information;
|
||||||
|
file_size -= (ULONGLONG)buffer_size;
|
||||||
|
|
||||||
|
status = NtWriteFile(
|
||||||
|
CopyHandle, NULL, NULL, NULL, &IoStatusBlock,
|
||||||
|
buffer, buffer_size, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!NT_SUCCESS(status))
|
||||||
|
break;
|
||||||
|
|
||||||
|
ULONG Cur_Ticks = GetTickCount();
|
||||||
|
if (Next_Status < Cur_Ticks) {
|
||||||
|
Next_Status = Cur_Ticks + 1000; // update prgress every second
|
||||||
|
|
||||||
|
WCHAR size_str[32];
|
||||||
|
Sbie_snwprintf(size_str, 32, L"%I64u", file_size);
|
||||||
|
const WCHAR* strings[] = { Dll_BoxName, TruePath, size_str, NULL };
|
||||||
|
SbieApi_LogMsgExt(2198, strings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buffer)
|
||||||
|
Dll_Free(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// set the short name on the file. we must do this before we copy
|
||||||
|
// its attributes, as this may make the file read-only
|
||||||
|
//
|
||||||
|
|
||||||
|
if (NT_SUCCESS(status)) {
|
||||||
|
|
||||||
|
status = File_CopyShortName(TruePath, CopyPath);
|
||||||
|
|
||||||
|
if (IsWritePath && status == STATUS_ACCESS_DENIED)
|
||||||
|
status = STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// set information on the CopyPath file
|
||||||
|
//
|
||||||
|
|
||||||
|
if (NT_SUCCESS(status)) {
|
||||||
|
|
||||||
|
FILE_BASIC_INFORMATION info;
|
||||||
|
|
||||||
|
info.CreationTime.QuadPart = open_info.CreationTime.QuadPart;
|
||||||
|
info.LastAccessTime.QuadPart = open_info.LastAccessTime.QuadPart;
|
||||||
|
info.LastWriteTime.QuadPart = open_info.LastWriteTime.QuadPart;
|
||||||
|
info.ChangeTime.QuadPart = open_info.ChangeTime.QuadPart;
|
||||||
|
info.FileAttributes = open_info.FileAttributes;
|
||||||
|
|
||||||
|
status = File_SetAttributes(CopyHandle, CopyPath, &info);
|
||||||
|
}
|
||||||
|
|
||||||
|
NtClose(TrueHandle);
|
||||||
|
NtClose(CopyHandle);
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
|
@ -106,8 +106,6 @@ static WCHAR *File_AllocAndInitEnvironment_2(
|
||||||
static void File_AdjustDrives(
|
static void File_AdjustDrives(
|
||||||
ULONG path_drive_index, BOOLEAN subst, const WCHAR *path);
|
ULONG path_drive_index, BOOLEAN subst, const WCHAR *path);
|
||||||
|
|
||||||
static void File_InitCopyLimit(void);
|
|
||||||
|
|
||||||
static void File_InitSnapshots(void);
|
static void File_InitSnapshots(void);
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,7 +154,7 @@ _FX BOOLEAN File_Init(void)
|
||||||
|
|
||||||
File_InitRecoverFolders();
|
File_InitRecoverFolders();
|
||||||
|
|
||||||
File_InitCopyLimit();
|
File_InitFileMigration();
|
||||||
|
|
||||||
//
|
//
|
||||||
// intercept NTDLL entry points
|
// intercept NTDLL entry points
|
||||||
|
@ -1489,59 +1487,6 @@ _FX WCHAR *File_AllocAndInitEnvironment_2(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
// File_InitCopyLimit
|
|
||||||
//---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
_FX void File_InitCopyLimit(void)
|
|
||||||
{
|
|
||||||
static const WCHAR *_CopyLimitKb = L"CopyLimitKb";
|
|
||||||
static const WCHAR *_CopyLimitSilent = L"CopyLimitSilent";
|
|
||||||
NTSTATUS status;
|
|
||||||
WCHAR str[32];
|
|
||||||
|
|
||||||
//
|
|
||||||
// if this is one of SandboxieCrypto, SandboxieWUAU or WUAUCLT,
|
|
||||||
// or TrustedInstaller, then we don't impose a CopyLimit
|
|
||||||
//
|
|
||||||
|
|
||||||
BOOLEAN SetMaxCopyLimit = FALSE;
|
|
||||||
|
|
||||||
if (Dll_ImageType == DLL_IMAGE_SANDBOXIE_CRYPTO ||
|
|
||||||
Dll_ImageType == DLL_IMAGE_SANDBOXIE_WUAU ||
|
|
||||||
Dll_ImageType == DLL_IMAGE_WUAUCLT ||
|
|
||||||
Dll_ImageType == DLL_IMAGE_TRUSTED_INSTALLER) {
|
|
||||||
|
|
||||||
SetMaxCopyLimit = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SetMaxCopyLimit) {
|
|
||||||
|
|
||||||
File_CopyLimitKb = -1;
|
|
||||||
File_CopyLimitSilent = FALSE;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// get configuration settings for CopyLimitKb and CopyLimitSilent
|
|
||||||
//
|
|
||||||
|
|
||||||
status = SbieApi_QueryConfAsIs(
|
|
||||||
NULL, _CopyLimitKb, 0, str, sizeof(str) - sizeof(WCHAR));
|
|
||||||
if (NT_SUCCESS(status)) {
|
|
||||||
ULONGLONG num = _wtoi64(str);
|
|
||||||
if (num)
|
|
||||||
File_CopyLimitKb = (num > 0x000000007fffffff) ? -1 : (ULONG)num;
|
|
||||||
else
|
|
||||||
SbieApi_Log(2207, _CopyLimitKb);
|
|
||||||
}
|
|
||||||
|
|
||||||
File_CopyLimitSilent =
|
|
||||||
SbieApi_QueryConfBool(NULL, _CopyLimitSilent, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// File_TranslateDosToNtPath
|
// File_TranslateDosToNtPath
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -1750,11 +1695,10 @@ _FX void File_GetSetDeviceMap(WCHAR *DeviceMap96)
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// File_InitCopyLimit
|
// File_InitSnapshots
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
/* CRC */
|
// CRC
|
||||||
|
|
||||||
#define CRC_WITH_ADLERTZUK64
|
#define CRC_WITH_ADLERTZUK64
|
||||||
#include "common/crc.c"
|
#include "common/crc.c"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -370,11 +370,12 @@ _FX BOOLEAN Ipc_Init(void)
|
||||||
|
|
||||||
Ipc_CreateObjects();
|
Ipc_CreateObjects();
|
||||||
|
|
||||||
if (Dll_OsBuild >= 9600)
|
g_Ipc_DynamicPortNames[SPOOLER_PORT] = Dll_Alloc(DYNAMIC_PORT_NAME_CHARS * sizeof(WCHAR));
|
||||||
g_Ipc_DynamicPortNames[SPOOLER_PORT] = Dll_Alloc(DYNAMIC_PORT_NAME_CHARS * sizeof(WCHAR));
|
|
||||||
|
|
||||||
g_Ipc_DynamicPortNames[WPAD_PORT] = Dll_Alloc(DYNAMIC_PORT_NAME_CHARS * sizeof(WCHAR));
|
g_Ipc_DynamicPortNames[WPAD_PORT] = Dll_Alloc(DYNAMIC_PORT_NAME_CHARS * sizeof(WCHAR));
|
||||||
g_Ipc_DynamicPortNames[SMART_CARD_PORT] = Dll_Alloc(DYNAMIC_PORT_NAME_CHARS * sizeof(WCHAR));
|
g_Ipc_DynamicPortNames[SMART_CARD_PORT] = Dll_Alloc(DYNAMIC_PORT_NAME_CHARS * sizeof(WCHAR));
|
||||||
|
g_Ipc_DynamicPortNames[BT_PORT] = Dll_Alloc(DYNAMIC_PORT_NAME_CHARS * sizeof(WCHAR));
|
||||||
|
|
||||||
g_Ipc_DynamicPortNames[GAME_CONFIG_STORE_PORT] = Dll_Alloc(DYNAMIC_PORT_NAME_CHARS * sizeof(WCHAR));
|
g_Ipc_DynamicPortNames[GAME_CONFIG_STORE_PORT] = Dll_Alloc(DYNAMIC_PORT_NAME_CHARS * sizeof(WCHAR));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -280,8 +281,9 @@ IEnumPStoreTypesImpl::~IEnumPStoreTypesImpl(void)
|
||||||
// IEnumPStoreTypesImpl::StringFromGUID
|
// IEnumPStoreTypesImpl::StringFromGUID
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern "C"
|
||||||
void IEnumPStoreTypesImpl::StringFromGUID(const GUID *guid, WCHAR *str)
|
{
|
||||||
|
void Sbie_StringFromGUID(const GUID* guid, WCHAR* str)
|
||||||
{
|
{
|
||||||
struct _s {
|
struct _s {
|
||||||
ULONG a;
|
ULONG a;
|
||||||
|
@ -301,7 +303,7 @@ void IEnumPStoreTypesImpl::StringFromGUID(const GUID *guid, WCHAR *str)
|
||||||
s->x1, s->x2,
|
s->x1, s->x2,
|
||||||
s->y1, s->y2, s->y3, s->y4, s->y5, s->y6);
|
s->y1, s->y2, s->y3, s->y4, s->y5, s->y6);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// IEnumPStoreTypesImpl::InsertSorted
|
// IEnumPStoreTypesImpl::InsertSorted
|
||||||
|
@ -312,11 +314,11 @@ void IEnumPStoreTypesImpl::InsertSorted(GUID *guid)
|
||||||
{
|
{
|
||||||
WCHAR guidL[48], guidR[48];
|
WCHAR guidL[48], guidR[48];
|
||||||
|
|
||||||
StringFromGUID(guid, guidR);
|
Sbie_StringFromGUID(guid, guidR);
|
||||||
IEnumPStoreListElem *elem =
|
IEnumPStoreListElem *elem =
|
||||||
(IEnumPStoreListElem *)List_Head(&m_list->list);
|
(IEnumPStoreListElem *)List_Head(&m_list->list);
|
||||||
while (elem) {
|
while (elem) {
|
||||||
StringFromGUID(&elem->v.guid, guidL);
|
Sbie_StringFromGUID(&elem->v.guid, guidL);
|
||||||
int c = wcscmp(guidL, guidR);
|
int c = wcscmp(guidL, guidR);
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -80,8 +81,6 @@ protected:
|
||||||
IEnumPStoreTypesImpl(const IEnumPStoreTypesImpl *model);
|
IEnumPStoreTypesImpl(const IEnumPStoreTypesImpl *model);
|
||||||
~IEnumPStoreTypesImpl();
|
~IEnumPStoreTypesImpl();
|
||||||
|
|
||||||
void StringFromGUID(const GUID *guid, WCHAR *str);
|
|
||||||
|
|
||||||
void InsertSorted(GUID *guid);
|
void InsertSorted(GUID *guid);
|
||||||
|
|
||||||
// IUnknown
|
// IUnknown
|
||||||
|
@ -158,3 +157,4 @@ protected:
|
||||||
IEnumPStoreItems **ppenum);
|
IEnumPStoreItems **ppenum);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -56,6 +57,24 @@ void *Scm_QueryServiceByName(
|
||||||
ULONG with_service_status, ULONG with_service_config);
|
ULONG with_service_status, ULONG with_service_config);
|
||||||
|
|
||||||
int Scm_Start_Sppsvc();
|
int Scm_Start_Sppsvc();
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
|
||||||
|
extern ULONG_PTR __cdecl RpcRt_NdrClientCall3(
|
||||||
|
MIDL_STUBLESS_PROXY_INFO* pProxyInfo, ULONG nProcNum, void* pReturnValue, ...);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
//extern ULONG_PTR __cdecl RpcRt_NdrClientCall3(
|
||||||
|
// MIDL_STUBLESS_PROXY_INFO* pProxyInfo, ULONG nProcNum, void* pReturnValue, ULONG_PTR* Args);
|
||||||
|
|
||||||
|
extern ULONG_PTR __cdecl RpcRt_NdrClientCall2(
|
||||||
|
PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ULONG_PTR* Args);
|
||||||
|
|
||||||
|
#endif _WIN64
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,6 +110,17 @@ typedef RPC_STATUS(RPC_ENTRY *P_RpcStringFreeW)(RPC_WSTR *String);
|
||||||
|
|
||||||
typedef RPC_STATUS (*P_RpcMgmtSetComTimeout)(RPC_BINDING_HANDLE Binding, unsigned int __RPC_FAR Timeout);
|
typedef RPC_STATUS (*P_RpcMgmtSetComTimeout)(RPC_BINDING_HANDLE Binding, unsigned int __RPC_FAR Timeout);
|
||||||
|
|
||||||
|
typedef BOOL(WINAPI* P_GetModuleInformation)(_In_ HANDLE hProcess, _In_ HMODULE hModule, _Out_ LPMODULEINFO lpmodinfo, _In_ DWORD cb);
|
||||||
|
|
||||||
|
typedef ULONG_PTR(__cdecl* P_NdrClientCall3)(
|
||||||
|
MIDL_STUBLESS_PROXY_INFO* pProxyInfo, ULONG nProcNum, void* pReturnValue, ...);
|
||||||
|
|
||||||
|
typedef ULONG_PTR(__cdecl* P_NdrClientCall2)(
|
||||||
|
PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ...);
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
P_RpcStringBindingComposeW __sys_RpcStringBindingComposeW = NULL;
|
P_RpcStringBindingComposeW __sys_RpcStringBindingComposeW = NULL;
|
||||||
|
|
||||||
P_RpcBindingInqAuthClientEx __sys_RpcBindingInqAuthClientEx = NULL;
|
P_RpcBindingInqAuthClientEx __sys_RpcBindingInqAuthClientEx = NULL;
|
||||||
|
@ -108,12 +138,17 @@ P_UuidToStringW __sys_UuidToStringW = NULL;
|
||||||
|
|
||||||
P_RpcStringFreeW __sys_RpcStringFreeW = NULL;
|
P_RpcStringFreeW __sys_RpcStringFreeW = NULL;
|
||||||
|
|
||||||
extern WCHAR *g_Ipc_DynamicPortNames[NUM_DYNAMIC_PORTS];
|
|
||||||
|
|
||||||
|
|
||||||
typedef BOOL (WINAPI *P_GetModuleInformation)(_In_ HANDLE hProcess, _In_ HMODULE hModule, _Out_ LPMODULEINFO lpmodinfo, _In_ DWORD cb);
|
|
||||||
P_GetModuleInformation __sys_GetModuleInformation = NULL;
|
P_GetModuleInformation __sys_GetModuleInformation = NULL;
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
P_NdrClientCall3 __sys_NdrClientCall3 = NULL;
|
||||||
|
#else
|
||||||
|
P_NdrClientCall2 __sys_NdrClientCall2 = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern WCHAR* g_Ipc_DynamicPortNames[NUM_DYNAMIC_PORTS];
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// RpcRt_Init
|
// RpcRt_Init
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -156,6 +191,24 @@ _FX BOOLEAN RpcRt_Init(HMODULE module)
|
||||||
__sys_RpcMgmtSetComTimeout = (P_RpcMgmtSetComTimeout)Ldr_GetProcAddrNew(DllName_rpcrt4, L"RpcMgmtSetComTimeout", "RpcMgmtSetComTimeout");
|
__sys_RpcMgmtSetComTimeout = (P_RpcMgmtSetComTimeout)Ldr_GetProcAddrNew(DllName_rpcrt4, L"RpcMgmtSetComTimeout", "RpcMgmtSetComTimeout");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WCHAR wsTraceOptions[4];
|
||||||
|
if (SbieApi_QueryConf(NULL, L"IpcTrace", 0, wsTraceOptions, sizeof(wsTraceOptions)) == STATUS_SUCCESS && wsTraceOptions[0] != L'\0')
|
||||||
|
{
|
||||||
|
#ifdef _WIN64
|
||||||
|
|
||||||
|
P_NdrClientCall3 NdrClientCall3;
|
||||||
|
NdrClientCall3 = (P_NdrClientCall3)Ldr_GetProcAddrNew(DllName_rpcrt4, L"NdrClientCall3", "NdrClientCall3");
|
||||||
|
SBIEDLL_HOOK(RpcRt_, NdrClientCall3);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
P_NdrClientCall2 NdrClientCall2;
|
||||||
|
NdrClientCall2 = (P_NdrClientCall2)Ldr_GetProcAddrNew(DllName_rpcrt4, L"NdrClientCall2", "NdrClientCall2");
|
||||||
|
SBIEDLL_HOOK(RpcRt_, NdrClientCall2);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return Secure_Init_Elevation(module);
|
return Secure_Init_Elevation(module);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,35 +405,47 @@ _FX ULONG RpcRt_RpcBindingFromStringBindingW(
|
||||||
|
|
||||||
WCHAR* pwszTempPortName = GetDynamicLpcPortName(SPOOLER_PORT);
|
WCHAR* pwszTempPortName = GetDynamicLpcPortName(SPOOLER_PORT);
|
||||||
|
|
||||||
if (pwszTempPortName) {
|
if (pwszTempPortName == NULL)
|
||||||
|
return RPC_S_ACCESS_DENIED;
|
||||||
|
|
||||||
wcscpy(wstrPortName, L"ncalrpc:[");
|
wcscpy(wstrPortName, L"ncalrpc:[");
|
||||||
wcscpy(wstrPortName + 9, pwszTempPortName);
|
wcscpy(wstrPortName + 9, pwszTempPortName);
|
||||||
wcscat(wstrPortName, _old + 9);
|
wcscat(wstrPortName, _old + 9);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WPAD (Windows Proxy Auto Discovery) uses dynamic RPC endpoints starting in Win 10 Anniv.
|
|
||||||
|
|
||||||
else if (_wcsicmp(StringBinding, L"ncalrpc:") == 0) {
|
else if (_wcsicmp(StringBinding, L"ncalrpc:") == 0) {
|
||||||
|
|
||||||
|
WCHAR pwszEmpty[] = L"";
|
||||||
|
WCHAR* pwszTempPortName = pwszEmpty;
|
||||||
|
|
||||||
ULONG_PTR hWinHttp = (ULONG_PTR)GetModuleHandle(L"WinHttp.dll");
|
ULONG_PTR hWinHttp = (ULONG_PTR)GetModuleHandle(L"WinHttp.dll");
|
||||||
|
ULONG_PTR hBtApi = (ULONG_PTR)GetModuleHandle(L"BluetoothApis.dll");
|
||||||
ULONG_PTR pRetAddr = (ULONG_PTR)_ReturnAddress();
|
ULONG_PTR pRetAddr = (ULONG_PTR)_ReturnAddress();
|
||||||
|
|
||||||
|
if (RpcRt_TestCallingModule(pRetAddr, hWinHttp))
|
||||||
|
{
|
||||||
|
// WPAD (Windows Proxy Auto Discovery) uses dynamic RPC endpoints starting in Win 10 Anniv.
|
||||||
|
pwszTempPortName = GetDynamicLpcPortName(WPAD_PORT);
|
||||||
|
}
|
||||||
|
else if (RpcRt_TestCallingModule(pRetAddr, hBtApi))
|
||||||
|
{
|
||||||
|
// Bluetooth support service
|
||||||
|
pwszTempPortName = GetDynamicLpcPortName(BT_PORT);
|
||||||
|
}
|
||||||
|
|
||||||
if (RpcRt_TestCallingModule(pRetAddr, hWinHttp)) {
|
if (pwszTempPortName != pwszEmpty) {
|
||||||
|
|
||||||
WCHAR* pwszTempPortName = GetDynamicLpcPortName(WPAD_PORT);
|
if (pwszTempPortName == NULL)
|
||||||
|
return RPC_S_ACCESS_DENIED;
|
||||||
|
|
||||||
if (pwszTempPortName) {
|
wcscpy(wstrPortName, L"ncalrpc:[");
|
||||||
|
wcscpy(wstrPortName + 9, pwszTempPortName);
|
||||||
wcscpy(wstrPortName, L"ncalrpc:[");
|
wcscat(wstrPortName, L"]");
|
||||||
wcscpy(wstrPortName + 9, pwszTempPortName);
|
|
||||||
wcscat(wstrPortName, L"]");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RPC_STATUS status;
|
RPC_STATUS status;
|
||||||
status = __sys_RpcBindingFromStringBindingW(*wstrPortName ? wstrPortName : StringBinding, OutBinding);
|
status = __sys_RpcBindingFromStringBindingW(*wstrPortName ? wstrPortName : StringBinding, OutBinding);
|
||||||
// If there are any IpcTrace options set, then output this debug string
|
// If there are any IpcTrace options set, then output this debug string
|
||||||
|
@ -396,7 +461,7 @@ _FX ULONG RpcRt_RpcBindingFromStringBindingW(
|
||||||
//OutputDebugString(msg);
|
//OutputDebugString(msg);
|
||||||
SbieApi_MonitorPut2(MONITOR_IPC | MONITOR_TRACE, msg, FALSE);
|
SbieApi_MonitorPut2(MONITOR_IPC | MONITOR_TRACE, msg, FALSE);
|
||||||
}
|
}
|
||||||
__sys_RpcMgmtSetComTimeout(*OutBinding, RPC_C_BINDING_TIMEOUT);
|
//__sys_RpcMgmtSetComTimeout(*OutBinding, RPC_C_BINDING_TIMEOUT); // this breaks things
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,7 +525,7 @@ _FX RPC_STATUS RpcRt_RpcBindingCreateW(
|
||||||
//OutputDebugString(msg);
|
//OutputDebugString(msg);
|
||||||
SbieApi_MonitorPut2(MONITOR_IPC | MONITOR_TRACE, msg, FALSE);
|
SbieApi_MonitorPut2(MONITOR_IPC | MONITOR_TRACE, msg, FALSE);
|
||||||
}
|
}
|
||||||
__sys_RpcMgmtSetComTimeout(*Binding, RPC_C_BINDING_TIMEOUT);
|
//__sys_RpcMgmtSetComTimeout(*Binding, RPC_C_BINDING_TIMEOUT); // this breaks things
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -483,3 +548,62 @@ RPC_STATUS RPC_ENTRY RpcRt_RpcStringBindingComposeW(TCHAR *ObjUuid,TCHAR *ProtSe
|
||||||
}
|
}
|
||||||
return __sys_RpcStringBindingComposeW(ObjUuid,ProtSeq,NetworkAddr,EndPoint,Options,StringBinding);
|
return __sys_RpcStringBindingComposeW(ObjUuid,ProtSeq,NetworkAddr,EndPoint,Options,StringBinding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Sbie_StringFromGUID(const GUID* guid, WCHAR* str);
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
|
||||||
|
ULONG_PTR RpcRt_NdrClientCall3_x64(
|
||||||
|
MIDL_STUBLESS_PROXY_INFO* pProxyInfo, ULONG nProcNum, void* pReturnValue, va_list vl
|
||||||
|
)
|
||||||
|
{
|
||||||
|
void* ReturnAddress = (void*)*(__int64*)(vl - (4 * 8));
|
||||||
|
|
||||||
|
__try
|
||||||
|
{
|
||||||
|
PRPC_CLIENT_INTERFACE rpcInterface = (PRPC_CLIENT_INTERFACE)pProxyInfo->pStubDesc->RpcInterfaceInformation;
|
||||||
|
|
||||||
|
WCHAR interfaceID[48];
|
||||||
|
Sbie_StringFromGUID(&rpcInterface->InterfaceId.SyntaxGUID, interfaceID);
|
||||||
|
|
||||||
|
WCHAR text[130];
|
||||||
|
Sbie_snwprintf(text, 130, L"Calling NdrClientCall3 for interface %s}, %d.%d", interfaceID,
|
||||||
|
rpcInterface->InterfaceId.SyntaxVersion.MajorVersion, rpcInterface->InterfaceId.SyntaxVersion.MinorVersion);
|
||||||
|
|
||||||
|
SbieApi_MonitorPut2(MONITOR_IPC | MONITOR_TRACE, text, FALSE);
|
||||||
|
}
|
||||||
|
__except (EXCEPTION_EXECUTE_HANDLER) {}
|
||||||
|
|
||||||
|
return FALSE; // return TRUE to not call the trampoline upon return
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
ULONG_PTR __cdecl RpcRt_NdrClientCall2_x86(
|
||||||
|
void* ReturnAddress,
|
||||||
|
PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ...)
|
||||||
|
{
|
||||||
|
//va_list vl;
|
||||||
|
//va_start(vl, pFormat);
|
||||||
|
|
||||||
|
__try
|
||||||
|
{
|
||||||
|
PRPC_CLIENT_INTERFACE rpcInterface = (PRPC_CLIENT_INTERFACE)pStubDescriptor->RpcInterfaceInformation;
|
||||||
|
|
||||||
|
WCHAR interfaceID[48];
|
||||||
|
Sbie_StringFromGUID(&rpcInterface->InterfaceId.SyntaxGUID, interfaceID);
|
||||||
|
|
||||||
|
WCHAR text[130];
|
||||||
|
Sbie_snwprintf(text, 130, L"Calling NdrClientCall2 for interface %s}, %d.%d", interfaceID,
|
||||||
|
rpcInterface->InterfaceId.SyntaxVersion.MajorVersion, rpcInterface->InterfaceId.SyntaxVersion.MinorVersion);
|
||||||
|
|
||||||
|
SbieApi_MonitorPut2(MONITOR_IPC | MONITOR_TRACE, text, FALSE);
|
||||||
|
}
|
||||||
|
__except (EXCEPTION_EXECUTE_HANDLER) {}
|
||||||
|
|
||||||
|
//va_end(vl);
|
||||||
|
|
||||||
|
return FALSE; // return TRUE to not call the trampoline upon return
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif _WIN64
|
|
@ -1285,9 +1285,9 @@ _FX BOOLEAN SbieApi_QueryConfBool(
|
||||||
*value = L'\0';
|
*value = L'\0';
|
||||||
SbieApi_QueryConfAsIs(
|
SbieApi_QueryConfAsIs(
|
||||||
section_name, setting_name, 0, value, sizeof(value));
|
section_name, setting_name, 0, value, sizeof(value));
|
||||||
if (*value == 'y' || *value == 'Y')
|
if (*value == L'y' || *value == L'Y')
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (*value == 'n' || *value == 'N')
|
if (*value == L'n' || *value == L'N')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -222,3 +222,31 @@ l04: dec esp
|
||||||
Gui_MsgWaitForMultipleObjects@20 ENDP
|
Gui_MsgWaitForMultipleObjects@20 ENDP
|
||||||
|
|
||||||
PUBLIC C Gui_MsgWaitForMultipleObjects@20
|
PUBLIC C Gui_MsgWaitForMultipleObjects@20
|
||||||
|
|
||||||
|
|
||||||
|
;----------------------------------------------------------------------------
|
||||||
|
; RpcRt_NdrClientCall2
|
||||||
|
;----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
EXTERN C RpcRt_NdrClientCall2_x86 : PROC
|
||||||
|
;EXTERN C RpcRt_NdrClientCall2_... : PROC
|
||||||
|
EXTERN C __sys_NdrClientCall2 : DWORD
|
||||||
|
|
||||||
|
RpcRt_NdrClientCall2 PROC C PUBLIC
|
||||||
|
|
||||||
|
call RpcRt_NdrClientCall2_x86
|
||||||
|
test al,al
|
||||||
|
jnz CancelCall
|
||||||
|
|
||||||
|
jmp dword ptr [__sys_NdrClientCall2]
|
||||||
|
|
||||||
|
CancelCall:
|
||||||
|
|
||||||
|
; jmp RpcRt_NdrClientCall2_...
|
||||||
|
ret
|
||||||
|
|
||||||
|
RpcRt_NdrClientCall2 ENDP
|
||||||
|
|
||||||
|
PUBLIC C RpcRt_NdrClientCall2
|
||||||
|
|
||||||
|
|
|
@ -189,3 +189,55 @@ l01: mov eax,dword ptr [rdx]
|
||||||
l02: ret
|
l02: ret
|
||||||
|
|
||||||
Gui_FixupCallbackPointers ENDP
|
Gui_FixupCallbackPointers ENDP
|
||||||
|
|
||||||
|
|
||||||
|
;----------------------------------------------------------------------------
|
||||||
|
; RpcRt_NdrClientCall3
|
||||||
|
;----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
EXTERN RpcRt_NdrClientCall3_x64 : PROC
|
||||||
|
;EXTERN RpcRt_NdrClientCall3_... : PROC
|
||||||
|
EXTERN __sys_NdrClientCall3 : QWORD
|
||||||
|
|
||||||
|
RpcRt_NdrClientCall3 PROC
|
||||||
|
|
||||||
|
mov rax,rsp
|
||||||
|
mov [rax+1*8],rcx ; spill pProxyInfo
|
||||||
|
mov [rax+2*8],rdx ; spill nProcNum
|
||||||
|
mov [rax+3*8],r8 ; spill pReturnValue
|
||||||
|
mov [rax+4*8],r9 ; spill first variadic parameter
|
||||||
|
sub rsp,8+(4*8)
|
||||||
|
|
||||||
|
;; xor rcx,rcx ; clear pProxyInfo
|
||||||
|
;; xor rdx,rdx ; clear nProcNum
|
||||||
|
;; xor r8,r8 ; clear pReturnValue
|
||||||
|
; mov r8,[rsp + 8+(4*8)] ; return poitner
|
||||||
|
lea r9,[rsp + 8+(4*8) + 4*8] ; Args
|
||||||
|
call RpcRt_NdrClientCall3_x64
|
||||||
|
test al,al
|
||||||
|
jnz CancelCall
|
||||||
|
|
||||||
|
lea rax,[rsp+8+(4*8)]
|
||||||
|
mov rcx,[rax+1*8] ; restore pProxyInfo
|
||||||
|
mov rdx,[rax+2*8] ; restore nProcNum
|
||||||
|
mov r8,[rax+3*8] ; restore pReturnValue
|
||||||
|
mov r9,[rax+4*8] ; restore first variadic parameter
|
||||||
|
|
||||||
|
add rsp,8+(4*8)
|
||||||
|
jmp [__sys_NdrClientCall3]
|
||||||
|
|
||||||
|
CancelCall:
|
||||||
|
|
||||||
|
;;; xor rcx,rcx ; clear pProxyInfo
|
||||||
|
;;; xor rdx,rdx ; clear nProcNum
|
||||||
|
;;; xor r8,r8 ; clear pReturnValue
|
||||||
|
;; mov r8,[rsp + 8+(4*8)] ; return poitner
|
||||||
|
; lea r9,[rsp + 8+(4*8) + 4*8] ; Args
|
||||||
|
; call RpcRt_NdrClientCall3_...
|
||||||
|
|
||||||
|
add rsp,8+(4*8)
|
||||||
|
ret
|
||||||
|
|
||||||
|
RpcRt_NdrClientCall3 ENDP
|
||||||
|
|
||||||
|
|
|
@ -259,6 +259,12 @@
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|x64'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|x64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\common\stream.c">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|x64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|x64'">true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\dll\hook_inst.c">
|
<ClCompile Include="..\dll\hook_inst.c">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|Win32'">true</ExcludedFromBuild>
|
||||||
|
@ -423,6 +429,12 @@
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|x64'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|x64'">true</ExcludedFromBuild>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\common\stream.h">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|x64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|x64'">true</ExcludedFromBuild>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\dll\hook.h">
|
<ClInclude Include="..\dll\hook.h">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieRelease|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='SbieDebug|Win32'">true</ExcludedFromBuild>
|
||||||
|
|
|
@ -115,6 +115,9 @@
|
||||||
<ClCompile Include="syscall_open.c">
|
<ClCompile Include="syscall_open.c">
|
||||||
<Filter>syscall</Filter>
|
<Filter>syscall</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\common\stream.c">
|
||||||
|
<Filter>common</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="api.h" />
|
<ClInclude Include="api.h" />
|
||||||
|
@ -172,6 +175,9 @@
|
||||||
<ClInclude Include="syscall.h">
|
<ClInclude Include="syscall.h">
|
||||||
<Filter>syscall</Filter>
|
<Filter>syscall</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\common\stream.h">
|
||||||
|
<Filter>common</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CustomBuild Include="aulldvrm.asm" />
|
<CustomBuild Include="aulldvrm.asm" />
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -51,6 +51,7 @@ typedef struct _CONF_DATA {
|
||||||
POOL *pool;
|
POOL *pool;
|
||||||
LIST sections; // CONF_SECTION
|
LIST sections; // CONF_SECTION
|
||||||
BOOLEAN home; // TRUE if configuration read from Driver_Home_Path
|
BOOLEAN home; // TRUE if configuration read from Driver_Home_Path
|
||||||
|
ULONG encoding; // 0 - unicode, 1 - utf8, 2 - unicode (byte swaped)
|
||||||
volatile ULONG use_count;
|
volatile ULONG use_count;
|
||||||
|
|
||||||
} CONF_DATA;
|
} CONF_DATA;
|
||||||
|
@ -140,6 +141,9 @@ static const WCHAR *Conf_Template = L"Template";
|
||||||
static const WCHAR *Conf_H = L"H";
|
static const WCHAR *Conf_H = L"H";
|
||||||
static const WCHAR *Conf_W = L"W";
|
static const WCHAR *Conf_W = L"W";
|
||||||
|
|
||||||
|
static const WCHAR* Conf_Unicode = L"U";
|
||||||
|
static const WCHAR* Conf_UTF8 = L"8";
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// Conf_AdjustUseCount
|
// Conf_AdjustUseCount
|
||||||
|
@ -249,6 +253,8 @@ _FX NTSTATUS Conf_Read(ULONG session_id)
|
||||||
data.home = path_home;
|
data.home = path_home;
|
||||||
data.use_count = 0;
|
data.use_count = 0;
|
||||||
|
|
||||||
|
status = Stream_Read_BOM(stream, &data.encoding);
|
||||||
|
|
||||||
linenum = 1;
|
linenum = 1;
|
||||||
while (NT_SUCCESS(status))
|
while (NT_SUCCESS(status))
|
||||||
status = Conf_Read_Sections(stream, &data, &linenum);
|
status = Conf_Read_Sections(stream, &data, &linenum);
|
||||||
|
@ -277,6 +283,8 @@ _FX NTSTATUS Conf_Read(ULONG session_id)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
status = Stream_Read_BOM(stream, NULL);
|
||||||
|
|
||||||
linenum = 1 + CONF_TMPL_LINE_BASE;
|
linenum = 1 + CONF_TMPL_LINE_BASE;
|
||||||
|
|
||||||
while (NT_SUCCESS(status))
|
while (NT_SUCCESS(status))
|
||||||
|
@ -581,7 +589,7 @@ _FX NTSTATUS Conf_Read_Line(STREAM *stream, WCHAR *line, int *linenum)
|
||||||
|
|
||||||
// skip leading control and whitespace characters
|
// skip leading control and whitespace characters
|
||||||
while (1) {
|
while (1) {
|
||||||
status = Stream_Read_Short(stream, &ch);
|
status = Stream_Read_Wchar(stream, &ch);
|
||||||
if ((! NT_SUCCESS(status)) || (ch > 32 && ch < 0xFE00))
|
if ((! NT_SUCCESS(status)) || (ch > 32 && ch < 0xFE00))
|
||||||
break;
|
break;
|
||||||
if (ch == L'\r')
|
if (ch == L'\r')
|
||||||
|
@ -609,7 +617,7 @@ _FX NTSTATUS Conf_Read_Line(STREAM *stream, WCHAR *line, int *linenum)
|
||||||
if (ptr - line == CONF_LINE_LEN)
|
if (ptr - line == CONF_LINE_LEN)
|
||||||
status = STATUS_BUFFER_OVERFLOW;
|
status = STATUS_BUFFER_OVERFLOW;
|
||||||
else
|
else
|
||||||
status = Stream_Read_Short(stream, &ch);
|
status = Stream_Read_Wchar(stream, &ch);
|
||||||
if ((! NT_SUCCESS(status)) || ch == L'\n' || ch == L'\r')
|
if ((! NT_SUCCESS(status)) || ch == L'\n' || ch == L'\r')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1060,11 +1068,20 @@ _FX const WCHAR *Conf_Get(
|
||||||
_wcsicmp(setting, L"IniLocation") == 0) {
|
_wcsicmp(setting, L"IniLocation") == 0) {
|
||||||
|
|
||||||
// return "H" if configuration file was found in the Sandboxie
|
// return "H" if configuration file was found in the Sandboxie
|
||||||
// home directory, or "S" if it was found in Windows directory
|
// home directory, or "W" if it was found in Windows directory
|
||||||
|
|
||||||
value = (Conf_Data.home) ? Conf_H : Conf_W;
|
value = (Conf_Data.home) ? Conf_H : Conf_W;
|
||||||
|
|
||||||
} else if (have_setting) {
|
} else if ((!have_section) && have_setting &&
|
||||||
|
_wcsicmp(setting, L"IniEncoding") == 0) {
|
||||||
|
|
||||||
|
// return "U" if configuration file was Unicode encoded,
|
||||||
|
// or "8" if it was UTF-8 encoded
|
||||||
|
|
||||||
|
value = (Conf_Data.encoding == 1) ? Conf_UTF8 : Conf_Unicode;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (have_setting) {
|
||||||
|
|
||||||
check_global = ((index & CONF_GET_NO_GLOBAL) == 0);
|
check_global = ((index & CONF_GET_NO_GLOBAL) == 0);
|
||||||
index &= 0xFFFF;
|
index &= 0xFFFF;
|
||||||
|
@ -1232,6 +1249,7 @@ _FX NTSTATUS Conf_Api_Reload(PROCESS *proc, ULONG64 *parms)
|
||||||
Conf_Data.pool = NULL;
|
Conf_Data.pool = NULL;
|
||||||
List_Init(&Conf_Data.sections);
|
List_Init(&Conf_Data.sections);
|
||||||
Conf_Data.home = FALSE;
|
Conf_Data.home = FALSE;
|
||||||
|
Conf_Data.encoding = 0;
|
||||||
|
|
||||||
ExReleaseResourceLite(Conf_Lock);
|
ExReleaseResourceLite(Conf_Lock);
|
||||||
KeLowerIrql(irql);
|
KeLowerIrql(irql);
|
||||||
|
@ -1373,6 +1391,7 @@ _FX BOOLEAN Conf_Init(void)
|
||||||
Conf_Data.pool = NULL;
|
Conf_Data.pool = NULL;
|
||||||
List_Init(&Conf_Data.sections);
|
List_Init(&Conf_Data.sections);
|
||||||
Conf_Data.home = FALSE;
|
Conf_Data.home = FALSE;
|
||||||
|
Conf_Data.encoding = 0;
|
||||||
|
|
||||||
if (! Mem_GetLockResource(&Conf_Lock, TRUE))
|
if (! Mem_GetLockResource(&Conf_Lock, TRUE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -204,20 +204,16 @@ _FX BOOLEAN Ipc_Init(void)
|
||||||
Api_SetFunction(API_GET_DYNAMIC_PORT_FROM_PID, Ipc_Api_GetDynamicPortFromPid);
|
Api_SetFunction(API_GET_DYNAMIC_PORT_FROM_PID, Ipc_Api_GetDynamicPortFromPid);
|
||||||
Api_SetFunction(API_OPEN_DYNAMIC_PORT, Ipc_Api_OpenDynamicPort);
|
Api_SetFunction(API_OPEN_DYNAMIC_PORT, Ipc_Api_OpenDynamicPort);
|
||||||
|
|
||||||
if (Driver_OsVersion >= DRIVER_WINDOWS_81) {
|
// prepare dynamic ports
|
||||||
|
if (!Mem_GetLockResource(&Ipc_Dynamic_Ports[WPAD_PORT].pPortLock, TRUE)
|
||||||
if (!Mem_GetLockResource(&Ipc_Dynamic_Ports[SPOOLER_PORT].pPortLock, TRUE))
|
|| !Mem_GetLockResource(&Ipc_Dynamic_Ports[SMART_CARD_PORT].pPortLock, TRUE)
|
||||||
return FALSE;
|
|| !Mem_GetLockResource(&Ipc_Dynamic_Ports[BT_PORT].pPortLock, TRUE)
|
||||||
}
|
// since Windows 8
|
||||||
|
|| !Mem_GetLockResource(&Ipc_Dynamic_Ports[SPOOLER_PORT].pPortLock, TRUE)
|
||||||
if (Driver_OsVersion >= DRIVER_WINDOWS_10) {
|
// since Windows 10
|
||||||
|
|| !Mem_GetLockResource(&Ipc_Dynamic_Ports[GAME_CONFIG_STORE_PORT].pPortLock, TRUE)
|
||||||
|
) return FALSE;
|
||||||
|
|
||||||
if(!Mem_GetLockResource(&Ipc_Dynamic_Ports[WPAD_PORT].pPortLock, TRUE)
|
|
||||||
|| !Mem_GetLockResource(&Ipc_Dynamic_Ports[GAME_CONFIG_STORE_PORT].pPortLock, TRUE)
|
|
||||||
|| !Mem_GetLockResource(&Ipc_Dynamic_Ports[SMART_CARD_PORT].pPortLock, TRUE)
|
|
||||||
) return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// finish
|
// finish
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -231,34 +231,13 @@ BOOLEAN UnicodeStringEndsWith(PCUNICODE_STRING pString1, PWCHAR pString2, BOOLEA
|
||||||
return (RtlCompareUnicodeString(&usStr, &usSearch, boolCaseInSensitive) == 0);
|
return (RtlCompareUnicodeString(&usStr, &usSearch, boolCaseInSensitive) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN DoesRegValueExist(ULONG RelativeTo, WCHAR *Path, WCHAR *ValueName)
|
BOOLEAN DoesRegValueExist(ULONG RelativeTo, WCHAR *Path, WCHAR *ValueName)
|
||||||
{
|
{
|
||||||
NTSTATUS status;
|
WCHAR DummyBuffer[1] = {0}; // if we provide a NULL buffer this wil cause a memory pool leak someware in the kernel
|
||||||
RTL_QUERY_REGISTRY_TABLE qrt[2];
|
UNICODE_STRING Dummy = { 0, sizeof(DummyBuffer), DummyBuffer };
|
||||||
UNICODE_STRING uni;
|
return GetRegString(RelativeTo, Path, ValueName, &Dummy);
|
||||||
|
|
||||||
// we don't care about the value, but we have to give it a NULL object
|
|
||||||
uni.Length = 0;
|
|
||||||
uni.MaximumLength = 0;
|
|
||||||
uni.Buffer = NULL;
|
|
||||||
|
|
||||||
memzero(qrt, sizeof(qrt));
|
|
||||||
qrt[0].Flags = RTL_QUERY_REGISTRY_REQUIRED |
|
|
||||||
RTL_QUERY_REGISTRY_DIRECT |
|
|
||||||
RTL_QUERY_REGISTRY_NOVALUE |
|
|
||||||
RTL_QUERY_REGISTRY_NOEXPAND;
|
|
||||||
qrt[0].Name = ValueName;
|
|
||||||
qrt[0].EntryContext = &uni;
|
|
||||||
qrt[0].DefaultType = REG_NONE;
|
|
||||||
|
|
||||||
status = RtlQueryRegistryValues(
|
|
||||||
RelativeTo, Path, qrt, NULL, NULL);
|
|
||||||
|
|
||||||
return (status == STATUS_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN GetRegString(ULONG RelativeTo, WCHAR *Path, WCHAR *ValueName, UNICODE_STRING* pData)
|
BOOLEAN GetRegString(ULONG RelativeTo, WCHAR *Path, WCHAR *ValueName, UNICODE_STRING* pData)
|
||||||
{
|
{
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -72,8 +73,10 @@ MSG_HEADER *EpMapperServer::EpmapperGetPortNameHandler(MSG_HEADER *msg)
|
||||||
|
|
||||||
const WCHAR* wstrSpooler = L"Spooler";
|
const WCHAR* wstrSpooler = L"Spooler";
|
||||||
const WCHAR* wstrWPAD = L"WinHttpAutoProxySvc";
|
const WCHAR* wstrWPAD = L"WinHttpAutoProxySvc";
|
||||||
|
//const WCHAR* wstrBT = L"bthserv";
|
||||||
RPC_IF_ID ifidGCS = { {0x88abcbc3, 0x34EA, 0x76AE, { 0x82, 0x15, 0x76, 0x75, 0x20, 0x65, 0x5A, 0x23 }}, 0, 0 };
|
RPC_IF_ID ifidGCS = { {0x88abcbc3, 0x34EA, 0x76AE, { 0x82, 0x15, 0x76, 0x75, 0x20, 0x65, 0x5A, 0x23 }}, 0, 0 };
|
||||||
RPC_IF_ID ifidSmartCard = { {0xC6B5235A, 0xE413, 0x481D, { 0x9A, 0xC8, 0x31, 0x68, 0x1B, 0x1F, 0xAA, 0xF5 }}, 1, 1 };
|
RPC_IF_ID ifidSmartCard = { {0xC6B5235A, 0xE413, 0x481D, { 0x9A, 0xC8, 0x31, 0x68, 0x1B, 0x1F, 0xAA, 0xF5 }}, 1, 1 };
|
||||||
|
RPC_IF_ID ifidBluetooth = { {0x2ACB9D68, 0xB434, 0x4B3E, { 0xB9, 0x66, 0xE0, 0x6B, 0x4B, 0x3A, 0x84, 0xCB }}, 1, 0 };
|
||||||
|
|
||||||
RPC_IF_ID ifidRequest;
|
RPC_IF_ID ifidRequest;
|
||||||
const WCHAR* pwszServiceName = NULL;
|
const WCHAR* pwszServiceName = NULL;
|
||||||
|
@ -81,10 +84,18 @@ MSG_HEADER *EpMapperServer::EpmapperGetPortNameHandler(MSG_HEADER *msg)
|
||||||
{
|
{
|
||||||
case SPOOLER_PORT: if (SbieApi_QueryConfBool(boxname, L"ClosePrintSpooler", FALSE)) return SHORT_REPLY(E_ACCESSDENIED);
|
case SPOOLER_PORT: if (SbieApi_QueryConfBool(boxname, L"ClosePrintSpooler", FALSE)) return SHORT_REPLY(E_ACCESSDENIED);
|
||||||
pwszServiceName = wstrSpooler; break;
|
pwszServiceName = wstrSpooler; break;
|
||||||
|
|
||||||
case WPAD_PORT: pwszServiceName = wstrWPAD; break;
|
case WPAD_PORT: pwszServiceName = wstrWPAD; break;
|
||||||
|
|
||||||
|
case BT_PORT: if (!SbieApi_QueryConfBool(boxname, L"OpenBluetooth", FALSE)) return SHORT_REPLY(E_ACCESSDENIED);
|
||||||
|
//pwszServiceName = wstrBT; break;
|
||||||
|
memcpy(&ifidRequest, &ifidBluetooth, sizeof(RPC_IF_ID)); break;
|
||||||
|
|
||||||
case GAME_CONFIG_STORE_PORT: memcpy(&ifidRequest, &ifidGCS, sizeof(RPC_IF_ID)); break;
|
case GAME_CONFIG_STORE_PORT: memcpy(&ifidRequest, &ifidGCS, sizeof(RPC_IF_ID)); break;
|
||||||
|
|
||||||
case SMART_CARD_PORT: if (!SbieApi_QueryConfBool(boxname, L"OpenSmartCard", TRUE)) return SHORT_REPLY(E_ACCESSDENIED);
|
case SMART_CARD_PORT: if (!SbieApi_QueryConfBool(boxname, L"OpenSmartCard", TRUE)) return SHORT_REPLY(E_ACCESSDENIED);
|
||||||
memcpy(&ifidRequest, &ifidSmartCard, sizeof(RPC_IF_ID)); break;
|
memcpy(&ifidRequest, &ifidSmartCard, sizeof(RPC_IF_ID)); break;
|
||||||
|
|
||||||
default: return SHORT_REPLY(E_INVALIDARG);
|
default: return SHORT_REPLY(E_INVALIDARG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -66,7 +66,7 @@ MSG_HEADER *SbieIniServer::Handler(void *_this, MSG_HEADER *msg)
|
||||||
pThis->m_text = NULL;
|
pThis->m_text = NULL;
|
||||||
pThis->m_text_base = NULL;
|
pThis->m_text_base = NULL;
|
||||||
pThis->m_text_max_len = 0;
|
pThis->m_text_max_len = 0;
|
||||||
pThis->m_insertbom = FALSE;
|
//pThis->m_insertbom = FALSE;
|
||||||
|
|
||||||
MSG_HEADER *rpl = pThis->Handler2(msg);
|
MSG_HEADER *rpl = pThis->Handler2(msg);
|
||||||
|
|
||||||
|
@ -1278,8 +1278,8 @@ ULONG SbieIniServer::CallSetSetting(WCHAR *text, MSG_HEADER *msg)
|
||||||
|
|
||||||
bool SbieIniServer::AddText(const WCHAR *line)
|
bool SbieIniServer::AddText(const WCHAR *line)
|
||||||
{
|
{
|
||||||
static const WCHAR *_ByteOrderMark = L"ByteOrderMark=";
|
//static const WCHAR *_ByteOrderMark = L"ByteOrderMark=";
|
||||||
static ULONG _ByteOrderMarkLen = 0;
|
//static ULONG _ByteOrderMarkLen = 0;
|
||||||
|
|
||||||
ULONG line_len = wcslen(line);
|
ULONG line_len = wcslen(line);
|
||||||
|
|
||||||
|
@ -1309,13 +1309,13 @@ bool SbieIniServer::AddText(const WCHAR *line)
|
||||||
m_text[2] = L'\0';
|
m_text[2] = L'\0';
|
||||||
m_text += 2;
|
m_text += 2;
|
||||||
|
|
||||||
if (! _ByteOrderMarkLen)
|
//if (! _ByteOrderMarkLen)
|
||||||
_ByteOrderMarkLen = wcslen(_ByteOrderMark);
|
// _ByteOrderMarkLen = wcslen(_ByteOrderMark);
|
||||||
if (_wcsnicmp(line, _ByteOrderMark, _ByteOrderMarkLen) == 0) {
|
//if (_wcsnicmp(line, _ByteOrderMark, _ByteOrderMarkLen) == 0) {
|
||||||
const WCHAR ch = line[_ByteOrderMarkLen];
|
// const WCHAR ch = line[_ByteOrderMarkLen];
|
||||||
if (ch == L'y' || ch == L'Y')
|
// if (ch == L'y' || ch == L'Y')
|
||||||
m_insertbom = TRUE;
|
// m_insertbom = TRUE;
|
||||||
}
|
//}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1366,7 +1366,8 @@ bool SbieIniServer::AddCallerText(WCHAR *setting, WCHAR *value)
|
||||||
ULONG SbieIniServer::RefreshConf()
|
ULONG SbieIniServer::RefreshConf()
|
||||||
{
|
{
|
||||||
WCHAR *IniPath, *TmpPath;
|
WCHAR *IniPath, *TmpPath;
|
||||||
if (! GetIniPath(&IniPath, &TmpPath))
|
BOOLEAN IsUTF8 = FALSE;
|
||||||
|
if (! GetIniPath(&IniPath, &TmpPath, NULL, &IsUTF8))
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
||||||
HANDLE hFile = INVALID_HANDLE_VALUE;
|
HANDLE hFile = INVALID_HANDLE_VALUE;
|
||||||
|
@ -1440,7 +1441,16 @@ ULONG SbieIniServer::RefreshConf()
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_insertbom) {
|
if (IsUTF8)
|
||||||
|
{
|
||||||
|
// UTF-8 Signature
|
||||||
|
static const UCHAR bom[3] = { 0xEF, 0xBB, 0xBF };
|
||||||
|
ULONG lenDummy;
|
||||||
|
WriteFile(hFile, bom, sizeof(bom), &lenDummy, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
//if (m_insertbom)
|
||||||
|
{
|
||||||
// UNICODE Byte Order Mark (little endian)
|
// UNICODE Byte Order Mark (little endian)
|
||||||
static const UCHAR bom[2] = { 0xFF, 0xFE };
|
static const UCHAR bom[2] = { 0xFF, 0xFE };
|
||||||
ULONG lenDummy;
|
ULONG lenDummy;
|
||||||
|
@ -1448,9 +1458,21 @@ ULONG SbieIniServer::RefreshConf()
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG lenToWrite = wcslen(m_text_base) * sizeof(WCHAR);
|
ULONG lenToWrite = wcslen(m_text_base) * sizeof(WCHAR);
|
||||||
|
|
||||||
|
char* text_utf8 = NULL;
|
||||||
|
if (IsUTF8)
|
||||||
|
{
|
||||||
|
text_utf8 = (char*)HeapAlloc(GetProcessHeap(), 0, lenToWrite + 16);
|
||||||
|
lenToWrite = WideCharToMultiByte(CP_UTF8, 0, m_text_base, lenToWrite / sizeof(WCHAR), text_utf8, lenToWrite + 16, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
ULONG lenWritten = 0;
|
ULONG lenWritten = 0;
|
||||||
if (! WriteFile(hFile, m_text_base, lenToWrite, &lenWritten, NULL))
|
if (! WriteFile(hFile, text_utf8 ? (void*)text_utf8 : (void*)m_text_base, lenToWrite, &lenWritten, NULL))
|
||||||
lenWritten = -1;
|
lenWritten = -1;
|
||||||
|
|
||||||
|
if(text_utf8)
|
||||||
|
HeapFree(GetProcessHeap(), 0, text_utf8);
|
||||||
|
|
||||||
if (lenWritten != lenToWrite)
|
if (lenWritten != lenToWrite)
|
||||||
SbieApi_LogEx(m_session_id, 2322, L"[16 / %d]", GetLastError());
|
SbieApi_LogEx(m_session_id, 2322, L"[16 / %d]", GetLastError());
|
||||||
else {
|
else {
|
||||||
|
@ -1500,7 +1522,7 @@ finish:
|
||||||
|
|
||||||
|
|
||||||
bool SbieIniServer::GetIniPath(WCHAR **IniPath, WCHAR **TmpPath,
|
bool SbieIniServer::GetIniPath(WCHAR **IniPath, WCHAR **TmpPath,
|
||||||
BOOLEAN *IsHomePath)
|
BOOLEAN *IsHomePath, BOOLEAN* IsUTF8)
|
||||||
{
|
{
|
||||||
static const WCHAR *_ini = SANDBOXIE_INI;
|
static const WCHAR *_ini = SANDBOXIE_INI;
|
||||||
WCHAR *path = (WCHAR *)HeapAlloc(GetProcessHeap(), 0, 2048);
|
WCHAR *path = (WCHAR *)HeapAlloc(GetProcessHeap(), 0, 2048);
|
||||||
|
@ -1516,6 +1538,12 @@ bool SbieIniServer::GetIniPath(WCHAR **IniPath, WCHAR **TmpPath,
|
||||||
// program home directory or from the Windows directory, and
|
// program home directory or from the Windows directory, and
|
||||||
// we use that information to select the output path
|
// we use that information to select the output path
|
||||||
|
|
||||||
|
if (IsUTF8 != NULL) {
|
||||||
|
LONG rc = SbieApi_QueryConfAsIs(NULL, L"IniEncoding", 0, path, 8);
|
||||||
|
if (rc == 0 && *path == L'8')
|
||||||
|
*IsUTF8 = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
LONG rc = SbieApi_QueryConfAsIs(NULL, L"IniLocation", 0, path, 8);
|
LONG rc = SbieApi_QueryConfAsIs(NULL, L"IniLocation", 0, path, 8);
|
||||||
if (rc == 0 && *path == L'H') {
|
if (rc == 0 && *path == L'H') {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -75,7 +76,7 @@ protected:
|
||||||
ULONG RefreshConf();
|
ULONG RefreshConf();
|
||||||
|
|
||||||
bool GetIniPath(WCHAR **IniPath, WCHAR **TmpPath,
|
bool GetIniPath(WCHAR **IniPath, WCHAR **TmpPath,
|
||||||
BOOLEAN *IsHomePath = NULL);
|
BOOLEAN *IsHomePath = NULL, BOOLEAN* IsUTF8 = NULL);
|
||||||
|
|
||||||
bool TokenIsAdmin(HANDLE hToken);
|
bool TokenIsAdmin(HANDLE hToken);
|
||||||
|
|
||||||
|
@ -97,7 +98,7 @@ protected:
|
||||||
WCHAR *m_text, *m_text_base;
|
WCHAR *m_text, *m_text_base;
|
||||||
ULONG m_text_max_len;
|
ULONG m_text_max_len;
|
||||||
WCHAR m_line[1500];
|
WCHAR m_line[1500];
|
||||||
BOOLEAN m_insertbom;
|
//BOOLEAN m_insertbom;
|
||||||
BOOLEAN m_admin;
|
BOOLEAN m_admin;
|
||||||
HANDLE m_hLockFile;
|
HANDLE m_hLockFile;
|
||||||
ULONG m_session_id;
|
ULONG m_session_id;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
* Copyright 2020 David Xanatos, xanasoft.com
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
Binary file not shown.
|
@ -491,6 +491,11 @@ SBIE2224 Sandboxed program has crashed: %2
|
||||||
SBIE2301 %2
|
SBIE2301 %2
|
||||||
.
|
.
|
||||||
|
|
||||||
|
2302;pop;err;01
|
||||||
|
SBIE2302 Process image configuration conflict: %2
|
||||||
|
.
|
||||||
|
|
||||||
|
|
||||||
2303;pop;err;01
|
2303;pop;err;01
|
||||||
SBIE2303 Could not hook %2
|
SBIE2303 Could not hook %2
|
||||||
.
|
.
|
||||||
|
@ -3020,6 +3025,10 @@ Default list of blocked TCP/IP ports
|
||||||
Permit programs to update jump lists in the Windows 7 taskbar
|
Permit programs to update jump lists in the Windows 7 taskbar
|
||||||
.
|
.
|
||||||
|
|
||||||
|
4295;txt;01
|
||||||
|
Default exclusions File Migration presets
|
||||||
|
.
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Applications - Software Compatibility
|
# Applications - Software Compatibility
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
* Copyright 2004-2020 Sandboxie Holdings, LLC
|
||||||
|
* Copyright 2020-2021 David Xanatos, xanasoft.com
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup />
|
|
||||||
</Project>
|
|
|
@ -2,10 +2,6 @@
|
||||||
# This file is generated by the Qt Visual Studio Tools.
|
# This file is generated by the Qt Visual Studio Tools.
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
|
|
||||||
# This is a reminder that you are using a generated .pro file.
|
|
||||||
# Remove it when you are finished editing this file.
|
|
||||||
message("You are running qmake on a generated .pro file. This may not work!")
|
|
||||||
|
|
||||||
|
|
||||||
HEADERS += ./qsbieapi_global.h \
|
HEADERS += ./qsbieapi_global.h \
|
||||||
./stdafx.h \
|
./stdafx.h \
|
||||||
|
@ -20,6 +16,7 @@ HEADERS += ./qsbieapi_global.h \
|
||||||
./Sandboxie/BoxBorder.h \
|
./Sandboxie/BoxBorder.h \
|
||||||
./Sandboxie/SbieTemplates.h \
|
./Sandboxie/SbieTemplates.h \
|
||||||
./Helpers/NtIO.h
|
./Helpers/NtIO.h
|
||||||
|
|
||||||
SOURCES += ./stdafx.cpp \
|
SOURCES += ./stdafx.cpp \
|
||||||
./SbieAPI.cpp \
|
./SbieAPI.cpp \
|
||||||
./SbieUtils.cpp \
|
./SbieUtils.cpp \
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup />
|
|
||||||
</Project>
|
|
|
@ -280,6 +280,7 @@ CSandMan::CSandMan(QWidget *parent)
|
||||||
|
|
||||||
m_uTimerID = startTimer(250);
|
m_uTimerID = startTimer(250);
|
||||||
|
|
||||||
|
OnStatusChanged();
|
||||||
if (CSbieUtils::IsRunning(CSbieUtils::eAll) || theConf->GetBool("Options/StartIfStopped", true))
|
if (CSbieUtils::IsRunning(CSbieUtils::eAll) || theConf->GetBool("Options/StartIfStopped", true))
|
||||||
{
|
{
|
||||||
SB_STATUS Status = ConnectSbie();
|
SB_STATUS Status = ConnectSbie();
|
||||||
|
@ -1075,7 +1076,7 @@ void CSandMan::OnNewBox()
|
||||||
|
|
||||||
void CSandMan::OnEmptyAll()
|
void CSandMan::OnEmptyAll()
|
||||||
{
|
{
|
||||||
if (theConf->GetInt("Options/TerminateAll", -1) == -1)
|
if (theConf->GetInt("Options/TerminateAll", -1) == -1)
|
||||||
{
|
{
|
||||||
bool State = false;
|
bool State = false;
|
||||||
if(CCheckableMessageBox::question(this, "Sandboxie-Plus", tr("Do you want to terminate all processes in all sandboxes?")
|
if(CCheckableMessageBox::question(this, "Sandboxie-Plus", tr("Do you want to terminate all processes in all sandboxes?")
|
||||||
|
@ -1095,8 +1096,10 @@ void CSandMan::OnDisableForce()
|
||||||
int Seconds = 0;
|
int Seconds = 0;
|
||||||
if (Status)
|
if (Status)
|
||||||
{
|
{
|
||||||
|
int LastValue = theAPI->GetGlobalSettings()->GetNum("ForceDisableSeconds", 60);
|
||||||
|
|
||||||
bool bOK = false;
|
bool bOK = false;
|
||||||
Seconds = QInputDialog::getInt(this, "Sandboxie-Plus", tr("Please enter the duration for disabling forced programs."), 10, 0, INT_MAX, 1, &bOK);
|
Seconds = QInputDialog::getInt(this, "Sandboxie-Plus", tr("Please enter the duration for disabling forced programs."), LastValue, 0, INT_MAX, 1, &bOK);
|
||||||
if (!bOK)
|
if (!bOK)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup />
|
|
||||||
</Project>
|
|
|
@ -21,6 +21,7 @@ cd %~dp0\Build_qtsingleapp_%build_arch%
|
||||||
|
|
||||||
%qt_path%\bin\qmake.exe %~dp0\QtSingleApp\qtsingleapp\qtsingleapp\qtsingleapp.qc.pro -spec win32-msvc "CONFIG+=qtquickcompiler"
|
%qt_path%\bin\qmake.exe %~dp0\QtSingleApp\qtsingleapp\qtsingleapp\qtsingleapp.qc.pro -spec win32-msvc "CONFIG+=qtquickcompiler"
|
||||||
%~dp0..\..\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Release -j 8
|
%~dp0..\..\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Release -j 8
|
||||||
|
IF %ERRORLEVEL% NEQ 0 goto end
|
||||||
|
|
||||||
|
|
||||||
mkdir %~dp0\Build_MiscHelpers_%build_arch%
|
mkdir %~dp0\Build_MiscHelpers_%build_arch%
|
||||||
|
@ -28,6 +29,7 @@ cd %~dp0\Build_MiscHelpers_%build_arch%
|
||||||
|
|
||||||
%qt_path%\bin\qmake.exe %~dp0\MiscHelpers\MiscHelpers.qc.pro -spec win32-msvc "CONFIG+=qtquickcompiler"
|
%qt_path%\bin\qmake.exe %~dp0\MiscHelpers\MiscHelpers.qc.pro -spec win32-msvc "CONFIG+=qtquickcompiler"
|
||||||
%~dp0..\..\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Release -j 8
|
%~dp0..\..\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Release -j 8
|
||||||
|
IF %ERRORLEVEL% NEQ 0 goto end
|
||||||
|
|
||||||
|
|
||||||
mkdir %~dp0\Build_QSbieAPI_%build_arch%
|
mkdir %~dp0\Build_QSbieAPI_%build_arch%
|
||||||
|
@ -35,6 +37,7 @@ cd %~dp0\Build_QSbieAPI_%build_arch%
|
||||||
|
|
||||||
%qt_path%\bin\qmake.exe %~dp0\QSbieAPI\QSbieAPI.qc.pro -spec win32-msvc "CONFIG+=qtquickcompiler"
|
%qt_path%\bin\qmake.exe %~dp0\QSbieAPI\QSbieAPI.qc.pro -spec win32-msvc "CONFIG+=qtquickcompiler"
|
||||||
%~dp0..\..\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Release -j 8
|
%~dp0..\..\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Release -j 8
|
||||||
|
IF %ERRORLEVEL% NEQ 0 goto end
|
||||||
|
|
||||||
|
|
||||||
mkdir %~dp0\Build_SandMan_%build_arch%
|
mkdir %~dp0\Build_SandMan_%build_arch%
|
||||||
|
@ -42,9 +45,12 @@ cd %~dp0\Build_SandMan_%build_arch%
|
||||||
|
|
||||||
%qt_path%\bin\qmake.exe %~dp0\SandMan\SandMan.qc.pro -spec win32-msvc "CONFIG+=qtquickcompiler"
|
%qt_path%\bin\qmake.exe %~dp0\SandMan\SandMan.qc.pro -spec win32-msvc "CONFIG+=qtquickcompiler"
|
||||||
%~dp0..\..\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Release -j 8
|
%~dp0..\..\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Release -j 8
|
||||||
|
IF %ERRORLEVEL% NEQ 0 goto end
|
||||||
|
|
||||||
|
|
||||||
cd %~dp0
|
rem cd %~dp0
|
||||||
dir .\bin
|
rem dir .\bin
|
||||||
dir .\bin\%build_arch%
|
rem dir .\bin\%build_arch%
|
||||||
dir .\bin\%build_arch%\Release
|
rem dir .\bin\%build_arch%\Release
|
||||||
|
|
||||||
|
:end
|
||||||
|
|
Loading…
Reference in New Issue