summaryrefslogtreecommitdiff
path: root/external/plyer/platforms/win/uniqueid.py
blob: bfcf996c929fb6d205047e223d6456461d158e0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
try:
    import _winreg as regedit
except:
    try:
        import winreg as regedit
    except:
        raise NotImplemented()

from plyer.facades import UniqueID


class WinUniqueID(UniqueID):
    def _get_uid(self):
        hKey = regedit.OpenKey(regedit.HKEY_LOCAL_MACHINE,
            r"SOFTWARE\\Microsoft\\Cryptography")
        value, _ = regedit.QueryValueEx(hKey, "MachineGuid")
        return value


def instance():
    return WinUniqueID()