C Board  

Go Back   C Board > Platform Specific Boards > Windows Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 06-24-2009, 09:13 AM   #1
Registered User
 
Join Date: Jun 2009
Posts: 5
GetDiskFreeSpace Windows API fails on windows 2000

Hi All,
I need to calculate the cluster size using my program.
Windows provides API - GetDiskFreeSpace, to serve the purpose.
But the API fails on windows 2000 host giving the following error-
--------------------
ERROR_DIR_NOT_ROOT 144 (0x90) :The directory is not a subdirectory of the root directory.
--------------------
The same program runs successfully on windows 2003 and above.

Does anyone knows the solution of this problem?
dnyampawar is offline   Reply With Quote
Old 06-24-2009, 09:55 AM   #2
and the hat of vanishing
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,214
The error message seems pretty self-explanatory to me.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Up to 8Mb PlusNet broadband from only £5.99 a month!
Salem is offline   Reply With Quote
Old 06-27-2009, 02:32 PM   #3
Algorithm Dissector
 
iMalc's Avatar
 
Join Date: Dec 2005
Location: New Zealand
Posts: 2,475
What are you passing as the first parameter?

Your should really use GetDiskFreeSpaceEx anyway.
__________________
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
iMalc is offline   Reply With Quote
Old 06-29-2009, 12:15 AM   #4
Registered User
 
Join Date: Jun 2009
Posts: 5
Quote:
Originally Posted by iMalc View Post
What are you passing as the first parameter?

Your should really use GetDiskFreeSpaceEx anyway.
Hi iMalc!,
I can't use GetDiskFreeSpaceEx because i need cluster size.
Is there any way to calculate cluster size, other than GetDiskFreeSpace ?

Last edited by dnyampawar; 06-29-2009 at 12:19 AM.
dnyampawar is offline   Reply With Quote
Old 06-29-2009, 12:18 AM   #5
Registered User
 
Join Date: Jun 2009
Posts: 5
Hi,

Just to make the qustion more clear-

Here is my code-
-----------------------------------------------------------------------------------------------------------
Code:
#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
{
DWORD SectorsPerCluster, BytesPerSector, FreeClusters, TotalClusters;

if (GetDiskFreeSpace(argv[1], &SectorsPerCluster, &BytesPerSector, &FreeClusters, &TotalClusters))
{
printf ("GetDiskFreeSpace Success\n");
}
else
{
printf ("GetDiskFreeSpace Failed : '%d'\n", GetLastError ());
}

return 0;
}
----------------------------------------------------------------------------------------------------------

basically, using win2k host , i am trying to access file/directory resided on netapp volume from using UNC path.

argv[1] is my case is " \\?\UNC\netapp2704\aniket\tempQtree\" for which the API is failing(error code 144).

whereas, I am able to access " \\netapp2704\aniket\tempQtree\" from file explorer.

"tempQtree" is qtree on share "aniket".

The GetDiskFreeSpace API succeeds on the path " \\?\UNC\netapp2704\aniket\ ".

Hope this clears my question. Please let me know if any additional inputs required.
dnyampawar is offline   Reply With Quote
Old 06-29-2009, 02:17 AM   #6
Mysterious C++ User
 
Join Date: Oct 2007
Posts: 14,099
GetDiskFreeSpace works on drives, not directories.
So it must be a root directory, as your results clearly shows.
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Old 06-29-2009, 02:46 AM   #7
Registered User
 
Join Date: Jun 2009
Posts: 5
Quote:
Originally Posted by Elysia View Post
GetDiskFreeSpace works on drives, not directories.
So it must be a root directory, as your results clearly shows.
Hi Elysia,
GetDiskFreeSpace works fine on directories too with Windows 2003 and above.
It is giving me the correct output on the same path mentioned earlier.

here is the output -
----------------------------
C:\Documents and Settings\Dnyaneshwar_Pawar\My Documents\Visual Studio Projects\
GetDiskFreeSpace\Debug>GetDiskFreeSpace.exe \\?\UNC\netapp2704\aniket\tempQtree\
GetDiskFreeSpace Success
SectorsPerCluster = 8
BytesPerSector = 733106
TotalClusters = 12582912
----------------------------

Thanks!
dnyampawar is offline   Reply With Quote
Old 07-09-2009, 03:39 AM   #8
Registered User
 
Join Date: Jun 2009
Posts: 5
Red face

anybody??
dnyampawar is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Virtual keys Arkanos Windows Programming 4 12-12-2005 10:00 AM
Windows API: Edit Box Help Frantic- Windows Programming 2 08-30-2005 07:00 PM
Windows messenger API GanglyLamb Windows Programming 0 07-10-2005 02:52 AM
MFC or Windows API aresashura Windows Programming 7 12-01-2001 10:21 PM
Networking Windows 2000 and Windows Me FCP A Brief History of Cprogramming.com 3 08-29-2001 09:10 AM


All times are GMT -6. The time now is 07:21 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22