The only way I know of is to call win32file.DeviceIoControl
with FSCTL_GET_REPARSE_POINT, and unpack the
buffer yourself.

      Roger

import win32con, winioctlcon, winnt, win32file
import struct

def get_reparse_target(fname):
        h = win32file.CreateFile(fname, 0,
                
win32con.FILE_SHARE_READ|win32con.FILE_SHARE_WRITE|win32con.FILE_SHARE_DELETE, 
None,
                win32con.OPEN_EXISTING,
                
win32file.FILE_FLAG_OVERLAPPED|win32file.FILE_FLAG_OPEN_REPARSE_POINT|win32file.FILE_FLAG_BACKUP_SEMANTICS,
 0)

        
output_buf=win32file.AllocateReadBuffer(winnt.MAXIMUM_REPARSE_DATA_BUFFER_SIZE)
        buf=win32file.DeviceIoControl(h, 
winioctlcon.FSCTL_GET_REPARSE_POINT,None,
                OutBuffer=output_buf, Overlapped=None)
        fixed_fmt='LHHHHHH'
        fixed_len=struct.calcsize(fixed_fmt)
        tag, datalen, reserved, target_offset, target_len, printname_offset, 
printname_len = \
                struct.unpack(fixed_fmt, buf[:fixed_len])

        ## variable size target data follows the fixed portion of the buffer
        name_buf=buf[fixed_len:]

        target_buf=name_buf[target_offset:target_offset+target_len]
        target=target_buf.decode('utf-16-le')
        return target

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to