1. GetDiskFreeSpaceA

Howdy y'all!

As I plug along on the installer, I've run into a bit of a snag when it 
comes to calling the API function GetDiskFreeSpace().  I have 
linked to the function like this:

-- start code
include win32lib.ew

atom aGetDiskFreeSpace

aGetDiskFreeSpace = define_c_func(kernel32,
    "GetDiskFreeSpaceA",
     {C_POINTER, C_POINTER, C_POINTER, C_POINTER,
      C_POINTER}, 
      C_ULONG)

-- end code
 
Unfortunately, aGetDiskFreeSpace is getting a value of -1, which 
means that the poor installer is backfiring something fierce.

Now then, I checked at the msdn site, and although the function 
has been deprecated in favor of GetDiskFreeSpaceEx(), the 
documentation would lead me to believe that it had not been taken 
out of API completely as of Windows 2000.  So it seems 
reasonable to assume that it also exists on Windows ME, which 
my machine is running.  (Yes I know, it's a horrible mistake to 
expect Micro$oft to be reasonable.)

I have also checked winbase.h (as supplied with Borland C++ 5.02) 
to verify the c types in the parameters of define_c_func(), and  
everything appears to be correct.  But she still won't work.

Oh, and as a bit of personal opinion, over the last couple of 
months, I've discovered that Windows ME works about as well as a 
one-legged frog.  I can just about imagine how discombobulated 
Windows XP will be ...

Any assistance would be greatly appreciated,

Travis Beaty
Claude, Texas.

new topic     » topic index » view message » categorize

2. Re: GetDiskFreeSpaceA

To further Matthews advice, try this instead....

 aGetDiskFreeSpace = registerw32Function(kernel32,
     "GetDiskFreeSpaceA",
      {C_POINTER, C_POINTER, C_POINTER, C_POINTER,
       C_POINTER},
       C_ULONG)


and then use it like this ...

   result = w32Func(aGetDiskFreeSpace, {...})

The reason for this is that "kernel32" is not created by the open_dll() but
by a win32lib function.

Also, I've been using Windows ME for almost a year now with almost no
troubles at all. I'd be interested (offline) to hear about what you think is
broken with it.

------
Derek Parnell
Melbourne, Australia
"To finish a job quickly, go slower."

----- Original Message -----
From: "Matthew Lewis" <matthewwalkerlewis at YAHOO.COM>
To: "EUforum" <EUforum at topica.com>
Sent: Tuesday, June 12, 2001 1:24 AM
Subject: RE: GetDiskFreeSpaceA


>
>
>
> > -----Original Message-----
> > From: Travis Beaty [mailto:travisbeaty at arn.net]
>
> > As I plug along on the installer, I've run into a bit of a
> > snag when it
> > comes to calling the API function GetDiskFreeSpace().  I have
> > linked to the function like this:
> >
> > -- start code
> > include win32lib.ew
> >
> > atom aGetDiskFreeSpace
> >
> > aGetDiskFreeSpace = define_c_func(kernel32,
> >     "GetDiskFreeSpaceA",
> >      {C_POINTER, C_POINTER, C_POINTER, C_POINTER,
> >       C_POINTER},
> >       C_ULONG)
> >
> > -- end code
> >
> > Unfortunately, aGetDiskFreeSpace is getting a value of -1, which
> > means that the poor installer is backfiring something fierce.
>
> You can't use the same values for the dll as win32lib defines with
> define_c_proc/func.  This is because win32lib doesn't actually call
> open_dll/define... until c_func/proc is called, to avoid loading things
into
> memory.  So, what you end up with is an index to the actual value which is
> stored in a sequence.
>
> You'll need to either open the dll yourself, or use the win32lib routines
> for linking/calling dll routines.
>
> Matt Lewis
>
>
>
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: GetDiskFreeSpaceA

Derek Parnell wrote:
> Also, I've been using Windows ME for almost a year now with almost no
> troubles at all. I'd be interested (offline) to hear about what you think
is
> broken with it.

Why offline? I'm interested too.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu