.386
.MODEL FLAT,STDCALL
locals
jumps

UNICODE=0

include w32.inc



extrn lstrcpy:proc

.DATA

;[--------==========================================================--------];

title1 db 'total disk size', 0
title2 db 'free disk size', 0

MSG_T_1 db 'Total Space : ' ,14 dup(0)
MSG_T_2 db 'Free Space : ' ,13 dup(0)
numbuff db 64 dup(0)
fmat1 db "%lu", 0
fmat2 db "%lX", 0
cdrive db 'c:\', 0
ddrive db 'a'
Tot_clust dd 0
Free_clust dd 0
BytesPSect dd 0
SectPClust dd 0



.CODE

;[--------==========================================================--------];
main:
Get_DISKINFOS:

;---- drivename in cdrive einf?gen

;--function server
call GetDiskFreeSpace,offset cdrive,offset SectPClust ,offset BytesPSect,offset Free_clust,offset Tot_clust ; Get free disk space

mov eax, Tot_clust
cdq
imul SectPClust
imul BytesPSect
call PutBytes

;--nun antwort zu server senden - numbuff
call lstrcpy,offset MSG_T_1+14 ,offset numbuff
call MessageBox,0,offset MSG_T_1, offset title1, 0

mov eax, Free_clust
cdq
imul SectPClust
imul BytesPSect
call PutBytes

;--nun antwort zu server senden - numbuff
call lstrcpy,offset MSG_T_2+13 ,offset numbuff
call MessageBox,0,offset MSG_T_2, offset title1, 0

call ExitProcess,0




PutBytes proc
or edx, edx
jnz isbig3 ; If > 4Gig
cmp eax, 1024 ; > 1k?
jae isbig1
call jprintf, offset numbuff, offset fmat1, eax
ret
isbig1:
cmp eax, 1024*1024
jae isbig2
mov si, 'bK'
dok:
mov ecx, 1024
mov ebx, 1000
idiv ecx
mov ecx, eax ; ecx = Integer, edx = MOD
mov eax, edx
cdq
imul ebx
mov ebx, 1024
idiv ebx ; eax = Frac
push esi
push eax
call jprintf, offset numbuff, offset fmat1, ecx
pop eax
call fendnum
mov byte ptr , '.'
inc edi
cmp eax, 100
jae okl1
mov byte ptr , '0'
inc edi
cmp eax, 10
jae okl1
mov byte ptr , '0'
inc edi
okl1:
call jprintf, edi, offset fmat1, eax
call fendnum
pop esi
mov byte ptr , ' '
mov word ptr , si
mov byte ptr , 0
ret
isbig2:
cmp eax, 1024*1024*1024
jae isbig3
mov ecx, 1024
idiv ecx
cdq
mov si, 'bM'
jmp dok
isbig3:
mov ecx, 1024 * 1024
idiv ecx
cdq
mov si, 'bG'
jmp dok
PutBytes endp

fendnum proc
mov edi, offset numbuff
lopfs:
cmp byte ptr , 0
je fouio
inc edi
jmp lopfs
fouio:
ret
fendnum endp

jprintf proc p1:dword, p2:dword, p3:dword
push p3
push p2
push p1
call _wsprintf
add esp, 12
ret
jprintf endp

ends
end main
Posted on 2001-12-18 07:17:42 by Max
Shouldn't you call GetDiskFreeSpaceEx instead?
GetDiskFreeSpace only works on hard drives 2Gigs or smaller.
Posted on 2001-12-28 12:29:39 by Mecurius
------
Shouldn't you call GetDiskFreeSpaceEx instead?
------
dont know the call before ,why dont you post a example ?

-------
GetDiskFreeSpace only works on hard drives 2Gigs or smaller.
------

hm dont know this before ,my hd is 2gb.
but thanks for this helpfull statement ,im shure all newbie readers ,like me ,can now fix the problem.
Posted on 2001-12-30 09:59:36 by Max