VirtualBox

Changeset 36025 in vbox


Ignore:
Timestamp:
Feb 21, 2011 9:20:11 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
70126
Message:

VBoxService/GuestCtrl: Fixed argument handling for sysprep.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp

    r35954 r36025  
    12971297
    12981298    int  rc = VINF_SUCCESS;
     1299    char szExecExp[RTPATH_MAX];
    12991300#ifdef RT_OS_WINDOWS
    13001301    /*
     
    13051306    if (RTStrICmp(pszExec, "sysprep") == 0)
    13061307    {
    1307         /* Get the predefined path of sysprep.exe (depending on Windows OS). */
     1308        /* Use a predefined sysprep path as default. */
    13081309        char szSysprepCmd[RTPATH_MAX] = "C:\\sysprep\\sysprep.exe";
     1310
     1311        /*
     1312         * On Windows Vista (and up) sysprep is located in "system32\\sysprep\\sysprep.exe",
     1313         * so detect the OS and use a different path.
     1314         */
    13091315        OSVERSIONINFOEX OSInfoEx;
    13101316        RT_ZERO(OSInfoEx);
     
    13181324                rc = RTPathAppend(szSysprepCmd, sizeof(szSysprepCmd), "system32\\sysprep\\sysprep.exe");
    13191325        }
    1320         rc = RTProcCreateEx(szSysprepCmd, papszArgs, hEnv, 0 /* fFlags */,
    1321                             phStdIn, phStdOut, phStdErr, NULL /* pszAsUser */,
    1322                             NULL /* pszPassword */, phProcess);
     1326
     1327        if (RT_SUCCESS(rc))
     1328        {
     1329            char **papszArgsExp;
     1330            rc = VBoxServiceControlExecPrepareArgv(szSysprepCmd, papszArgs, &papszArgsExp);
     1331            if (RT_SUCCESS(rc))
     1332            {
     1333                rc = RTProcCreateEx(szSysprepCmd, papszArgsExp, hEnv, 0 /* fFlags */,
     1334                                    phStdIn, phStdOut, phStdErr, NULL /* pszAsUser */,
     1335                                    NULL /* pszPassword */, phProcess);
     1336            }
     1337            RTGetOptArgvFree(papszArgsExp);
     1338        }
    13231339        return rc;
    13241340    }
     
    13281344     * Do the environment variables expansion on executable and arguments.
    13291345     */
    1330     char szExecExp[RTPATH_MAX];
    13311346    rc = VBoxServiceControlExecResolveExecutable(pszExec, szExecExp, sizeof(szExecExp));
    13321347    if (RT_SUCCESS(rc))
Note: See TracChangeset for help on using the changeset viewer.

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