462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync * IPRT - Environment, Generic.
f4c45a1ca8a0bbdb88cf32e34c29474850ab0ee8vboxsync * Copyright (C) 2006-2012 Oracle Corporation
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * available from http://www.virtualbox.org. This file is free software;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * you can redistribute it and/or modify it under the terms of the GNU
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * General Public License (GPL) as published by the Free Software
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * The contents of this file may alternatively be used under the terms
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * of the Common Development and Distribution License Version 1.0
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * VirtualBox OSE distribution, in which case the provisions of the
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * CDDL are applicable instead of those of the GPL.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * You may elect to license modified versions of this file under the
7b9f0c34e9ea328981c99e97054bdf8684d9d620vboxsync * terms and conditions of either the GPL or the CDDL or both.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync/*******************************************************************************
0fd108a555ae02f2fb557d5f2c40281999b60d15vboxsync* Header Files *
c55bf74b54ecdfb5ebc4e5d90b620d0fee31737evboxsync*******************************************************************************/
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync#if defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD) || defined(RT_OS_NETBSD) || defined(RT_OS_OPENBSD)
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsyncextern char **environ;
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync/*******************************************************************************
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync* Defined Constants And Macros *
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync*******************************************************************************/
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync/** The allocation granularity of the RTENVINTERNAL::papszEnv memory. */
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync/** Macro that unlocks the specified environment block. */
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync/** Macro that unlocks the specified environment block. */
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync/** @def RTENV_HAVE_WENVIRON
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync * Indicates that we have a _wenviron variable with UTF-16 strings that we
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync * better use instead of the current-cp strings in environ. */
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync#if defined(RT_OS_WINDOWS) || defined(DOXYGEN_RUNNING)
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync/** @def RTENV_IMPLEMENTS_UTF8_DEFAULT_ENV_API
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync * Indicates the RTEnv*Utf8 APIs are implemented. */
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync#if defined(RT_OS_WINDOWS) || defined(DOXYGEN_RUNNING)
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync/*******************************************************************************
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync* Structures and Typedefs *
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync*******************************************************************************/
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync * The internal representation of a (non-default) environment.
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync /** Magic value . */
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync /** Number of variables in the array.
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync * This does not include the terminating NULL entry. */
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync /** Capacity (allocated size) of the array.
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync * This includes space for the terminating NULL element (for compatibility
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync * with the C library), so that c <= cCapacity - 1. */
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync /** Array of environment variables. */
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync /** Array of environment variables in the process CP.
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync * This get (re-)constructed when RTEnvGetExecEnvP method is called. */
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync /** The compare function we're using. */
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync DECLCALLBACKMEMBER(int, pfnCompare)(const char *psz1, const char *psz2, size_t cchMax);
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync * Internal worker that resolves the pointer to the default
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync * process environment. (environ)
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync * @returns Pointer to the default environment.
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync * This may be NULL.
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync * Internal worker that creates an environment handle with a specified capacity.
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync * @returns IPRT status code.
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync * @param ppIntEnv Where to store the result.
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync * @param cAllocated The initial array size.
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync * @param fCaseSensitive Whether the environment block is case sensitive or
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsyncstatic int rtEnvCreate(PRTENVINTERNAL *ppIntEnv, size_t cAllocated, bool fCaseSensitive)
581f0625e43a928987623d7cf59e1b1ab61ca6c8vboxsync * Allocate environment handle.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync PRTENVINTERNAL pIntEnv = (PRTENVINTERNAL)RTMemAlloc(sizeof(*pIntEnv));
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * Pre-allocate the variable array.
3f5dd727ecbcf3e99217c70f04bc2340beb9072cvboxsync pIntEnv->pfnCompare = fCaseSensitive ? RTStrNCmp : RTStrNICmp;
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync pIntEnv->cAllocated = RT_ALIGN_Z(RT_MAX(cAllocated, RTENV_GROW_SIZE), RTENV_GROW_SIZE);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync pIntEnv->papszEnv = (char **)RTMemAllocZ(sizeof(pIntEnv->papszEnv[0]) * pIntEnv->cAllocated);
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync return rtEnvCreate(pEnv, RTENV_GROW_SIZE, false /*fCaseSensitive*/);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * Ignore NIL_RTENV and validate input.
fb41ad77bcfbdb3aaa1fc9503a37ee6a70dc6461vboxsync AssertReturn(pIntEnv->u32Magic == RTENV_MAGIC, VERR_INVALID_HANDLE);
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync * Do the cleanup.
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync while (iVar-- > 0)
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync for (iVar = 0; pIntEnv->papszEnvOtherCP[iVar]; iVar++)
cd5df721f068659172f3bf95de8fedeb465f057dvboxsync /*RTCritSectDelete(&pIntEnv->CritSect) */
cd5df721f068659172f3bf95de8fedeb465f057dvboxsyncRTDECL(int) RTEnvClone(PRTENV pEnv, RTENV EnvToClone)
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync * Validate input and figure out how many variable to clone and where to get them.
cd5df721f068659172f3bf95de8fedeb465f057dvboxsync _wgetenv(L"Path"); /* Force the CRT to initalize it. */
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync /* DOS systems was case insensitive. A prime example is the 'Path'
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync variable on windows which turns into the 'PATH' variable. */
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync AssertPtrReturn(pIntEnvToClone, VERR_INVALID_HANDLE);
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync AssertReturn(pIntEnvToClone->u32Magic == RTENV_MAGIC, VERR_INVALID_HANDLE);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * Create the duplicate.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync int rc = rtEnvCreate(&pIntEnv, cVars + 1 /* NULL */, fCaseSensitive);
9523921c89c66f4bececdbd5ac95aed0039eda1bvboxsync /* ASSUMES the default environment is in the current codepage. */
c55bf74b54ecdfb5ebc4e5d90b620d0fee31737evboxsync int rc2 = RTUtf16ToUtf8(papwszEnv[iSrc], &pIntEnv->papszEnv[iDst]);
e86baafe99d1f1eb37adcca5fdecfd06e7f13bc5vboxsync int rc2 = RTStrCurrentCPToUtf8(&pIntEnv->papszEnv[iDst], papszEnv[iSrc]);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncRTDECL(int) RTEnvPutEx(RTENV Env, const char *pszVarEqualValue)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AssertPtrReturn(pszVarEqualValue, VERR_INVALID_POINTER);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * Make a copy of the variable name so we can terminate it
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync * properly and then pass the request on to RTEnvSetEx.
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsyncRTDECL(int) RTEnvSetEx(RTENV Env, const char *pszVar, const char *pszValue)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * Since RTEnvPut isn't UTF-8 clean and actually expects the strings
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * to be in the current code page (codeset), we'll do the necessary
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync * conversions here.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync rc = RTStrUtf8ToCurrentCP(&pszValueOtherCP, pszValue);
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync AssertReturn(pIntEnv->u32Magic == RTENV_MAGIC, VERR_INVALID_HANDLE);
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync * Create the variable string.
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync char *pszEntry = (char *)RTMemAlloc(cchVar + cchValue + 2);
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync memcpy(&pszEntry[cchVar + 1], pszValue, cchValue + 1);
510567648d46488f4166e5f69ffffe3eeeeec4d9vboxsync * Find the location of the variable. (iVar = cVars if new)
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync if ( !pIntEnv->pfnCompare(pIntEnv->papszEnv[iVar], pszVar, cchVar)
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync * Replace the current entry. Simple.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * Adding a new variable. Resize the array if required
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync * and then insert the new value at the end.
7e8ef90d3160234df0f254131b87af4243d79476vboxsync void *pvNew = RTMemRealloc(pIntEnv->papszEnv, sizeof(char *) * (pIntEnv->cAllocated + RTENV_GROW_SIZE));
7e8ef90d3160234df0f254131b87af4243d79476vboxsync for (size_t iNewVar = pIntEnv->cVars; iNewVar < pIntEnv->cAllocated; iNewVar++)
cd5df721f068659172f3bf95de8fedeb465f057dvboxsync pIntEnv->papszEnv[iVar + 1] = NULL; /* this isn't really necessary, but doesn't hurt. */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncRTDECL(int) RTEnvUnsetEx(RTENV Env, const char *pszVar)
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync * Since RTEnvUnset isn't UTF-8 clean and actually expects the strings
702a8ee2dc1de96f2f77e97135015d3e243186fdvboxsync * to be in the current code page (codeset), we'll do the necessary
510567648d46488f4166e5f69ffffe3eeeeec4d9vboxsync * conversions here.
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync AssertReturn(pIntEnv->u32Magic == RTENV_MAGIC, VERR_INVALID_HANDLE);
1cd59fdf671ca60c64d77e3f7046aaecf7003824vboxsync * Remove all variable by the given name.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync if ( !pIntEnv->pfnCompare(pIntEnv->papszEnv[iVar], pszVar, cchVar)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync pIntEnv->papszEnv[iVar] = pIntEnv->papszEnv[pIntEnv->cVars];
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync /* no break, there could be more. */
2f3883b126a405f92b19e829472f614c7352b4f9vboxsyncRTDECL(int) RTEnvGetEx(RTENV Env, const char *pszVar, char *pszValue, size_t cbValue, size_t *pcchActual)
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AssertPtrNullReturn(pszValue, VERR_INVALID_POINTER);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AssertPtrNullReturn(pcchActual, VERR_INVALID_POINTER);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync AssertReturn(pcchActual || (pszValue && cbValue), VERR_INVALID_PARAMETER);
53b41bf9cfe74839ada5f98dca17cddcb47cf687vboxsync rc = RTEnvGetUtf8(pszVar, pszValue, cbValue, pcchActual);
53b41bf9cfe74839ada5f98dca17cddcb47cf687vboxsync * Since RTEnvGet isn't UTF-8 clean and actually expects the strings
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync * to be in the current code page (codeset), we'll do the necessary
53b41bf9cfe74839ada5f98dca17cddcb47cf687vboxsync * conversions here.
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync const char *pszValueOtherCP = RTEnvGet(pszVarOtherCP);
2f3883b126a405f92b19e829472f614c7352b4f9vboxsync rc = RTStrCurrentCPToUtf8(&pszValueUtf8, pszValueOtherCP);
510567648d46488f4166e5f69ffffe3eeeeec4d9vboxsync AssertReturn(pIntEnv->u32Magic == RTENV_MAGIC, VERR_INVALID_HANDLE);
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync * Locate the first variable and return it to the caller.
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync if ( !pIntEnv->pfnCompare(pIntEnv->papszEnv[iVar], pszVar, cchVar)
cd5df721f068659172f3bf95de8fedeb465f057dvboxsync const char *pszValueOrg = pIntEnv->papszEnv[iVar] + cchVar + 1;
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsyncRTDECL(bool) RTEnvExistEx(RTENV Env, const char *pszVar)
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync * Since RTEnvExist isn't UTF-8 clean and actually expects the strings
ecf100db90e8e3af96312908282d3c20e754fbe8vboxsync * to be in the current code page (codeset), we'll do the necessary
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync * conversions here.
3fb3de312d1ff675e0f7cc62a7d46cbb1d5d9353vboxsync int rc = RTStrUtf8ToCurrentCP(&pszVarOtherCP, pszVar);
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync AssertReturn(pIntEnv->u32Magic == RTENV_MAGIC, false);
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync * Simple search.
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync for (size_t iVar = 0; iVar < pIntEnv->cVars; iVar++)
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync if ( !pIntEnv->pfnCompare(pIntEnv->papszEnv[iVar], pszVar, cchVar)
e86baafe99d1f1eb37adcca5fdecfd06e7f13bc5vboxsyncRTDECL(char const * const *) RTEnvGetExecEnvP(RTENV Env)
e86baafe99d1f1eb37adcca5fdecfd06e7f13bc5vboxsync /** @todo fix this API it's fundamentally wrong! */
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync static const char * const s_papszDummy[2] = { NULL, NULL };
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync AssertReturn(pIntEnv->u32Magic == RTENV_MAGIC, NULL);
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync * Free any old envp.
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync for (size_t iVar = 0; pIntEnv->papszEnvOtherCP[iVar]; iVar++)
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync * Construct a new envp with the strings in the process code set.
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync papszRet = pIntEnv->papszEnvOtherCP = papsz = (char **)RTMemAlloc(sizeof(char *) * (pIntEnv->cVars + 1));
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync for (size_t iVar = 0; iVar < pIntEnv->cVars; iVar++)
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync int rc = RTStrUtf8ToCurrentCP(&papsz[iVar], pIntEnv->papszEnv[iVar]);
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync /* RTEnvDestroy / we cleans up later. */
e86baafe99d1f1eb37adcca5fdecfd06e7f13bc5vboxsync * RTSort callback for comparing two environment variables.
e86baafe99d1f1eb37adcca5fdecfd06e7f13bc5vboxsync * @returns -1, 0, 1. See PFNRTSORTCMP.
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync * @param pvElement1 Variable 1.
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync * @param pvElement2 Variable 2.
d4a9d525e6f2111d462d2d96462dced6b9ec00efvboxsync * @param pvUser Ignored.
e86baafe99d1f1eb37adcca5fdecfd06e7f13bc5vboxsyncDECLCALLBACK(int) rtEnvSortCompare(const void *pvElement1, const void *pvElement2, void *pvUser)
c10a6f0c7041e4d1ee50ad38425aab9d43c55522vboxsync int iDiff = strcmp((const char *)pvElement1, (const char *)pvElement2);
c10a6f0c7041e4d1ee50ad38425aab9d43c55522vboxsync else if (iDiff > 0)
f044158ee9eb7045a43f2c4ef2fbc07cb11329aevboxsyncRTDECL(int) RTEnvQueryUtf16Block(RTENV hEnv, PRTUTF16 *ppwszzBlock)
e86baafe99d1f1eb37adcca5fdecfd06e7f13bc5vboxsync * Validate / simplify input.
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync AssertReturn(pIntEnv->u32Magic == RTENV_MAGIC, VERR_INVALID_HANDLE);
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync * Sort it first.
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync RTSortApvShell((void **)pIntEnv->papszEnv, pIntEnv->cVars, rtEnvSortCompare, pIntEnv);
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync * Calculate the size.
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync for (size_t iVar = 0; iVar < pIntEnv->cVars; iVar++)
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync rc = RTStrCalcUtf16LenEx(pIntEnv->papszEnv[iVar], RTSTR_MAX, &cwc);
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync * Perform the conversion.
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync PRTUTF16 pwszz = pwszzBlock = (PRTUTF16)RTMemAlloc(cwcTotal * sizeof(RTUTF16));
35e6d303696e46d969aaf9a59cc381333a483b0bvboxsync for (size_t iVar = 0; iVar < pIntEnv->cVars; iVar++)
d86beb7ea7f5fb6bf4a4e80c7b3fe0aeec98fa93vboxsync rc = RTStrToUtf16Ex(pIntEnv->papszEnv[iVar], RTSTR_MAX,
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync AssertBreakStmt(cwcLeft >= 2, rc = VERR_INTERNAL_ERROR_3);
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync AssertStmt(cwcLeft == 2 || RT_FAILURE(rc), rc = VERR_INTERNAL_ERROR_2);
dea3e7faa80f4aab41e08945b9308fd2e3ffe7fcvboxsyncRTDECL(void) RTEnvFreeUtf16Block(PRTUTF16 pwszzBlock)
81dfa298981df637a707b142ebd03cb7d3385097vboxsync AssertReturn(pIntEnv->u32Magic == RTENV_MAGIC, UINT32_MAX);
81dfa298981df637a707b142ebd03cb7d3385097vboxsyncRTDECL(uint32_t) RTEnvGetByIndexEx(RTENV hEnv, uint32_t iVar, char *pszVar, size_t cbVar, char *pszValue, size_t cbValue)
462e60a19d02a99b2b1a5c08dff74bb0808d707cvboxsync AssertReturn(pIntEnv->u32Magic == RTENV_MAGIC, UINT32_MAX);
4171ffb38eb8720b2ae9a8d13e95103ab26cfd12vboxsync rc = RTStrCopyEx(pszVar, cbVar, pszSrcVar, pszSrcValue - pszSrcVar - fHasEqual);