Index: installer/src/installer-lib/process.cpp |
=================================================================== |
--- a/installer/src/installer-lib/process.cpp |
+++ b/installer/src/installer-lib/process.cpp |
@@ -16,9 +16,9 @@ |
if (moduleNames.empty()) |
return true; |
- ModulesSnapshot ms(process.th32ProcessID); |
- MODULEENTRY32W* me = ms.first(); |
- while (me != NULL) |
+ Module_Snapshot ms(process.th32ProcessID); |
+ const MODULEENTRY32W* me = ms.first(); |
+ while (me != 0) |
{ |
if (moduleNames.find(me->szModule) != moduleNames.end()) |
{ |
@@ -47,49 +47,6 @@ |
} |
//------------------------------------------------------- |
-// Snapshot |
-//------------------------------------------------------- |
-Snapshot::Snapshot() |
- : handle( ::CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 ) ) |
-{ |
- process.dwSize = sizeof( PROCESSENTRY32W ) ; |
-} |
- |
-PROCESSENTRY32W * Snapshot::first() |
-{ |
- return ::Process32FirstW(handle, &process) ? (&process) : 0; |
-} |
- |
-PROCESSENTRY32W * Snapshot::next() |
-{ |
- return ::Process32NextW(handle, &process) ? (&process) : 0; |
-} |
- |
-void Snapshot::refresh() |
-{ |
- handle = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); |
-} |
- |
-//------------------------------------------------------- |
-// ModulesSnapshot |
-//------------------------------------------------------- |
-ModulesSnapshot::ModulesSnapshot(DWORD processId) |
- : handle(::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, processId)) |
-{ |
- module.dwSize = sizeof(MODULEENTRY32); |
-} |
- |
-MODULEENTRY32W * ModulesSnapshot::first() |
-{ |
- return ::Module32FirstW(handle, &module) ? (&module) : 0; |
-} |
- |
-MODULEENTRY32W * ModulesSnapshot::next() |
-{ |
- return ::Module32NextW(handle, &module) ? (&module) : 0; |
-} |
- |
-//------------------------------------------------------- |
// send_message, send_endsession_messages |
//------------------------------------------------------- |
/** |
@@ -108,7 +65,7 @@ |
* This class provides the base for any variation from the default behavior. |
*/ |
struct message_accumulator |
- : public std::binary_function< DWORD_PTR, BOOL, bool > |
+ : public std::binary_function< DWORD_PTR, bool, bool > |
{ |
virtual result_type operator()( first_argument_type result, second_argument_type return_value ) = 0 ; |
virtual ~message_accumulator() {} ; |
@@ -150,7 +107,7 @@ |
bool operator()( HWND window ) |
{ |
DWORD_PTR result ; |
- BOOL rv = SendMessageTimeoutW( window, message, p1, p2, SMTO_BLOCK, timeout, & result ) ; |
+ LRESULT rv = SendMessageTimeoutW( window, message, p1, p2, SMTO_BLOCK, timeout, & result ) ; |
/* |
* If we have no message accumulator, the default behavior is to iterate everything. |
* If we do have one, we delegate to it the decision whether to break or to continue. |
@@ -159,7 +116,7 @@ |
{ |
return true ; |
} |
- return ( * f )( result, rv ) ; |
+ return ( * f )( result, (rv != 0) ) ; |
} |
} ; |
@@ -214,7 +171,7 @@ |
/** |
* Enumeration function applied to each window. |
*/ |
- bool operator()( DWORD_PTR result, BOOL return_value ) |
+ bool operator()( DWORD_PTR result, bool return_value ) |
{ |
if ( ( ! return_value ) || result ) |
{ |