Help!!!

new topic     » goto parent     » topic index » view thread      » older message » newer message

This win32 C++ function call is kicking my butt!
I just cannot figure this stuff out.  Can someone tell me what I am doing
wrong or what I am missing please correct my code.
see below....
I have tried everything that I know?  All I want to do is get the total disk
size and total free space on the drive.  The function is for drives larger
than 2.1GB on Win9x OSR2 and above and WinNT 4.0 and above.  I think that it
is a lack of knowledge in C and Win32 API on my part....  Any comments would
be appreciate it.
--------------

include dll.e
include machine.e
constant KERNEL32 = open_dll("kernel32")
if KERNEL32 = 0 then
    puts(1,"Couldn't open kernel32.dll.\n")
    abort(1)
end if
object C_GetDiskFreeSpaceEx =
C_POINTER},C_LONG)
global function GetDiskFreeSpaceEx(atom dirname)
                atom diskqouta, totdisksize, totdiskfree
                sequence freespace
                object diskinfo
                diskqouta = allocate(8)
                totdisksize = allocate(8)
                totdiskfree = allocate(8)
diskinfo = c_func(C_GetDiskFreeSpaceEx,{dirname, diskqouta,
                totdisksize,
totdiskfree})
                freespace = peek4u(totdiskfree, 2)
                free(diskqouta)
                free(totdisksize)
                free(totdiskfree)
                return freespace
end function
atom totdiskinfo, volname
volname = allocate_string("C:\\")
totdiskinfo = GetDiskFreeSpaceEx(volname)
puts(1, totdiskinfo)

-----------

Thanks,
JKinsey

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu