MCPcopy Create free account
hub / github.com/Kitware/CMake / GetValueNames

Method GetValueNames

Source/cmWindowsRegistry.cxx:329–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327}
328
329std::vector<std::string> KeyHandler::GetValueNames()
330{
331 LSTATUS status;
332 DWORD maxSize;
333 // pick-up maximum size for value names
334 if ((status = RegQueryInfoKeyW(
335 this->Handler, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
336 nullptr, &maxSize, nullptr, nullptr, nullptr)) != ERROR_SUCCESS) {
337 throw registry_error(this->FormatSystemError(status));
338 }
339 // increment size for final null
340 auto data = cm::make_unique<wchar_t[]>(++maxSize);
341 DWORD index = 0;
342 DWORD size = maxSize;
343
344 std::vector<std::string> valueNames;
345
346 while ((status = RegEnumValueW(this->Handler, index, data.get(), &size,
347 nullptr, nullptr, nullptr, nullptr)) ==
348 ERROR_SUCCESS) {
349 auto name = this->ToNarrow(data.get());
350 valueNames.push_back(name.empty() ? "(default)" : name);
351 size = maxSize;
352 ++index;
353 }
354
355 if (status != ERROR_NO_MORE_ITEMS) {
356 throw registry_error(this->FormatSystemError(status));
357 }
358
359 return valueNames;
360}
361
362std::vector<std::string> KeyHandler::GetSubKeys()
363{

Callers 1

QueryWindowsRegistryFunction · 0.80

Calls 13

FormatSystemErrorMethod · 0.95
ToNarrowMethod · 0.95
ComputeViewsMethod · 0.95
registry_errorClass · 0.85
moveFunction · 0.85
push_backMethod · 0.80
eraseMethod · 0.80
getMethod · 0.45
emptyMethod · 0.45
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected