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的驱 ...
随机推荐
- 一行代码让3D翻转后的文本恢复清晰
FlashPlayer10提供的3D功能有一个相当蛋疼的问题:只要设置过rotationX.rotationY或者rotationZ属性,显示对象里面的文字(尤其是设备字体,位图文本)就会一直处于模糊 ...
- Codeforces 1239B. The World Is Just a Programming Task (Hard Version)
传送门 这一题好妙啊 首先把括号序列转化成平面直角坐标系 $xOy$ 上的折线,初始时折线从坐标系原点 $(0,0)$ 出发 如果第 $i$ 个位置是 '(' 那么折线就往上走一步($y+1$),否则 ...
- 利用脚本一键执行脚本,创建SharePoint文档库列表
SharePoint基于文档库和列表上进行二次开发,生成新的文档库和新的列表模板 通过新的模板,创建新的文档库与列表 --定义site对象$site = SPSite http://dvt176/si ...
- PreparedStatement和批处理
1.概述 PreparedStatement 接口继承了 Statement,并与之在两方面有所不同,它表示预编译的 SQL 语句对象. 首先,数据库会对预编译语句提供性能优化.因为预编译语句有可能被 ...
- 5_PHP数组_3_数组处理函数及其应用_7_数组排列函数
以下为学习孔祥盛主编的<PHP编程基础与实例教程>(第二版)所做的笔记. 数组排列函数 1. sort() 函数 程序: <?php $array = array("img ...
- PHP敏感信息脱敏函数
测试 $name = '王刚'; $mobile = '13817558198'; $name = desensitize($name,1,1); $mobile = desensitize($mob ...
- Matlab函数装饰器
info.m function result_func= info(msg) function res_func =wrap(func) function varargout = inner_wrap ...
- 禁止迅雷极速版被强制升级为迅雷x
PS:迅雷极速版( ThunderSpeed1.0.34.360 )下载地址: https://pan.baidu.com/s/1wuBOpNbim5jBru03AfSAVg 按照下面的这个路径去找. ...
- 在SQL Server中,为何都建议禁止 VIA 协议,VIA协议具体内容是什么?
在SQL Server 在SQL Server中,为何都建议禁止 VIA 协议,VIA协议具体内容是什么? 中,为何都建议禁止 VIA 协议,VIA协议具体内容是什么? 在SQL Server中,为何 ...
- hybris backoffice创建product遇到的synchronization问题和解答
我从product DSC-H20_MD clone了一个新的product,code为DSC-H20_MD1 因为它的状态有个红灯: 所以我点了这个sync按钮: 结果报这个错: 之后这个clone ...