GetFreeSpaceEx returns paramter is incorrect.

GetFreeSpaceEx returns paramter is incorrect.

WCHAR *driveletter = L"X:\";
BOOL bResult;
ULARGE_INTEGER FreeBytes;
ULARGE_INTEGER TotalBytes;
ULARGE_INTEGER TotalFreeBytes;
bResult = GetDiskFreeSpaceEx(driveletter,
&FreeBytes,
&TotalBytes,
&TotalFreeBytes);

This works all the time but we have a scenario where the above code results in paramter is incorrect…
any idea when such a condition would occur. I dont have access to the machine which has this problem. just from the logs I see that the above API fails with paramter incorrect error code.

  1. You mean ERROR_INVALID_PARAMETER, correct?

  2. I have no idea, and this API has a quirky history, but I don’t see what it could be other than something to do with your path, as the other arguments aren’t NULL and otherwise don’t matter. It wouldn’t be the strangest thing ever if you got back a strange error message for, say, a path that you don’t have access to, no one has access to, et. c.

  3. This really isn’t the list for this question.

Good luck,

mm

I can’t even find GetFreeSpaceEx. I find GetFreeSpace that has been replaced
with GlobalMemoryStatus, but nowhere do I find GetFreeSpaceEx; VS 2008, 7.0
SDK, or WDK. Overall however, I would agree with MM. You’ve got a path that
is boluxed on one machine, and from my experience, hardcoding something like
"X:" is an open opportunity for Mr. Murphy to muck things up. You are
assuming that every machine has every drive mapped the same way, and unless
you control every machine with an iron hand, I doubt you can say what
machine is mapped where at any point in time.

Gary G. Little
H (952) 223-1349
C (952) 454-4629
xxxxx@comcast.net

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: Friday, May 28, 2010 8:41 AM
To: Windows File Systems Devs Interest List
Subject: RE:[ntfsd] GetFreeSpaceEx returns paramter is incorrect.

  1. You mean ERROR_INVALID_PARAMETER, correct?

  2. I have no idea, and this API has a quirky history, but I don’t see what
    it could be other than something to do with your path, as the other
    arguments aren’t NULL and otherwise don’t matter. It wouldn’t be the
    strangest thing ever if you got back a strange error message for, say, a
    path that you don’t have access to, no one has access to, et. c.

  3. This really isn’t the list for this question.

Good luck,

mm


NTFSD is sponsored by OSR

For our schedule of debugging and file system seminars
(including our new fs mini-filter seminar) visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

__________ Information from ESET Smart Security, version of virus signature
database 5153 (20100528) __________

The message was checked by ESET Smart Security.

http://www.eset.com

__________ Information from ESET Smart Security, version of virus signature
database 5153 (20100528) __________

The message was checked by ESET Smart Security.

http://www.eset.com

I think that he means ‘GetDiskFreeSpaceEx;’ I went through the same process as you did before I figured this out.

mm

Try without the backslash.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntfsd…
> GetFreeSpaceEx returns paramter is incorrect.
>
> WCHAR *driveletter = L"X:\";
> BOOL bResult;
> ULARGE_INTEGER FreeBytes;
> ULARGE_INTEGER TotalBytes;
> ULARGE_INTEGER TotalFreeBytes;
> bResult = GetDiskFreeSpaceEx(driveletter,
> &FreeBytes,
> &TotalBytes,
> &TotalFreeBytes);
>
> This works all the time but we have a scenario where the above code results in paramter is incorrect…
> any idea when such a condition would occur. I dont have access to the machine which has this problem. just from the logs I see that the above API fails with paramter incorrect error code.
>
>

I never hard code the drive letter in my code…
Just for the post as an example I have hard coded it.
And sorry its a typo error…The API is 'GetDiskFreeSpaceEx…
Problem here is I am not getting this failure message always…
It is a code which is running fine…
In a particialr setup I see the following error message…I dont have access to the machine eitehr…
I basically want to repo the issue…
I tried modifying drive’s permissions to see if I get the error code.For me it always succeeds.
The code I have posted works…but I want to put the drive in some state so that I get
the parameter Incorrect error code…