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

Side by Side Diff: test/win/win_child_process.cc

Issue 1405093013: win: Lower integrity level of connection pipe (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: fixes Created 5 years, 1 month 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 2015 The Crashpad Authors. All rights reserved. 1 // Copyright 2015 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,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and 12 // See the License for the specific language governing permissions and
13 // limitations under the License. 13 // limitations under the License.
14 14
15 #include "test/win/win_child_process.h" 15 #include "test/win/win_child_process.h"
16 16
17 #include <windows.h> 17 #include <windows.h>
18 #include <shellapi.h> 18 #include <shellapi.h>
19 19
20 #include <string> 20 #include <string>
21 21
22 #include "base/logging.h" 22 #include "base/logging.h"
23 #include "base/strings/stringprintf.h" 23 #include "base/strings/stringprintf.h"
24 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
25 #include "gtest/gtest.h" 25 #include "gtest/gtest.h"
26 #include "util/stdlib/string_number_conversion.h" 26 #include "util/stdlib/string_number_conversion.h"
27 #include "util/string/split_string.h" 27 #include "util/string/split_string.h"
28 #include "util/win/handle.h" 28 #include "util/win/handle.h"
29 #include "util/win/scoped_local_alloc.h"
29 #include "test/paths.h" 30 #include "test/paths.h"
30 31
31 namespace crashpad { 32 namespace crashpad {
32 namespace test { 33 namespace test {
33 34
34 namespace { 35 namespace {
35 36
36 const char kIsMultiprocessChild[] = "--is-multiprocess-child"; 37 const char kIsMultiprocessChild[] = "--is-multiprocess-child";
37 struct LocalFreeTraits {
38 static HLOCAL InvalidValue() { return nullptr; }
39 static void Free(HLOCAL mem) {
40 if (LocalFree(mem) != nullptr)
41 PLOG(ERROR) << "LocalFree";
42 }
43 };
44
45 using ScopedLocalFree = base::ScopedGeneric<HLOCAL, LocalFreeTraits>;
46 38
47 bool GetSwitch(const char* switch_name, std::string* value) { 39 bool GetSwitch(const char* switch_name, std::string* value) {
48 int num_args; 40 int num_args;
49 wchar_t** args = CommandLineToArgvW(GetCommandLine(), &num_args); 41 wchar_t** args = CommandLineToArgvW(GetCommandLine(), &num_args);
50 ScopedLocalFree scoped_args(args); // Take ownership. 42 ScopedLocalAlloc scoped_args(args); // Take ownership.
51 if (!args) { 43 if (!args) {
52 PLOG(FATAL) << "CommandLineToArgvW"; 44 PLOG(FATAL) << "CommandLineToArgvW";
53 return false; 45 return false;
54 } 46 }
55 47
56 std::string switch_name_with_equals(switch_name); 48 std::string switch_name_with_equals(switch_name);
57 switch_name_with_equals += "="; 49 switch_name_with_equals += "=";
58 for (int i = 1; i < num_args; ++i) { 50 for (int i = 1; i < num_args; ++i) {
59 const wchar_t* arg = args[i]; 51 const wchar_t* arg = args[i];
60 std::string arg_as_utf8 = base::UTF16ToUTF8(arg); 52 std::string arg_as_utf8 = base::UTF16ToUTF8(arg);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 void WinChildProcess::CloseReadPipe() { 222 void WinChildProcess::CloseReadPipe() {
231 pipe_read_.reset(); 223 pipe_read_.reset();
232 } 224 }
233 225
234 void WinChildProcess::CloseWritePipe() { 226 void WinChildProcess::CloseWritePipe() {
235 pipe_write_.reset(); 227 pipe_write_.reset();
236 } 228 }
237 229
238 } // namespace test 230 } // namespace test
239 } // namespace crashpad 231 } // namespace crashpad
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