Changeset 34206 in vbox for trunk/src/VBox
- Timestamp:
- Nov 19, 2010 3:10:16 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Installer/win/Stub/VBoxStub.cpp
r34199 r34206 301 301 int CopyDir(const char *pszDestDir, const char *pszSourceDir) 302 302 { 303 char szDest[ _MAX_PATH+ 1];304 char szSource[ _MAX_PATH+ 1];303 char szDest[RTPATH_MAX + 1]; 304 char szSource[RTPATH_MAX + 1]; 305 305 306 306 AssertStmt(pszDestDir, "Destination directory invalid!"); … … 329 329 int nCmdShow) 330 330 { 331 char ** pArgV= __argv;332 int iArgC= __argc;331 char **argv = __argv; 332 int argc = __argc; 333 333 334 334 /* Check if we're already running and jump out if so. */ … … 352 352 BOOL fSilent = FALSE; 353 353 BOOL fEnableLogging = FALSE; 354 BOOL bExit = FALSE;354 BOOL fExit = FALSE; 355 355 356 356 /* Temp variables for arguments. */ … … 359 359 360 360 /* Process arguments. */ 361 for (int i = 0; i < iArgC; i++)362 { 363 if ( (0 == RTStrICmp( pArgV[i], "-x"))364 || (0 == RTStrICmp( pArgV[i], "-extract"))365 || (0 == RTStrICmp( pArgV[i], "/extract")))361 for (int i = 0; i < argc; i++) 362 { 363 if ( (0 == RTStrICmp(argv[i], "-x")) 364 || (0 == RTStrICmp(argv[i], "-extract")) 365 || (0 == RTStrICmp(argv[i], "/extract"))) 366 366 { 367 367 fExtractOnly = TRUE; 368 368 } 369 369 370 else if ( (0 == RTStrICmp( pArgV[i], "-s"))371 || (0 == RTStrICmp( pArgV[i], "-silent"))372 || (0 == RTStrICmp( pArgV[i], "/silent")))370 else if ( (0 == RTStrICmp(argv[i], "-s")) 371 || (0 == RTStrICmp(argv[i], "-silent")) 372 || (0 == RTStrICmp(argv[i], "/silent"))) 373 373 { 374 374 fSilent = TRUE; 375 375 } 376 376 377 else if ( (0 == RTStrICmp( pArgV[i], "-l"))378 || (0 == RTStrICmp( pArgV[i], "-logging"))379 || (0 == RTStrICmp( pArgV[i], "/logging")))377 else if ( (0 == RTStrICmp(argv[i], "-l")) 378 || (0 == RTStrICmp(argv[i], "-logging")) 379 || (0 == RTStrICmp(argv[i], "/logging"))) 380 380 { 381 381 fEnableLogging = TRUE; 382 382 } 383 383 384 else if (( (0 == RTStrICmp(pArgV[i], "-p")) 385 || (0 == RTStrICmp(pArgV[i], "-path")) 386 || (0 == RTStrICmp(pArgV[i], "/path"))) 387 && (iArgC > i)) 388 { 389 vrc = ::StringCbCat(szExtractPath, sizeof(szExtractPath), pArgV[i+1]); 390 i++; /* Avoid the specify path from being parsed */ 391 } 392 393 else if (( (0 == RTStrICmp(pArgV[i], "-msiparams")) 394 || (0 == RTStrICmp(pArgV[i], "/msiparams"))) 395 && (iArgC > i)) 396 { 397 for (int a=i+1; a<iArgC; a++) 384 else if (( (0 == RTStrICmp(argv[i], "-p")) 385 || (0 == RTStrICmp(argv[i], "-path")) 386 || (0 == RTStrICmp(argv[i], "/path"))) 387 ) 388 { 389 if (argc > i) 390 { 391 vrc = ::StringCbCat(szExtractPath, sizeof(szExtractPath), argv[i+1]); 392 i++; /* Avoid the specified path from being parsed. */ 393 } 394 else 395 { 396 ShowError("No path for extraction specified!"); 397 fExit = TRUE; 398 } 399 } 400 401 else if (( (0 == RTStrICmp(argv[i], "-msiparams")) 402 || (0 == RTStrICmp(argv[i], "/msiparams"))) 403 && (argc > i)) 404 { 405 for (int a = i + 1; a < argc; a++) 398 406 { 399 407 if (a > i+1) /* Insert a space. */ 400 408 vrc = ::StringCbCat(szMSIArgs, sizeof(szMSIArgs), " "); 401 409 402 vrc = ::StringCbCat(szMSIArgs, sizeof(szMSIArgs), pArgV[a]);410 vrc = ::StringCbCat(szMSIArgs, sizeof(szMSIArgs), argv[a]); 403 411 } 404 412 } 405 413 406 else if ( (0 == RTStrICmp( pArgV[i], "-v"))407 || (0 == RTStrICmp( pArgV[i], "-version"))408 || (0 == RTStrICmp( pArgV[i], "/version")))414 else if ( (0 == RTStrICmp(argv[i], "-v")) 415 || (0 == RTStrICmp(argv[i], "-version")) 416 || (0 == RTStrICmp(argv[i], "/version"))) 409 417 { 410 418 ShowInfo("Version: %d.%d.%d.%d", 411 419 VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR, VBOX_VERSION_BUILD, VBOX_SVN_REV); 412 bExit = TRUE;413 } 414 415 else if ( (0 == RTStrICmp( pArgV[i], "-help"))416 || (0 == RTStrICmp( pArgV[i], "/help"))417 || (0 == RTStrICmp( pArgV[i], "/?")))420 fExit = TRUE; 421 } 422 423 else if ( (0 == RTStrICmp(argv[i], "-help")) 424 || (0 == RTStrICmp(argv[i], "/help")) 425 || (0 == RTStrICmp(argv[i], "/?"))) 418 426 { 419 427 ShowInfo("-- %s v%d.%d.%d.%d --\n" … … 430 438 "%s -extract -path C:\\VBox\n", 431 439 VBOX_STUB_TITLE, VBOX_VERSION_MAJOR, VBOX_VERSION_MINOR, VBOX_VERSION_BUILD, VBOX_SVN_REV, 432 pArgV[0], pArgV[0]);433 bExit = TRUE;440 argv[0], argv[0]); 441 fExit = TRUE; 434 442 } 435 443 else … … 437 445 if (i > 0) 438 446 { 439 Show Info("Unknown option \"%s\"!\n"440 "Please refer to the command line help by specifying \"/?\"\n"441 "to get more information.", pArgV[i]);442 bExit = TRUE;447 ShowError("Unknown option \"%s\"!\n" 448 "Please refer to the command line help by specifying \"/?\"\n" 449 "to get more information.", argv[i]); 450 fExit = TRUE; 443 451 } 444 452 } 445 453 } 446 454 447 if ( bExit)455 if (fExit) 448 456 return 0; 449 457 … … 486 494 PVBOXSTUBPKG pPackage = NULL; 487 495 DWORD cbPackage = 0; 488 char szHeaderName[ _MAX_PATH] = {0};489 490 hr = ::StringCchPrintf(szHeaderName, _MAX_PATH, "HDR_%02d", k);496 char szHeaderName[RTPATH_MAX + 1] = {0}; 497 498 hr = ::StringCchPrintf(szHeaderName, RTPATH_MAX, "HDR_%02d", k); 491 499 vrc = ReadData(NULL, szHeaderName, (LPVOID*)&pPackage, &cbPackage); 492 500 AssertMsgRCBreak(vrc, ("Header not found!\n")); /** @todo include header name, how? */ … … 525 533 PVBOXSTUBPKG pPackage = NULL; 526 534 DWORD cbPackage = 0; 527 char szHeaderName[ _MAX_PATH] = {0};528 529 hr = StringCchPrintf(szHeaderName, _MAX_PATH, "HDR_%02d", k);535 char szHeaderName[RTPATH_MAX] = {0}; 536 537 hr = StringCchPrintf(szHeaderName, RTPATH_MAX, "HDR_%02d", k); 530 538 vrc = ReadData(NULL, szHeaderName, (LPVOID*)&pPackage, &cbPackage); 531 539 AssertMsgRCBreak(vrc, ("Package not found!\n"));
Note:
See TracChangeset
for help on using the changeset viewer.