VirtualBox

Changeset 29842 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 27, 2010 10:53:19 AM (15 years ago)
Author:
vboxsync
Message:

Guest Control/Sysprep: Use the special keyword "sysprep" as program path in order to get it started.

File:
1 edited

Legend:

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

    r29830 r29842  
    753753    int  rc = VINF_SUCCESS;
    754754#ifdef RT_OS_WINDOWS
    755     /* Get the predefined path of sysprep.exe (depending on Windows OS). */
    756     char szSysprepCmd[RTPATH_MAX] = "C:\\sysprep\\sysprep.exe";
    757     OSVERSIONINFOEX OSInfoEx;
    758     RT_ZERO(OSInfoEx);
    759     OSInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
    760     if (    GetVersionEx((LPOSVERSIONINFO) &OSInfoEx)
    761         &&  OSInfoEx.dwPlatformId == VER_PLATFORM_WIN32_NT
    762         &&  OSInfoEx.dwMajorVersion >= 6 /* Vista or later */)
    763     {
    764         rc = RTEnvGetEx(RTENV_DEFAULT, "windir", szSysprepCmd, sizeof(szSysprepCmd), NULL);
    765         if (RT_SUCCESS(rc))
    766             rc = RTPathAppend(szSysprepCmd, sizeof(szSysprepCmd), "system32\\sysprep\\sysprep.exe");
    767     }
    768 
    769755    /*
    770756     * If sysprep should be executed do this in the context of VBoxService, which
     
    772758     * won't be shown (doesn't have a desktop).
    773759     */
    774     if (   RT_SUCCESS(rc)
    775         && stricmp(pszExec, szSysprepCmd) == 0)
    776     {
    777          rc = RTProcCreateEx(pszExec, papszArgs, hEnv, 0 /* fFlags */,
    778                              phStdIn, phStdOut, phStdErr, NULL /* pszAsUser */,
    779                              NULL /* pszPassword */, phProcess);
     760    if (stricmp(pszExec, "sysprep") == 0)
     761    {
     762        /* Get the predefined path of sysprep.exe (depending on Windows OS). */
     763        char szSysprepCmd[RTPATH_MAX] = "C:\\sysprep\\sysprep.exe";
     764        OSVERSIONINFOEX OSInfoEx;
     765        RT_ZERO(OSInfoEx);
     766        OSInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
     767        if (    GetVersionEx((LPOSVERSIONINFO) &OSInfoEx)
     768            &&  OSInfoEx.dwPlatformId == VER_PLATFORM_WIN32_NT
     769            &&  OSInfoEx.dwMajorVersion >= 6 /* Vista or later */)
     770        {
     771            rc = RTEnvGetEx(RTENV_DEFAULT, "windir", szSysprepCmd, sizeof(szSysprepCmd), NULL);
     772            if (RT_SUCCESS(rc))
     773                rc = RTPathAppend(szSysprepCmd, sizeof(szSysprepCmd), "system32\\sysprep\\sysprep.exe");
     774        }
     775        rc = RTProcCreateEx(szSysprepCmd, papszArgs, hEnv, 0 /* fFlags */,
     776                            phStdIn, phStdOut, phStdErr, NULL /* pszAsUser */,
     777                            NULL /* pszPassword */, phProcess);
    780778    }
    781779    else
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