| 1406 | |
| 1407 | |
| 1408 | inline RegResult RegKey::TrySetMultiStringValue(const std::wstring& valueName, |
| 1409 | const std::vector<std::wstring>& data) |
| 1410 | { |
| 1411 | _ASSERTE(IsValid()); |
| 1412 | |
| 1413 | // First, we have to build a double-NUL-terminated multi-string from the input data. |
| 1414 | // |
| 1415 | // NOTE: This is the reason why I *cannot* mark this method noexcept, |
| 1416 | // since a *dynamic allocation* happens for creating the std::vector in BuildMultiString. |
| 1417 | // And, if dynamic memory allocations fail, an exception is thrown. |
| 1418 | // |
| 1419 | const std::vector<wchar_t> multiString = detail::BuildMultiString(data); |
| 1420 | |
| 1421 | // Total size, in bytes, of the whole multi-string structure |
| 1422 | const DWORD dataSize = static_cast<DWORD>(multiString.size() * sizeof(wchar_t)); |
| 1423 | |
| 1424 | return RegResult{ ::RegSetValueExW( |
| 1425 | m_hKey, |
| 1426 | valueName.c_str(), |
| 1427 | 0, // reserved |
| 1428 | REG_MULTI_SZ, |
| 1429 | reinterpret_cast<const BYTE*>(multiString.data()), |
| 1430 | dataSize |
| 1431 | ) }; |
| 1432 | } |
| 1433 | |
| 1434 | |
| 1435 | inline RegResult RegKey::TrySetBinaryValue(const std::wstring& valueName, |
nothing calls this directly
no test coverage detected