From: Michal Privoznik Date: Thu, 19 Jan 2023 16:34:04 +0000 (+0100) Subject: vbox: Introduce vboxUniformedPFN::GetException() X-Git-Tag: v9.1.0-rc1~183 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52aefc9d31f127b64431a4e4aa2922ec5f4e4f67;p=thirdparty%2Flibvirt.git vbox: Introduce vboxUniformedPFN::GetException() The GetException() method can be used to obtain the latest exception that occurred in VirtualBox. Calling the method does not reset the exception though. For that we'll need to call another method (introduced in following commit). Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- diff --git a/src/vbox/vbox_common.h b/src/vbox/vbox_common.h index 1893c280bd..b81b62187c 100644 --- a/src/vbox/vbox_common.h +++ b/src/vbox/vbox_common.h @@ -109,6 +109,7 @@ typedef unsigned long PRUword; #define nsnull 0 typedef PRUint32 nsresult; +#define HRESULT nsresult #if defined(__GNUC__) && (__GNUC__ > 2) # define NS_LIKELY(x) (__builtin_expect((x), 1)) @@ -362,6 +363,7 @@ typedef nsISupports IHostNetworkInterface; typedef nsISupports IDHCPServer; typedef nsISupports IKeyboard; typedef nsISupports IVirtualBoxErrorInfo; +typedef struct nsIException nsIException; /* Macros for all vbox drivers. */ diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 9800b8fceb..d95a2d2dc6 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -481,6 +481,11 @@ static int _pfnUtf8ToUtf16(PCVBOXXPCOM pFuncs, const char *pszString, PRUnichar return pFuncs->pfnUtf8ToUtf16(pszString, ppwszString); } +static HRESULT _pfnGetException(PCVBOXXPCOM pFuncs, IErrorInfo **ppException) +{ + return pFuncs->pfnGetException(ppException); +} + static void _vboxIIDInitialize(vboxIID *iid) { memset(iid, 0, sizeof(vboxIID)); @@ -2218,6 +2223,7 @@ static vboxUniformedPFN _UPFN = { .Utf8Free = _pfnUtf8Free, .Utf16ToUtf8 = _pfnUtf16ToUtf8, .Utf8ToUtf16 = _pfnUtf8ToUtf16, + .GetException = _pfnGetException, }; static vboxUniformedIID _UIID = { diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h index 5fbc1bf77d..9d55bd0dd7 100644 --- a/src/vbox/vbox_uniformed_api.h +++ b/src/vbox/vbox_uniformed_api.h @@ -109,6 +109,7 @@ typedef struct { void (*Utf8Free)(PCVBOXXPCOM pFuncs, char *pszString); int (*Utf16ToUtf8)(PCVBOXXPCOM pFuncs, const PRUnichar *pwszString, char **ppszString); int (*Utf8ToUtf16)(PCVBOXXPCOM pFuncs, const char *pszString, PRUnichar **ppwszString); + HRESULT (*GetException)(PCVBOXXPCOM pFuncs, nsIException **ppException); } vboxUniformedPFN; /* Functions for vboxIID */