| 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/browser/policy/configuration_policy_provider_win.h" | 5 #include "chrome/browser/policy/configuration_policy_provider_win.h" |
| 6 | 6 |
| 7 #include <userenv.h> | 7 #include <userenv.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 return false; | 165 return false; |
| 166 if (key_type != REG_SZ) | 166 if (key_type != REG_SZ) |
| 167 return false; | 167 return false; |
| 168 | 168 |
| 169 // According to the Microsoft documentation, the string | 169 // According to the Microsoft documentation, the string |
| 170 // buffer may not be explicitly 0-terminated. Allocate a | 170 // buffer may not be explicitly 0-terminated. Allocate a |
| 171 // slightly larger buffer and pre-fill to zeros to guarantee | 171 // slightly larger buffer and pre-fill to zeros to guarantee |
| 172 // the 0-termination. | 172 // the 0-termination. |
| 173 buffer.reset(new uint8[value_size + 2]); | 173 buffer.reset(new uint8[value_size + 2]); |
| 174 memset(buffer.get(), 0, value_size + 2); | 174 memset(buffer.get(), 0, value_size + 2); |
| 175 key->ReadValue(name.c_str(), buffer.get(), &value_size); | 175 key->ReadValue(name.c_str(), buffer.get(), &value_size, NULL); |
| 176 result->assign(reinterpret_cast<const wchar_t*>(buffer.get())); | 176 result->assign(reinterpret_cast<const wchar_t*>(buffer.get())); |
| 177 return true; | 177 return true; |
| 178 } | 178 } |
| 179 | 179 |
| 180 bool ConfigurationPolicyProviderWin::GetRegistryPolicyStringList( | 180 bool ConfigurationPolicyProviderWin::GetRegistryPolicyStringList( |
| 181 const string16& key, ListValue* result) { | 181 const string16& key, ListValue* result) { |
| 182 string16 path = string16(policy::kRegistrySubKey); | 182 string16 path = string16(policy::kRegistrySubKey); |
| 183 path += ASCIIToUTF16("\\") + key; | 183 path += ASCIIToUTF16("\\") + key; |
| 184 RegKey policy_key; | 184 RegKey policy_key; |
| 185 if (!policy_key.Open(HKEY_LOCAL_MACHINE, path.c_str(), KEY_READ)) { | 185 if (!policy_key.Open(HKEY_LOCAL_MACHINE, path.c_str(), KEY_READ)) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 break; | 270 break; |
| 271 } | 271 } |
| 272 default: | 272 default: |
| 273 NOTREACHED(); | 273 NOTREACHED(); |
| 274 return false; | 274 return false; |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 | 277 |
| 278 return true; | 278 return true; |
| 279 } | 279 } |
| OLD | NEW |