OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Some pointless code that will become a DLL with some exports and relocs. | 5 // Some pointless code that will become a DLL with some exports and relocs. |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
11 void* g_somestate = nullptr; | 11 void (*g_somestate)(int) = nullptr; |
12 int g_somevalue = 0; | 12 int g_somevalue = 0; |
13 | 13 |
14 } // namespace | 14 } // namespace |
15 | 15 |
16 extern "C" | 16 extern "C" |
17 void DummyExport(int foo) { | 17 void DummyExport(int foo) { |
18 g_somevalue = foo; | 18 g_somevalue = foo; |
19 } | 19 } |
20 | 20 |
21 extern "C" | 21 extern "C" |
22 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { | 22 BOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) { |
23 if (reason == DLL_PROCESS_ATTACH) | 23 if (reason == DLL_PROCESS_ATTACH) |
24 g_somestate = &DummyExport; | 24 g_somestate = &DummyExport; |
25 else if (reason == DLL_PROCESS_DETACH) | 25 else if (reason == DLL_PROCESS_DETACH) |
26 g_somestate = nullptr; | 26 g_somestate = nullptr; |
27 | 27 |
28 return TRUE; | 28 return TRUE; |
29 } | 29 } |
OLD | NEW |