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 "base/test/test_file_util.h" | 5 #include "base/test/test_file_util.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <aclapi.h> | 8 #include <aclapi.h> |
9 #include <shlwapi.h> | 9 #include <shlwapi.h> |
10 | 10 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
17 #include "base/threading/platform_thread.h" | 17 #include "base/threading/platform_thread.h" |
18 #include "base/win/scoped_handle.h" | 18 #include "base/win/scoped_handle.h" |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 | 21 |
22 static const ptrdiff_t kOneMB = 1024 * 1024; | |
23 | |
24 namespace { | 22 namespace { |
25 | 23 |
26 struct PermissionInfo { | 24 struct PermissionInfo { |
27 PSECURITY_DESCRIPTOR security_descriptor; | 25 PSECURITY_DESCRIPTOR security_descriptor; |
28 ACL dacl; | 26 ACL dacl; |
29 }; | 27 }; |
30 | 28 |
31 // Deny |permission| on the file |path|, for the current user. | 29 // Deny |permission| on the file |path|, for the current user. |
32 bool DenyFilePermission(const FilePath& path, DWORD permission) { | 30 bool DenyFilePermission(const FilePath& path, DWORD permission) { |
33 PACL old_dacl; | 31 PACL old_dacl; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 DCHECK(info_ != NULL); | 205 DCHECK(info_ != NULL); |
208 DCHECK_NE(0u, length_); | 206 DCHECK_NE(0u, length_); |
209 } | 207 } |
210 | 208 |
211 FilePermissionRestorer::~FilePermissionRestorer() { | 209 FilePermissionRestorer::~FilePermissionRestorer() { |
212 if (!RestorePermissionInfo(path_, info_, length_)) | 210 if (!RestorePermissionInfo(path_, info_, length_)) |
213 NOTREACHED(); | 211 NOTREACHED(); |
214 } | 212 } |
215 | 213 |
216 } // namespace base | 214 } // namespace base |
OLD | NEW |