| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <windows.h> | 5 #include <windows.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 | 7 |
| 8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/win/scoped_handle.h" | 10 #include "base/win/scoped_handle.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 if (pid == 0) { | 57 if (pid == 0) { |
| 58 LOG(ERROR) << "Invalid process PID: " << args[0]; | 58 LOG(ERROR) << "Invalid process PID: " << args[0]; |
| 59 return kErrorExitCode; | 59 return kErrorExitCode; |
| 60 } | 60 } |
| 61 | 61 |
| 62 DWORD desired_access = PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION | | 62 DWORD desired_access = PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION | |
| 63 PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_VM_READ; | 63 PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_VM_READ; |
| 64 base::win::ScopedHandle process; | 64 base::win::ScopedHandle process; |
| 65 process.Set(OpenProcess(desired_access, FALSE, pid)); | 65 process.Set(OpenProcess(desired_access, FALSE, pid)); |
| 66 if (!process.IsValid()) { | 66 if (!process.IsValid()) { |
| 67 LOG_GETLASTERROR(ERROR) << "Failed to open the process " << pid; | 67 PLOG(ERROR) << "Failed to open the process " << pid; |
| 68 return kErrorExitCode; | 68 return kErrorExitCode; |
| 69 } | 69 } |
| 70 | 70 |
| 71 DWORD thread_id; | 71 DWORD thread_id; |
| 72 base::win::ScopedHandle thread; | 72 base::win::ScopedHandle thread; |
| 73 thread.Set(CreateRemoteThread(process.Get(), NULL, 0, NULL, NULL, 0, | 73 thread.Set(CreateRemoteThread(process.Get(), NULL, 0, NULL, NULL, 0, |
| 74 &thread_id)); | 74 &thread_id)); |
| 75 if (!thread.IsValid()) { | 75 if (!thread.IsValid()) { |
| 76 LOG_GETLASTERROR(ERROR) << "Failed to create a remote thread in " << pid; | 76 PLOG(ERROR) << "Failed to create a remote thread in " << pid; |
| 77 return kErrorExitCode; | 77 return kErrorExitCode; |
| 78 } | 78 } |
| 79 | 79 |
| 80 return kSuccessExitCode; | 80 return kSuccessExitCode; |
| 81 } | 81 } |
| OLD | NEW |