Skip to content

Instantly share code, notes, and snippets.

@Akira-Hayasaka
Last active September 12, 2017 03:57
Show Gist options
  • Save Akira-Hayasaka/5602661 to your computer and use it in GitHub Desktop.
Save Akira-Hayasaka/5602661 to your computer and use it in GitHub Desktop.
Get UUID on Windows
#include <Rpc.h>
#pragma comment(lib, "Rpcrt4.lib")
static string get_uuid()
{
string rtn;
UUID uuid;
UuidCreate(&uuid);
char *str;
UuidToStringA(&uuid, (RPC_CSTR*)&str);
rtn = string(str);
RpcStringFreeA((RPC_CSTR*)&str);
return rtn;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment