check CoCreateGuid return value

This commit is contained in:
Marius Bancila 2021-12-22 19:41:06 +02:00
parent 889fffda69
commit 8068131ec3

View File

@ -613,7 +613,12 @@ namespace uuids
#ifdef _WIN32 #ifdef _WIN32
GUID newId; GUID newId;
::CoCreateGuid(&newId); HRESULT hr = ::CoCreateGuid(&newId);
if (FAILED(hr))
{
throw std::system_error(hr, std::system_category(), "CoCreateGuid failed");
}
std::array<uint8_t, 16> bytes = std::array<uint8_t, 16> bytes =
{ { { {