]> xenbits.xensource.com Git - libvirt.git/commitdiff
vbox: Introduce vboxUniformedPFN::GetException()
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 19 Jan 2023 16:34:04 +0000 (17:34 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 24 Jan 2023 09:45:33 +0000 (10:45 +0100)
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 <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/vbox/vbox_common.h
src/vbox/vbox_tmpl.c
src/vbox/vbox_uniformed_api.h

index 1893c280bd9aaab9ad547461841df0dfc1072d9f..b81b62187c9c3d0c400b3eb9c3ebe3f9c71530fb 100644 (file)
@@ -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. */
 
index 9800b8fcebd86942f7dcf8c6c1894f076e1abbbc..d95a2d2dc6c3c2dbc54cc45b44e5f5a635cc44b1 100644 (file)
@@ -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 = {
index 5fbc1bf77d50dbcb41d9dfa945dfdeac21dfaf51..9d55bd0dd7a1adce48929dcfcf36aa11f3981f32 100644 (file)
@@ -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 */