OLD | NEW |
1 /** | 1 /** |
2 * \file DLL.h The DLL as a Windows system module. | 2 * \file DLL.h The DLL as a Windows system module. |
3 */ | 3 */ |
4 | 4 |
5 #ifndef DLL_H | 5 #ifndef DLL_H |
6 #define DLL_H | 6 #define DLL_H |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "windows.h" | 11 #include "windows.h" |
12 | 12 |
13 /** | 13 /** |
14 * Singleton representing the DLL module. This class is the source of the file n
ame for the custom action library, used in logging. | 14 * Singleton representing the DLL module. This class is the source of the file na
me for the custom action library, used in logging. |
15 * The choice to use a singleton reflects the design of the Windows API, which t
reats the module handle as a global for the DLL instance, | 15 * The choice to use a singleton reflects the design of the Windows API, which tr
eats the module handle as a global for the DLL instance, |
16 * only appearing during the calls that manage the lifetime of the DLL. | 16 * only appearing during the calls that manage the lifetime of the DLL. |
17 */ | 17 */ |
18 class DLL_Module | 18 class DLL_Module |
19 { | 19 { |
20 public: | 20 public: |
21 /** | 21 /** |
22 * Accessor function for the singleton. | 22 * Accessor function for the singleton. |
23 */ | 23 */ |
24 static DLL_Module & module(); | 24 static DLL_Module & module(); |
25 | 25 |
26 /** | 26 /** |
27 * Hook function to call on DLL attach. | 27 * Hook function to call on DLL attach. |
28 */ | 28 */ |
29 static void attach( HINSTANCE handle ); | 29 static void attach( HINSTANCE handle ); |
30 | 30 |
31 /** | 31 /** |
32 * Hook function to call on DLL detach. | 32 * Hook function to call on DLL detach. |
33 */ | 33 */ |
34 static void detach(); | 34 static void detach(); |
35 | 35 |
36 /** | 36 /** |
37 * Textual name of the DLL as an OS module. | 37 * Textual name of the DLL as an OS module. |
38 */ | 38 */ |
39 std::wstring name(); | 39 std::wstring name(); |
40 | 40 |
41 private: | 41 private: |
42 /** | 42 /** |
43 * The singleton value. | 43 * The singleton value. |
44 */ | 44 */ |
45 static std::shared_ptr< DLL_Module > singleton; | 45 static std::shared_ptr< DLL_Module > singleton; |
46 | 46 |
47 /** | 47 /** |
48 * Private constructor ensures use of accessor function only. | 48 * Private constructor ensures use of accessor function only. |
49 */ | 49 */ |
50 DLL_Module( HINSTANCE handle ); | 50 DLL_Module( HINSTANCE handle ); |
51 | 51 |
52 /** | 52 /** |
53 * Windows handle for the instance of the DLL. | 53 * Windows handle for the instance of the DLL. |
54 */ | 54 */ |
55 HINSTANCE handle; | 55 HINSTANCE handle; |
56 | 56 |
57 /** | 57 /** |
58 * The text name of the module. | 58 * The text name of the module. |
59 * | 59 * |
60 * Implemented as a smart pointer for deferred evaluation of the system call t
o get the module name. | 60 * Implemented as a smart pointer for deferred evaluation of the system call to
get the module name. |
61 */ | 61 */ |
62 std::shared_ptr< std::wstring > _name; | 62 std::shared_ptr< std::wstring > _name; |
63 }; | 63 }; |
64 | 64 |
65 #endif | 65 #endif |
OLD | NEW |