0x80004005 和 0x80000008 的 HRESULT E_FAIL 错误有什么不同?

What's the different between HRESULT E_FAIL error of 0x80004005 and 0x80000008?

我有点困惑, 我检查了 WinError.h 并看到了 2 E_FAIL 个声明:

//
// MessageId: E_FAIL
//
// MessageText:
//
// Unspecified error
//
#define E_FAIL                           _HRESULT_TYPEDEF_(0x80000008L)

//
// MessageId: E_FAIL
//
// MessageText:
//
// Unspecified error
//
#define E_FAIL                           _HRESULT_TYPEDEF_(0x80004005L)

我遇到的一个问题是,我正在实施命名空间扩展,当打开一个不存在的文件时,我得到以下信息:

返回 0x80000008 时 - 我得到 "Unspecified error"

返回 0x80004005 时 - 我得到 期望的 行为 "The file name is not valid."

那我应该用什么?有什么不同? 谢谢

这些是在条件块中定义的。

第二个定义为:

#if defined(_WIN32) && !defined(_MAC)

第一个是:

#else

这是否回答了您的问题?