1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#![cfg(windows)]
extern crate winapi;
use winapi::*;
extern "system" {
pub fn RoInitialize(initType: RO_INIT_TYPE) -> HRESULT;
pub fn RoUninitialize();
pub fn RoActivateInstance(activatableClassId: HSTRING, instance: *mut *mut IInspectable) -> HRESULT;
pub fn RoRegisterActivationFactories(
activatableClassIds: *const HSTRING,
activationFactoryCallbacks: *const PFNGETACTIVATIONFACTORY,
count: UINT32,
cookie: *mut RO_REGISTRATION_COOKIE,
) -> HRESULT;
pub fn RoRevokeActivationFactories(cookie: RO_REGISTRATION_COOKIE);
pub fn RoGetActivationFactory(
activatableClassId: HSTRING, iid: REFIID, factory: *mut *mut VOID
) -> HRESULT;
pub fn RoRegisterForApartmentShutdown(
callbackObject: *const IApartmentShutdown, apartmentIdentifier: *mut UINT64,
regCookie: *mut APARTMENT_SHUTDOWN_REGISTRATION_COOKIE,
) -> HRESULT;
pub fn RoUnregisterForApartmentShutdown(
regCookie: APARTMENT_SHUTDOWN_REGISTRATION_COOKIE,
) -> HRESULT;
pub fn RoGetApartmentIdentifier(apartmentIdentifier: *mut UINT64) -> HRESULT;
pub fn RoGetBufferMarshaler(bufferMarshaler: *mut *mut IMarshal) -> HRESULT;
pub fn RoGetErrorReportingFlags(pflags: *mut UINT32) -> HRESULT;
pub fn RoSetErrorReportingFlags(flags: UINT32) -> HRESULT;
pub fn RoResolveRestrictedErrorInfoReference(
reference: PCWSTR, ppRestrictedErrorInfo: *mut *mut IRestrictedErrorInfo
) -> HRESULT;
pub fn SetRestrictedErrorInfo(pRestrictedErrorInfo: *const IRestrictedErrorInfo) -> HRESULT;
pub fn GetRestrictedErrorInfo(
ppRestrictedErrorInfo: *mut *mut IRestrictedErrorInfo
) -> HRESULT;
pub fn RoOriginateErrorW(error: HRESULT, cchMax: UINT, message: PCWSTR) -> BOOL;
pub fn RoOriginateError(error: HRESULT, message: HSTRING) -> BOOL;
pub fn RoTransformErrorW(
oldError: HRESULT, newError: HRESULT, cchMax: UINT, message: PCWSTR
) -> BOOL;
pub fn RoTransformError(oldError: HRESULT, newError: HRESULT, message: HSTRING) -> BOOL;
pub fn RoCaptureErrorContext(hr: HRESULT) -> HRESULT;
pub fn RoFailFastWithErrorContext(hrError: HRESULT);
pub fn RoOriginateLanguageException(
error: HRESULT, message: HSTRING, languageException: *const IUnknown
) -> BOOL;
pub fn RoClearError();
pub fn RoReportUnhandledError(pRestrictedErrorInfo: *const IRestrictedErrorInfo) -> HRESULT;
pub fn RoInspectThreadErrorInfo(
targetTebAddress: UINT_PTR, machine: USHORT, readMemoryCallback: PINSPECT_MEMORY_CALLBACK,
context: PVOID, targetErrorInfoAddress: *mut UINT_PTR,
) -> HRESULT;
pub fn RoInspectCapturedStackBackTrace(
targetErrorInfoAddress: UINT_PTR, machine: USHORT,
readMemoryCallback: PINSPECT_MEMORY_CALLBACK, context: PVOID, frameCount: *mut UINT32,
targetBackTraceAddress: *mut UINT_PTR,
) -> HRESULT;
pub fn RoGetMatchingRestrictedErrorInfo(
hrIn: HRESULT, ppRestrictedErrorInfo: *mut *mut IRestrictedErrorInfo,
) -> HRESULT;
pub fn RoReportFailedDelegate(
punkDelegate: *const IUnknown, pRestrictedErrorInfo: *const IRestrictedErrorInfo,
) -> HRESULT;
pub fn IsErrorPropagationEnabled() -> BOOL;
pub fn WindowsCreateString(
sourceString: PCWSTR, length: UINT32, string: *mut HSTRING
) -> HRESULT;
pub fn WindowsCreateStringReference(
sourceString: PCWSTR, length: UINT32, hstringHeader: *mut HSTRING_HEADER,
string: *mut HSTRING
) -> HRESULT;
pub fn WindowsDeleteString(string: HSTRING) -> HRESULT;
pub fn WindowsDuplicateString(
string: HSTRING, newString: *mut HSTRING
) -> HRESULT;
pub fn WindowsGetStringLen(string: HSTRING) -> UINT32;
pub fn WindowsGetStringRawBuffer(string: HSTRING, length: *mut UINT32) -> PCWSTR;
pub fn WindowsIsStringEmpty(string: HSTRING) -> BOOL;
pub fn WindowsStringHasEmbeddedNull(string: HSTRING, hasEmbedNull: *mut BOOL) -> HRESULT;
pub fn WindowsCompareStringOrdinal(
string1: HSTRING, string2: HSTRING, result: *mut INT32
) -> HRESULT;
pub fn WindowsSubstring(
string: HSTRING, startIndex: UINT32, newString: *mut HSTRING
) -> HSTRING;
pub fn WindowsSubstringWithSpecifiedLength(
string: HSTRING, startIndex: UINT32, length: UINT32, newString: *mut HSTRING
) -> HRESULT;
pub fn WindowsConcatString(
string1: HSTRING, string2: HSTRING, newString: *mut HSTRING
) -> HRESULT;
pub fn WindowsReplaceString(
string: HSTRING, stringReplaced: HSTRING, stringReplaceWith: HSTRING,
newString: *mut HSTRING
) -> HRESULT;
pub fn WindowsTrimStringStart(
string: HSTRING, trimString: HSTRING, newString: *mut HSTRING
) -> HRESULT;
pub fn WindowsTrimStringEnd(
string: HSTRING, trimString: HSTRING, newString: *mut HSTRING
) -> HRESULT;
pub fn WindowsPreallocateStringBuffer(
length: UINT32, charBuffer: *mut *mut WCHAR, bufferHandle: *mut HSTRING_BUFFER
) -> HRESULT;
pub fn WindowsPromoteStringBuffer(
bufferHandle: HSTRING_BUFFER, string: *mut HSTRING
) -> HRESULT;
pub fn WindowsDeleteStringBuffer(
bufferHandle: HSTRING_BUFFER
) -> HRESULT;
pub fn WindowsInspectString(
targetHString: UINT_PTR, machine: USHORT, callback: PINSPECT_HSTRING_CALLBACK,
context: *const VOID, length: *mut UINT32, targetStringAddress: *mut UINT_PTR
) -> HRESULT;
pub fn HSTRING_UserSize(
pFlags: *const ULONG, StartingSize: ULONG, ppidl: *const HSTRING
) -> ULONG;
pub fn HSTRING_UserMarshal(
pFlags: *const ULONG, pBuffer: *mut UCHAR, ppidl: *const HSTRING
) -> *mut UCHAR;
pub fn HSTRING_UserUnmarshal(
pFlags: *const ULONG, pBuffer: *const UCHAR, ppidl: *mut HSTRING
) -> *mut UCHAR;
pub fn HSTRING_UserFree(
pFlags: *const ULONG, ppidl: *const HSTRING
);
}
#[cfg(target_arch = "x86_64")]
extern "system" {
pub fn HSTRING_UserSize64(
pFlags: *const ULONG, StartingSize: ULONG, ppidl: *const HSTRING
) -> ULONG;
pub fn HSTRING_UserMarshal64(
pFlags: *const ULONG, pBuffer: *mut UCHAR, ppidl: *const HSTRING
) -> *mut UCHAR;
pub fn HSTRING_UserUnmarshal64(
pFlags: *const ULONG, pBuffer: *const UCHAR, ppidl: *mut HSTRING
) -> *mut UCHAR;
pub fn HSTRING_UserFree64(
pFlags: *const ULONG, ppidl: *const HSTRING
);
}