Re: FAT32 HELP!

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

Wes Hamilton wrote:
> 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

Hi, Wes.
If it is only the free space you need, this DOS 2+ interrupt routine
should work most anywhere.  It is limited to reporting a maximum of
about 2G but then so is the Win95 interrupt.

Cheers,
-- Nick


--<WARNING: This code works on my computer but no guarantees>--

include machine.e

--disk_free() returns {free space, total space} where drive_num = 0 for
-- default drive, 1 for A:, 2 for B: 3 for C: and so on -- Nick Metcalfe
--Notes: don't use for CD-ROMS.  The reported total and free space are
-- limited to 2G - 32k even if there's more.
function disk_free(integer drive_num)
  sequence mregs
  mregs = repeat(0,10)
  mregs[REG_AX] = #3600
  mregs[REG_DX] = drive_num * 256
  mregs = dos_interrupt(#21,mregs)
  --check for invalid drive number
  if mregs[REG_AX] = #FFFF then
    return -1
  end if
  --return {free space, total space}
  return{mregs[REG_AX] * mregs[REG_BX] * mregs[REG_CX], mregs[REG_AX] *
mregs[REG_CX] * mregs[REG_DX]}
end function

printf(1, "%dk free of %dk total\n", disk_free(3) / 1024)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu