<s> import ctypes <EOL> from ctypes import POINTER , WinError , byref <EOL> from ctypes . wintypes import DWORD , BOOL <EOL> LPDWORD = POINTER ( DWORD ) <EOL> FILE_SUPPORTS_HARD_LINKS = <NUM_LIT> <EOL> FILE_SUPPORTS_REPARSE_POINTS = <NUM_LIT> <EOL> MAX_PATH = <NUM_LIT> <EOL> INVALID_HANDLE_VALUE = - <NUM_LIT:1> <EOL> GetVolumePathName = ctypes . windll . kernel32 . GetVolumePathNameW <EOL> GetVolumePathName . argtypes = [ ctypes . c_wchar_p , ctypes . c_wchar_p , DWORD ] <EOL> GetVolumePathName . restype = BOOL <EOL> GetVolumeInformation = ctypes . windll . kernel32 . GetVolumeInformationW <EOL> GetVolumeInformation . argtypes = [ ctypes . c_wchar_p , ctypes . c_wchar_p , DWORD , <EOL> LPDWORD , LPDWORD , LPDWORD , ctypes . c_wchar_p , <EOL> DWORD ] <EOL> GetVolumeInformation . restype = BOOL <EOL> def getvolumeinfo ( path ) : <EOL> """<STR_LIT>""" <EOL> volpath = ctypes . create_unicode_buffer ( len ( path ) + <NUM_LIT:2> ) <EOL> rv = GetVolumePathName ( path , volpath , len ( volpath ) ) <EOL> if rv == <NUM_LIT:0> : <EOL> raise WinError ( ) <EOL> fsnamebuf = ctypes . create_unicode_buffer ( MAX_PATH + <NUM_LIT:1> ) <EOL> fsflags = DWORD ( <NUM_LIT:0> ) <EOL> rv = GetVolumeInformation ( volpath , None , <NUM_LIT:0> , None , None , byref ( fsflags ) , <EOL> fsnamebuf , len ( fsnamebuf ) ) <EOL> if rv == <NUM_LIT:0> : <EOL> raise WinError ( ) <EOL> return ( fsnamebuf . value , fsflags . value ) <EOL> def hardlinks_supported ( path ) : <EOL> ( fsname , fsflags ) = getvolumeinfo ( path ) <EOL> return bool ( ( fsflags & FILE_SUPPORTS_HARD_LINKS ) or ( fsname == "<STR_LIT>" ) ) <EOL> def junctions_supported ( path ) : <EOL> ( fsname , fsflags ) = getvolumeinfo ( path ) <EOL> return bool ( fsflags & FILE_SUPPORTS_REPARSE_POINTS ) </s>
