Changeset 73196 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jul 18, 2018 10:45:52 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 123800
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/globals
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r73193 r73196 3814 3814 #endif 3815 3815 3816 /* 3817 * Parse the command line options. 3818 * 3819 * This is a little sloppy but we're trying to tighten it up. Unfortuately, 3820 * both on X11 and darwin (IIRC) there might be additional arguments aimed 3821 * for client libraries with GUI processes. So, using RTGetOpt or similar 3822 * is a bit hard since we have to cope with unknown options. 3823 */ 3816 3824 m_fShowStartVMErrors = true; 3817 3825 bool startVM = false; … … 3826 3834 const QByteArray &argBytes = arguments.at(i).toUtf8(); 3827 3835 const char *arg = argBytes.constData(); 3828 enum { OptType_Unknown, OptType_VMRunner, OptType_VMSelector } enmOptType = OptType_Unknown;3836 enum { OptType_Unknown, OptType_VMRunner, OptType_VMSelector, OptType_MaybeBoth } enmOptType = OptType_Unknown; 3829 3837 /* NOTE: the check here must match the corresponding check for the 3830 3838 * options to start a VM in main.cpp and hardenedmain.cpp exactly, … … 3848 3856 else if (!::strcmp(arg, "-pidfile") || !::strcmp(arg, "--pidfile")) 3849 3857 { 3858 enmOptType = OptType_MaybeBoth; 3850 3859 if (++i < argc) 3851 3860 m_strPidFile = arguments.at(i); … … 3854 3863 /* Visual state type options: */ 3855 3864 else if (!::strcmp(arg, "-normal") || !::strcmp(arg, "--normal")) 3865 { 3866 enmOptType = OptType_MaybeBoth; 3856 3867 visualStateType = UIVisualStateType_Normal; 3868 } 3857 3869 else if (!::strcmp(arg, "-fullscreen") || !::strcmp(arg, "--fullscreen")) 3870 { 3871 enmOptType = OptType_MaybeBoth; 3858 3872 visualStateType = UIVisualStateType_Fullscreen; 3873 } 3859 3874 else if (!::strcmp(arg, "-seamless") || !::strcmp(arg, "--seamless")) 3875 { 3876 enmOptType = OptType_MaybeBoth; 3860 3877 visualStateType = UIVisualStateType_Seamless; 3878 } 3861 3879 else if (!::strcmp(arg, "-scale") || !::strcmp(arg, "--scale")) 3880 { 3881 enmOptType = OptType_MaybeBoth; 3862 3882 visualStateType = UIVisualStateType_Scale; 3883 } 3863 3884 /* Passwords: */ 3864 3885 else if (!::strcmp(arg, "--settingspw")) 3865 3886 { 3887 enmOptType = OptType_MaybeBoth; 3866 3888 if (++i < argc) 3867 3889 { … … 3872 3894 else if (!::strcmp(arg, "--settingspwfile")) 3873 3895 { 3896 enmOptType = OptType_MaybeBoth; 3874 3897 if (++i < argc) 3875 3898 { 3876 size_t cbFile;3877 3899 const QByteArray &argFileBytes = arguments.at(i).toLocal8Bit(); 3878 3900 const char *pszFile = argFileBytes.constData(); … … 3886 3908 if (RT_SUCCESS(vrc)) 3887 3909 { 3888 vrc = RTStrmReadEx(pStrm, m_astrSettingsPw, sizeof(m_astrSettingsPw)-1, &cbFile); 3910 size_t cbFile; 3911 vrc = RTStrmReadEx(pStrm, m_astrSettingsPw, sizeof(m_astrSettingsPw) - 1, &cbFile); 3889 3912 if (RT_SUCCESS(vrc)) 3890 3913 { 3891 if (cbFile >= sizeof(m_astrSettingsPw)-1) 3892 continue; 3893 else 3894 { 3895 unsigned i; 3896 for (i = 0; i < cbFile && !RT_C_IS_CNTRL(m_astrSettingsPw[i]); i++) 3897 ; 3898 m_astrSettingsPw[i] = '\0'; 3899 m_fSettingsPwSet = true; 3900 } 3914 if (cbFile >= sizeof(m_astrSettingsPw) - 1) 3915 cbFile = sizeof(m_astrSettingsPw) - 1; 3916 unsigned i; 3917 for (i = 0; i < cbFile && !RT_C_IS_CNTRL(m_astrSettingsPw[i]); i++) 3918 ; 3919 m_astrSettingsPw[i] = '\0'; 3920 m_fSettingsPwSet = true; 3901 3921 } 3902 3922 if (!fStdIn) … … 3907 3927 /* Misc options: */ 3908 3928 else if (!::strcmp(arg, "-comment") || !::strcmp(arg, "--comment")) 3929 { 3930 enmOptType = OptType_MaybeBoth; 3909 3931 ++i; 3932 } 3910 3933 else if (!::strcmp(arg, "--no-startvm-errormsgbox")) 3911 3934 { … … 3914 3937 } 3915 3938 else if (!::strcmp(arg, "--aggressive-caching")) 3939 { 3940 enmOptType = OptType_MaybeBoth; 3916 3941 m_fAgressiveCaching = true; 3942 } 3917 3943 else if (!::strcmp(arg, "--no-aggressive-caching")) 3944 { 3945 enmOptType = OptType_MaybeBoth; 3918 3946 m_fAgressiveCaching = false; 3947 } 3919 3948 else if (!::strcmp(arg, "--restore-current")) 3920 3949 { -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r73119 r73196 802 802 #endif 803 803 804 /** Holds the --settingspw option value . */804 /** Holds the --settingspw option value or the content of --settingspwfile. */ 805 805 char m_astrSettingsPw[256]; 806 806 /** Holds the --settingspwfile option value. */
Note:
See TracChangeset
for help on using the changeset viewer.