VirtualBox

Changeset 57820 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Sep 18, 2015 10:00:11 AM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
102769
Message:

IPRT/process-win.cpp: User profile environment handling, take 2: Renamed RTPROC_FLAGS_OVERWRITE_WITH_PROFILE to RTPROC_MODIFY_DEFAULT_ENV and changed its semantics. See flag description for details.

File:
1 edited

Legend:

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

    r57800 r57820  
    19561956#ifdef RT_OS_WINDOWS
    19571957                                /* Make sure to also load the profile data on a Windows guest. */
    1958                                 | RTPROC_FLAGS_PROFILE                /** @todo Not implemented for non-Windows yet. */
    1959                                 | RTPROC_FLAGS_OVERWRITE_WITH_PROFILE
    1960 #endif
    1961                                 | RTPROC_FLAGS_HIDDEN; /** @todo More flags from startup info? */
     1958                                | RTPROC_FLAGS_PROFILE       /** @todo Not implemented for non-Windows yet. */
     1959                                | RTPROC_MODIFY_DEFAULT_ENV
     1960#endif
     1961                                | RTPROC_FLAGS_HIDDEN;       /** @todo More flags from startup info? */
    19621962            /*
    19631963             * Create the session process' environment block.
    19641964             */
    1965             RTENV hEnv = NIL_RTENV;
    19661965            if (RT_SUCCESS(rc))
    19671966            {
    1968                 /** @todo At the moment a session process does not have the ability to use the
    1969                  *        per-session environment variables itself, only the session's guest
    1970                  *        processes do so. Implement that later, also needs tweaking of
    1971                  *        VbglR3GuestCtrlSessionGetOpen(). */
    1972                 rc = RTEnvClone(&hEnv, RTENV_DEFAULT);
    1973 
    19741967                if (g_cVerbosity > 3)
    19751968                {
    1976                     VBoxServiceVerbose(4, "Environment variables:\n");
    1977 
    1978                     uint32_t cVars = RTEnvCountEx(hEnv);
    1979                     for (uint32_t iVar = 0; iVar < cVars; iVar++)
     1969                    /** @todo At the moment a session process does not have the ability to use the
     1970                     *        per-session environment variables itself, only the session's guest
     1971                     *        processes do so. Implement that later, also needs tweaking of
     1972                     *        VbglR3GuestCtrlSessionGetOpen(). */
     1973                    RTENV hEnv = NIL_RTENV;
     1974                    rc = RTEnvClone(&hEnv, RTENV_DEFAULT);
     1975                    if (RT_SUCCESS(rc))
    19801976                    {
    1981                         char szVar[_1K];
    1982                         char szValue[_16K];
    1983                         rc2 = RTEnvGetByIndexEx(hEnv, iVar, szVar, sizeof(szVar), szValue, sizeof(szValue));
    1984                         if (RT_SUCCESS(rc2))
    1985                             VBoxServiceVerbose(4, "\t%s=%s\n", szVar, szValue);
    1986                         else if (rc2 == VERR_BUFFER_OVERFLOW)
    1987                             VBoxServiceVerbose(4, "\t%s=%s [VERR_BUFFER_OVERFLOW]\n", szVar, szValue);
    1988                         else
     1977                        VBoxServiceVerbose(4, "Environment variables:\n");
     1978
     1979                        uint32_t cVars = RTEnvCountEx(hEnv);
     1980                        for (uint32_t iVar = 0; iVar < cVars; iVar++)
    19891981                        {
    1990                             VBoxServiceVerbose(4, "\tUnable to enumerate environment variable #%RU32: %Rrc\n", iVar, rc2);
    1991                             /* Keep going. */
     1982                            char szVar[_1K];
     1983                            char szValue[_16K];
     1984                            rc2 = RTEnvGetByIndexEx(hEnv, iVar, szVar, sizeof(szVar), szValue, sizeof(szValue));
     1985                            if (RT_SUCCESS(rc2))
     1986                                VBoxServiceVerbose(4, "\t%s=%s\n", szVar, szValue);
     1987                            else if (rc2 == VERR_BUFFER_OVERFLOW)
     1988                                VBoxServiceVerbose(4, "\t%s=%s [VERR_BUFFER_OVERFLOW]\n", szVar, szValue);
     1989                            else
     1990                            {
     1991                                VBoxServiceVerbose(4, "\tUnable to enumerate environment variable #%RU32: %Rrc\n", iVar, rc2);
     1992                                /* Keep going. */
     1993                            }
    19921994                        }
     1995
     1996                        RTEnvDestroy(hEnv);
    19931997                    }
    19941998                }
     
    20562060                    hStdOutAndErr.enmType = RTHANDLETYPE_FILE;
    20572061
    2058                     rc = RTProcCreateEx(pszExeName, papszArgs, hEnv, uProcFlags,
     2062                    rc = RTProcCreateEx(pszExeName, papszArgs, RTENV_DEFAULT, uProcFlags,
    20592063                                        &hStdIn, &hStdOutAndErr, &hStdOutAndErr,
    20602064                                        !fAnonymous ? pSessionThread->StartupInfo.szUser : NULL,
     
    20682072            }
    20692073#endif
    2070             if (hEnv != NIL_RTENV)
    2071                 RTEnvDestroy(hEnv);
    20722074        }
    20732075        else
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