author | Aaron Klotz <aklotz@mozilla.com> |
Wed, 27 Jun 2018 11:48:45 -0600 | |
changeset 424933 | 7bdadc37becdd1c800543396b19a3d8f2c114e08 |
parent 424932 | d1e8418da3b446ecfe81495ac484abace554b5cf |
child 424934 | f538fbf4d5099cbd84c3777d5eb338333dca33a4 |
push id | 104944 |
push user | aklotz@mozilla.com |
push date | Wed, 04 Jul 2018 02:23:52 +0000 |
treeherder | mozilla-inbound@ff25e66da36e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | handyman |
bugs | 1460022 |
milestone | 63.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
mozglue/tests/interceptor/TestDllInterceptorCrossProcess.cpp | file | annotate | diff | comparison | revisions |
--- a/mozglue/tests/interceptor/TestDllInterceptorCrossProcess.cpp +++ b/mozglue/tests/interceptor/TestDllInterceptorCrossProcess.cpp @@ -6,29 +6,29 @@ #include "nsWindowsDllInterceptor.h" #include "nsWindowsHelpers.h" #include <string> using std::wstring; -static void* gOrigReturnResult; - extern "C" __declspec(dllexport) int ReturnResult() { return 2; } +static mozilla::CrossProcessDllInterceptor::FuncHookType<decltype(&ReturnResult)> + gOrigReturnResult; + static int ReturnResultHook() { - auto origFn = reinterpret_cast<decltype(&ReturnResult)>(gOrigReturnResult); - if (origFn() != 2) { + if (gOrigReturnResult() != 2) { return 3; } return 0; } int ParentMain() { @@ -68,19 +68,17 @@ int ParentMain() printf("TEST-UNEXPECTED-FAIL | DllInterceptorCrossProcess | Failed to assign child process to job\n"); ::TerminateProcess(childProcess.get(), 1); return 1; } mozilla::CrossProcessDllInterceptor intcpt(childProcess.get()); intcpt.Init("TestDllInterceptorCrossProcess.exe"); - if (!intcpt.AddHook("ReturnResult", - reinterpret_cast<intptr_t>(&ReturnResultHook), - &gOrigReturnResult)) { + if (!gOrigReturnResult.Set(intcpt, "ReturnResult", &ReturnResultHook)) { printf("TEST-UNEXPECTED-FAIL | DllInterceptorCrossProcess | Failed to add hook\n"); return 1; } printf("TEST-PASS | DllInterceptorCrossProcess | Hook added\n"); // Let's save the original hook SIZE_T bytesWritten;