Changeset 9884 in vbox
- Timestamp:
- Jun 23, 2008 3:04:43 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r9551 r9884 648 648 "\n"); 649 649 } 650 651 if (u64Cmd & USAGE_GETCONFIGVAL) 652 { 653 RTPrintf("VBoxManage getconfigval <vmname>|<uuid> <key>\n" 654 "\n"); 655 } 656 657 if (u64Cmd & USAGE_SETCONFIGVAL) 658 { 659 RTPrintf("VBoxManage setconfigval <vmname>|<uuid> <key>\n" 660 " [<value>] (no value deletes key)\n" 661 "\n"); 662 } 663 650 664 } 651 665 … … 7456 7470 } 7457 7471 7472 static int handleGetConfigVal(int argc, char *argv[], 7473 ComPtr<IVirtualBox> virtualBox, ComPtr<ISession> session) 7474 { 7475 HRESULT rc = S_OK; 7476 7477 if (argc != 2) 7478 return errorSyntax(USAGE_GETCONFIGVAL, "Incorrect number of parameters"); 7479 7480 ComPtr<IMachine> machine; 7481 /* assume it's a UUID */ 7482 rc = virtualBox->GetMachine(Guid(argv[0]), machine.asOutParam()); 7483 if (FAILED(rc) || !machine) 7484 { 7485 /* must be a name */ 7486 CHECK_ERROR(virtualBox, FindMachine(Bstr(argv[0]), machine.asOutParam())); 7487 } 7488 if (machine) 7489 { 7490 #if 0 7491 /* enumeration? */ 7492 if (strcmp(argv[1], "enumerate") == 0) 7493 { 7494 Bstr extraDataKey; 7495 7496 do 7497 { 7498 Bstr nextExtraDataKey; 7499 Bstr nextExtraDataValue; 7500 HRESULT rcEnum = machine->GetNextExtraDataKey(extraDataKey, nextExtraDataKey.asOutParam(), 7501 nextExtraDataValue.asOutParam()); 7502 extraDataKey = nextExtraDataKey; 7503 7504 if (SUCCEEDED(rcEnum) && extraDataKey) 7505 { 7506 RTPrintf("Key: %lS, Value: %lS\n", nextExtraDataKey.raw(), nextExtraDataValue.raw()); 7507 } 7508 } while (extraDataKey); 7509 } 7510 else 7511 #endif /* 0 */ 7512 { 7513 Bstr value; 7514 CHECK_ERROR(machine, GetConfigRegistryValue(Bstr(argv[1]), value.asOutParam())); 7515 if (value) 7516 RTPrintf("Value: %lS\n", value.raw()); 7517 else 7518 RTPrintf("No value set!\n"); 7519 } 7520 } 7521 return SUCCEEDED(rc) ? 0 : 1; 7522 } 7523 7524 static int handleSetConfigVal(int argc, char *argv[], 7525 ComPtr<IVirtualBox> virtualBox, ComPtr<ISession> session) 7526 { 7527 HRESULT rc = S_OK; 7528 7529 if (argc < 2) 7530 return errorSyntax(USAGE_SETCONFIGVAL, "Not enough parameters"); 7531 7532 ComPtr<IMachine> machine; 7533 /* assume it's a UUID */ 7534 rc = virtualBox->GetMachine(Guid(argv[0]), machine.asOutParam()); 7535 if (FAILED(rc) || !machine) 7536 { 7537 /* must be a name */ 7538 CHECK_ERROR(virtualBox, FindMachine(Bstr(argv[0]), machine.asOutParam())); 7539 } 7540 if (machine) 7541 { 7542 if (argc < 3) 7543 CHECK_ERROR(machine, SetConfigRegistryValue(Bstr(argv[1]), NULL)); 7544 else if (argc == 3) 7545 CHECK_ERROR(machine, SetConfigRegistryValue(Bstr(argv[1]), Bstr(argv[2]))); 7546 else 7547 return errorSyntax(USAGE_SETCONFIGVAL, "Too many parameters"); 7548 } 7549 return SUCCEEDED(rc) ? 0 : 1; 7550 } 7551 7458 7552 enum ConvertSettings 7459 7553 { … … 7790 7884 { "sharedfolder", handleSharedFolder }, 7791 7885 { "vmstatistics", handleVMStatistics }, 7886 { "getconfigval", handleGetConfigVal }, 7887 { "setconfigval", handleSetConfigVal }, 7792 7888 { NULL, NULL } 7793 7889 }; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r9103 r9884 70 70 #define USAGE_MODUNINSTALL RT_BIT_64(38) 71 71 #define USAGE_RENAMEVMDK RT_BIT_64(39) 72 #define USAGE_GETCONFIGVAL RT_BIT_64(40) 73 #define USAGE_SETCONFIGVAL RT_BIT_64(41) 72 74 #define USAGE_ALL (~(uint64_t)0) 73 75 /** @} */
Note:
See TracChangeset
for help on using the changeset viewer.