OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | |
Will Harris
2016/04/04 00:15:09
no (c)
penny
2016/04/11 22:11:59
Done.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include <windows.h> | |
6 #include <stdio.h> | |
7 | |
8 #pragma data_seg(".shared") | |
9 BOOL hook_called = false; | |
Will Harris
2016/04/04 00:15:09
why is this linker-fu needed?
penny
2016/04/11 22:11:59
Fair question. I've added some detailed comments.
| |
10 #pragma data_seg() | |
11 #pragma comment(linker, "/SECTION:.shared,RWS") | |
12 | |
13 extern "C" __declspec(dllexport) BOOL WasHookCalled() { | |
14 return hook_called; | |
15 } | |
16 | |
17 extern "C" __declspec(dllexport) LRESULT | |
18 HookProc(int code, WPARAM wParam, LPARAM lParam) { | |
19 // Supported versions of Windows do not require the HHOOK to be passed along. | |
20 hook_called = true; | |
21 return CallNextHookEx(NULL, code, wParam, lParam); | |
22 } | |
23 | |
24 BOOL WINAPI DllMain(__in HINSTANCE hinstDLL, | |
25 __in DWORD reason, | |
26 __in LPVOID lpvReserved) { | |
27 return TRUE; | |
28 } | |
OLD | NEW |