Improve registry enumeration performance (#40828)
* Improve registry enumeration performance - Extend QueryInfo to expose subkey and value counts from RegQueryInfoKeyW, enabling callers to pre-allocate collections. - Add reserve() calls in EnumGuidKeys and EnumValues to eliminate vector reallocations during registry enumeration. These functions are on the critical path for distro listing and plugin loading. - Replace emplace_back(std::make_pair(...)) with direct emplace_back in EnumGuidKeys to avoid unnecessary pair construction overhead. - Eliminate temporary std::wstring allocations in ReportErrorIfFailed by appending a char literal and the LPCWSTR directly instead of constructing intermediate wstring objects for concatenation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Use _Out_opt_ for QueryInfo subkey/value count out-params Address PR review feedback: the new SubKeyCount/ValueCount parameters are output values filled by RegQueryInfoKeyW, so annotate them with _Out_opt_ rather than _In_opt_ for correct SAL/static analysis. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>