Skip to content

Instantly share code, notes, and snippets.

@phraemer
Created April 10, 2019 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phraemer/57e61c0f9f82d19b9fb9ba4eaf941ddf to your computer and use it in GitHub Desktop.
Save phraemer/57e61c0f9f82d19b9fb9ba4eaf941ddf to your computer and use it in GitHub Desktop.
Print CLSID as GUID string
#include <iostream>
typedef unsigned long DWORD;
typedef unsigned short WORD;
typedef unsigned char BYTE;
struct GUID {
DWORD Data1;
WORD Data2;
WORD Data3;
BYTE Data4[8];
};
int main()
{
GUID guid{ 0x177F0C4A, 0x1CD3, 0x4DE7, { 0xA3, 0x2C, 0x71, 0xDB, 0xBB, 0x9F, 0xA3, 0x6D } };
printf("{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", guid.Data1, guid.Data2, guid.Data3, guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment