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 |
(...skipping 29 matching lines...) Expand all Loading... |
40 } | 40 } |
41 | 41 |
42 EXPLICIT_ACCESS change; | 42 EXPLICIT_ACCESS change; |
43 change.grfAccessPermissions = permission; | 43 change.grfAccessPermissions = permission; |
44 change.grfAccessMode = DENY_ACCESS; | 44 change.grfAccessMode = DENY_ACCESS; |
45 change.grfInheritance = 0; | 45 change.grfInheritance = 0; |
46 change.Trustee.pMultipleTrustee = NULL; | 46 change.Trustee.pMultipleTrustee = NULL; |
47 change.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; | 47 change.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; |
48 change.Trustee.TrusteeForm = TRUSTEE_IS_NAME; | 48 change.Trustee.TrusteeForm = TRUSTEE_IS_NAME; |
49 change.Trustee.TrusteeType = TRUSTEE_IS_USER; | 49 change.Trustee.TrusteeType = TRUSTEE_IS_USER; |
50 change.Trustee.ptstrName = L"CURRENT_USER"; | 50 change.Trustee.ptstrName = const_cast<wchar_t*>(L"CURRENT_USER"); |
51 | 51 |
52 PACL new_dacl; | 52 PACL new_dacl; |
53 if (SetEntriesInAcl(1, &change, old_dacl, &new_dacl) != ERROR_SUCCESS) { | 53 if (SetEntriesInAcl(1, &change, old_dacl, &new_dacl) != ERROR_SUCCESS) { |
54 LocalFree(security_descriptor); | 54 LocalFree(security_descriptor); |
55 return false; | 55 return false; |
56 } | 56 } |
57 | 57 |
58 DWORD rc = SetNamedSecurityInfo(const_cast<wchar_t*>(path.value().c_str()), | 58 DWORD rc = SetNamedSecurityInfo(const_cast<wchar_t*>(path.value().c_str()), |
59 SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, | 59 SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, |
60 NULL, NULL, new_dacl, NULL); | 60 NULL, NULL, new_dacl, NULL); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 DCHECK(info_ != NULL); | 288 DCHECK(info_ != NULL); |
289 DCHECK_NE(0u, length_); | 289 DCHECK_NE(0u, length_); |
290 } | 290 } |
291 | 291 |
292 PermissionRestorer::~PermissionRestorer() { | 292 PermissionRestorer::~PermissionRestorer() { |
293 if (!RestorePermissionInfo(path_, info_, length_)) | 293 if (!RestorePermissionInfo(path_, info_, length_)) |
294 NOTREACHED(); | 294 NOTREACHED(); |
295 } | 295 } |
296 | 296 |
297 } // namespace file_util | 297 } // namespace file_util |
OLD | NEW |