mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1460022: Part 9 - Update sandboxing code to work with revised DLL interceptor interface; r=bobowen
This commit is contained in:
parent
d88f616e24
commit
fab8ec82c6
@ -15,7 +15,7 @@ namespace mozilla {
|
||||
namespace sandboxing {
|
||||
|
||||
typedef BOOL(WINAPI* CloseHandle_func) (HANDLE hObject);
|
||||
static CloseHandle_func stub_CloseHandle = nullptr;
|
||||
static WindowsDllInterceptor::FuncHookType<CloseHandle_func> stub_CloseHandle;
|
||||
|
||||
typedef BOOL(WINAPI* DuplicateHandle_func)(HANDLE hSourceProcessHandle,
|
||||
HANDLE hSourceHandle,
|
||||
@ -24,7 +24,8 @@ typedef BOOL(WINAPI* DuplicateHandle_func)(HANDLE hSourceProcessHandle,
|
||||
DWORD dwDesiredAccess,
|
||||
BOOL bInheritHandle,
|
||||
DWORD dwOptions);
|
||||
static DuplicateHandle_func stub_DuplicateHandle = nullptr;
|
||||
static WindowsDllInterceptor::FuncHookType<DuplicateHandle_func>
|
||||
stub_DuplicateHandle;
|
||||
|
||||
static BOOL WINAPI
|
||||
patched_CloseHandle(HANDLE hObject)
|
||||
@ -62,17 +63,14 @@ EnableHandleCloseMonitoring()
|
||||
{
|
||||
Kernel32Intercept.Init("kernel32.dll");
|
||||
bool hooked =
|
||||
Kernel32Intercept.AddHook("CloseHandle",
|
||||
reinterpret_cast<intptr_t>(patched_CloseHandle),
|
||||
(void**)&stub_CloseHandle);
|
||||
stub_CloseHandle.Set(Kernel32Intercept, "CloseHandle", &patched_CloseHandle);
|
||||
if (!hooked) {
|
||||
return false;
|
||||
}
|
||||
|
||||
hooked =
|
||||
Kernel32Intercept.AddHook("DuplicateHandle",
|
||||
reinterpret_cast<intptr_t>(patched_DuplicateHandle),
|
||||
(void**)&stub_DuplicateHandle);
|
||||
stub_DuplicateHandle.Set(Kernel32Intercept, "DuplicateHandle",
|
||||
&patched_DuplicateHandle);
|
||||
if (!hooked) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user