From: Anna R Békefi <annareginabekefi@gmail.com> --- dlls/combase/errorinfo.c | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/dlls/combase/errorinfo.c b/dlls/combase/errorinfo.c index 47934c199cb..a617dd4b47c 100644 --- a/dlls/combase/errorinfo.c +++ b/dlls/combase/errorinfo.c @@ -658,3 +658,45 @@ HRESULT create_restricted_error_info(HRESULT hr, const WCHAR *description, *ret = &info->IRestrictedErrorInfo_iface; return S_OK; } + +HRESULT capture_restricted_error_context(IRestrictedErrorInfo *iface, HRESULT hr) +{ + struct restricted_error_info *info; + ULONG hash = 0; + + TRACE("%p, %#lx.\n", iface, hr); + + if (!iface) + return E_INVALIDARG; + + info = impl_from_IRestrictedErrorInfo(iface); + + info->hr = hr; + memset(info->stack_frames, 0, sizeof(info->stack_frames)); + info->stack_frame_count = RtlCaptureStackBackTrace(1, ARRAY_SIZE(info->stack_frames), + info->stack_frames, &hash); + info->stack_hash = hash; + info->context_captured = TRUE; + + return S_OK; +} + +HRESULT copy_restricted_error_context(IRestrictedErrorInfo *dst_iface, IRestrictedErrorInfo *src_iface) +{ + struct restricted_error_info *dst, *src; + + TRACE("%p, %p.\n", dst_iface, src_iface); + + if (!dst_iface || !src_iface) + return E_INVALIDARG; + + dst = impl_from_IRestrictedErrorInfo(dst_iface); + src = impl_from_IRestrictedErrorInfo(src_iface); + + dst->context_captured = src->context_captured; + dst->stack_frame_count = src->stack_frame_count; + memcpy(dst->stack_frames, src->stack_frames, sizeof(dst->stack_frames)); + dst->stack_hash = src->stack_hash; + + return S_OK; +} -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10659