Tuesday, 20 August 2013

Using GetDiskFreeSpaceEx on CIFS share (C#)

Using GetDiskFreeSpaceEx on CIFS share (C#)

I'm trying to use WIN Api function GetDiskFreeSpaceEx() to get available
disk space on CIFS share. I discovered that this function return different
values after the disk have been formatted.
So here are my steps: 1. Create the CIFS shared folder. 2. Call
GetDiskFreeSpaceEx(). It returns correct value. 3. Format the disk with
shared folder. 4. Recreate folder on the disk. (Sharing wasn't be stopped)
5. Call GetDiskFreeSpaceEx(). It returns 0. 6. Call GetDiskFreeSpaceEx()
again. Now it returns correct value. And all next calling of this function
returns right value.
I also discovered that when I stop sharing the folder after formatting the
disk and than begin to share it again, the GetDiskFreeSpaceEx() always
return correct value.
Do you have any ideas about such situation? Thanks.

No comments:

Post a Comment