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

Side by Side Diff: tools/generate_dump.cc

Issue 1337133002: win: Fix OpenProcess(PROCESS_ALL_ACCESS, ...) on XP (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: fixes Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | util/util.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 24 matching lines...) Expand all
35 #include <unistd.h> 35 #include <unistd.h>
36 36
37 #include "base/mac/scoped_mach_port.h" 37 #include "base/mac/scoped_mach_port.h"
38 #include "snapshot/mac/process_snapshot_mac.h" 38 #include "snapshot/mac/process_snapshot_mac.h"
39 #include "util/mach/scoped_task_suspend.h" 39 #include "util/mach/scoped_task_suspend.h"
40 #include "util/mach/task_for_pid.h" 40 #include "util/mach/task_for_pid.h"
41 #elif defined(OS_WIN) 41 #elif defined(OS_WIN)
42 #include "base/strings/utf_string_conversions.h" 42 #include "base/strings/utf_string_conversions.h"
43 #include "snapshot/win/process_snapshot_win.h" 43 #include "snapshot/win/process_snapshot_win.h"
44 #include "util/win/scoped_process_suspend.h" 44 #include "util/win/scoped_process_suspend.h"
45 #include "util/win/xp_compat.h"
45 #endif // OS_MACOSX 46 #endif // OS_MACOSX
46 47
47 namespace crashpad { 48 namespace crashpad {
48 namespace { 49 namespace {
49 50
50 struct Options { 51 struct Options {
51 std::string dump_path; 52 std::string dump_path;
52 pid_t pid; 53 pid_t pid;
53 bool suspend; 54 bool suspend;
54 }; 55 };
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 145
145 if (options.pid == getpid()) { 146 if (options.pid == getpid()) {
146 if (options.suspend) { 147 if (options.suspend) {
147 LOG(ERROR) << "cannot suspend myself"; 148 LOG(ERROR) << "cannot suspend myself";
148 return EXIT_FAILURE; 149 return EXIT_FAILURE;
149 } 150 }
150 LOG(WARNING) << "operating on myself"; 151 LOG(WARNING) << "operating on myself";
151 } 152 }
152 #elif defined(OS_WIN) 153 #elif defined(OS_WIN)
153 ScopedKernelHANDLE process( 154 ScopedKernelHANDLE process(
154 OpenProcess(PROCESS_ALL_ACCESS, false, options.pid)); 155 OpenProcess(kXPProcessAllAccess, false, options.pid));
155 if (!process.is_valid()) { 156 if (!process.is_valid()) {
156 LOG(ERROR) << "could not open process " << options.pid; 157 LOG(ERROR) << "could not open process " << options.pid;
157 return EXIT_FAILURE; 158 return EXIT_FAILURE;
158 } 159 }
159 #endif // OS_MACOSX 160 #endif // OS_MACOSX
160 161
161 if (options.dump_path.empty()) { 162 if (options.dump_path.empty()) {
162 options.dump_path = base::StringPrintf("minidump.%d", options.pid); 163 options.dump_path = base::StringPrintf("minidump.%d", options.pid);
163 } 164 }
164 165
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 220
220 #if defined(OS_POSIX) 221 #if defined(OS_POSIX)
221 int main(int argc, char* argv[]) { 222 int main(int argc, char* argv[]) {
222 return crashpad::GenerateDumpMain(argc, argv); 223 return crashpad::GenerateDumpMain(argc, argv);
223 } 224 }
224 #elif defined(OS_WIN) 225 #elif defined(OS_WIN)
225 int wmain(int argc, wchar_t* argv[]) { 226 int wmain(int argc, wchar_t* argv[]) {
226 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::GenerateDumpMain); 227 return crashpad::ToolSupport::Wmain(argc, argv, crashpad::GenerateDumpMain);
227 } 228 }
228 #endif // OS_POSIX 229 #endif // OS_POSIX
OLDNEW
« no previous file with comments | « no previous file | util/util.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698