import os,stat
filename=r"u:\1.png"
# filename=r"u:\D1\Days\Stefajir\core\misc\draggable.png"


def is_sparse_file_win(path):
    try:
        import ctypes
        from ctypes import wintypes

        FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200
        GetFileAttributes = ctypes.windll.kernel32.GetFileAttributesW
        GetFileAttributes.argtypes = [wintypes.LPCWSTR]
        GetFileAttributes.restype = wintypes.DWORD

        attrs = GetFileAttributes(path)
        return attrs & FILE_ATTRIBUTE_SPARSE_FILE != 0
    except:
        return False


# import mmap
#
# def is_memory_mapped_file(path):
#     try:
#         with open(path, 'r+b') as f:
#             try:
#                 mmap.mmap(f.fileno(), 0)
#                 return True
#             except:
#                 return False
#     except OSError:
#         return False

# def is_windows_virtual_file(path):
#     try:
#         st = os.stat(path)
#         # Check if it's a character or block device (common for virtual files)
#         return stat.S_ISCHR(st.st_mode) or stat.S_ISBLK(st.st_mode)
#     except (OSError, AttributeError):
#         return False


print(is_sparse_file_win(filename))