• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            HRESULT -- Structure of COM Error Codes

            SCODEs on 16-bit platforms are divided into four fields: a severity code, a context field, a facility field, and an error code. The following illustration shows the format of an SCODE on a 16-bit platform; the numbers indicate bit positions:

            image

            HRESULTs and SCODEs on 32-bit platforms have the following format:

            image

            The high-order bit in the HRESULT or SCODE indicates whether the return value represents success or failure. If set to 0, SEVERITY_SUCCESS, the value indicates success. If set to 1, SEVERITY_ERROR, it indicates failure.

            The context field is reserved in the SCODE on 16-bit platforms and does not exist in the version for 32-bit platforms. The R, C, N, and r bits are also reserved.

            The facility field in both versions indicates the system service responsible for the error. Microsoft allocates new facility codes as they become necessary. Most SCODEs and HRESULTs set the facility field to FACILITY_ITF, indicating an interface method error.

             

            vc6中的說明(in winerror.h line:7860)

            ////////////////////////////////////
            //                                //
            //     OLE Error Codes            //
            //                                //
            ////////////////////////////////////

            //
            // OLE error definitions and values
            //
            // The return value of OLE APIs and methods is an HRESULT.
            // This is not a handle to anything, but is merely a 32-bit value
            // with several fields encoded in the value.  The parts of an
            // HRESULT are shown below.
            //
            // Many of the macros and functions below were orginally defined to
            // operate on SCODEs.  SCODEs are no longer used.  The macros are
            // still present for compatibility and easy porting of Win16 code.
            // Newly written code should use the HRESULT macros and functions.
            //

            //
            //  HRESULTs are 32 bit values layed out as follows:
            //
            //   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
            //   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
            //  +-+-+-+-+-+---------------------+-------------------------------+
            //  |S|R|C|N|r|    Facility         |               Code            |
            //  +-+-+-+-+-+---------------------+-------------------------------+
            //
            //  where
            //
            //      S - Severity - indicates success/fail
            //
            //          0 - Success
            //          1 - Fail (COERROR)
            //
            //      R - reserved portion of the facility code, corresponds to NT's
            //              second severity bit.
            //
            //      C - reserved portion of the facility code, corresponds to NT's
            //              C field.
            //
            //      N - reserved portion of the facility code. Used to indicate a
            //              mapped NT status value.
            //
            //      r - reserved portion of the facility code. Reserved for internal
            //              use. Used to indicate HRESULT values that are not status
            //              values, but are instead message ids for display strings.
            //
            //      Facility - is the facility code
            //
            //      Code - is the facility's status code
            //

            Common facility fields are described in the following table.

            Facility Field Value Description
            FACILITY_DISPATCH 2 For late-binding IDispatch interface errors.

            FACILITY_ITF

            4 For most status codes returned from interface methods. The actual meaning of the error is defined by the interface. That is, two HRESULTs with exactly the same 32-bit value returned from two different interfaces might have different meanings.
            FACILITY_NULL 0 For broadly applicable common status codes such as S_OK.
            FACILITY_RPC 1 For status codes returned from remote procedure calls.
            FACILITY_STORAGE 3

            For status codes returned from IStorage or IStream method calls relating to structured storage. Status codes whose code (lower 16 bits) value is in the range of DOS error codes (that is, less than 256) have the same meaning as the corresponding DOS error.

            FACILITY_WIN32 7 Used to provide a means of handling error codes from functions in the Win32 API as an HRESULT. Error codes in 16-bit OLE that duplicated Win32 error codes have also been changed to FACILITY_WIN32.
            FACILITY_WINDOWS 8 Used for additional error codes from Microsoft-defined interfaces.
            VC6中的定義    
            FACILITY_SSPI 9  
            FACILITY_SETUPAPI 15  
            FACILITY_CONTROL 10  
            FACILITY_CERT 11  
            FACILITY_INTERNET 12  
            FACILITY_MEDIASERVER 13  
            FACILITY_MSMQ 14  

            The code field is a unique number that is assigned to represent the error or warning.

            By convention, HRESULTs generally have names in the following format:

                    Facility_Severity_Reason
            

            Facility is either the facility name or some other distinguishing identifier; Severity is a single letter, S or E, that indicates whether the function call succeeded (S) or produced an error (E); and Reason is an identifier that describes the meaning of the code. For example, the status code STG_E_FILENOTFOUND indicates a storage-related error has occurred; specifically, a requested file does not exist. Status codes from FACILITY_NULL omit the Facility_ prefix.

            Error codes are defined within the context of an interface implementation. Once defined, success codes cannot be changed or new success codes added. However, new failure codes can be written. Microsoft reserves the right to define new failure codes (but not success codes) for the interfaces described in FACILITY_ITF or in new facilities.

            posted on 2008-08-11 10:33 FongLuo 閱讀(524) 評論(0)  編輯 收藏 引用


            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            <2016年5月>
            24252627282930
            1234567
            891011121314
            15161718192021
            22232425262728
            2930311234

            導(dǎo)航

            常用鏈接

            留言簿

            隨筆分類(11)

            隨筆檔案(79)

            文章檔案(1)

            收藏夾(38)

            學(xué)習(xí)網(wǎng)站

            一般網(wǎng)站

            最新隨筆

            搜索

            積分與排名

            最新評論

            閱讀排行榜

            性做久久久久久久久浪潮| 久久久久综合网久久| 日本精品久久久久久久久免费| 久久e热在这里只有国产中文精品99 | 久久精品aⅴ无码中文字字幕不卡| 狠狠色婷婷久久综合频道日韩| 久久精品国产清高在天天线| 久久国产香蕉一区精品| 久久99国产综合精品女同| 狠狠综合久久综合中文88| 久久国产劲爆AV内射—百度| 91精品国产高清久久久久久91| 一本久道久久综合狠狠爱| 久久午夜综合久久| 久久久久亚洲av成人无码电影 | 99久久国产亚洲高清观看2024| 久久国产欧美日韩精品| 一本一本久久a久久综合精品蜜桃| 午夜精品久久影院蜜桃| 麻豆久久| 精品无码久久久久久午夜| 亚洲AV无码久久精品色欲| 久久精品国产亚洲av瑜伽| av无码久久久久久不卡网站| 久久免费视频1| 日日噜噜夜夜狠狠久久丁香五月| 日日狠狠久久偷偷色综合96蜜桃| 久久国产视频网| 亚洲精品无码久久久久久| 欧美精品久久久久久久自慰| 99久久中文字幕| 国产精品免费久久| 久久ZYZ资源站无码中文动漫| 亚洲国产二区三区久久| 亚洲乱码日产精品a级毛片久久 | 亚洲欧美一区二区三区久久| 国内精品久久久久影院一蜜桃 | 国产精品久久久久久久久软件| 蜜臀av性久久久久蜜臀aⅴ麻豆 | 国产精品99久久久精品无码 | aaa级精品久久久国产片|