| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 const TCHAR* value) { | 93 const TCHAR* value) { |
| 94 ASSERT(full_key_name != NULL); | 94 ASSERT(full_key_name != NULL); |
| 95 ASSERT(value != NULL); | 95 ASSERT(value != NULL); |
| 96 | 96 |
| 97 return SetValueStaticHelper(full_key_name, value_name, | 97 return SetValueStaticHelper(full_key_name, value_name, |
| 98 REG_SZ, const_cast<wchar_t*>(value)); | 98 REG_SZ, const_cast<wchar_t*>(value)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 HRESULT RegKey::SetValue(const wchar_t* full_key_name, | 101 HRESULT RegKey::SetValue(const wchar_t* full_key_name, |
| 102 const wchar_t* value_name, | 102 const wchar_t* value_name, |
| 103 const uint8* value, | 103 const uint8_t* value, |
| 104 DWORD byte_count) { | 104 DWORD byte_count) { |
| 105 ASSERT(full_key_name != NULL); | 105 ASSERT(full_key_name != NULL); |
| 106 | 106 |
| 107 return SetValueStaticHelper(full_key_name, value_name, REG_BINARY, | 107 return SetValueStaticHelper(full_key_name, value_name, REG_BINARY, |
| 108 const_cast<uint8*>(value), byte_count); | 108 const_cast<uint8_t*>(value), byte_count); |
| 109 } | 109 } |
| 110 | 110 |
| 111 HRESULT RegKey::SetValueMultiSZ(const wchar_t* full_key_name, | 111 HRESULT RegKey::SetValueMultiSZ(const wchar_t* full_key_name, |
| 112 const wchar_t* value_name, | 112 const wchar_t* value_name, |
| 113 const uint8* value, | 113 const uint8_t* value, |
| 114 DWORD byte_count) { | 114 DWORD byte_count) { |
| 115 ASSERT(full_key_name != NULL); | 115 ASSERT(full_key_name != NULL); |
| 116 | 116 |
| 117 return SetValueStaticHelper(full_key_name, value_name, REG_MULTI_SZ, | 117 return SetValueStaticHelper(full_key_name, value_name, REG_MULTI_SZ, |
| 118 const_cast<uint8*>(value), byte_count); | 118 const_cast<uint8_t*>(value), byte_count); |
| 119 } | 119 } |
| 120 | 120 |
| 121 HRESULT RegKey::GetValue(const wchar_t* full_key_name, | 121 HRESULT RegKey::GetValue(const wchar_t* full_key_name, |
| 122 const wchar_t* value_name, | 122 const wchar_t* value_name, |
| 123 DWORD* value) { | 123 DWORD* value) { |
| 124 ASSERT(full_key_name != NULL); | 124 ASSERT(full_key_name != NULL); |
| 125 ASSERT(value != NULL); | 125 ASSERT(value != NULL); |
| 126 | 126 |
| 127 return GetValueStaticHelper(full_key_name, value_name, REG_DWORD, value); | 127 return GetValueStaticHelper(full_key_name, value_name, REG_DWORD, value); |
| 128 } | 128 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 const wchar_t* value_name, | 201 const wchar_t* value_name, |
| 202 std::vector<std::wstring>* value) { | 202 std::vector<std::wstring>* value) { |
| 203 ASSERT(full_key_name != NULL); | 203 ASSERT(full_key_name != NULL); |
| 204 ASSERT(value != NULL); | 204 ASSERT(value != NULL); |
| 205 | 205 |
| 206 return GetValueStaticHelper(full_key_name, value_name, REG_MULTI_SZ, value); | 206 return GetValueStaticHelper(full_key_name, value_name, REG_MULTI_SZ, value); |
| 207 } | 207 } |
| 208 | 208 |
| 209 HRESULT RegKey::GetValue(const wchar_t* full_key_name, | 209 HRESULT RegKey::GetValue(const wchar_t* full_key_name, |
| 210 const wchar_t* value_name, | 210 const wchar_t* value_name, |
| 211 uint8** value, | 211 uint8_t** value, |
| 212 DWORD* byte_count) { | 212 DWORD* byte_count) { |
| 213 ASSERT(full_key_name != NULL); | 213 ASSERT(full_key_name != NULL); |
| 214 ASSERT(value != NULL); | 214 ASSERT(value != NULL); |
| 215 ASSERT(byte_count != NULL); | 215 ASSERT(byte_count != NULL); |
| 216 | 216 |
| 217 return GetValueStaticHelper(full_key_name, value_name, | 217 return GetValueStaticHelper(full_key_name, value_name, |
| 218 REG_BINARY, value, byte_count); | 218 REG_BINARY, value, byte_count); |
| 219 } | 219 } |
| 220 | 220 |
| 221 HRESULT RegKey::DeleteSubKey(const wchar_t* key_name) { | 221 HRESULT RegKey::DeleteSubKey(const wchar_t* key_name) { |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 case REG_DWORD: | 400 case REG_DWORD: |
| 401 hr = key.SetValue(value_name, *(static_cast<DWORD*>(value))); | 401 hr = key.SetValue(value_name, *(static_cast<DWORD*>(value))); |
| 402 break; | 402 break; |
| 403 case REG_QWORD: | 403 case REG_QWORD: |
| 404 hr = key.SetValue(value_name, *(static_cast<DWORD64*>(value))); | 404 hr = key.SetValue(value_name, *(static_cast<DWORD64*>(value))); |
| 405 break; | 405 break; |
| 406 case REG_SZ: | 406 case REG_SZ: |
| 407 hr = key.SetValue(value_name, static_cast<const wchar_t*>(value)); | 407 hr = key.SetValue(value_name, static_cast<const wchar_t*>(value)); |
| 408 break; | 408 break; |
| 409 case REG_BINARY: | 409 case REG_BINARY: |
| 410 hr = key.SetValue(value_name, static_cast<const uint8*>(value), | 410 hr = key.SetValue(value_name, static_cast<const uint8_t*>(value), |
| 411 byte_count); | 411 byte_count); |
| 412 break; | 412 break; |
| 413 case REG_MULTI_SZ: | 413 case REG_MULTI_SZ: |
| 414 hr = key.SetValue(value_name, static_cast<const uint8*>(value), | 414 hr = key.SetValue(value_name, static_cast<const uint8_t*>(value), |
| 415 byte_count, type); | 415 byte_count, type); |
| 416 break; | 416 break; |
| 417 default: | 417 default: |
| 418 ASSERT(false); | 418 ASSERT(false); |
| 419 hr = HRESULT_FROM_WIN32(ERROR_DATATYPE_MISMATCH); | 419 hr = HRESULT_FROM_WIN32(ERROR_DATATYPE_MISMATCH); |
| 420 break; | 420 break; |
| 421 } | 421 } |
| 422 // close the key after writing | 422 // close the key after writing |
| 423 HRESULT temp_hr = key.Close(); | 423 HRESULT temp_hr = key.Close(); |
| 424 if (hr == S_OK) { | 424 if (hr == S_OK) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 454 hr = key.GetValue(value_name, reinterpret_cast<DWORD64*>(value)); | 454 hr = key.GetValue(value_name, reinterpret_cast<DWORD64*>(value)); |
| 455 break; | 455 break; |
| 456 case REG_SZ: | 456 case REG_SZ: |
| 457 hr = key.GetValue(value_name, reinterpret_cast<wchar_t**>(value)); | 457 hr = key.GetValue(value_name, reinterpret_cast<wchar_t**>(value)); |
| 458 break; | 458 break; |
| 459 case REG_MULTI_SZ: | 459 case REG_MULTI_SZ: |
| 460 hr = key.GetValue(value_name, reinterpret_cast< | 460 hr = key.GetValue(value_name, reinterpret_cast< |
| 461 std::vector<std::wstring>*>(value)); | 461 std::vector<std::wstring>*>(value)); |
| 462 break; | 462 break; |
| 463 case REG_BINARY: | 463 case REG_BINARY: |
| 464 hr = key.GetValue(value_name, reinterpret_cast<uint8**>(value), | 464 hr = key.GetValue(value_name, reinterpret_cast<uint8_t**>(value), |
| 465 byte_count); | 465 byte_count); |
| 466 break; | 466 break; |
| 467 default: | 467 default: |
| 468 ASSERT(false); | 468 ASSERT(false); |
| 469 hr = HRESULT_FROM_WIN32(ERROR_DATATYPE_MISMATCH); | 469 hr = HRESULT_FROM_WIN32(ERROR_DATATYPE_MISMATCH); |
| 470 break; | 470 break; |
| 471 } | 471 } |
| 472 // close the key after writing | 472 // close the key after writing |
| 473 HRESULT temp_hr = key.Close(); | 473 HRESULT temp_hr = key.Close(); |
| 474 if (hr == S_OK) { | 474 if (hr == S_OK) { |
| 475 hr = temp_hr; | 475 hr = temp_hr; |
| 476 } | 476 } |
| 477 } | 477 } |
| 478 } | 478 } |
| 479 return hr; | 479 return hr; |
| 480 } | 480 } |
| 481 | 481 |
| 482 // GET helper | 482 // GET helper |
| 483 HRESULT RegKey::GetValueHelper(const wchar_t* value_name, | 483 HRESULT RegKey::GetValueHelper(const wchar_t* value_name, |
| 484 DWORD* type, | 484 DWORD* type, |
| 485 uint8** value, | 485 uint8_t** value, |
| 486 DWORD* byte_count) const { | 486 DWORD* byte_count) const { |
| 487 ASSERT(byte_count != NULL); | 487 ASSERT(byte_count != NULL); |
| 488 ASSERT(value != NULL); | 488 ASSERT(value != NULL); |
| 489 ASSERT(type != NULL); | 489 ASSERT(type != NULL); |
| 490 | 490 |
| 491 // init return buffer | 491 // init return buffer |
| 492 *value = NULL; | 492 *value = NULL; |
| 493 | 493 |
| 494 // get the size of the return data buffer | 494 // get the size of the return data buffer |
| 495 LONG res = ::SHQueryValueEx(h_key_, value_name, NULL, type, NULL, byte_count); | 495 LONG res = ::SHQueryValueEx(h_key_, value_name, NULL, type, NULL, byte_count); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 } | 601 } |
| 602 | 602 |
| 603 ASSERT((hr != S_OK) || (type == REG_SZ) || | 603 ASSERT((hr != S_OK) || (type == REG_SZ) || |
| 604 (type == REG_MULTI_SZ) || (type == REG_EXPAND_SZ)); | 604 (type == REG_MULTI_SZ) || (type == REG_EXPAND_SZ)); |
| 605 } | 605 } |
| 606 | 606 |
| 607 return hr; | 607 return hr; |
| 608 } | 608 } |
| 609 | 609 |
| 610 // convert REG_MULTI_SZ bytes to string array | 610 // convert REG_MULTI_SZ bytes to string array |
| 611 HRESULT RegKey::MultiSZBytesToStringArray(const uint8* buffer, | 611 HRESULT RegKey::MultiSZBytesToStringArray(const uint8_t* buffer, |
| 612 DWORD byte_count, | 612 DWORD byte_count, |
| 613 std::vector<std::wstring>* value) { | 613 std::vector<std::wstring>* value) { |
| 614 ASSERT(buffer != NULL); | 614 ASSERT(buffer != NULL); |
| 615 ASSERT(value != NULL); | 615 ASSERT(value != NULL); |
| 616 | 616 |
| 617 const wchar_t* data = reinterpret_cast<const wchar_t*>(buffer); | 617 const wchar_t* data = reinterpret_cast<const wchar_t*>(buffer); |
| 618 DWORD data_len = byte_count / sizeof(wchar_t); | 618 DWORD data_len = byte_count / sizeof(wchar_t); |
| 619 value->clear(); | 619 value->clear(); |
| 620 if (data_len > 1) { | 620 if (data_len > 1) { |
| 621 // must be terminated by two null characters | 621 // must be terminated by two null characters |
| (...skipping 11 matching lines...) Expand all Loading... |
| 633 return S_OK; | 633 return S_OK; |
| 634 } | 634 } |
| 635 | 635 |
| 636 // get a std::vector<std::wstring> value from REG_MULTI_SZ type | 636 // get a std::vector<std::wstring> value from REG_MULTI_SZ type |
| 637 HRESULT RegKey::GetValue(const wchar_t* value_name, | 637 HRESULT RegKey::GetValue(const wchar_t* value_name, |
| 638 std::vector<std::wstring>* value) const { | 638 std::vector<std::wstring>* value) const { |
| 639 ASSERT(value != NULL); | 639 ASSERT(value != NULL); |
| 640 | 640 |
| 641 DWORD byte_count = 0; | 641 DWORD byte_count = 0; |
| 642 DWORD type = 0; | 642 DWORD type = 0; |
| 643 uint8* buffer = 0; | 643 uint8_t* buffer = 0; |
| 644 | 644 |
| 645 // first get the size of the buffer | 645 // first get the size of the buffer |
| 646 HRESULT hr = GetValueHelper(value_name, &type, &buffer, &byte_count); | 646 HRESULT hr = GetValueHelper(value_name, &type, &buffer, &byte_count); |
| 647 ASSERT((hr != S_OK) || (type == REG_MULTI_SZ)); | 647 ASSERT((hr != S_OK) || (type == REG_MULTI_SZ)); |
| 648 | 648 |
| 649 if (SUCCEEDED(hr)) { | 649 if (SUCCEEDED(hr)) { |
| 650 hr = MultiSZBytesToStringArray(buffer, byte_count, value); | 650 hr = MultiSZBytesToStringArray(buffer, byte_count, value); |
| 651 } | 651 } |
| 652 | 652 |
| 653 return hr; | 653 return hr; |
| 654 } | 654 } |
| 655 | 655 |
| 656 // Binary data Get | 656 // Binary data Get |
| 657 HRESULT RegKey::GetValue(const wchar_t* value_name, | 657 HRESULT RegKey::GetValue(const wchar_t* value_name, |
| 658 uint8** value, | 658 uint8_t** value, |
| 659 DWORD* byte_count) const { | 659 DWORD* byte_count) const { |
| 660 ASSERT(byte_count != NULL); | 660 ASSERT(byte_count != NULL); |
| 661 ASSERT(value != NULL); | 661 ASSERT(value != NULL); |
| 662 | 662 |
| 663 DWORD type = 0; | 663 DWORD type = 0; |
| 664 HRESULT hr = GetValueHelper(value_name, &type, value, byte_count); | 664 HRESULT hr = GetValueHelper(value_name, &type, value, byte_count); |
| 665 ASSERT((hr != S_OK) || (type == REG_MULTI_SZ) || (type == REG_BINARY)); | 665 ASSERT((hr != S_OK) || (type == REG_MULTI_SZ) || (type == REG_BINARY)); |
| 666 return hr; | 666 return hr; |
| 667 } | 667 } |
| 668 | 668 |
| 669 // Raw data get | 669 // Raw data get |
| 670 HRESULT RegKey::GetValue(const wchar_t* value_name, | 670 HRESULT RegKey::GetValue(const wchar_t* value_name, |
| 671 uint8** value, | 671 uint8_t** value, |
| 672 DWORD* byte_count, | 672 DWORD* byte_count, |
| 673 DWORD*type) const { | 673 DWORD* type) const { |
| 674 ASSERT(type != NULL); | 674 ASSERT(type != NULL); |
| 675 ASSERT(byte_count != NULL); | 675 ASSERT(byte_count != NULL); |
| 676 ASSERT(value != NULL); | 676 ASSERT(value != NULL); |
| 677 | 677 |
| 678 return GetValueHelper(value_name, type, value, byte_count); | 678 return GetValueHelper(value_name, type, value, byte_count); |
| 679 } | 679 } |
| 680 | 680 |
| 681 // Int32 set | 681 // Int32 set |
| 682 HRESULT RegKey::SetValue(const wchar_t* value_name, DWORD value) const { | 682 HRESULT RegKey::SetValue(const wchar_t* value_name, DWORD value) const { |
| 683 ASSERT(h_key_ != NULL); | 683 ASSERT(h_key_ != NULL); |
| 684 | 684 |
| 685 LONG res = ::RegSetValueEx(h_key_, value_name, NULL, REG_DWORD, | 685 LONG res = |
| 686 reinterpret_cast<const uint8*>(&value), | 686 ::RegSetValueEx(h_key_, value_name, NULL, REG_DWORD, |
| 687 sizeof(DWORD)); | 687 reinterpret_cast<const uint8_t*>(&value), sizeof(DWORD)); |
| 688 return HRESULT_FROM_WIN32(res); | 688 return HRESULT_FROM_WIN32(res); |
| 689 } | 689 } |
| 690 | 690 |
| 691 // Int64 set | 691 // Int64 set |
| 692 HRESULT RegKey::SetValue(const wchar_t* value_name, DWORD64 value) const { | 692 HRESULT RegKey::SetValue(const wchar_t* value_name, DWORD64 value) const { |
| 693 ASSERT(h_key_ != NULL); | 693 ASSERT(h_key_ != NULL); |
| 694 | 694 |
| 695 LONG res = ::RegSetValueEx(h_key_, value_name, NULL, REG_QWORD, | 695 LONG res = ::RegSetValueEx(h_key_, value_name, NULL, REG_QWORD, |
| 696 reinterpret_cast<const uint8*>(&value), | 696 reinterpret_cast<const uint8_t*>(&value), |
| 697 sizeof(DWORD64)); | 697 sizeof(DWORD64)); |
| 698 return HRESULT_FROM_WIN32(res); | 698 return HRESULT_FROM_WIN32(res); |
| 699 } | 699 } |
| 700 | 700 |
| 701 // String set | 701 // String set |
| 702 HRESULT RegKey::SetValue(const wchar_t* value_name, | 702 HRESULT RegKey::SetValue(const wchar_t* value_name, |
| 703 const wchar_t* value) const { | 703 const wchar_t* value) const { |
| 704 ASSERT(value != NULL); | 704 ASSERT(value != NULL); |
| 705 ASSERT(h_key_ != NULL); | 705 ASSERT(h_key_ != NULL); |
| 706 | 706 |
| 707 LONG res = ::RegSetValueEx(h_key_, value_name, NULL, REG_SZ, | 707 LONG res = ::RegSetValueEx(h_key_, value_name, NULL, REG_SZ, |
| 708 reinterpret_cast<const uint8*>(value), | 708 reinterpret_cast<const uint8_t*>(value), |
| 709 (lstrlen(value) + 1) * sizeof(wchar_t)); | 709 (lstrlen(value) + 1) * sizeof(wchar_t)); |
| 710 return HRESULT_FROM_WIN32(res); | 710 return HRESULT_FROM_WIN32(res); |
| 711 } | 711 } |
| 712 | 712 |
| 713 // Binary data set | 713 // Binary data set |
| 714 HRESULT RegKey::SetValue(const wchar_t* value_name, | 714 HRESULT RegKey::SetValue(const wchar_t* value_name, |
| 715 const uint8* value, | 715 const uint8_t* value, |
| 716 DWORD byte_count) const { | 716 DWORD byte_count) const { |
| 717 ASSERT(h_key_ != NULL); | 717 ASSERT(h_key_ != NULL); |
| 718 | 718 |
| 719 // special case - if 'value' is NULL make sure byte_count is zero | 719 // special case - if 'value' is NULL make sure byte_count is zero |
| 720 if (value == NULL) { | 720 if (value == NULL) { |
| 721 byte_count = 0; | 721 byte_count = 0; |
| 722 } | 722 } |
| 723 | 723 |
| 724 LONG res = ::RegSetValueEx(h_key_, value_name, NULL, | 724 LONG res = ::RegSetValueEx(h_key_, value_name, NULL, |
| 725 REG_BINARY, value, byte_count); | 725 REG_BINARY, value, byte_count); |
| 726 return HRESULT_FROM_WIN32(res); | 726 return HRESULT_FROM_WIN32(res); |
| 727 } | 727 } |
| 728 | 728 |
| 729 // Raw data set | 729 // Raw data set |
| 730 HRESULT RegKey::SetValue(const wchar_t* value_name, | 730 HRESULT RegKey::SetValue(const wchar_t* value_name, |
| 731 const uint8* value, | 731 const uint8_t* value, |
| 732 DWORD byte_count, | 732 DWORD byte_count, |
| 733 DWORD type) const { | 733 DWORD type) const { |
| 734 ASSERT(value != NULL); | 734 ASSERT(value != NULL); |
| 735 ASSERT(h_key_ != NULL); | 735 ASSERT(h_key_ != NULL); |
| 736 | 736 |
| 737 LONG res = ::RegSetValueEx(h_key_, value_name, NULL, type, value, byte_count); | 737 LONG res = ::RegSetValueEx(h_key_, value_name, NULL, type, value, byte_count); |
| 738 return HRESULT_FROM_WIN32(res); | 738 return HRESULT_FROM_WIN32(res); |
| 739 } | 739 } |
| 740 | 740 |
| 741 bool RegKey::HasKey(const wchar_t* full_key_name) { | 741 bool RegKey::HasKey(const wchar_t* full_key_name) { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 parent_key = L""; | 957 parent_key = L""; |
| 958 } else { | 958 } else { |
| 959 parent_key = key_name->substr(0, index); | 959 parent_key = key_name->substr(0, index); |
| 960 *key_name = key_name->substr(index + 1, key_name->length() - index - 1); | 960 *key_name = key_name->substr(index + 1, key_name->length() - index - 1); |
| 961 } | 961 } |
| 962 | 962 |
| 963 return parent_key; | 963 return parent_key; |
| 964 } | 964 } |
| 965 | 965 |
| 966 // get the number of values for this key | 966 // get the number of values for this key |
| 967 uint32 RegKey::GetValueCount() { | 967 uint32_t RegKey::GetValueCount() { |
| 968 DWORD num_values = 0; | 968 DWORD num_values = 0; |
| 969 | 969 |
| 970 if (ERROR_SUCCESS != ::RegQueryInfoKey( | 970 if (ERROR_SUCCESS != ::RegQueryInfoKey( |
| 971 h_key_, // key handle | 971 h_key_, // key handle |
| 972 NULL, // buffer for class name | 972 NULL, // buffer for class name |
| 973 NULL, // size of class string | 973 NULL, // size of class string |
| 974 NULL, // reserved | 974 NULL, // reserved |
| 975 NULL, // number of subkeys | 975 NULL, // number of subkeys |
| 976 NULL, // longest subkey size | 976 NULL, // longest subkey size |
| 977 NULL, // longest class string | 977 NULL, // longest class string |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1000 res = ::RegEnumValue(h_key_, index, value_name_buf, &value_name_buf_size, | 1000 res = ::RegEnumValue(h_key_, index, value_name_buf, &value_name_buf_size, |
| 1001 NULL, type, NULL, NULL); | 1001 NULL, type, NULL, NULL); |
| 1002 | 1002 |
| 1003 if (res == ERROR_SUCCESS) { | 1003 if (res == ERROR_SUCCESS) { |
| 1004 value_name->assign(value_name_buf); | 1004 value_name->assign(value_name_buf); |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 return HRESULT_FROM_WIN32(res); | 1007 return HRESULT_FROM_WIN32(res); |
| 1008 } | 1008 } |
| 1009 | 1009 |
| 1010 uint32 RegKey::GetSubkeyCount() { | 1010 uint32_t RegKey::GetSubkeyCount() { |
| 1011 // number of values for key | 1011 // number of values for key |
| 1012 DWORD num_subkeys = 0; | 1012 DWORD num_subkeys = 0; |
| 1013 | 1013 |
| 1014 if (ERROR_SUCCESS != ::RegQueryInfoKey( | 1014 if (ERROR_SUCCESS != ::RegQueryInfoKey( |
| 1015 h_key_, // key handle | 1015 h_key_, // key handle |
| 1016 NULL, // buffer for class name | 1016 NULL, // buffer for class name |
| 1017 NULL, // size of class string | 1017 NULL, // size of class string |
| 1018 NULL, // reserved | 1018 NULL, // reserved |
| 1019 &num_subkeys, // number of subkeys | 1019 &num_subkeys, // number of subkeys |
| 1020 NULL, // longest subkey size | 1020 NULL, // longest subkey size |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 } | 1093 } |
| 1094 CloseHandle(token); | 1094 CloseHandle(token); |
| 1095 } else { | 1095 } else { |
| 1096 LOG_GLE(LS_ERROR) << "OpenProcessToken(GetCurrentProcess) failed"; | 1096 LOG_GLE(LS_ERROR) << "OpenProcessToken(GetCurrentProcess) failed"; |
| 1097 } | 1097 } |
| 1098 | 1098 |
| 1099 return ret; | 1099 return ret; |
| 1100 } | 1100 } |
| 1101 | 1101 |
| 1102 } // namespace rtc | 1102 } // namespace rtc |
| OLD | NEW |