I'm using the following function in order to create an UUID and write it in a human-readable form into a pre-allocated buffer. Something goes wrong.
void createUUID(char* pDst)
{
UUID lUUIDObj;
UuidCreate(&lUUIDObj);
unsigned char* lDest = reinterpret_cast<unsigned char*>(pDst);
UuidToStringA(&lUUIDObj, &lDest)
}
At the end of the method, the debugger says:
I thought that both would have the same content, however it is not the case.
What happened? Thanks.
Looking at the documentation for UuidToStringA
, it says:
The RPC run-time library allocates memory for the string returned in the StringUuid parameter.
This means that after the call lDest
does no longer point to pDst
.