def WinGetRawDevice(path):
 path = CanonicalPathToLocalPath(path)
 try:
  path = win32file.GetLongPathName(path)
 except pywintypes.error:
  pass
 try:
  mount_point = win32file.GetVolumePathName(path)
 except pywintypes.error as details:
  logging.info('path not found. %s', details)
  raise IOError('No mountpoint for path: %s', path)
 if (not path.startswith(mount_point)):
  stripped_mp = mount_point.rstrip('\\')
  if (not path.startswith(stripped_mp)):
   raise IOError(('path %s is not mounted under %s' % (path, mount_point)))
 corrected_path = LocalPathToCanonicalPath(path[len(mount_point):])
 corrected_path = utils.NormalizePath(corrected_path)
 volume = win32file.GetVolumeNameForVolumeMountPoint(mount_point).rstrip('\\')
 volume = LocalPathToCanonicalPath(volume)
 result = rdf_paths.PathSpec(path=volume, pathtype=rdf_paths.PathSpec.PathType.OS, mount_point=mount_point.rstrip('\\'))
 return (result, corrected_path)

def WinGetRawDevice ( path ) : path = CanonicalPathToLocalPath ( path ) try : path = win32file . GetLongPathName ( path ) except pywintypes . error : pass try : mount_point = win32file . GetVolumePathName ( path ) except pywintypes . error as details : logging . info ( 'path not found. %s' , details ) raise IOError ( 'No mountpoint for path: %s' , path ) if ( not path . startswith ( mount_point ) ) : stripped_mp = mount_point . rstrip ( '\\' ) if ( not path . startswith ( stripped_mp ) ) : raise IOError ( ( 'path %s is not mounted under %s' % ( path , mount_point ) ) ) corrected_path = LocalPathToCanonicalPath ( path [ len ( mount_point ) : ] ) corrected_path = utils . NormalizePath ( corrected_path ) volume = win32file . GetVolumeNameForVolumeMountPoint ( mount_point ) . rstrip ( '\\' ) volume = LocalPathToCanonicalPath ( volume ) result = rdf_paths . PathSpec ( path = volume , pathtype = rdf_paths . PathSpec . PathType . OS , mount_point = mount_point . rstrip ( '\\' ) ) return ( result , corrected_path )
resolves the raw device that contains the path .