Changeset 2459 in vbox for trunk/src/VBox/Main
- Timestamp:
- May 3, 2007 9:40:33 AM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 20872
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/testcase/tstVBoxAPIWin.cpp
r1 r2459 80 80 } 81 81 82 int testErrorInfo(IVirtualBox *virtualBox) 83 { 84 HRESULT rc; 85 86 /* try to find a machine that doesn't exist */ 87 IMachine *machine = NULL; 88 BSTR machineName = SysAllocString(L"Foobar"); 89 90 rc = virtualBox->FindMachine(machineName, &machine); 91 92 if (FAILED(rc)) 93 { 94 IErrorInfo *errorInfo; 95 96 rc = GetErrorInfo(0, &errorInfo); 97 98 if (FAILED(rc)) 99 printf("Error getting error info! rc = 0x%x\n", rc); 100 else 101 { 102 BSTR errorDescription = NULL; 103 104 rc = errorInfo->GetDescription(&errorDescription); 105 106 if (FAILED(rc) || !errorDescription) 107 printf("Error getting error description! rc = 0x%x\n", rc); 108 else 109 { 110 printf("Successfully retrieved error description: %S\n", errorDescription); 111 112 SysFreeString(errorDescription); 113 } 114 115 errorInfo->Release(); 116 } 117 } 118 119 if (machine) 120 machine->Release(); 121 122 SysFreeString(machineName); 123 124 return 0; 125 } 126 82 127 83 128 int main(int argc, char *argv[]) … … 106 151 listVMs(virtualBox); 107 152 153 testErrorInfo(virtualBox); 108 154 109 155 /* release the VirtualBox object */
Note:
See TracChangeset
for help on using the changeset viewer.