Re: FAT32 HELP!

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

Bernie Wrote:
>>WES
>>  RUN THIS PROGRAM BY IT SELF
>>  DON'T ADD ANYTHING
>>  This works in WIN95 SR2 FAT32

That it does, as well as in WIN98.  Unfortunately, my original routine did
as well.  Perhaps I'm not being clear as to what I'm trying to do:

(1) in windows, run the following program (don't add anything)
    output is {xxxxxxx,xxxxxxx}

(2) restart your computer
    press F8 to boot in command mode
    run the following program (don't add anything)
    output is -1

If you get anything else, then I'm going to be really confused.  But in all
seriousness, I really appreciate all your help on this (and that of everyone
else who replied).  I'll be busy tonight working on the 'dir' parse kludge
in case I can't ever get a work-around on this...

Wes
_________________________________________________________________________

include machine.e

sequence mregs
mregs = repeat(0, 10)

global function disk_free_space_ex(sequence 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[1]) then -- commented out because I
--     return -1                       -- don't know what routine
--  end if                             -- your using here bernie

  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
    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

? disk_free_space_ex("C")   -- calling this

----------------------------------------------------------------------------

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

Search



Quick Links

User menu

Not signed in.

Misc Menu