Skip to content

Instantly share code, notes, and snippets.

@viewpointsa
Created August 16, 2017 10:58
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 viewpointsa/a3a1e42ea6809a1aabf208a8dd97128c to your computer and use it in GitHub Desktop.
Save viewpointsa/a3a1e42ea6809a1aabf208a8dd97128c to your computer and use it in GitHub Desktop.
GUID to DEFINE_GUID
s = "0e59f1d5-1fbe-11d0-8ff2-00a0d10038bc"
#DEFINE_GUID(IID_IScriptControl, 0x8b167d60, 0x8605, 0x11d0,
# 0xab, 0xcb, 0x00, 0xa0, 0xc9, 0x0f, 0xff, 0xc0);
#"0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s" % ( s[0:8], s[9:13], s[14:18], s[19:21]
arr = [8,4,4,2,2,2,2,2,2,2,2]
print "DEFINE_GUID(IID_IXXX," + ','.join( map( lambda kv: '0x' + s.replace('-','')[ sum(arr[:kv[0]]) : sum(arr[:kv[0]]) + kv[1] ], enumerate(arr) ) ) + ");"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment