![]() |
| | #1 |
| Registered User Join Date: Jun 2009
Posts: 5
| GetDiskFreeSpace Windows API fails on windows 2000 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 | |
| | #2 |
| and the hat of vanishing 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 | |
| | #3 |
| Algorithm Dissector Join Date: Dec 2005 Location: New Zealand
Posts: 2,475
|
__________________ My homepage Advice: Take only as directed - If symptoms persist, please see your debugger |
| iMalc is offline | |
| | #4 | |
| Registered User Join Date: Jun 2009
Posts: 5
| Quote: 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 | |
| | #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 | |
| | #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:
| |
| Elysia is offline | |
| | #7 | |
| Registered User Join Date: Jun 2009
Posts: 5
| Quote:
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 | |
| | #8 |
| Registered User Join Date: Jun 2009
Posts: 5
| anybody?? |
| dnyampawar is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
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 |