| 285 | |
| 286 | template <typename TQueryFunction, typename... TQueryFunctionArgs> |
| 287 | std::vector<BYTE> w_QueryInformation(const std::string QueryFunctionName, TQueryFunction QueryFunction, TQueryFunctionArgs... QueryFunctionArgs) |
| 288 | { |
| 289 | ULONG InformationLength = 0; |
| 290 | auto Ntstatus = STATUS_INFO_LENGTH_MISMATCH; |
| 291 | std::vector<BYTE> Information; |
| 292 | |
| 293 | do |
| 294 | { |
| 295 | Information.resize(InformationLength); |
| 296 | Ntstatus = QueryFunction(QueryFunctionArgs..., Information.data(), InformationLength, &InformationLength); |
| 297 | } while (STATUS_INFO_LENGTH_MISMATCH == Ntstatus); |
| 298 | |
| 299 | if (!NT_SUCCESS(Ntstatus)) |
| 300 | { |
| 301 | throw std::runtime_error(GetLastErrorString(QueryFunctionName, RtlNtStatusToDosError(Ntstatus))); |
| 302 | } |
| 303 | |
| 304 | return Information; |
| 305 | } |
nothing calls this directly
no test coverage detected