# File lib/sys/windows/sys/filesystem.rb, line 162
    def self.mounts
      # First call, get needed buffer size
      buffer = 0.chr
      length = GetLogicalDriveStringsA(buffer.size, buffer)

      if length == 0
        raise SystemCallError.new('GetLogicalDriveStrings', FFI.errno)
      else
        buffer = 0.chr * length
      end

      mounts = block_given? ? nil : []

      # Try again with new buffer size
      if GetLogicalDriveStringsA(buffer.size, buffer) == 0
        raise SystemCallError.new('GetLogicalDriveStrings', FFI.errno)
      end

      drives = buffer.split(0.chr)

      boot_time = get_boot_time

      drives.each{ |drive|
        mount  = Mount.new
        volume = FFI::MemoryPointer.new(:char, MAXPATH)
        fsname = FFI::MemoryPointer.new(:char, MAXPATH)

        mount.instance_variable_set(:@mount_point, drive)
        mount.instance_variable_set(:@mount_time, boot_time)

        volume_serial_number = FFI::MemoryPointer.new(:ulong)
        max_component_length = FFI::MemoryPointer.new(:ulong)
        filesystem_flags     = FFI::MemoryPointer.new(:ulong)

        bool = GetVolumeInformationA(
           drive,
           volume,
           volume.size,
           volume_serial_number,
           max_component_length,
           filesystem_flags,
           fsname,
           fsname.size
        )

        # Skip unmounted floppies or cd-roms, or inaccessible drives
        unless bool
          if [5,21].include?(FFI.errno) # ERROR_NOT_READY or ERROR_ACCESS_DENIED
            next
          else
            raise SystemCallError.new('GetVolumeInformation', FFI.errno)
          end
        end

        filesystem_flags = filesystem_flags.read_ulong
        fsname = fsname.read_string

        name = 0.chr * MAXPATH

        if QueryDosDeviceA(drive[0,2], name, name.size) == 0
          raise SystemCallError.new('QueryDosDevice', FFI.errno)
        end

        mount.instance_variable_set(:@name, name.strip)
        mount.instance_variable_set(:@mount_type, fsname)
        mount.instance_variable_set(:@options, get_options(filesystem_flags))

        if block_given?
          yield mount
        else
          mounts << mount
        end
      }

      mounts # Nil if the block form was used.
    end