Hi Mark, you are wrong, sorry... > No, I think (1024*1024)/(64*32768) would be .5, which > is zero in integer division. :-) 2097152 > 1048576
clustersize will never be 64*32768. If your cluster size is 32kb, then it will be 32768, in other words, it will be 64 * 512. If you get a cluster size bigger than 1024, * 1024 (cluster size above 1 MB) then this is for 95% sure because of the OTHER bug: FreeCOM fails to properly check for "FAT32 not supported by this kernel", which means that it will try to use completely random 32bit values for "bytes per sector" and "sectors per cluster". > All they appear to be doing is converting bytes to Megabytes, > so (FAT32_Free_Space.free_clusters * clustersize )/(1024l*1024) > should do it, without yielding 0 all the time... No, that would overflow. You can have 2^28 clusters and you can have cluster sizes up to 2^16 bytes, so you would need a 44 bit long value to hold the intermediate result before you / (1024L*1024). I still recommend using: > FAT32_Free_Space.free_clusters / (2048UL / (clustersize/512)) And, maybe more importantly, I recommend fixing the: > > r.r_ax = 0x7303; > > ... > > intr(0x21, &r); > > if(!(r.r_flags & 1)) { > > ... Which because of > Notes: on DOS versions which do not support the FAT32 calls, this function > returns CF clear/AL=00h (which is the DOS v1+ method for reporting > unimplemented functions) must rather be: > > r.r_ax = 0x7303; > > ... > > intr(0x21, &r); > > if( ((r.r_ax & 0xff) != 0) && ((r.r_flags & 1) == 0) ) { > > ... ... and I would even recommend as addition: "if FAT32_Free_Space.bytes_per_sector & 0x1ff is != 0 then reject the FAT32 info as well" Eric ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ Freedos-devel mailing list Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel