/** * Same as dbgfR3AsSearchEnv, except that the path is taken from the environment. * * If the environment variable doesn't exist, the current directory is searched * instead. * * @returns VBox status code. * @param pszFilename The filename. * @param pszEnvVar The environment variable name. * @param pfnOpen The open callback function. * @param pvUser User argument for the callback. */ static int dbgfR3AsSearchEnvPath(const char *pszFilename, const char *pszEnvVar, PFNDBGFR3ASSEARCHOPEN pfnOpen, void *pvUser) { int rc; char *pszPath = RTEnvDupEx(RTENV_DEFAULT, pszEnvVar); if (pszPath) { rc = dbgfR3AsSearchPath(pszFilename, pszPath, pfnOpen, pvUser); RTStrFree(pszPath); } else rc = dbgfR3AsSearchPath(pszFilename, ".", pfnOpen, pvUser); return rc; }
/** * Same as dbgfR3AsSearchEnv, except that the path is taken from the DBGF config * (CFGM). * * Nothing is done if the CFGM variable isn't set. * * @returns VBox status code. * @param pszFilename The filename. * @param pszCfgValue The name of the config variable (under /DBGF/). * @param pfnOpen The open callback function. * @param pvUser User argument for the callback. */ static int dbgfR3AsSearchCfgPath(PVM pVM, const char *pszFilename, const char *pszCfgValue, PFNDBGFR3ASSEARCHOPEN pfnOpen, void *pvUser) { char *pszPath; int rc = CFGMR3QueryStringAllocDef(CFGMR3GetChild(CFGMR3GetRoot(pVM), "/DBGF"), pszCfgValue, &pszPath, NULL); if (RT_FAILURE(rc)) return rc; if (!pszPath) return VERR_FILE_NOT_FOUND; rc = dbgfR3AsSearchPath(pszFilename, pszPath, pfnOpen, pvUser); MMR3HeapFree(pszPath); return rc; }