Changeset 26322 in vbox for trunk/src/VBox/Frontends/VBoxSDL
- Timestamp:
- Feb 8, 2010 11:08:02 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 57403
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp
r26089 r26322 991 991 } 992 992 993 rc = com::Initialize();994 if (FAILED(rc))995 {996 RTPrintf("Error: COM initialization failed, rc = 0x%x!\n", rc);997 return 1;998 }999 1000 do1001 {1002 // scopes all the stuff till shutdown1003 ////////////////////////////////////////////////////////////////////////////1004 1005 ComPtr <IVirtualBox> virtualBox;1006 ComPtr <ISession> session;1007 bool sessionOpened = false;1008 1009 rc = virtualBox.createLocalObject (CLSID_VirtualBox);1010 if (FAILED(rc))1011 {1012 com::ErrorInfo info;1013 if (info.isFullAvailable())1014 PrintError("Failed to create VirtualBox object",1015 info.getText().raw(), info.getComponent().raw());1016 else1017 RTPrintf("Failed to create VirtualBox object! No error information available (rc = 0x%x).\n", rc);1018 break;1019 }1020 rc = session.createInprocObject (CLSID_Session);1021 if (FAILED(rc))1022 {1023 RTPrintf("Failed to create session object, rc = 0x%x!\n", rc);1024 break;1025 }1026 1027 EventQueue* eventQ = com::EventQueue::getMainEventQueue();1028 1029 /* Get the number of network adapters */1030 ULONG NetworkAdapterCount = 0;1031 ComPtr <ISystemProperties> sysInfo;1032 virtualBox->COMGETTER(SystemProperties) (sysInfo.asOutParam());1033 sysInfo->COMGETTER (NetworkAdapterCount) (&NetworkAdapterCount);1034 1035 993 // command line argument parsing stuff 1036 994 for (int curArg = 1; curArg < argc; curArg++) … … 1046 1004 { 1047 1005 RTPrintf("Error: VM not specified (UUID or name)!\n"); 1048 rc = E_FAIL; 1049 break; 1006 return 1; 1050 1007 } 1051 1008 // first check if a UUID was supplied … … 1062 1019 { 1063 1020 RTPrintf("Error: missing argument for comment!\n"); 1064 rc = E_FAIL; 1065 break; 1021 return 1; 1066 1022 } 1067 1023 } … … 1072 1028 { 1073 1029 RTPrintf("Error: missing argument for boot drive!\n"); 1074 rc = E_FAIL; 1075 break; 1030 return 1; 1076 1031 } 1077 1032 switch (argv[curArg][0]) … … 1104 1059 { 1105 1060 RTPrintf("Error: wrong argument for boot drive!\n"); 1106 rc = E_FAIL; 1107 break; 1061 return 1; 1108 1062 } 1109 1063 } 1110 if (FAILED (rc))1111 break;1112 1064 } 1113 1065 else if ( !strcmp(argv[curArg], "--memory") … … 1118 1070 { 1119 1071 RTPrintf("Error: missing argument for memory size!\n"); 1120 rc = E_FAIL; 1121 break; 1072 return 1; 1122 1073 } 1123 1074 memorySize = atoi(argv[curArg]); … … 1129 1080 { 1130 1081 RTPrintf("Error: missing argument for vram size!\n"); 1131 rc = E_FAIL; 1132 break; 1082 return 1; 1133 1083 } 1134 1084 vramSize = atoi(argv[curArg]); … … 1154 1104 { 1155 1105 RTPrintf("Error: missing arguments for fixed video mode!\n"); 1156 rc = E_FAIL; 1157 break; 1106 return 1; 1158 1107 } 1159 1108 fixedWidth = atoi(argv[++curArg]); … … 1183 1132 { 1184 1133 RTPrintf("Error: missing a string of disabled hostkey combinations\n"); 1185 rc = E_FAIL; 1186 break; 1134 return 1; 1187 1135 } 1188 1136 gHostKeyDisabledCombinations = argv[curArg]; … … 1194 1142 RTPrintf("Error: <hostkey> + '%c' is not a valid combination\n", 1195 1143 gHostKeyDisabledCombinations[i]); 1196 rc = E_FAIL; 1197 break; 1144 return 1; 1198 1145 } 1199 1146 } 1200 if (rc == E_FAIL)1201 break;1202 1147 } 1203 1148 else if ( !strcmp(argv[curArg], "--nograbonclick") … … 1217 1162 { 1218 1163 RTPrintf("Error: missing file name for --pidfile!\n"); 1219 rc = E_FAIL; 1220 break; 1164 return 1; 1221 1165 } 1222 1166 gpszPidFile = argv[curArg]; … … 1228 1172 { 1229 1173 RTPrintf("Error: missing file name for first hard disk!\n"); 1230 rc = E_FAIL; 1231 break; 1174 return 1; 1232 1175 } 1233 1176 /* resolve it. */ … … 1237 1180 { 1238 1181 RTPrintf("Error: The path to the specified harddisk, '%s', could not be resolved.\n", argv[curArg]); 1239 rc = E_FAIL; 1240 break; 1182 return 1; 1241 1183 } 1242 1184 } … … 1247 1189 { 1248 1190 RTPrintf("Error: missing file/device name for first floppy disk!\n"); 1249 rc = E_FAIL; 1250 break; 1191 return 1; 1251 1192 } 1252 1193 /* resolve it. */ … … 1256 1197 { 1257 1198 RTPrintf("Error: The path to the specified floppy disk, '%s', could not be resolved.\n", argv[curArg]); 1258 rc = E_FAIL; 1259 break; 1199 return 1; 1260 1200 } 1261 1201 } … … 1266 1206 { 1267 1207 RTPrintf("Error: missing file/device name for cdrom!\n"); 1268 rc = E_FAIL; 1269 break; 1208 return 1; 1270 1209 } 1271 1210 /* resolve it. */ … … 1275 1214 { 1276 1215 RTPrintf("Error: The path to the specified cdrom, '%s', could not be resolved.\n", argv[curArg]); 1277 rc = E_FAIL; 1278 break; 1216 return 1; 1279 1217 } 1280 1218 } … … 1320 1258 { 1321 1259 RTPrintf("Error: missing font file name for secure label!\n"); 1322 rc = E_FAIL; 1323 break; 1260 return 1; 1324 1261 } 1325 1262 secureLabelFontFile = argv[curArg]; … … 1331 1268 { 1332 1269 RTPrintf("Error: missing font point size for secure label!\n"); 1333 rc = E_FAIL; 1334 break; 1270 return 1; 1335 1271 } 1336 1272 secureLabelPointSize = atoi(argv[curArg]); … … 1342 1278 { 1343 1279 RTPrintf("Error: missing font pixel offset for secure label!\n"); 1344 rc = E_FAIL; 1345 break; 1280 return 1; 1346 1281 } 1347 1282 secureLabelFontOffs = atoi(argv[curArg]); … … 1353 1288 { 1354 1289 RTPrintf("Error: missing text color value for secure label!\n"); 1355 rc = E_FAIL; 1356 break; 1290 return 1; 1357 1291 } 1358 1292 sscanf(argv[curArg], "%X", &secureLabelColorFG); … … 1364 1298 { 1365 1299 RTPrintf("Error: missing background color value for secure label!\n"); 1366 rc = E_FAIL; 1367 break; 1300 return 1; 1368 1301 } 1369 1302 sscanf(argv[curArg], "%X", &secureLabelColorBG); … … 1407 1340 { 1408 1341 RTPrintf("Error: missing the rate value for the --warpdrive option!\n"); 1409 rc = E_FAIL; 1410 break; 1342 return 1; 1411 1343 } 1412 1344 u32WarpDrive = RTStrToUInt32(argv[curArg]); … … 1414 1346 { 1415 1347 RTPrintf("Error: the warp drive rate is restricted to [2..20000]. (%d)\n", u32WarpDrive); 1416 rc = E_FAIL; 1417 break; 1348 return 1; 1418 1349 } 1419 1350 } … … 1433 1364 { 1434 1365 RTPrintf("Error: not enough arguments for host keys!\n"); 1435 rc = E_FAIL; 1436 break; 1366 return 1; 1437 1367 } 1438 1368 gHostKeySym1 = atoi(argv[curArg++]); … … 1455 1385 } 1456 1386 } 1387 1388 rc = com::Initialize(); 1457 1389 if (FAILED(rc)) 1390 { 1391 RTPrintf("Error: COM initialization failed, rc = 0x%x!\n", rc); 1392 return 1; 1393 } 1394 1395 do 1396 { 1397 // scopes all the stuff till shutdown 1398 //////////////////////////////////////////////////////////////////////////// 1399 1400 ComPtr <IVirtualBox> virtualBox; 1401 ComPtr <ISession> session; 1402 bool sessionOpened = false; 1403 1404 rc = virtualBox.createLocalObject (CLSID_VirtualBox); 1405 if (FAILED(rc)) 1406 { 1407 com::ErrorInfo info; 1408 if (info.isFullAvailable()) 1409 PrintError("Failed to create VirtualBox object", 1410 info.getText().raw(), info.getComponent().raw()); 1411 else 1412 RTPrintf("Failed to create VirtualBox object! No error information available (rc = 0x%x).\n", rc); 1458 1413 break; 1414 } 1415 rc = session.createInprocObject (CLSID_Session); 1416 if (FAILED(rc)) 1417 { 1418 RTPrintf("Failed to create session object, rc = 0x%x!\n", rc); 1419 break; 1420 } 1421 1422 EventQueue* eventQ = com::EventQueue::getMainEventQueue(); 1459 1423 1460 1424 /* … … 2922 2886 LogFlow(("Returning from main()!\n")); 2923 2887 RTLogFlush(NULL); 2924 return FAILED 2888 return FAILED(rc) ? 1 : 0; 2925 2889 } 2926 2890
Note:
See TracChangeset
for help on using the changeset viewer.