Changeset 95834 in vbox for trunk/src/VBox/Runtime/r3
- Timestamp:
- Jul 26, 2022 2:46:59 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/nocrt-startup-exe-win.cpp
r95818 r95834 45 45 # include <iprt/nocrt/stdlib.h> 46 46 #endif 47 48 #include "internal/compiler-vcc.h" 47 49 48 50 … … 158 160 } 159 161 } 162 163 rtVccInitializersRunTerm(); 160 164 } 161 165 #else … … 203 207 initProcExecPath(); 204 208 205 /*206 * Get and convert the command line to argc/argv format.207 */208 209 RTEXITCODE rcExit; 209 UNICODE_STRING const *pCmdLine = pPeb->ProcessParameters ? &pPeb->ProcessParameters->CommandLine : NULL; 210 if (pCmdLine) 211 { 212 char *pszCmdLine = NULL; 213 int rc = RTUtf16ToUtf8Ex(pCmdLine->Buffer, pCmdLine->Length / sizeof(WCHAR), &pszCmdLine, 0, NULL); 214 if (RT_SUCCESS(rc)) 215 { 216 char **papszArgv; 217 int cArgs = 0; 218 rc = RTGetOptArgvFromString(&papszArgv, &cArgs, pszCmdLine, 219 RTGETOPTARGV_CNV_MODIFY_INPUT | RTGETOPTARGV_CNV_QUOTE_MS_CRT, NULL); 210 #ifdef IPRT_NO_CRT 211 AssertCompile(sizeof(rcExit) == sizeof(int)); 212 rcExit = (RTEXITCODE)rtVccInitializersRunInit(); 213 if (rcExit == RTEXITCODE_SUCCESS) 214 #endif 215 { 216 /* 217 * Get and convert the command line to argc/argv format. 218 */ 219 UNICODE_STRING const *pCmdLine = pPeb->ProcessParameters ? &pPeb->ProcessParameters->CommandLine : NULL; 220 if (pCmdLine) 221 { 222 char *pszCmdLine = NULL; 223 int rc = RTUtf16ToUtf8Ex(pCmdLine->Buffer, pCmdLine->Length / sizeof(WCHAR), &pszCmdLine, 0, NULL); 220 224 if (RT_SUCCESS(rc)) 221 225 { 222 /* 223 * Call the main function. 224 */ 225 AssertCompile(sizeof(rcExit) == sizeof(int)); 226 rcExit = (RTEXITCODE)main(cArgs, papszArgv, NULL /*envp*/); 226 char **papszArgv; 227 int cArgs = 0; 228 rc = RTGetOptArgvFromString(&papszArgv, &cArgs, pszCmdLine, 229 RTGETOPTARGV_CNV_MODIFY_INPUT | RTGETOPTARGV_CNV_QUOTE_MS_CRT, NULL); 230 if (RT_SUCCESS(rc)) 231 { 232 /* 233 * Call the main function. 234 */ 235 AssertCompile(sizeof(rcExit) == sizeof(int)); 236 rcExit = (RTEXITCODE)main(cArgs, papszArgv, NULL /*envp*/); 237 } 238 else 239 rcExit = RTMsgErrorExitFailure("Error parsing command line: %Rrc\n", rc); 227 240 } 228 241 else 229 rcExit = RTMsgErrorExitFailure(" Error parsing command line: %Rrc\n", rc);242 rcExit = RTMsgErrorExitFailure("Failed to convert command line to UTF-8: %Rrc\n", rc); 230 243 } 231 244 else 232 rcExit = RTMsgErrorExitFailure("Failed to convert command line to UTF-8: %Rrc\n", rc); 233 } 245 rcExit = RTMsgErrorExitFailure("No command line\n"); 246 rtTerminateProcess(rcExit, true /*fDoAtExit*/); 247 } 248 #ifdef IPRT_NO_CRT 234 249 else 235 rcExit = RTMsgErrorExitFailure("No command line\n"); 236 237 rtTerminateProcess(rcExit, true /*fDoAtExit*/); 238 } 239 250 { 251 RTMsgError("A C static initializor failed (%d)\n", rcExit); 252 rtTerminateProcess(rcExit, false /*fDoAtExit*/); 253 } 254 #endif 255 } 256
Note:
See TracChangeset
for help on using the changeset viewer.