- Timestamp:
- Jan 21, 2022 9:26:43 AM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 149485
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Installer/win/Stub/VBoxStub.cpp
r93115 r93390 145 145 va_end(va); 146 146 return RTEXITCODE_FAILURE; 147 } 148 149 150 /** 151 * Same as ShowError, only it returns RTEXITCODE_SYNTAX. 152 */ 153 static RTEXITCODE ShowSyntaxError(const char *pszFmt, ...) 154 { 155 va_list va; 156 va_start(va, pszFmt); 157 ShowError("%N", pszFmt, &va); 158 va_end(va); 159 return RTEXITCODE_SYNTAX; 147 160 } 148 161 … … 908 921 { "--msiparams", 'm', RTGETOPT_REQ_STRING }, 909 922 { "-msiparams", 'm', RTGETOPT_REQ_STRING }, 923 { "--msi-prop", 'P', RTGETOPT_REQ_STRING }, 910 924 { "--reinstall", 'f', RTGETOPT_REQ_NOTHING }, 911 925 { "-reinstall", 'f', RTGETOPT_REQ_NOTHING }, … … 918 932 { "-version", 'V', RTGETOPT_REQ_NOTHING }, 919 933 { "/version", 'V', RTGETOPT_REQ_NOTHING }, 920 { "-v", 'V', RTGETOPT_REQ_NOTHING },921 934 { "--help", 'h', RTGETOPT_REQ_NOTHING }, 922 935 { "-help", 'h', RTGETOPT_REQ_NOTHING }, … … 946 959 "REINSTALLMODE=vomus REINSTALL=ALL"); 947 960 if (RT_FAILURE(vrc)) 948 rcExit = Show Error("MSI parameters are too long.");961 rcExit = ShowSyntaxError("Out of space for MSI parameters and properties"); 949 962 break; 950 963 … … 969 982 vrc = RTStrCopy(szExtractPath, sizeof(szExtractPath), ValueUnion.psz); 970 983 if (RT_FAILURE(vrc)) 971 rcExit = Show Error("Extraction path is too long.");984 rcExit = ShowSyntaxError("Extraction path is too long."); 972 985 break; 973 986 … … 978 991 vrc = RTStrCat(szMSIArgs, sizeof(szMSIArgs), ValueUnion.psz); 979 992 if (RT_FAILURE(vrc)) 980 rcExit = Show Error("MSI parameters are too long.");993 rcExit = ShowSyntaxError("Out of space for MSI parameters and properties"); 981 994 break; 995 996 case 'P': 997 { 998 const char *pszProp = ValueUnion.psz; 999 if (strpbrk(pszProp, " \t\n\r") == NULL) 1000 { 1001 vrc = RTGetOptFetchValue(&GetState, &ValueUnion, RTGETOPT_REQ_STRING); 1002 if (RT_SUCCESS(vrc)) 1003 { 1004 size_t cchMsiArgs = strlen(szMSIArgs); 1005 if (RTStrPrintf2(&szMSIArgs[cchMsiArgs], sizeof(szMSIArgs) - cchMsiArgs, 1006 strpbrk(ValueUnion.psz, " \t\n\r") == NULL ? "%s%s=%s" : "%s%s=\"%s\"", 1007 cchMsiArgs ? " " : "", pszProp, ValueUnion.psz) <= 1) 1008 rcExit = ShowSyntaxError("Out of space for MSI parameters and properties"); 1009 } 1010 else if (vrc == VERR_GETOPT_REQUIRED_ARGUMENT_MISSING) 1011 rcExit = ShowSyntaxError("--msi-prop takes two arguments, the 2nd is missing"); 1012 else 1013 rcExit = ShowSyntaxError("Failed to get 2nd --msi-prop argument: %Rrc", vrc); 1014 } 1015 else 1016 rcExit = ShowSyntaxError("The first argument to --msi-prop must not contain spaces: %s", pszProp); 1017 break; 1018 } 982 1019 983 1020 case 'r': … … 986 1023 987 1024 case 'V': 988 ShowInfo("Version: %d.%d.%d.%d", 989 VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR, VBOX_VERSION_BUILD, 990 VBOX_SVN_REV); 1025 ShowInfo("Version: %u.%u.%ur%u", VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR, VBOX_VERSION_BUILD, VBOX_SVN_REV); 991 1026 fExitEarly = true; 992 1027 break; … … 997 1032 998 1033 case 'h': 999 ShowInfo("-- %s v% d.%d.%d.%d--\n"1034 ShowInfo("-- %s v%u.%u.%ur%u --\n" 1000 1035 "\n" 1001 1036 "Command Line Parameters:\n\n" 1002 "--extract - Extract file contents to temporary directory\n" 1003 "--help - Print this help and exit\n" 1004 "--logging - Enables installer logging\n" 1005 "--msiparams <parameters> - Specifies extra parameters for the MSI installers\n" 1006 "--no-silent-cert - Do not install VirtualBox Certificate automatically when --silent option is specified\n" 1007 "--path - Sets the path of the extraction directory\n" 1008 "--reinstall - Forces VirtualBox to get re-installed\n" 1009 "--ignore-reboot - Don't set exit code to 3010 if a reboot is required\n" 1010 "--silent - Enables silent mode installation\n" 1011 "--version - Print version number and exit\n" 1037 "--extract\n" 1038 " Extract file contents to temporary directory\n" 1039 "--logging\n" 1040 " Enables installer logging\n" 1041 "--msiparams <parameters>\n" 1042 " Specifies extra parameters for the MSI installers\n" 1043 " double quoted arguments must be doubled and put\n" 1044 " in quotes: --msiparams \"PROP=\"\"a b c\"\"\"\n" 1045 "--msi-prop <prop> <value>\n" 1046 " Adds <prop>=<value> to the MSI parameters,\n" 1047 " quoting the property value if necessary\n" 1048 "--no-silent-cert\n" 1049 " Do not install VirtualBox Certificate automatically\n" 1050 " when --silent option is specified\n" 1051 "--path\n" 1052 " Sets the path of the extraction directory\n" 1053 "--reinstall\n" 1054 " Forces VirtualBox to get re-installed\n" 1055 "--ignore-reboot\n" 1056 " Do not set exit code to 3010 if a reboot is required\n" 1057 "--silent\n" 1058 " Enables silent mode installation\n" 1059 "--version\n" 1060 " Displays version number and exit\n" 1061 "-?, -h, --help\n" 1062 " Displays this help text and exit\n" 1012 1063 "\n" 1013 1064 "Examples:\n" 1014 " %s --msiparams INSTALLDIR=C:\\VBox\n"1015 " %s --extract -path C:\\VBox",1065 " %s --msiparams \"INSTALLDIR=\"\"C:\\Program Files\\VirtualBox\"\"\"\n" 1066 " %s --extract -path C:\\VBox", 1016 1067 VBOX_STUB_TITLE, VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR, VBOX_VERSION_BUILD, VBOX_SVN_REV, 1017 1068 argv[0], argv[0]); … … 1022 1073 /* Are (optional) MSI parameters specified and this is the last 1023 1074 * parameter? Append everything to the MSI parameter list then. */ 1075 /** @todo r=bird: this makes zero sense */ 1024 1076 if (szMSIArgs[0]) 1025 1077 { … … 1028 1080 vrc = RTStrCat(szMSIArgs, sizeof(szMSIArgs), ValueUnion.psz); 1029 1081 if (RT_FAILURE(vrc)) 1030 rcExit = Show Error("MSI parameters are too long.");1082 rcExit = ShowSyntaxError("Out of space for MSI parameters and properties"); 1031 1083 continue; 1032 1084 } … … 1037 1089 rcExit = RTGetOptPrintError(ch, &ValueUnion); 1038 1090 if (ch == VERR_GETOPT_UNKNOWN_OPTION) 1039 rcExit = Show Error("Unknown option \"%s\"\n"1040 "Please refer to the command line help by specifying \"/?\"\n"1041 "to get more information.", ValueUnion.psz);1091 rcExit = ShowSyntaxError("Unknown option \"%s\"\n" 1092 "Please refer to the command line help by specifying \"-?\"\n" 1093 "to get more information.", ValueUnion.psz); 1042 1094 else 1043 rcExit = Show Error("Parameter parsing error: %Rrc\n"1044 "Please refer to the command line help by specifying \"/?\"\n"1045 "to get more information.", ch);1095 rcExit = ShowSyntaxError("Parameter parsing error: %Rrc\n" 1096 "Please refer to the command line help by specifying \"-?\"\n" 1097 "to get more information.", ch); 1046 1098 break; 1047 1099 }
Note:
See TracChangeset
for help on using the changeset viewer.