Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: installer/src/installer-lib/process.cpp

Issue 5195376613130240: Issue #1762 - Remove smart handle for HMODULE (Closed)
Patch Set: Created Jan. 7, 2015, 7:38 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « installer/src/installer-lib/handle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: installer/src/installer-lib/process.cpp
===================================================================
--- a/installer/src/installer-lib/process.cpp
+++ b/installer/src/installer-lib/process.cpp
@@ -14,34 +14,23 @@
typedef int (__stdcall *IsImmersiveDynamicFunc)(HANDLE);
bool process_by_any_exe_not_immersive::operator()( const PROCESSENTRY32W & process )
{
- if (processNames.find(process.szExeFile) != processNames.end())
- {
- // Make sure the process is still alive
- HANDLE tmpHandle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, process.th32ProcessID);
- if (tmpHandle == NULL)
- return false;
- Windows_Handle procHandle(tmpHandle);
+ // If the name is not found in our list, it's filtered out
+ if (processNames.find(process.szExeFile) == processNames.end()) return false;
- DWORD exitCode;
- if (!GetExitCodeProcess(procHandle, &exitCode)) return false;
+ // Make sure the process is still alive
+ HANDLE tmpHandle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, process.th32ProcessID);
+ if (tmpHandle == NULL) return false;
+ Windows_Handle procHandle(tmpHandle);
+ DWORD exitCode;
+ if (!GetExitCodeProcess(procHandle, &exitCode)) return false;
+ if (exitCode != STILL_ACTIVE) return false;
- if (exitCode != STILL_ACTIVE) return false;
-
- // Check if this is a Windows Store app process (we don't care for IE in Modern UI)
- HMODULE tmpModule = LoadLibrary(L"user32.dll");
- if (tmpModule == NULL)
- return true;
- Windows_Module_Handle user32Dll(tmpModule);
- if (!user32Dll) return true;
-
- IsImmersiveDynamicFunc IsImmersiveDynamicCall = (IsImmersiveDynamicFunc)GetProcAddress(user32Dll, "IsImmersiveProcess");
- if (!IsImmersiveDynamicCall) return true;
-
- BOOL retValue = !IsImmersiveDynamicCall(procHandle);
-
- return retValue;
- }
- return false;
+ // Check if this is a Windows Store app process (we don't care for IE in Modern UI)
+ HMODULE user32Dll = LoadLibrary(L"user32.dll");
+ if (!user32Dll) return true;
+ IsImmersiveDynamicFunc IsImmersiveDynamicCall = (IsImmersiveDynamicFunc)GetProcAddress(user32Dll, "IsImmersiveProcess");
+ if (!IsImmersiveDynamicCall) return true;
+ return !IsImmersiveDynamicCall(procHandle);
}
//-------------------------------------------------------
« no previous file with comments | « installer/src/installer-lib/handle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld