| 360 | } |
| 361 | |
| 362 | std::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 |
no test coverage detected