mirror of https://github.com/BOINC/boinc.git
VBOX: Update error dump function with ATL Wrapper classes.
This commit is contained in:
parent
e9acbfc8a8
commit
7c0fa017ef
|
@ -46,6 +46,39 @@
|
|||
using std::string;
|
||||
|
||||
|
||||
// Helper function to print MSCOM exception information set on the current
|
||||
// thread after a failed MSCOM method call. This function will also print
|
||||
// extended VirtualBox error info if it is available.
|
||||
//
|
||||
void virtualbox_dump_error() {
|
||||
HRESULT rc;
|
||||
char buf[256];
|
||||
CComPtr<IErrorInfo> pErrorInfo;
|
||||
CComBSTR strDescription;
|
||||
|
||||
rc = GetErrorInfo(0, &pErrorInfo);
|
||||
|
||||
if (FAILED(rc)) {
|
||||
fprintf(
|
||||
stderr,
|
||||
"%s Error: getting error info! rc = 0x%x\n",
|
||||
vboxwrapper_msg_prefix(buf, sizeof(buf)),
|
||||
rc
|
||||
);
|
||||
} else {
|
||||
rc = pErrorInfo->GetDescription(&strDescription);
|
||||
if (SUCCEEDED(rc)) {
|
||||
fprintf(
|
||||
stderr,
|
||||
"%s Error description: %S\n",
|
||||
vboxwrapper_msg_prefix(buf, sizeof(buf)),
|
||||
CW2A(strDescription)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char *MachineStateToName(MachineState State)
|
||||
{
|
||||
switch (State)
|
||||
|
@ -97,49 +130,6 @@ const char *MachineStateToName(MachineState State)
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// Helper function to print MSCOM exception information set on the current
|
||||
// thread after a failed MSCOM method call. This function will also print
|
||||
// extended VirtualBox error info if it is available.
|
||||
//
|
||||
void virtualbox_dump_error() {
|
||||
HRESULT rc;
|
||||
BSTR strDescription = NULL;
|
||||
char buf[256];
|
||||
IErrorInfo* pErrorInfo;
|
||||
|
||||
rc = GetErrorInfo(0, &pErrorInfo);
|
||||
|
||||
if (FAILED(rc)) {
|
||||
fprintf(
|
||||
stderr,
|
||||
"%s Error: getting error info! rc = 0x%x\n",
|
||||
vboxwrapper_msg_prefix(buf, sizeof(buf)),
|
||||
rc
|
||||
);
|
||||
} else {
|
||||
rc = pErrorInfo->GetDescription(&strDescription);
|
||||
if (FAILED(rc) || !strDescription) {
|
||||
fprintf(
|
||||
stderr,
|
||||
"%s Error: getting error description! rc = 0x%x\n",
|
||||
vboxwrapper_msg_prefix(buf, sizeof(buf)),
|
||||
rc
|
||||
);
|
||||
} else {
|
||||
fprintf(
|
||||
stderr,
|
||||
"%s Error description: %S\n",
|
||||
vboxwrapper_msg_prefix(buf, sizeof(buf)),
|
||||
strDescription
|
||||
);
|
||||
SysFreeString(strDescription);
|
||||
}
|
||||
pErrorInfo->Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VBOX_VM::VBOX_VM()
|
||||
{
|
||||
VBOX_BASE::VBOX_BASE();
|
||||
|
|
Loading…
Reference in New Issue