def GetCanonicalName(disk):
    target = QueryDosDevice(disk)
    if target is None:
        print("QueryDosDevice(%r) is %r" % (letter, target))
        return None
    elif target.startswith("\\??\\"):
        # `subst`-mapped disk
        if target.startswith("\\??\\"):
            target = target[len("\\??\\"):]
        return target, False
    elif target.startswith("\\Device\\LanmanRedirector\\"):
        # network disk
        return Net.NetUseGetInfo(None, disk[0]+":")["remote"], True
    elif target.startswith("UNC\\"):
        # `subst`-mapped network disk
        return target[4:], True
    else:
        return GetMountVolume(letter), False
dataset/ETHPy150Open grawity/hacks/hacks/Dead-projects/Win32/df.py/GetCanonicalName/original