- Timestamp:
- Jul 18, 2012 1:24:10 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r41819 r42209 118 118 /* Other VBox includes: */ 119 119 #include <iprt/asm.h> 120 #include <iprt/ctype.h> 120 121 #include <iprt/err.h> 121 122 #include <iprt/param.h> … … 125 126 #include <iprt/ldr.h> 126 127 #include <iprt/system.h> 128 #include <iprt/stream.h> 127 129 128 130 #include <VBox/vd.h> … … 305 307 , mVerString("1.0") 306 308 , m3DAvailable(false) 309 , mSettingsPwSet(false) 307 310 { 308 311 } … … 4402 4405 vm_render_mode_str = qApp->argv() [i]; 4403 4406 } 4407 else if (!::strcmp (arg, "--settingspw")) 4408 { 4409 if (++i < argc) 4410 { 4411 RTStrCopy(mSettingsPw, sizeof(mSettingsPw), qApp->argv() [i]); 4412 mSettingsPwSet = true; 4413 } 4414 } 4415 else if (!::strcmp (arg, "--settingspwfile")) 4416 { 4417 if (++i < argc) 4418 { 4419 size_t cbFile; 4420 char *pszFile = qApp->argv() [i]; 4421 bool fStdIn = !::strcmp(pszFile, "stdin"); 4422 int vrc = VINF_SUCCESS; 4423 PRTSTREAM pStrm; 4424 if (!fStdIn) 4425 vrc = RTStrmOpen(pszFile, "r", &pStrm); 4426 else 4427 pStrm = g_pStdIn; 4428 if (RT_SUCCESS(vrc)) 4429 { 4430 vrc = RTStrmReadEx(pStrm, mSettingsPw, sizeof(mSettingsPw)-1, &cbFile); 4431 if (RT_SUCCESS(vrc)) 4432 { 4433 if (cbFile >= sizeof(mSettingsPw)-1) 4434 continue; 4435 else 4436 { 4437 unsigned i; 4438 for (i = 0; i < cbFile && !RT_C_IS_CNTRL(mSettingsPw[i]); i++) 4439 ; 4440 mSettingsPw[i] = '\0'; 4441 mSettingsPwSet = true; 4442 } 4443 } 4444 if (!fStdIn) 4445 RTStrmClose(pStrm); 4446 } 4447 } 4448 } 4404 4449 else if (!::strcmp (arg, "--no-startvm-errormsgbox")) 4405 {4406 4450 mShowStartVMErrors = false; 4407 }4408 4451 else if (!::strcmp(arg, "--disable-patm")) 4409 4452 mDisablePatm = true; … … 4477 4520 } 4478 4521 } 4522 4523 if (mSettingsPwSet) 4524 mVBox.SetSettingsSecret(mSettingsPw); 4479 4525 4480 4526 if (bForceSeamless && !vmUuid.isEmpty()) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r41819 r42209 535 535 #endif 536 536 537 char mSettingsPw[256]; 538 bool mSettingsPwSet; 539 537 540 friend VBoxGlobal &vboxGlobal(); 538 541 };
Note:
See TracChangeset
for help on using the changeset viewer.