Please help me ..............

How can i write a source code in assembly language that will calculate the free space and used space  of hard drive .
Please help me. :sad:

Posted on 2010-02-16 23:55:36 by nishith
Posted on 2010-02-17 01:51:58 by Homer


    lpRootPathName db "\",0
    lpSPerClus dd 0
    lpBPerSec dd 0
    lpNOfFreeClus dd 0
    lpTotalNClus dd 0
ConvertStr db "%lu kB available to caller",13,10,"%lu k total",0
String db 255 dup (0)

caption db "GetDiskFreeSpace",0
lpDir db "\",0
lpFBAvailableQ dq 0
lpTotalBytesQ dq 0
lpFBAvailableD dd 0
lpTotalBytesD dd 0

String1 db 255 dup (0)

OneK REAL10 1024.0

invoke GetDiskFreeSpaceEx, ADDR lpDir, ADDR lpFBAvailableQ, ADDR lpTotalBytesQ, NULL
finit ;initialisiert FPU
fld OneK ;laed eine Realzahl (1024,0) in den TOS
fild lpFBAvailableQ ;laed lpFB... in den TOS
fdiv ST(0),ST(1) ;dividiert zwei Realzahlen
fistp lpFBAvailableD ;speichert Integer aus dem TOS und poppt
fild lpTotalBytesQ
fdiv ST(0),ST(1)
fistp lpTotalBytesD
invoke wsprintf, ADDR String1, ADDR ConvertStr,lpFBAvailableD, lpTotalBytesD
invoke MessageBox,0,ADDR String1,ADDR caption,MB_OK
push 0
call ExitProcess        
end start

Thanks to Florian for share this code

Best greets
Posted on 2010-03-01 04:22:41 by ragdog
1. Why use FPU to divide by 1024?
2. Why use FPU at all?
Posted on 2010-03-01 13:35:12 by ti_mo_n
floating point unit

Better calculation with comma
then have u a correct result
Posted on 2010-03-01 15:04:17 by ragdog