USBDK/UsbDkHelper/GuidGen.cpp
Kirill Moizik 82dc647a24 UsbDkHelper: Introduce UUID generator (CGuid class)
Signed-off-by: Kirill Moizik <kirill@daynix.com>
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
2015-03-23 13:24:00 +02:00

22 lines
No EOL
439 B
C++

#include "stdafx.h"
#include "GuidGen.h"
CGuid::CGuid()
{
UUID Uuid;
auto res = UuidCreate(&Uuid);
if ((res != RPC_S_OK) && (res != RPC_S_UUID_LOCAL_ONLY))
{
throw GuidGenException(res);
}
RPC_TSTR UuidStr;
res = UuidToString(&Uuid, &UuidStr);
if (res != RPC_S_OK)
{
throw GuidGenException(res);
}
m_GuidStr = reinterpret_cast<LPCTSTR>(UuidStr);
RpcStringFree(&UuidStr);
}