gpt4 book ai didi

windows - RegOpenKeyEx 在失败时返回什么错误代码?

转载 作者:可可西里 更新时间:2023-11-01 09:22:24 27 4
gpt4 key购买 nike

MSDN 文档:

http://msdn.microsoft.com/en-us/library/ms724897(VS.85).aspx

对于此函数可能返回的错误,奇怪地保持沉默。

如果 key 不存在,我对返回什么错误代码特别感兴趣,但更全面的信息也很好。

最佳答案

这是标准的 Win32 内核错误代码。 GetLastError() 返回的代码类型,因此可以在 WinError.h 中找到可能值的集合。请注意,这些不是 HRESULT 值。

//  The configuration registry database is corrupt.
//
#define ERROR_BADDB 1009L

// The configuration registry key is invalid.
//
#define ERROR_BADKEY 1010L

// The configuration registry key could not be opened.
//
#define ERROR_CANTOPEN 1011L

// The configuration registry key could not be read.
//
#define ERROR_CANTREAD 1012L

// The configuration registry key could not be written.
//
#define ERROR_CANTWRITE 1013L

// One of the files in the registry database had to be recovered by use of a log or alternate copy. The recovery was successful.
//
#define ERROR_REGISTRY_RECOVERED 1014L

// The registry is corrupted. The structure of one of the files containing registry data is corrupted, or the system's memory image of the file is corrupted, or the file could not be recovered because the alternate copy or log was absent or corrupted.
//
#define ERROR_REGISTRY_CORRUPT 1015L

// An I/O operation initiated by the registry failed unrecoverably. The registry could not read in, or write out, or flush, one of the files that contain the system's image of the registry.
//
#define ERROR_REGISTRY_IO_FAILED 1016L

// The system has attempted to load or restore a file into the registry, but the specified file is not in a registry file format.
//
#define ERROR_NOT_REGISTRY_FILE 1017L

// Illegal operation attempted on a registry key that has been marked for deletion.
//
#define ERROR_KEY_DELETED 1018L

// System could not allocate the required space in a registry log.
//
#define ERROR_NO_LOG_SPACE 1019L

// Cannot create a symbolic link in a registry key that already has subkeys or values.
//
#define ERROR_KEY_HAS_CHILDREN 1020L

// Cannot create a stable subkey under a volatile parent key.
//
#define ERROR_CHILD_MUST_BE_VOLATILE 1021L

来自 RegOpenKeyEx 的可能错误代码的综合列表会非常大,并且可能会随着 Windows 的每个版本而变化,您应该准备好处理任何 Win32 错误代码。

编辑:显然,不存在 key 的错误是 ERROR_FILE_NOT_FOUND。

关于windows - RegOpenKeyEx 在失败时返回什么错误代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2284904/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com