| OLD | NEW |
| 1 /** | 1 /** |
| 2 * \file abp_ca.cpp Top-level source for custom actions. Includes DLL initializa
tion. | 2 * \file test-installer-lib-ca.cpp Top-level source for custom actions, test ver
sion |
| 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] moduleHandle |
| 11 * Handle for this instance of the DLL; same as the module handle. | 11 * Handle for this instance of the DLL; same as the module handle. |
| 12 * This handle allows us to get the DLL file name for logging. | 12 * This handle allows us to get the DLL file name for logging. |
| 13 * \param[in] reason | 13 * \param[in] reason |
| 14 * The point in the DLL life cycle at which this call is made. Called "reason
code" by Microsoft. | 14 * The point in the DLL life cycle at which this call is made. Called "reason
code" by Microsoft. |
| 15 * \param[in] reserved | 15 * \param[in] reserved |
| 16 * No longer reserved, since it contains a point in the thread life cycle. | 16 * No longer reserved, since it contains a point in the thread life cycle. |
| 17 * We aren't using it, though. | 17 * We aren't using it, though. |
| 18 | 18 |
| 19 * \sa { http://msdn.microsoft.com/en-us/library/windows/desktop/ms682583%28v=vs
.85%29.aspx } | 19 * \sa { http://msdn.microsoft.com/en-us/library/windows/desktop/ms682583%28v=vs
.85%29.aspx } |
| 20 * Documentation on DLL entry points in Windows. | 20 * Documentation on DLL entry points in Windows. |
| 21 */ | 21 */ |
| 22 extern "C" BOOL WINAPI DllMain( | 22 extern "C" BOOL WINAPI DllMain( |
| 23 IN HINSTANCE module_handle, | 23 IN HINSTANCE moduleHandle, |
| 24 IN ULONG reason, | 24 IN ULONG reason, |
| 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 DllModule::Attach(module_handle); | 35 DllModule::Attach(moduleHandle); |
| 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
be 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
be 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 t
he 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 t
he 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 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 62 * doesn't support asynchronous operation, this entry point gets called anyw
ay. We need to ignore these calls. | 62 * doesn't support asynchronous operation, this entry point gets called anyw
ay. 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 } |
| OLD | NEW |