; +++++++++++++ Get Disk Space by Timo Harter ++++++++++++++
;
; Since PB 3.1, the old Version didn't work anymore (becouse
; of changes to '>>')
; So here is a new one.
; 
; Works even with high values (up to 2097152 GB) not like the
; one by Rings.
; Returns values in MegaByte
;
; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

drive.s = "C:\"

Structure Quad
  L1.l  
  L2.l
EndStructure 

GetDiskFreeSpaceEx_(@drive, FB.Quad, TB.Quad, TFB.Quad)

If TB\L1 & $80000000
  TB\L1 & $7FFFFFFF
  TB\L1>>20
  TB\L1 + $800
  TB\L2<<12
Else
  TB\L1>>20
  TB\L2<<12
EndIf
TotalMB.l = TB\L1 + TB\L2

If TFB\L1 & $80000000
  TFB\L1 & $7FFFFFFF
  TFB\L1>>20
  TFB\L1 + $800
  TFB\L2<<12
Else
  TFB\L1>>20
  TFB\L2<<12
EndIf
FreeMB.l = TFB\L1 + TFB\L2

UsedMB.l = TotalMB - FreeMB


MessageRequester("Disk Size","Space Total: "+Str(TotalMB)+" MB"+Chr(13)+"Space Free: "+Str(FreeMB)+" MB"+Chr(13)+"Space Used: "+Str(UsedMB)+" MB",0)
End

; ++++++++++++++++++++++++++++++++++++++