Index: base/process_win.cc |
=================================================================== |
--- base/process_win.cc (revision 97282) |
+++ base/process_win.cc (working copy) |
@@ -13,21 +13,11 @@ |
void Process::Close() { |
if (!process_) |
return; |
+ |
// Don't call CloseHandle on a pseudo-handle. |
- if (process_ != ::GetCurrentProcess()) { |
- // TODO(apatrick): Call NtCloseHandle directly, without going through the |
- // import table to determine if CloseHandle is being hooked. |
- // http://crbug.com/81449. |
- HMODULE module = GetModuleHandle(L"ntdll.dll"); |
- typedef UINT (WINAPI *CloseHandlePtr)(HANDLE handle); |
- CloseHandlePtr close_handle = reinterpret_cast<CloseHandlePtr>( |
- GetProcAddress(module, "NtClose")); |
- close_handle(process_); |
+ if (process_ != ::GetCurrentProcess()) |
+ ::CloseHandle(process_); |
- // It used to look like this: |
- // ::CloseHandle(process_); |
- } |
- |
process_ = NULL; |
} |
@@ -35,17 +25,14 @@ |
if (!process_) |
return; |
- // TODO(apatrick): Call NtTerminateProcess directly, without going through the |
- // import table to determine if TerminateProcess is being hooked. |
- // http://crbug.com/81449. |
+ // Call NtTerminateProcess directly, without going through the import table, |
+ // which might have been hooked with a buggy replacement by third party |
+ // software. http://crbug.com/81449. |
HMODULE module = GetModuleHandle(L"ntdll.dll"); |
typedef UINT (WINAPI *TerminateProcessPtr)(HANDLE handle, UINT code); |
TerminateProcessPtr terminate_process = reinterpret_cast<TerminateProcessPtr>( |
GetProcAddress(module, "NtTerminateProcess")); |
terminate_process(process_, result_code); |
- |
- // It used to look like this: |
- // ::TerminateProcess(process_, result_code); |
} |
bool Process::IsProcessBackgrounded() const { |