Bug 1460022: Part 3 - Update TestDllInterceptorCrossProcess to reflect new interceptor interface; r=handyman

--HG--
extra : rebase_source : 208380bdaaf2c394c5d93cf2f0f8cb2a117b3e66
This commit is contained in:
Aaron Klotz 2018-06-27 11:48:45 -06:00
Родитель 9c86a6adcd
Коммит 0ff30867ea
1 изменённых файлов: 5 добавлений и 7 удалений

Просмотреть файл

@ -11,19 +11,19 @@
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;
}
@ -73,9 +73,7 @@ int ParentMain()
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;
}