Win32 Error Code COM Error Code NTSTATUS的区别、转换
这三种码其实都是Windows系统错误码,只是对应不同API和使用场景。它们既有区别,又相互有联系。
一、区别和联系
- 都是32位值
- Win32 Error Code和NTSTATUS位域组成相同,但Win32 Error Code的取值范围只能在0x00000000---0x0000FFFF
- Win32 Error Code和COM Error Code,在高2位定义不同,设备来源值可能一样,但代表的设备不一样,设备来源值位数也不一样,但它们又可以互相转换。它们实际上的定义都是LONG型的,都是通过相关的API函数返回值返回来的,小于0时都代表着失败了。
- 具有相同格式的ntstatus和win32错误代码可能会使用相同的设施代码。然而,情况并非如此——相反,win32错误代码(根据winerrror.h)使用的是hresults的功能值!因此,交换ntstatus和win32错误代码在语法上是正常的,但由于设施代码不匹配而改变了它们的语义。
二、相互转换

1 Facility may need to be adapted
2 Holds for ‘real’ Win32 error codes. For compatibility error codes, use HRESULT_FROM_WIN32
3 As long as you have a ‘real’ HRESULT (i.e. not one from
HRESULT_FROM_WIN32) and want to get a ‘real’ Win32 error code (i.e. not a
compaitibility one) — otherwise it can get tricky
4 Note that HRESULT_FROM_NT does not take the NT Status to Win32 Error Code conversion table
into account, thus the result may not be what one would expect. Using
LsaNtStatusToWinError takes this table into account, but yields
‘compatibility’ Win32 error code.
参考:
https://jpassing.com/2007/08/20/error-codes-win32-vs-hresult-vs-ntstatus/?like=1&_wpnonce=9495153bae
Win32 Error Code COM Error Code NTSTATUS的区别、转换的更多相关文章
- Xocde一次版本升级遇到的问题 (Code Sign Error)
因为Xcode对ios版本的支持问题,我对XCode进行了一次升级,导致原来还好的项目代码出现了编译时错误. Code Sign Error failed with exit code 1 问题就在于 ...
- Description Resource Path Location Type Error executing aapt: Return code -1073741819 Client line 1
Logcat报错:Description Resource Path Location Type Error executing aapt: Return code -1073741 ...
- 【解决】查询无法完成,因为其包含的查找列数已超过管理员强制实施的查找列阈值。Error code=0x80070093; Error source=Groove
前因: 修改了SharePoint Server 2013 下面的文档库的名称,原先2个汉字,现在8个汉字.结果,SkyDrive Pro 就无法同步了,无论是停止重新同步还是手动填写进行同步都不可以 ...
- 真机测试及布署Code Sign error问题总结
Code Sign error: Certificate identity 'iPhone Developer: idf (XR9HN3TD7E)' appears more than once in ...
- Jenkins Code Sign error: No provisioning profiles found
=== BUILD TARGET JenkinsTest OF PROJECT JenkinsTest WITH CONFIGURATION Release === Check dependencie ...
- Error executing aapt: Return code -1073741819
在做andrid项目的时候,本来想把a项目中的a功能模块复制到b项目中,但是复制过程中出现xml文件id的问题, Error executing aapt: Return code -10737418 ...
- Code Sign error: No unexpired provisioning profiles found that contain any of the keychain's signing certificates
最近离职了,刚好在离职之际有人叫我帮做个项目,简直了,没有mac电脑,没有真ji设备,简直了.接项目那哥们,暂且叫做J,大哥说我给你想办法,then,给借了个mac pro.刚拿到电脑真是喜出望外啊, ...
- 更新证书错误Code Sign error: Provisioning profile ‘XXXX'can't be found
在Xcode中当你在更新了你得证书而再重新编译你的程序,真机调试一直会出现 Code Sign error: Provisioning profile ‘XXXX’ can't be found是不是 ...
- Code Sign error: No code signing identities found: No valid signing identities
Code Sign error: No code signing identities found: No valid signing identities 解决办法:如果证书可获取,最简办法就是把所 ...
- centos 7 运行Quartus ii 17.0 标准版,下载程序时遇到错误error (209053): unexpected error in jtag server -- error code 89
对于错误error (209053): unexpected error in jtag server -- error code 89,它产生的原因在于,在linux系统下,Quartus ii的驱 ...
随机推荐
- xorm插入数据实例
package main import ( "fmt" _ "github.com/go-sql-driver/mysql" "github.com/ ...
- 数组中重复的数字(Golang)
使用哈希表 package main import "fmt" func main() { a := [...]int{2,3,1,0,2,5,3} num := make(map ...
- SDOI2019 Round2
这鬼家伙已经咕了好久了-- SDOIR2的题目挺好玩的- 快速查询(???) 不难发现所有的操作都可以通过区间打Tag实现 那么可以维护两个标记\(a,b\)表示序列中的数为\(x\)时实际表示的值是 ...
- Thomas Brinkhoff 基于路网的移动对象生成器的使用[第二版]
Thomas Brinkhoff 基于路网的移动对象生成器的使用 Thomas Brinkhoff 基于路网的移动对象生成器的使用 相关操作的说明 相关文件的说明 运行 导入eclipse后运行时选择 ...
- MVC4 部署 could not load file or assembly system.web.http.webhost 或是其它文件出误
自从VS2010发布之后使用它来做开发的程序员越来越多,其中很多人使用了MVC来作为新的开发框架,但是在系统部署的时候我们也遇到诸多问题,因为目前大多数windows服务器采用的还是Windows S ...
- SSM框架之MyBatis入门介绍
一.什么是MyBatis? MyBatis源自Apache的iBatis开源项目, 从iBatis3.x开始正式更名为MyBatis.它是一个优秀的持久层框架. 二.为什么使用MyBatis? 为了和 ...
- mysql 插入一个字段 id自增并设置为主键
案例 ALTER TABLE customer MODIFY COLUMN custID int NOT NULL AUTO_INCREMENT 开启: ALTER TABLE 表名 MODIFY C ...
- Struts框架笔记03_OGNL表达式与值栈
目录 1. OGNL 1.1 OGNL概述 1.1 什么是OGNL 1.1.2 OGNL的优势 1.1.2 OGNL使用的要素 1.2 OGNL的Java环境入门[了解] 1.2.1 访问对象的方法 ...
- Spark运行原理【史上最详细】
https://blog.csdn.net/lovechendongxing/article/details/81746988 Spark应用程序以进程集合为单位在分布式集群上运行,通过driver程 ...
- 14.专攻python和centos7
大牛博客:https://blog.51cto.com/yangrong/p5 用户接口应用程序: [root@python01 ~]# ps aux|grep bashroot 23860 ...