OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome_frame/module_utils.h" | 5 #include "chrome_frame/module_utils.h" |
6 | 6 |
7 #include <aclapi.h> | 7 #include <aclapi.h> |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlsecurity.h> | 9 #include <atlsecurity.h> |
10 #include <sddl.h> | 10 #include <sddl.h> |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 141 } |
142 | 142 |
143 bool created_beacon = true; | 143 bool created_beacon = true; |
144 bool result = shared_memory_->CreateNamed(shared_memory_name_.c_str(), | 144 bool result = shared_memory_->CreateNamed(shared_memory_name_.c_str(), |
145 false, // open_existing | 145 false, // open_existing |
146 kSharedMemorySize); | 146 kSharedMemorySize); |
147 | 147 |
148 if (result) { | 148 if (result) { |
149 // We created the beacon, now we need to mutate the security attributes | 149 // We created the beacon, now we need to mutate the security attributes |
150 // on the shared memory to allow read-only access and let low-integrity | 150 // on the shared memory to allow read-only access and let low-integrity |
151 // processes open it. | 151 // processes open it. This will fail on FAT32 file systems. |
152 bool acls_set = SetFileMappingToReadOnly(shared_memory_->handle()); | 152 if (!SetFileMappingToReadOnly(shared_memory_->handle())) { |
153 DCHECK(acls_set); | 153 DLOG(ERROR) << "Failed to set file mapping permissions."; |
| 154 } |
154 } else { | 155 } else { |
155 created_beacon = false; | 156 created_beacon = false; |
156 | 157 |
157 // We failed to create the shared memory segment, suggesting it may already | 158 // We failed to create the shared memory segment, suggesting it may already |
158 // exist: try to create it read-only. | 159 // exist: try to create it read-only. |
159 result = shared_memory_->Open(shared_memory_name_.c_str(), | 160 result = shared_memory_->Open(shared_memory_name_.c_str(), |
160 true /* read_only */); | 161 true /* read_only */); |
161 } | 162 } |
162 | 163 |
163 if (result) { | 164 if (result) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 277 |
277 HMODULE hmodule = LoadLibrary(module_path.value().c_str()); | 278 HMODULE hmodule = LoadLibrary(module_path.value().c_str()); |
278 if (hmodule == NULL) { | 279 if (hmodule == NULL) { |
279 DPLOG(ERROR) << "Could not load reported module version " | 280 DPLOG(ERROR) << "Could not load reported module version " |
280 << version->GetString(); | 281 << version->GetString(); |
281 } | 282 } |
282 | 283 |
283 return hmodule; | 284 return hmodule; |
284 } | 285 } |
285 | 286 |
OLD | NEW |