Re: FAT32 HELP!
- Posted by Bernie Ryan <bwryan at PCOM.NET> Aug 19, 1999
- 421 views
WES RUN THIS PROGRAM BY IT SELF DON'T ADD ANYTHING This works in WIN95 SR2 FAT32 Bernie ___________________________________________________________________________ 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 ----------------------------------------------------------------------------