MCPcopy Create free account
hub / github.com/chrxh/alien / SetMultiStringValue

Method SetMultiStringValue

external/WinReg/WinReg.hpp:1266–1291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1264
1265
1266inline void RegKey::SetMultiStringValue(
1267 const std::wstring& valueName,
1268 const std::vector<std::wstring>& data
1269)
1270{
1271 _ASSERTE(IsValid());
1272
1273 // First, we have to build a double-NUL-terminated multi-string from the input data
1274 const std::vector<wchar_t> multiString = detail::BuildMultiString(data);
1275
1276 // Total size, in bytes, of the whole multi-string structure
1277 const DWORD dataSize = static_cast<DWORD>(multiString.size() * sizeof(wchar_t));
1278
1279 LSTATUS retCode = ::RegSetValueExW(
1280 m_hKey,
1281 valueName.c_str(),
1282 0, // reserved
1283 REG_MULTI_SZ,
1284 reinterpret_cast<const BYTE*>(multiString.data()),
1285 dataSize
1286 );
1287 if (retCode != ERROR_SUCCESS)
1288 {
1289 throw RegException{ retCode, "Cannot write multi-string value: RegSetValueExW failed." };
1290 }
1291}
1292
1293
1294inline void RegKey::SetBinaryValue(const std::wstring& valueName, const std::vector<BYTE>& data)

Callers

nothing calls this directly

Calls 2

BuildMultiStringFunction · 0.85
sizeMethod · 0.80

Tested by

no test coverage detected