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

Method GetSubKeys

Source/cmWindowsRegistry.cxx:362–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360}
361
362std::vector<std::string> KeyHandler::GetSubKeys()
363{
364 LSTATUS status;
365 DWORD size;
366 // pick-up maximum size for subkeys
367 if ((status = RegQueryInfoKeyW(
368 this->Handler, nullptr, nullptr, nullptr, nullptr, &size, nullptr,
369 nullptr, nullptr, nullptr, nullptr, nullptr)) != ERROR_SUCCESS) {
370 throw registry_error(this->FormatSystemError(status));
371 }
372 // increment size for final null
373 auto data = cm::make_unique<wchar_t[]>(++size);
374 DWORD index = 0;
375 std::vector<std::string> subKeys;
376
377 while ((status = RegEnumKeyW(this->Handler, index, data.get(), size)) ==
378 ERROR_SUCCESS) {
379 subKeys.push_back(this->ToNarrow(data.get()));
380 ++index;
381 }
382 if (status != ERROR_NO_MORE_ITEMS) {
383 throw registry_error(this->FormatSystemError(status));
384 }
385
386 return subKeys;
387}
388#endif
389
390// ExpressionParser: Helper to parse expression holding multiple

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
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected