Changeset 103532 in vbox for trunk/src/VBox/Frontends/VBoxManage
- Timestamp:
- Feb 22, 2024 2:05:31 PM (15 months ago)
- svn:sync-xref-src-repo-rev:
- 161878
- Location:
- trunk/src/VBox/Frontends/VBoxManage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r101125 r103532 1414 1414 if (bstrNVRAMFile.isNotEmpty()) 1415 1415 SHOW_BSTR_STRING("BIOS NVRAM File", Info::tr("BIOS NVRAM File:"), bstrNVRAMFile); 1416 if ( firmwareType == FirmwareType_EFI || firmwareType == FirmwareType_EFI32 1417 || firmwareType == FirmwareType_EFI64 || firmwareType == FirmwareType_EFIDUAL) 1418 { 1419 ComPtr<IUefiVariableStore> uefiVarStore; 1420 CHECK_ERROR_RET(nvramStore, COMGETTER(UefiVariableStore)(uefiVarStore.asOutParam()), hrc); 1421 SHOW_BOOLEAN_PROP(uefiVarStore, SecureBootEnabled, "SecureBoot", Info::tr("UEFI Secure Boot:")); 1422 } 1416 1423 SHOW_BOOLEAN_PROP_EX(platform, RTCUseUTC, "rtcuseutc", Info::tr("RTC:"), "UTC", Info::tr("local time")); 1417 1424 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyNvram.cpp
r98988 r103532 64 64 static RTEXITCODE handleModifyNvramInitUefiVarStore(HandlerArg *a, ComPtr<INvramStore> &nvramStore) 65 65 { 66 RT_NOREF(a); 66 if (a->argc != 2) 67 return errorTooManyParameters(&a->argv[1]); 67 68 68 69 CHECK_ERROR2I_RET(nvramStore, InitUefiVariableStore(0 /*aSize*/), RTEXITCODE_FAILURE); … … 79 80 static RTEXITCODE handleModifyNvramEnrollMsSignatures(HandlerArg *a, ComPtr<INvramStore> &nvramStore) 80 81 { 81 RT_NOREF(a); 82 if (a->argc != 2) 83 return errorTooManyParameters(&a->argv[1]); 82 84 83 85 ComPtr<IUefiVariableStore> uefiVarStore; … … 252 254 static RTEXITCODE handleModifyNvramEnrollOraclePlatformKey(HandlerArg *a, ComPtr<INvramStore> &nvramStore) 253 255 { 254 RT_NOREF(a); 256 if (a->argc != 2) 257 return errorTooManyParameters(&a->argv[1]); 255 258 256 259 ComPtr<IUefiVariableStore> uefiVarStore; … … 263 266 264 267 /** 268 * Handles the 'modifynvram myvm secureboot' sub-command. 269 * @returns Exit code. 270 * @param a The handler argument package. 271 * @param nvram Reference to the NVRAM store interface. 272 */ 273 static RTEXITCODE handleModifyNvramSecureBoot(HandlerArg *a, ComPtr<INvramStore> &nvramStore) 274 { 275 static const RTGETOPTDEF s_aOptions[] = 276 { 277 /* common options */ 278 { "--enable", 'e', RTGETOPT_REQ_NOTHING }, 279 { "--disable", 'd', RTGETOPT_REQ_NOTHING } 280 }; 281 282 int enable = -1; 283 284 RTGETOPTSTATE GetState; 285 int vrc = RTGetOptInit(&GetState, a->argc - 2, &a->argv[2], s_aOptions, RT_ELEMENTS(s_aOptions), 0, 0); 286 AssertRCReturn(vrc, RTEXITCODE_FAILURE); 287 288 int c; 289 RTGETOPTUNION ValueUnion; 290 while ((c = RTGetOpt(&GetState, &ValueUnion)) != 0) 291 { 292 switch (c) 293 { 294 case 'e': // --enable 295 if (enable >= 0) 296 return errorSyntax(Nvram::tr("You can specify either --enable or --disable once.")); 297 enable = 1; 298 break; 299 300 case 'd': // --disable 301 if (enable >= 0) 302 return errorSyntax(Nvram::tr("You can specify either --enable or --disable once.")); 303 enable = 0; 304 break; 305 306 default: 307 return errorGetOpt(c, &ValueUnion); 308 } 309 } 310 311 if (enable < 0) 312 return errorSyntax(Nvram::tr("You have to specify either --enable or --disable.")); 313 314 ComPtr<IUefiVariableStore> uefiVarStore; 315 CHECK_ERROR2I_RET(nvramStore, COMGETTER(UefiVariableStore)(uefiVarStore.asOutParam()), RTEXITCODE_FAILURE); 316 317 CHECK_ERROR2I_RET(uefiVarStore, COMSETTER(SecureBootEnabled((BOOL)enable)), RTEXITCODE_FAILURE); 318 return RTEXITCODE_SUCCESS; 319 } 320 321 322 /** 265 323 * Handles the 'modifynvram myvm listvars' sub-command. 266 324 * @returns Exit code. … … 270 328 static RTEXITCODE handleModifyNvramListUefiVars(HandlerArg *a, ComPtr<INvramStore> &nvramStore) 271 329 { 272 RT_NOREF(a); 330 if (a->argc != 2) 331 return errorTooManyParameters(&a->argv[1]); 273 332 274 333 ComPtr<IUefiVariableStore> uefiVarStore; … … 362 421 } 363 422 else 364 rcExit = RTMsgErrorExitFailure(Nvram::tr("Error opening '%s': %Rrc"), pszVarDataFilename, vrc);423 rcExit = RTMsgErrorExitFailure(Nvram::tr("Error opening '%s': %Rrc"), pszVarDataFilename, vrc); 365 424 } 366 425 … … 491 550 } 492 551 else 493 rcExit = RTMsgErrorExitFailure(Nvram::tr("Error opening '%s': %Rrc"), pszVarDataFilename, vrc);552 rcExit = RTMsgErrorExitFailure(Nvram::tr("Error opening '%s': %Rrc"), pszVarDataFilename, vrc); 494 553 495 554 return rcExit; … … 548 607 hrc = handleModifyNvramEnrollOraclePlatformKey(a, nvramStore) == RTEXITCODE_SUCCESS ? S_OK : E_FAIL; 549 608 } 609 else if (!strcmp(a->argv[1], "secureboot")) 610 { 611 setCurrentSubcommand(HELP_SCOPE_MODIFYNVRAM_SECUREBOOT); 612 hrc = handleModifyNvramSecureBoot(a, nvramStore) == RTEXITCODE_SUCCESS ? S_OK : E_FAIL; 613 } 550 614 else if (!strcmp(a->argv[1], "listvars")) 551 615 { … … 569 633 } 570 634 else 571 return errorUnknownSubcommand(a->argv[ 0]);635 return errorUnknownSubcommand(a->argv[1]); 572 636 573 637 /* commit changes */
Note:
See TracChangeset
for help on using the changeset viewer.