PATH_NOT_FOUND 和 NAME_NOT_FOUND 有什么区别
在Win32层,我们经常会遇到ERROR_PATH_NOT_FOUND
、ERROR_NAME_NOT_FOUND
。
WinAPI(例如CreateFileW、RemoveDirectoryW)
何时返回这些值? 和有什么区别?
如果我编写文件系统驱动程序,何时设置 STATUS_OBJECT_PATH_NOT_FOUND
或 STATUS_OBJECT_NAME_NOT_FOUND
?
你如何确定?
我很困惑。 有谁能解释清楚吗?
或者有什么文件可以解释这一点吗?我找不到他们。
提前致谢。
In Win32 layer, we often meet ERROR_PATH_NOT_FOUND
, ERROR_NAME_NOT_FOUND
.
When does WinAPI(eg CreateFileW, RemoveDirectoryW)
return these values?
And What's the difference?
If I write a file system driver, when do I set STATUS_OBJECT_PATH_NOT_FOUND
or STATUS_OBJECT_NAME_NOT_FOUND
?
How do you determine?
I'm so confused.
Is there anyone who can explain clearly?
Or are there any documents explain this? I couldn't find them.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ERROR_NAME_NOT_FOUND
不是标准 Win32 API 错误代码。采用文件名的文件相关 API 返回的典型错误是ERROR_FILE_NOT_FOUND
和ERROR_PATH_NOT_FOUND
。确定要返回什么错误代码的最佳方法是使用 WDK 示例作为指导。例如,cdfs 示例的create.c
源代码文件。如果找不到目录,则返回 STATUS_OBJECT_PATH_NOT_FOUND ;如果找不到文件,则返回 STATUS_OBJECT_NAME_NOT_FOUND 。ERROR_NAME_NOT_FOUND
is not a standard Win32 API error code. Typical errors returned by file related APIs that take a file name areERROR_FILE_NOT_FOUND
andERROR_PATH_NOT_FOUND
. The best way to figure out what error code to return is use a WDK sample as a guide. The cdfs sample'screate.c
source code file for example. It returnsSTATUS_OBJECT_PATH_NOT_FOUND
if it cannot locate a directory,STATUS_OBJECT_NAME_NOT_FOUND
if it cannot locate a file.