diff --git a/security/sandbox/win/SandboxInitialization.cpp b/security/sandbox/win/SandboxInitialization.cpp index 8e27b87dd2f4..8a4a5e858072 100644 --- a/security/sandbox/win/SandboxInitialization.cpp +++ b/security/sandbox/win/SandboxInitialization.cpp @@ -15,7 +15,7 @@ namespace mozilla { namespace sandboxing { typedef BOOL(WINAPI* CloseHandle_func) (HANDLE hObject); -static CloseHandle_func stub_CloseHandle = nullptr; +static WindowsDllInterceptor::FuncHookType 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 + 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(patched_CloseHandle), - (void**)&stub_CloseHandle); + stub_CloseHandle.Set(Kernel32Intercept, "CloseHandle", &patched_CloseHandle); if (!hooked) { return false; } hooked = - Kernel32Intercept.AddHook("DuplicateHandle", - reinterpret_cast(patched_DuplicateHandle), - (void**)&stub_DuplicateHandle); + stub_DuplicateHandle.Set(Kernel32Intercept, "DuplicateHandle", + &patched_DuplicateHandle); if (!hooked) { return false; }