Changeset 20928 in vbox for trunk/src/VBox/Frontends/VBoxHeadless
- Timestamp:
- Jun 25, 2009 11:53:37 AM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxHeadless
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
r20225 r20928 6 6 7 7 /* 8 * Copyright (C) 2006-200 7Sun Microsystems, Inc.8 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 25 25 #include <VBox/com/Guid.h> 26 26 #include <VBox/com/ErrorInfo.h> 27 #include <VBox/com/errorprint 2.h>27 #include <VBox/com/errorprint.h> 28 28 #include <VBox/com/EventQueue.h> 29 29 -
trunk/src/VBox/Frontends/VBoxHeadless/testcase/Makefile.kmk
r12258 r20928 5 5 6 6 # 7 # Copyright (C) 2006-200 7Sun Microsystems, Inc.7 # Copyright (C) 2006-2009 Sun Microsystems, Inc. 8 8 # 9 9 # This file is part of VirtualBox Open Source Edition (OSE), as … … 24 24 25 25 ifdef VBOX_WITH_TESTCASES 26 PROGRAMS += tstHeadless 227 tstHeadless 2_TEMPLATE = VBOXMAINCLIENTEXE28 tstHeadless 2_SOURCES = tstHeadless.cpp26 PROGRAMS += tstHeadless 27 tstHeadless_TEMPLATE = VBOXMAINCLIENTEXE 28 tstHeadless_SOURCES = tstHeadless.cpp 29 29 endif 30 30 -
trunk/src/VBox/Frontends/VBoxHeadless/testcase/tstHeadless.cpp
r20225 r20928 6 6 7 7 /* 8 * Copyright (C) 2006-200 7Sun Microsystems, Inc.8 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 25 25 #include <VBox/com/Guid.h> 26 26 #include <VBox/com/ErrorInfo.h> 27 #include <VBox/com/errorprint _legacy.h>27 #include <VBox/com/errorprint.h> 28 28 #include <VBox/com/EventQueue.h> 29 29 … … 75 75 HRESULT rc; 76 76 77 CHECK_RC_RET (com::Initialize()); 77 rc = com::Initialize(); 78 if (FAILED(rc)) 79 { 80 RTPrintf("ERROR: failed to initialize COM!\n"); 81 return rc; 82 } 78 83 79 84 do … … 83 88 84 89 RTPrintf ("Creating VirtualBox object...\n"); 85 CHECK_ERROR_NI_BREAK (virtualBox.createLocalObject (CLSID_VirtualBox)); 86 87 RTPrintf ("Creating Session object...\n"); 88 CHECK_ERROR_NI_BREAK (session.createInprocObject (CLSID_Session)); 90 rc = virtualBox.createLocalObject (CLSID_VirtualBox); 91 if (FAILED(rc)) 92 RTPrintf("ERROR: failed to create the VirtualBox object!\n"); 93 else 94 { 95 rc = session.createInprocObject(CLSID_Session); 96 if (FAILED(rc)) 97 RTPrintf("ERROR: failed to create a session object!\n"); 98 } 99 100 if (FAILED (rc)) 101 { 102 com::ErrorInfo info; 103 if (!info.isFullAvailable() && !info.isBasicAvailable()) 104 { 105 com::GluePrintRCMessage(rc); 106 RTPrintf("Most likely, the VirtualBox COM server is not running or failed to start.\n"); 107 } 108 else 109 com::GluePrintErrorInfo(info); 110 break; 111 } 89 112 90 113 // create the event queue … … 124 147 COMGETTER(ErrorInfo) (errorInfo.asOutParam())); 125 148 ErrorInfo info (errorInfo); 126 PRINT_ERROR_INFO(info);149 com::GluePrintErrorInfo(info); 127 150 } 128 151 else … … 141 164 if (!strcmp (operation, "off")) 142 165 { 166 ComPtr <IProgress> progress; 143 167 RTPrintf ("Powering the VM off...\n"); 144 CHECK_ERROR_BREAK (console, PowerDown()); 168 CHECK_ERROR_BREAK (console, PowerDown(progress.asOutParam())); 169 170 RTPrintf ("Waiting for the VM to power down...\n"); 171 CHECK_ERROR_BREAK (progress, WaitForCompletion (-1)); 172 173 BOOL completed; 174 CHECK_ERROR_BREAK (progress, COMGETTER(Completed) (&completed)); 175 ASSERT (completed); 176 177 LONG resultCode; 178 CHECK_ERROR_BREAK (progress, COMGETTER(ResultCode) (&resultCode)); 179 if (FAILED (resultCode)) 180 { 181 ComPtr <IVirtualBoxErrorInfo> errorInfo; 182 CHECK_ERROR_BREAK (progress, 183 COMGETTER(ErrorInfo) (errorInfo.asOutParam())); 184 ErrorInfo info (errorInfo); 185 com::GluePrintErrorInfo(info); 186 } 187 else 188 { 189 RTPrintf ("VM is powered down.\n"); 190 } 145 191 } 146 192 else
Note:
See TracChangeset
for help on using the changeset viewer.