This commit is contained in:
DavidXanatos 2022-05-08 15:36:03 +02:00
parent c23584b0ca
commit bba47abf3e
2 changed files with 42 additions and 1 deletions

View File

@ -14,6 +14,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [1.0.21 / 5.55.21] - 2022-05-02
### Added
- added "FuncSkipHook=FunctionName" option to allow to sellecively disable individual function hooks
### Changed
- improved support certificate entry box

View File

@ -1,6 +1,6 @@
/*
* Copyright 2004-2020 Sandboxie Holdings, LLC
* Copyright 2020 David Xanatos, xanasoft.com
* Copyright 2020-2022 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
@ -39,6 +39,8 @@ static void *SbieDll_Hook_CheckChromeHook(void *SourceFunc);
ULONG_PTR DLL_FindWow64Target(ULONG_PTR address);
BOOLEAN SbieDll_FuncSkipHook(const char* func);
//---------------------------------------------------------------------------
// Variables
//---------------------------------------------------------------------------
@ -111,6 +113,9 @@ _FX void *SbieDll_Hook(
BOOLEAN CallInstruction64 = FALSE;
#endif _WIN64
if (SbieDll_FuncSkipHook(SourceFuncName))
return SourceFunc;
//
// validate parameters
//
@ -616,6 +621,40 @@ _FX void *SbieDll_Hook_CheckChromeHook(void *SourceFunc)
}
//---------------------------------------------------------------------------
// SbieDll_FuncSkipHook
//---------------------------------------------------------------------------
BOOLEAN SbieDll_FuncSkipHook(const char* func)
{
static const WCHAR* setting = L"FuncSkipHook";
static BOOLEAN Disable = FALSE;
if (Disable) return FALSE;
WCHAR buf[66];
ULONG index = 0;
while (1) {
NTSTATUS status = SbieApi_QueryConfAsIs(NULL, setting, index, buf, 64 * sizeof(WCHAR));
if (NT_SUCCESS(status)) {
WCHAR* ptr = buf;
for (const char* tmp = func; *ptr && *tmp && *ptr == *tmp; ptr++, tmp++);
if (*ptr == L'\0') //if (_wcsicmp(buf, func) == 0)
return TRUE;
}
else if (status != STATUS_BUFFER_TOO_SMALL)
break;
++index;
}
// if there are no fucntions to skip configured, disable the check
if (index == 0) Disable = TRUE;
return FALSE;
}
//---------------------------------------------------------------------------
// Dll_GetSettingsForImageName
//---------------------------------------------------------------------------