| LEFT | RIGHT |
| (no file at all) | |
| 1 /** | 1 /** |
| 2 * \file abp_ca.cpp Top-level source for custom actions. Includes DLL initializa
tion. | 2 * \file abp_ca.cpp Top-level source for custom actions. Includes DLL initializa
tion. |
| 3 */ | 3 */ |
| 4 #include "DLL.h" | 4 #include "DLL.h" |
| 5 #include <stdexcept> | 5 #include <stdexcept> |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * DllMain is the standard entry point call when the DLL is loaded or unloaded. | 8 * DllMain is the standard entry point call when the DLL is loaded or unloaded. |
| 9 * | 9 * |
| 10 * \param[in] module_handle | 10 * \param[in] module_handle |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 IN LPVOID reserved ) | 25 IN LPVOID reserved ) |
| 26 { | 26 { |
| 27 /* | 27 /* |
| 28 * Because this is an external API, we must ensure that there is a catch-all b
lock for each execution path. There are two of these below. | 28 * Because this is an external API, we must ensure that there is a catch-all b
lock for each execution path. There are two of these below. |
| 29 */ | 29 */ |
| 30 switch ( reason ) | 30 switch ( reason ) |
| 31 { | 31 { |
| 32 case DLL_PROCESS_ATTACH: | 32 case DLL_PROCESS_ATTACH: |
| 33 try | 33 try |
| 34 { | 34 { |
| 35 DLL_Module::attach( module_handle ); | 35 DllModule::Attach( module_handle ); |
| 36 return TRUE; | 36 return TRUE; |
| 37 } | 37 } |
| 38 catch(...) | 38 catch(...) |
| 39 { | 39 { |
| 40 // We can't log to the installation log yet, and this couldn't shouldn't b
e executed except in rare cases such as out-of-memory. | 40 // We can't log to the installation log yet, and this couldn't shouldn't b
e executed except in rare cases such as out-of-memory. |
| 41 // Since it's a lot of code to do something useful (such as logging to the
Windows system event log), we don't do anything but return a failure. | 41 // Since it's a lot of code to do something useful (such as logging to the
Windows system event log), we don't do anything but return a failure. |
| 42 return FALSE; | 42 return FALSE; |
| 43 } | 43 } |
| 44 break; | 44 break; |
| 45 | 45 |
| 46 case DLL_PROCESS_DETACH: | 46 case DLL_PROCESS_DETACH: |
| 47 try | 47 try |
| 48 { | 48 { |
| 49 DLL_Module::detach(); | 49 DllModule::Detach(); |
| 50 return TRUE; | 50 return TRUE; |
| 51 } | 51 } |
| 52 catch(...) | 52 catch(...) |
| 53 { | 53 { |
| 54 // See comment above in parallel catch-block. | 54 // See comment above in parallel catch-block. |
| 55 return FALSE; | 55 return FALSE; |
| 56 } | 56 } |
| 57 break; | 57 break; |
| 58 | 58 |
| 59 /* | 59 /* |
| 60 * This entry point is called for each thread after the first in a process wit
h this DLL loaded. Note "after the first". | 60 * This entry point is called for each thread after the first in a process wit
h this DLL loaded. Note "after the first". |
| 61 * The process life cycle is always called, and we do our global initializatio
n there. So even though this DLL | 61 * The process life cycle is always called, and we do our global initializatio
n there. So even though this DLL |
| 62 * doesn't support asynchronous operation, this entry point gets called anyway
. We need to ignore these calls. | 62 * doesn't support asynchronous operation, this entry point gets called anyway
. We need to ignore these calls. |
| 63 */ | 63 */ |
| 64 case DLL_THREAD_ATTACH: | 64 case DLL_THREAD_ATTACH: |
| 65 case DLL_THREAD_DETACH: | 65 case DLL_THREAD_DETACH: |
| 66 return TRUE; | 66 return TRUE; |
| 67 | 67 |
| 68 default: | 68 default: |
| 69 return FALSE; | 69 return FALSE; |
| 70 } | 70 } |
| 71 } | 71 } |
| LEFT | RIGHT |