GetRestrictedErrorInfo function winrt
Gets the restricted error information object set by a previous call to SetRestrictedErrorInfo in the current logical thread.
Throws a WindowsException on failure.
To learn more, see learn.microsoft.com/windows/win32/api/roerrorapi/nf-roerrorapi-getrestrictederrorinfo.
Implementation
IRestrictedErrorInfo? GetRestrictedErrorInfo() {
final ppRestrictedErrorInfo = adaptiveCalloc<VTablePointer>();
final hr$ = HRESULT(_GetRestrictedErrorInfo(ppRestrictedErrorInfo));
if (hr$.isError) {
free(ppRestrictedErrorInfo);
throw WindowsException(hr$);
}
final result$ = ppRestrictedErrorInfo.value;
free(ppRestrictedErrorInfo);
if (result$.isNull) return null;
return .new(result$);
}