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(a)redhat.com>
---
src/vbox/vbox_common.h | 2 ++
src/vbox/vbox_tmpl.c | 6 ++++++
src/vbox/vbox_uniformed_api.h | 1 +
3 files changed, 9 insertions(+)
diff --git a/src/vbox/vbox_common.h b/src/vbox/vbox_common.h
index 78c36dcb19..08da0845a6 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 06cdd82e12..ba7dc34a6b 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -483,6 +483,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));
@@ -2237,6 +2242,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 b0674b4815..465a7877d9 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 */
--
2.39.1