This commit is contained in:
DavidXanatos 2024-07-22 08:42:00 +02:00
parent 91358e2f75
commit 48058e1a68
4 changed files with 39 additions and 2 deletions

View File

@ -28,6 +28,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- added UI options - added UI options
- fixed schannel error SEC_E_SECPKG_NOT_FOUND in encrypted sandboxes [#4081](https://github.com/sandboxie-plus/Sandboxie/issues/4081) - fixed schannel error SEC_E_SECPKG_NOT_FOUND in encrypted sandboxes [#4081](https://github.com/sandboxie-plus/Sandboxie/issues/4081)
- fixed The name of the sandbox is too long, causing an error in sbie2327 [#4064](https://github.com/sandboxie-plus/Sandboxie/issues/4064) - fixed The name of the sandbox is too long, causing an error in sbie2327 [#4064](https://github.com/sandboxie-plus/Sandboxie/issues/4064)
- fixed Job objects cannot be assigned memory limits greater than 4 GB [#4096](https://github.com/sandboxie-plus/Sandboxie/issues/4096)
### Changed ### Changed
- the certificate format can now take an explicit validity days specification, needed for gapless certificate renewal - the certificate format can now take an explicit validity days specification, needed for gapless certificate renewal

View File

@ -1506,6 +1506,36 @@ _FX ULONG SbieApi_QueryConfNumber(
} }
//---------------------------------------------------------------------------
// SbieApi_QueryConfBool
//---------------------------------------------------------------------------
_FX ULONG64 SbieApi_QueryConfNumber64(
const WCHAR *section_name, // WCHAR [66]
const WCHAR *setting_name, // WCHAR [66]
ULONG64 def)
{
WCHAR value[64];
*value = L'\0';
if (!NT_SUCCESS(SbieApi_QueryConfAsIs(
section_name, setting_name, 0, value, sizeof(value)))
|| *value == L'\0') // empty string
return def;
ULONG64 num = _wtoi64(value);
if (num == 0) {
WCHAR* ptr = value;
//if(*ptr == L'-')
// ptr++;
while (*ptr == L'0')
ptr++;
if(*ptr == L'\0')
return def;
}
return num;
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// SbieApi_EnumBoxes // SbieApi_EnumBoxes
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------

View File

@ -368,6 +368,12 @@ ULONG SbieApi_QueryConfNumber(
const WCHAR *setting_name, // WCHAR [66] const WCHAR *setting_name, // WCHAR [66]
ULONG def); ULONG def);
SBIEAPI_EXPORT
ULONG64 SbieApi_QueryConfNumber64(
const WCHAR *section_name, // WCHAR [66]
const WCHAR *setting_name, // WCHAR [66]
ULONG64 def);
SBIEAPI_EXPORT SBIEAPI_EXPORT
LONG SbieApi_EnumBoxes( LONG SbieApi_EnumBoxes(
LONG index, // initialize to -1 LONG index, // initialize to -1

View File

@ -1096,9 +1096,9 @@ HANDLE GuiServer::GetJobObjectForAssign(const WCHAR *boxname)
JOBOBJECT_EXTENDED_LIMIT_INFORMATION jobELInfo = {0}; JOBOBJECT_EXTENDED_LIMIT_INFORMATION jobELInfo = {0};
jobELInfo.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_BREAKAWAY_OK jobELInfo.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_BREAKAWAY_OK
| JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK; | JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK;
ULONG TotalMemoryLimit = SbieApi_QueryConfNumber(boxname, L"TotalMemoryLimit", 0); SIZE_T TotalMemoryLimit = (SIZE_T)SbieApi_QueryConfNumber64(boxname, L"TotalMemoryLimit", 0);
ULONG ProcessNumberLimit = SbieApi_QueryConfNumber(boxname, L"ProcessNumberLimit", 0); ULONG ProcessNumberLimit = SbieApi_QueryConfNumber(boxname, L"ProcessNumberLimit", 0);
ULONG ProcessMemoryLimit = SbieApi_QueryConfNumber(boxname, L"ProcessMemoryLimit", 0); SIZE_T ProcessMemoryLimit = (SIZE_T)SbieApi_QueryConfNumber64(boxname, L"ProcessMemoryLimit", 0);
if (TotalMemoryLimit != 0) { if (TotalMemoryLimit != 0) {
jobELInfo.JobMemoryLimit = TotalMemoryLimit; jobELInfo.JobMemoryLimit = TotalMemoryLimit;
jobELInfo.BasicLimitInformation.LimitFlags |= JOB_OBJECT_LIMIT_JOB_MEMORY; jobELInfo.BasicLimitInformation.LimitFlags |= JOB_OBJECT_LIMIT_JOB_MEMORY;