本文介绍了Windows 2000上的GetDiskFreeSpace Windows API失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我需要使用我的程序来计算群集大小.
Windows提供了API-GetDiskFreeSpace,以达到此目的.
但是在Windows 2000主机上,API失败了,出现以下错误-
--------------------
ERROR_DIR_NOT_ROOT 144(0x90):该目录不是根目录的子目录.
--------------------
同一程序可以在Windows 2003及更高版本上成功运行.

有谁知道解决方案这个问题?
或者
还有其他方法可以在Windows上获得群集大小吗?

这是我的代码-
------------ -------------------------------------------------- ---------------------------------------------
#包括"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失败:'%d'\ n",GetLastError());
}

return 0;
}

--------------------------------- -------------------------------------------------- -----------------------

基本上,我使用win2k主机从以下位置访问netapp卷上驻留的文件/目录使用UNC路径.

argv [1]是我的情况"\\?\ UNC \ netapp2704 \ aniket \ tempQtree \" API失败的原因(错误代码144).

但是,我可以访问"\\ netapp2704 \ aniket \ tempQtree \来自文件资源管理器.

"tempQtree"是共享"aniket"上的qtree.

GetDiskFreeSpace API在路径成功"上成功. \\?\ UNC \ netapp2704 \ aniket \".

希望这可以清除我的问题.请让我知道是否需要任何其他输入.

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.

Do anyone knows the solution of this problem?
Or
Is there any other way to get cluster size on windows?

Here is my 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.

推荐答案


这篇关于Windows 2000上的GetDiskFreeSpace Windows API失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 09:28