OLD | NEW |
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2010 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 "sandbox/win/src/process_thread_dispatcher.h" | 5 #include "sandbox/win/src/process_thread_dispatcher.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "sandbox/win/src/crosscall_client.h" | 9 #include "sandbox/win/src/crosscall_client.h" |
10 #include "sandbox/win/src/interception.h" | 10 #include "sandbox/win/src/interception.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // absolute. | 57 // absolute. |
58 bool IsPathRelative(const std::wstring &path) { | 58 bool IsPathRelative(const std::wstring &path) { |
59 // A path is Relative if it's not a UNC path beginnning with \\ or a | 59 // A path is Relative if it's not a UNC path beginnning with \\ or a |
60 // path beginning with a drive. (i.e. X:\) | 60 // path beginning with a drive. (i.e. X:\) |
61 if (path.find(L"\\\\") == 0 || path.find(L":\\") == 1) | 61 if (path.find(L"\\\\") == 0 || path.find(L":\\") == 1) |
62 return false; | 62 return false; |
63 return true; | 63 return true; |
64 } | 64 } |
65 | 65 |
66 // Converts a relative path to an absolute path. | 66 // Converts a relative path to an absolute path. |
67 bool ConvertToAbsolutePath(const std::wstring child_current_directory, | 67 bool ConvertToAbsolutePath(const std::wstring& child_current_directory, |
68 bool use_env_path, std::wstring *path) { | 68 bool use_env_path, std::wstring *path) { |
69 wchar_t file_buffer[MAX_PATH]; | 69 wchar_t file_buffer[MAX_PATH]; |
70 wchar_t *file_part = NULL; | 70 wchar_t *file_part = NULL; |
71 | 71 |
72 // Here we should start by looking at the path where the child application was | 72 // Here we should start by looking at the path where the child application was |
73 // started. We don't have this information yet. | 73 // started. We don't have this information yet. |
74 DWORD result = 0; | 74 DWORD result = 0; |
75 if (use_env_path) { | 75 if (use_env_path) { |
76 // Try with the complete path | 76 // Try with the complete path |
77 result = ::SearchPath(NULL, path->c_str(), NULL, MAX_PATH, file_buffer, | 77 result = ::SearchPath(NULL, path->c_str(), NULL, MAX_PATH, file_buffer, |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // If our logic was wrong, at least we wont allow create a random process. | 236 // If our logic was wrong, at least we wont allow create a random process. |
237 DWORD ret = ProcessPolicy::CreateProcessWAction(eval, *ipc->client_info, | 237 DWORD ret = ProcessPolicy::CreateProcessWAction(eval, *ipc->client_info, |
238 exe_name, *cmd_line, | 238 exe_name, *cmd_line, |
239 proc_info); | 239 proc_info); |
240 | 240 |
241 ipc->return_info.win32_result = ret; | 241 ipc->return_info.win32_result = ret; |
242 return true; | 242 return true; |
243 } | 243 } |
244 | 244 |
245 } // namespace sandbox | 245 } // namespace sandbox |
OLD | NEW |