VirtualBox

Ignore:
Timestamp:
Sep 5, 2011 1:49:45 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
73843
Message:

*,IPRT: Redid the ring-3 init to always convert the arguments to UTF-8.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp

    r38417 r38636  
    244244     * the support driver.
    245245     */
    246     RTR3Init();
     246    RTR3InitExe(argc, &argv, 0);
    247247
    248248    /*
     
    329329    if (FAILED(hrc))
    330330        return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to initialize COM!");
    331 
    332     /*
    333      * The input is ASSUMED to be in the current process codeset (NT guarantees
    334      * ACP, unixy systems doesn't guarantee anything).  This loop converts all
    335      * the argv[*] strings to UTF-8, which is a tad ugly but who cares.
    336      * (As a rule all strings in VirtualBox are UTF-8.)
    337      */
    338     for (int i = iCmdArg; i < argc; i++)
    339     {
    340         char *pszConverted;
    341         int rc = RTStrCurrentCPToUtf8(&pszConverted, argv[i]);
    342         if (RT_SUCCESS(rc))
    343             argv[i] = pszConverted;
    344         else
    345             /* Conversion was not possible,probably due to invalid characters.
    346              * Keep in mind that we do RTStrFree on the whole array below. */
    347             argv[i] = RTStrDup(argv[i]);
    348     }
    349331
    350332    RTEXITCODE rcExit = RTEXITCODE_FAILURE;
     
    500482    com::Shutdown();
    501483
    502     /*
    503      * Free converted argument vector
    504      */
    505     for (int i = iCmdArg; i < argc; i++)
    506     {
    507         RTStrFree(argv[i]);
    508         argv[i] = NULL;
    509     }
    510 
    511484    return rcExit;
    512485#else  /* VBOX_ONLY_DOCS */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette