# File lib/chef/win32/file.rb, line 90
      def self.readlink(link_name)
        raise Errno::ENOENT, link_name unless ::File.exists?(link_name)
        symlink_file_handle(link_name) do |handle|
          # Go to DeviceIoControl to get the symlink information
          # http://msdn.microsoft.com/en-us/library/windows/desktop/aa364571(v=vs.85).aspx
          reparse_buffer = FFI::MemoryPointer.new(MAXIMUM_REPARSE_DATA_BUFFER_SIZE)
          parsed_size = FFI::Buffer.new(:long).write_long(0)
          if DeviceIoControl(handle, FSCTL_GET_REPARSE_POINT, nil, 0, reparse_buffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, parsed_size, nil) == 0
            Chef::ReservedNames::Win32::Error.raise!
          end

          # Ensure it's a symbolic link
          reparse_buffer = REPARSE_DATA_BUFFER.new(reparse_buffer)
          if reparse_buffer[:ReparseTag] != IO_REPARSE_TAG_SYMLINK
            raise Errno::EACCES, "#{link_name} is not a symlink"
          end

          # Return the link destination (strip off \??\ at the beginning, which is a local filesystem thing)
          link_dest = reparse_buffer.reparse_buffer.substitute_name
          if link_dest =~ /^\\\?\?\\/
            link_dest = link_dest[4..-1]
          end
          link_dest
        end
      end