| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2003 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2003 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 return GetValueStaticHelper(full_key_name, value_name, REG_QWORD, value); | 136 return GetValueStaticHelper(full_key_name, value_name, REG_QWORD, value); |
| 137 } | 137 } |
| 138 | 138 |
| 139 HRESULT RegKey::GetValue(const wchar_t* full_key_name, | 139 HRESULT RegKey::GetValue(const wchar_t* full_key_name, |
| 140 const wchar_t* value_name, | 140 const wchar_t* value_name, |
| 141 float* value) { | 141 float* value) { |
| 142 ASSERT(value != NULL); | 142 ASSERT(value != NULL); |
| 143 ASSERT(full_key_name != NULL); | 143 ASSERT(full_key_name != NULL); |
| 144 | 144 |
| 145 DWORD byte_count = 0; | 145 DWORD byte_count = 0; |
| 146 scoped_ptr<byte[]> buffer; | 146 byte* buffer_raw = nullptr; |
| 147 HRESULT hr = GetValueStaticHelper(full_key_name, value_name, | 147 HRESULT hr = GetValueStaticHelper(full_key_name, value_name, |
| 148 REG_BINARY, buffer.accept(), &byte_count); | 148 REG_BINARY, &buffer_raw, &byte_count); |
| 149 scoped_ptr<byte[]> buffer(buffer_raw); |
| 149 if (SUCCEEDED(hr)) { | 150 if (SUCCEEDED(hr)) { |
| 150 ASSERT(byte_count == sizeof(*value)); | 151 ASSERT(byte_count == sizeof(*value)); |
| 151 if (byte_count == sizeof(*value)) { | 152 if (byte_count == sizeof(*value)) { |
| 152 *value = *reinterpret_cast<float*>(buffer.get()); | 153 *value = *reinterpret_cast<float*>(buffer.get()); |
| 153 } | 154 } |
| 154 } | 155 } |
| 155 return hr; | 156 return hr; |
| 156 } | 157 } |
| 157 | 158 |
| 158 HRESULT RegKey::GetValue(const wchar_t* full_key_name, | 159 HRESULT RegKey::GetValue(const wchar_t* full_key_name, |
| 159 const wchar_t* value_name, | 160 const wchar_t* value_name, |
| 160 double* value) { | 161 double* value) { |
| 161 ASSERT(value != NULL); | 162 ASSERT(value != NULL); |
| 162 ASSERT(full_key_name != NULL); | 163 ASSERT(full_key_name != NULL); |
| 163 | 164 |
| 164 DWORD byte_count = 0; | 165 DWORD byte_count = 0; |
| 165 scoped_ptr<byte[]> buffer; | 166 byte* buffer_raw = nullptr; |
| 166 HRESULT hr = GetValueStaticHelper(full_key_name, value_name, | 167 HRESULT hr = GetValueStaticHelper(full_key_name, value_name, |
| 167 REG_BINARY, buffer.accept(), &byte_count); | 168 REG_BINARY, &buffer_raw, &byte_count); |
| 169 scoped_ptr<byte[]> buffer(buffer_raw); |
| 168 if (SUCCEEDED(hr)) { | 170 if (SUCCEEDED(hr)) { |
| 169 ASSERT(byte_count == sizeof(*value)); | 171 ASSERT(byte_count == sizeof(*value)); |
| 170 if (byte_count == sizeof(*value)) { | 172 if (byte_count == sizeof(*value)) { |
| 171 *value = *reinterpret_cast<double*>(buffer.get()); | 173 *value = *reinterpret_cast<double*>(buffer.get()); |
| 172 } | 174 } |
| 173 } | 175 } |
| 174 return hr; | 176 return hr; |
| 175 } | 177 } |
| 176 | 178 |
| 177 HRESULT RegKey::GetValue(const wchar_t* full_key_name, | 179 HRESULT RegKey::GetValue(const wchar_t* full_key_name, |
| 178 const wchar_t* value_name, | 180 const wchar_t* value_name, |
| 179 wchar_t** value) { | 181 wchar_t** value) { |
| 180 ASSERT(full_key_name != NULL); | 182 ASSERT(full_key_name != NULL); |
| 181 ASSERT(value != NULL); | 183 ASSERT(value != NULL); |
| 182 | 184 |
| 183 return GetValueStaticHelper(full_key_name, value_name, REG_SZ, value); | 185 return GetValueStaticHelper(full_key_name, value_name, REG_SZ, value); |
| 184 } | 186 } |
| 185 | 187 |
| 186 HRESULT RegKey::GetValue(const wchar_t* full_key_name, | 188 HRESULT RegKey::GetValue(const wchar_t* full_key_name, |
| 187 const wchar_t* value_name, | 189 const wchar_t* value_name, |
| 188 std::wstring* value) { | 190 std::wstring* value) { |
| 189 ASSERT(full_key_name != NULL); | 191 ASSERT(full_key_name != NULL); |
| 190 ASSERT(value != NULL); | 192 ASSERT(value != NULL); |
| 191 | 193 |
| 192 scoped_ptr<wchar_t[]> buffer; | 194 wchar_t* buffer_raw = nullptr; |
| 193 HRESULT hr = RegKey::GetValue(full_key_name, value_name, buffer.accept()); | 195 HRESULT hr = RegKey::GetValue(full_key_name, value_name, &buffer_raw); |
| 196 scoped_ptr<wchar_t[]> buffer(buffer_raw); |
| 194 if (SUCCEEDED(hr)) { | 197 if (SUCCEEDED(hr)) { |
| 195 value->assign(buffer.get()); | 198 value->assign(buffer.get()); |
| 196 } | 199 } |
| 197 return hr; | 200 return hr; |
| 198 } | 201 } |
| 199 | 202 |
| 200 HRESULT RegKey::GetValue(const wchar_t* full_key_name, | 203 HRESULT RegKey::GetValue(const wchar_t* full_key_name, |
| 201 const wchar_t* value_name, | 204 const wchar_t* value_name, |
| 202 std::vector<std::wstring>* value) { | 205 std::vector<std::wstring>* value) { |
| 203 ASSERT(full_key_name != NULL); | 206 ASSERT(full_key_name != NULL); |
| (...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 } | 1096 } |
| 1094 CloseHandle(token); | 1097 CloseHandle(token); |
| 1095 } else { | 1098 } else { |
| 1096 LOG_GLE(LS_ERROR) << "OpenProcessToken(GetCurrentProcess) failed"; | 1099 LOG_GLE(LS_ERROR) << "OpenProcessToken(GetCurrentProcess) failed"; |
| 1097 } | 1100 } |
| 1098 | 1101 |
| 1099 return ret; | 1102 return ret; |
| 1100 } | 1103 } |
| 1101 | 1104 |
| 1102 } // namespace rtc | 1105 } // namespace rtc |
| OLD | NEW |