Index: sandbox/win/tests/integration_tests/hooking_dll.cc |
diff --git a/sandbox/win/tests/integration_tests/hooking_dll.cc b/sandbox/win/tests/integration_tests/hooking_dll.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d100d254b8131fea5d97384d134d7636e8b5d1fb |
--- /dev/null |
+++ b/sandbox/win/tests/integration_tests/hooking_dll.cc |
@@ -0,0 +1,28 @@ |
+// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include <windows.h> |
+#include <stdio.h> |
+ |
+#pragma data_seg(".shared") |
+BOOL hook_called = false; |
+#pragma data_seg() |
+#pragma comment(linker, "/SECTION:.shared,RWS") |
+ |
+extern "C" __declspec(dllexport) BOOL WasHookCalled() { |
+ return hook_called; |
+} |
+ |
+extern "C" __declspec(dllexport) LRESULT |
+ HookProc(int code, WPARAM wParam, LPARAM lParam) { |
+ // Supported versions of Windows do not require the HHOOK to be passed along. |
+ hook_called = true; |
+ return CallNextHookEx(NULL, code, wParam, lParam); |
+} |
+ |
+BOOL WINAPI DllMain(__in HINSTANCE hinstDLL, |
+ __in DWORD reason, |
+ __in LPVOID lpvReserved) { |
+ return TRUE; |
+} |