2 out of 5 rated this helpful - Rate this topic

UuidToString function

Applies to: desktop apps only

The UuidToString function converts a UUID to a string.

Syntax

RPC_STATUS RPC_ENTRY UuidToString(
  __in   const UUID __RPC_FAR *Uuid ,
  __out  RPC_CSTR  __RPC_FAR *StringUuid
);

Parameters

Uuid [in]

Pointer to a binary UUID.

StringUuid [out]

Pointer to the null-terminated string into which the UUID specified in the Uuid parameter will be placed.

Return value

ValueMeaning
RPC_S_OK

The call succeeded.

RPC_S_OUT_OF_MEMORY

The system is out of memory.

 

Note  For a list of valid error codes, see RPC Return Values.

Remarks

An application calls UuidToString to convert a binary UUID to a string UUID. The RPC run-time library allocates memory for the string returned in the StringUuid parameter. The application is responsible for calling RpcStringFree to deallocate that memory.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Rpcdce.h (include Rpc.h)

Library

Rpcrt4.lib

DLL

Rpcrt4.dll

Unicode and ANSI names

UuidToStringW (Unicode) and UuidToStringA (ANSI)

See also

RpcStringFree
UuidFromString

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
example you asked!!
#include <iostream>
#include <windows.h>

int main( int argc, char* argv[]) {
    CLSID clsAppID = { 0 };
    ZeroMemory( &clsAppID, sizeof(clsAppID));
    wchar_t* szGUID = 0;

    if ( RPC_S_OK == UuidToString( &clsAppID, (RPC_WSTR*)&szGUID)) {
        std::wcout << L"RPC_S_OK" << std::endl;
        std::wcout << szGUID << std::endl;
    } else {
        std::wcout << L"Unknown" << std::endl;
    }

    return 0;
}
Code Sample
It would be very helpful to have a small code sample for this and all APIs
The UUID string will contain dashes
The UUID string will contain dashes, as in the format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
A sample would be nice
For those of use not closely familiar with the RPC functions a quick example of how to call this function and free the string would be helpful. Mostly the double indirect pointer bits are non-obvious.