Created
February 25, 2020 00:38
-
-
Save ek0/f98db8cc90c2677a0e8997187f79d12b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ctypes | |
import ctypes.wintypes | |
class GUID(ctypes.Structure): | |
_fields_ = [("Data1", ctypes.wintypes.DWORD), | |
("Data2", ctypes.wintypes.WORD), | |
("Data3", ctypes.wintypes.WORD), | |
("Data4", ctypes.c_ubyte * 8)] | |
def __repr__(self): | |
return "{0:08X}-{1:04X}-{2:04X}-{3:02X}{4:02X}-{5:02X}{6:02X}{7:02X}{8:02X}{9:02X}{10:02X}".format(self.Data1, | |
self.Data2, self.Data3, self.Data4[0], self.Data4[1], self.Data4[2], self.Data4[3], self.Data4[4], | |
self.Data4[5], self.Data4[6], self.Data4[7]) | |
__str__ = __repr__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment