Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(860)

Unified Diff: base/process_win.cc

Issue 7624052: Cleanup code used to diagnose and fix bug 81449. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/task.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « no previous file | base/task.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698