FAT32 HELP!

new topic     » topic index » view thread      » older message » newer message

Hi Folks,

I'm hoping someone can point me in the right direction for obtaining
extended free space on FAT32 drives while in DOS.  I tried using the
following function (INT21, #7303), which works great in a dos box, but not
in real mode.  Is this impossible, or what?

Any help would be greatly appreciated!

Best Regards,

Wes Hamilton, Technical Specialist
Western Mass Regional Library, Hatfield, MA

----------------------------------------------------------
(this is part of J. Craig Gilbert's diskutil.e, modified):
----------------------------------------------------------

global function disk_free_space(integer letter)
  atom bytes_per_sector, sectors_per_cluster, free_clusters, total_clusters
  atom free_space, total_space
  atom NameBuffer, ResultBuffer

  if not drive_exist(letter) then
     return -1
  end if

  NameBuffer = allocate_low(4)
  if not NameBuffer then
    return -1
  end if
  poke(NameBuffer,letter & ":\\" & 0)

  ResultBuffer = allocate_low(44)
  if not ResultBuffer then
    free_low(NameBuffer)
    return -1
  end if

  mregs = repeat(0,10)
  mregs[REG_AX] = #7303
  mregs[REG_CX] = 44
  mregs[REG_DS] = floor(NameBuffer/16)
  mregs[REG_DX] = remainder(NameBuffer,16)
  mregs[REG_ES] = floor(ResultBuffer/16)
  mregs[REG_DI] = remainder(ResultBuffer,16)

  mregs = dos_interrupt(#21,mregs)
  free_low(NameBuffer)
  if and_bits(mregs[REG_FLAGS],1) then   <-------THIS IS WHERE IT FAILS!
    free_low(ResultBuffer)
    return -1
  end if

  bytes_per_sector = peek4u(ResultBuffer + 8)
  sectors_per_cluster = peek4u(ResultBuffer + 4)
  free_clusters = peek4u(ResultBuffer + 12)
  total_clusters = peek4u(ResultBuffer + 16)
  free_space = bytes_per_sector * sectors_per_cluster * free_clusters
  total_space = bytes_per_sector * sectors_per_cluster * total_clusters

  free_low(ResultBuffer)

  return {free_space, total_space}
end function

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu