- Timestamp:
- Sep 15, 2015 12:55:46 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp
r57753 r57759 1959 1959 #endif 1960 1960 | RTPROC_FLAGS_HIDDEN; /** @todo More flags from startup info? */ 1961 /*1962 * Create the session process' environment block.1963 */1964 RTENV hEnv = NIL_RTENV;1965 if (RT_SUCCESS(rc))1966 {1967 /** @todo At the moment a session process does not have the ability to use the1968 * per-session environment variables itself, only the session's guest1969 * processes do so. Implement that later, also needs tweaking of1970 * VbglR3GuestCtrlSessionGetOpen(). */1971 rc = RTEnvClone(&hEnv, RTENV_DEFAULT);1972 1973 if (g_cVerbosity > 3)1974 {1975 VBoxServiceVerbose(4, "Environment variables:\n");1976 1977 uint32_t cVars = RTEnvCountEx(hEnv);1978 for (uint32_t iVar = 0; iVar < cVars; iVar++)1979 {1980 char szVar[_1K];1981 char szValue[_16K];1982 rc2 = RTEnvGetByIndexEx(hEnv, iVar, szVar, sizeof(szVar), szValue, sizeof(szValue));1983 if (RT_SUCCESS(rc2))1984 VBoxServiceVerbose(4, "\t%s=%s\n", szVar, szValue);1985 else if (rc2 == VERR_BUFFER_OVERFLOW)1986 VBoxServiceVerbose(4, "\t%s=%s [VERR_BUFFER_OVERFLOW]\n", szVar, szValue);1987 else1988 {1989 VBoxServiceVerbose(4, "\tUnable to enumerate environment variable #%RU32: %Rrc\n", iVar, rc2);1990 /* Keep going. */1991 }1992 }1993 }1994 1995 #ifdef RT_OS_WINDOWS1996 if (RT_SUCCESS(rc))1997 {1998 /*1999 * On Windows, when VBoxService was started as local service via SCM, the environment variable2000 * USERPROFILE was set to point to LocalService's user directory.2001 *2002 * As we want to make sure that USERPROFILE actually points to the directory of the user we want2003 * to spawn the guest process for, unset the variable here before handing the environment block over2004 * to RTProcCreateEx().2005 *2006 * Note: RTProcCreateEx() in turn will *not* overwrite _any_ of already set2007 * environment variables by default! */2008 RTEnvUnsetEx(hEnv, "USERPROFILE");2009 }2010 #endif2011 }2012 1961 2013 1962 #if 0 /* Pipe handling not needed (yet). */ … … 2072 2021 hStdOutAndErr.enmType = RTHANDLETYPE_FILE; 2073 2022 2074 rc = RTProcCreateEx(pszExeName, papszArgs, hEnv, uProcFlags,2023 rc = RTProcCreateEx(pszExeName, papszArgs, RTENV_DEFAULT, uProcFlags, 2075 2024 &hStdIn, &hStdOutAndErr, &hStdOutAndErr, 2076 2025 !fAnonymous ? pSessionThread->StartupInfo.szUser : NULL, … … 2084 2033 } 2085 2034 #endif 2086 if (hEnv != NIL_RTENV)2087 RTEnvDestroy(hEnv);2088 2035 } 2089 2036 else
Note:
See TracChangeset
for help on using the changeset viewer.