| 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" |
| 11 #include "remoting/host/logging.h" | 11 #include "remoting/host/logging.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 // "--help" or "--?" prints the usage message. | 15 // "--help" or "--?" prints the usage message. |
| 16 const char kHelpSwitchName[] = "help"; | 16 const char kHelpSwitchName[] = "help"; |
| 17 const char kQuestionSwitchName[] = "?"; | 17 const char kQuestionSwitchName[] = "?"; |
| 18 | 18 |
| 19 const char kUsageMessage[] = | 19 const char kUsageMessage[] = |
| 20 "\n" | 20 "\n" |
| 21 "Usage: %s <pid>\n" | 21 "Usage: %s <pid>\n" |
| 22 "\n" | 22 "\n" |
| 23 " pid - PID of the process to be crashed.\n"; | 23 " pid - PID of the process to be crashed.\n" |
| 24 "\n\n" |
| 25 "Note: You may need to run this tool as SYSTEM\n" |
| 26 " to prevent access denied errors.\n"; |
| 24 | 27 |
| 25 // Exit codes: | 28 // Exit codes: |
| 26 const int kSuccessExitCode = 0; | 29 const int kSuccessExitCode = 0; |
| 27 const int kUsageExitCode = 1; | 30 const int kUsageExitCode = 1; |
| 28 const int kErrorExitCode = 2; | 31 const int kErrorExitCode = 2; |
| 29 | 32 |
| 30 void usage(const char* program_name) { | 33 void usage(const char* program_name) { |
| 31 fprintf(stderr, kUsageMessage, program_name); | 34 fprintf(stderr, kUsageMessage, program_name); |
| 32 } | 35 } |
| 33 | 36 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 base::win::ScopedHandle thread; | 76 base::win::ScopedHandle thread; |
| 74 thread.Set(CreateRemoteThread(process.Get(), NULL, 0, NULL, NULL, 0, | 77 thread.Set(CreateRemoteThread(process.Get(), NULL, 0, NULL, NULL, 0, |
| 75 &thread_id)); | 78 &thread_id)); |
| 76 if (!thread.IsValid()) { | 79 if (!thread.IsValid()) { |
| 77 PLOG(ERROR) << "Failed to create a remote thread in " << pid; | 80 PLOG(ERROR) << "Failed to create a remote thread in " << pid; |
| 78 return kErrorExitCode; | 81 return kErrorExitCode; |
| 79 } | 82 } |
| 80 | 83 |
| 81 return kSuccessExitCode; | 84 return kSuccessExitCode; |
| 82 } | 85 } |
| OLD | NEW |