OLD | NEW |
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "sandbox/src/filesystem_policy.h" | 7 #include "sandbox/src/filesystem_policy.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/scoped_handle_win.h" | 10 #include "base/win/scoped_handle.h" |
11 #include "sandbox/src/ipc_tags.h" | 11 #include "sandbox/src/ipc_tags.h" |
12 #include "sandbox/src/policy_engine_opcodes.h" | 12 #include "sandbox/src/policy_engine_opcodes.h" |
13 #include "sandbox/src/policy_params.h" | 13 #include "sandbox/src/policy_params.h" |
14 #include "sandbox/src/sandbox_utils.h" | 14 #include "sandbox/src/sandbox_utils.h" |
15 #include "sandbox/src/sandbox_types.h" | 15 #include "sandbox/src/sandbox_types.h" |
16 #include "sandbox/src/win_utils.h" | 16 #include "sandbox/src/win_utils.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 NTSTATUS NtCreateFileInTarget(HANDLE* target_file_handle, | 20 NTSTATUS NtCreateFileInTarget(HANDLE* target_file_handle, |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 ResolveNTFunctionPtr("NtSetInformationFile", &NtSetInformationFile); | 356 ResolveNTFunctionPtr("NtSetInformationFile", &NtSetInformationFile); |
357 | 357 |
358 HANDLE local_handle = NULL; | 358 HANDLE local_handle = NULL; |
359 if (!::DuplicateHandle(client_info.process, target_file_handle, | 359 if (!::DuplicateHandle(client_info.process, target_file_handle, |
360 ::GetCurrentProcess(), &local_handle, 0, FALSE, | 360 ::GetCurrentProcess(), &local_handle, 0, FALSE, |
361 DUPLICATE_SAME_ACCESS)) { | 361 DUPLICATE_SAME_ACCESS)) { |
362 *nt_status = STATUS_ACCESS_DENIED; | 362 *nt_status = STATUS_ACCESS_DENIED; |
363 return true; | 363 return true; |
364 } | 364 } |
365 | 365 |
366 ScopedHandle handle(local_handle); | 366 base::win::ScopedHandle handle(local_handle); |
367 | 367 |
368 FILE_INFORMATION_CLASS file_info_class = | 368 FILE_INFORMATION_CLASS file_info_class = |
369 static_cast<FILE_INFORMATION_CLASS>(info_class); | 369 static_cast<FILE_INFORMATION_CLASS>(info_class); |
370 *nt_status = NtSetInformationFile(local_handle, io_block, file_info, length, | 370 *nt_status = NtSetInformationFile(local_handle, io_block, file_info, length, |
371 file_info_class); | 371 file_info_class); |
372 | 372 |
373 return true; | 373 return true; |
374 } | 374 } |
375 | 375 |
376 bool PreProcessName(const std::wstring& path, std::wstring* new_path) { | 376 bool PreProcessName(const std::wstring& path, std::wstring* new_path) { |
377 ConvertToLongPath(path, new_path); | 377 ConvertToLongPath(path, new_path); |
378 | 378 |
379 bool reparsed = false; | 379 bool reparsed = false; |
380 if (ERROR_SUCCESS != IsReparsePoint(*new_path, &reparsed)) | 380 if (ERROR_SUCCESS != IsReparsePoint(*new_path, &reparsed)) |
381 return false; | 381 return false; |
382 | 382 |
383 // We can't process reparsed file. | 383 // We can't process reparsed file. |
384 return !reparsed; | 384 return !reparsed; |
385 } | 385 } |
386 | 386 |
387 } // namespace sandbox | 387 } // namespace sandbox |
OLD | NEW |