winapi_ui_automation/winrt/
roerrorapi.rs

1// Licensed under the Apache License, Version 2.0
2// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4// All files in the project carrying such notice may not be copied, modified, or distributed
5// except according to those terms.
6use shared::basetsd::{UINT32, UINT_PTR};
7use shared::minwindef::{BOOL, BYTE, UINT, USHORT};
8use um::restrictederrorinfo::IRestrictedErrorInfo;
9use um::unknwnbase::IUnknown;
10use um::winnt::{HRESULT, PCWSTR, PVOID, VOID};
11use winrt::hstring::HSTRING;
12ENUM!{enum RO_ERROR_REPORTING_FLAGS {
13    RO_ERROR_REPORTING_NONE = 0x00000000,
14    RO_ERROR_REPORTING_SUPPRESSEXCEPTIONS = 0x00000001,
15    RO_ERROR_REPORTING_FORCEEXCEPTIONS = 0x00000002,
16    RO_ERROR_REPORTING_USESETERRORINFO = 0x00000004,
17    RO_ERROR_REPORTING_SUPPRESSSETERRORINFO = 0x00000008,
18}}
19extern "system" {
20    pub fn RoGetErrorReportingFlags(
21        pflags: *mut UINT32,
22    ) -> HRESULT;
23    pub fn RoSetErrorReportingFlags(
24        flags: UINT32,
25    ) -> HRESULT;
26    pub fn RoResolveRestrictedErrorInfoReference(
27        reference: PCWSTR,
28        ppRestrictedErrorInfo: *mut *mut IRestrictedErrorInfo ,
29    ) -> HRESULT;
30    pub fn SetRestrictedErrorInfo(
31        pRestrictedErrorInfo: *const IRestrictedErrorInfo,
32    ) -> HRESULT;
33    pub fn GetRestrictedErrorInfo(
34        ppRestrictedErrorInfo: *mut *mut IRestrictedErrorInfo,
35    ) -> HRESULT;
36    pub fn RoOriginateErrorW(
37        error: HRESULT,
38        cchMax: UINT,
39        message: PCWSTR,
40    ) -> BOOL;
41    pub fn RoOriginateError(
42        error: HRESULT,
43        message: HSTRING,
44    ) -> BOOL;
45    pub fn RoTransformErrorW(
46        oldError: HRESULT,
47        newError: HRESULT,
48        cchMax: UINT,
49        message: PCWSTR,
50    ) -> BOOL;
51    pub fn RoTransformError(
52        oldError: HRESULT,
53        newError: HRESULT,
54        message: HSTRING,
55    ) -> BOOL;
56    pub fn RoCaptureErrorContext(
57        hr: HRESULT,
58    ) -> HRESULT;
59    pub fn RoFailFastWithErrorContext(
60        hrError: HRESULT,
61    );
62    pub fn RoOriginateLanguageException(
63        error: HRESULT,
64        message: HSTRING,
65        languageException: *const IUnknown,
66    ) -> BOOL;
67    pub fn RoClearError();
68    pub fn RoReportUnhandledError(
69        pRestrictedErrorInfo: *const IRestrictedErrorInfo,
70    ) -> HRESULT;
71}
72FN!{stdcall PINSPECT_MEMORY_CALLBACK(
73    *const VOID,
74    UINT_PTR,
75    UINT32,
76    *mut BYTE,
77) -> HRESULT}
78extern "system" {
79    pub fn RoInspectThreadErrorInfo(
80        targetTebAddress: UINT_PTR,
81        machine: USHORT,
82        readMemoryCallback: PINSPECT_MEMORY_CALLBACK,
83        context: PVOID,
84        targetErrorInfoAddress: *mut UINT_PTR,
85    ) -> HRESULT;
86    pub fn RoInspectCapturedStackBackTrace(
87        targetErrorInfoAddress: UINT_PTR,
88        machine: USHORT,
89        readMemoryCallback: PINSPECT_MEMORY_CALLBACK,
90        context: PVOID,
91        frameCount: *mut UINT32,
92        targetBackTraceAddress: *mut UINT_PTR,
93    ) -> HRESULT;
94    pub fn RoGetMatchingRestrictedErrorInfo(
95        hrIn: HRESULT,
96        ppRestrictedErrorInfo: *mut *mut IRestrictedErrorInfo,
97    ) -> HRESULT;
98    pub fn RoReportFailedDelegate(
99        punkDelegate: *const IUnknown,
100        pRestrictedErrorInfo: *const IRestrictedErrorInfo,
101    ) -> HRESULT;
102    pub fn IsErrorPropagationEnabled() -> BOOL;
103}