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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 return true; | 127 return true; |
128 } | 128 } |
129 | 129 |
130 // Manages a reparse point for a test. | 130 // Manages a reparse point for a test. |
131 class ReparsePoint { | 131 class ReparsePoint { |
132 public: | 132 public: |
133 // Creates a reparse point from |source| (an empty directory) to |target|. | 133 // Creates a reparse point from |source| (an empty directory) to |target|. |
134 ReparsePoint(const FilePath& source, const FilePath& target) { | 134 ReparsePoint(const FilePath& source, const FilePath& target) { |
135 dir_.Set( | 135 dir_.Set( |
136 ::CreateFile(source.value().c_str(), | 136 ::CreateFile(source.value().c_str(), |
137 FILE_ALL_ACCESS, | 137 GENERIC_READ | GENERIC_WRITE, |
138 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, | 138 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, |
139 NULL, | 139 NULL, |
140 OPEN_EXISTING, | 140 OPEN_EXISTING, |
141 FILE_FLAG_BACKUP_SEMANTICS, // Needed to open a directory. | 141 FILE_FLAG_BACKUP_SEMANTICS, // Needed to open a directory. |
142 NULL)); | 142 NULL)); |
143 created_ = dir_.IsValid() && SetReparsePoint(dir_.Get(), target); | 143 created_ = dir_.IsValid() && SetReparsePoint(dir_.Get(), target); |
144 } | 144 } |
145 | 145 |
146 ~ReparsePoint() { | 146 ~ReparsePoint() { |
147 if (created_) | 147 if (created_) |
(...skipping 2370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2518 // Trying to close it should crash. This is important for security. | 2518 // Trying to close it should crash. This is important for security. |
2519 EXPECT_DEATH(CloseWithScopedFD(fds[1]), ""); | 2519 EXPECT_DEATH(CloseWithScopedFD(fds[1]), ""); |
2520 #endif | 2520 #endif |
2521 } | 2521 } |
2522 | 2522 |
2523 #endif // defined(OS_POSIX) | 2523 #endif // defined(OS_POSIX) |
2524 | 2524 |
2525 } // namespace | 2525 } // namespace |
2526 | 2526 |
2527 } // namespace base | 2527 } // namespace base |
OLD | NEW |