From eb53852d7ae6838e54525eb57df1d8ce8a722f9b Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 24 Jun 2022 12:28:27 -0500 Subject: Add longPathAware to Burn manifest to support long paths. Fixes 3455 --- src/burn/engine/approvedexe.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/burn/engine/approvedexe.cpp') diff --git a/src/burn/engine/approvedexe.cpp b/src/burn/engine/approvedexe.cpp index 2a96868e..d8bd956b 100644 --- a/src/burn/engine/approvedexe.cpp +++ b/src/burn/engine/approvedexe.cpp @@ -148,6 +148,7 @@ extern "C" HRESULT ApprovedExesLaunch( LPWSTR sczCommand = NULL; LPWSTR sczCommandObfuscated = NULL; LPWSTR sczExecutableDirectory = NULL; + size_t cchExecutableDirectory = 0; STARTUPINFOW si = { }; PROCESS_INFORMATION pi = { }; @@ -177,9 +178,17 @@ extern "C" HRESULT ApprovedExesLaunch( // Try to get the directory of the executable so we can set the current directory of the process to help those executables // that expect stuff to be relative to them. Best effort only. hr = PathGetDirectory(pLaunchApprovedExe->sczExecutablePath, &sczExecutableDirectory); + if (SUCCEEDED(hr)) + { + // CreateProcessW has undocumented MAX_PATH restriction for lpCurrentDirectory even when long path support is enabled. + hr = ::StringCchLengthW(sczExecutableDirectory, MAX_PATH - 1, &cchExecutableDirectory); + } + if (FAILED(hr)) { ReleaseNullStr(sczExecutableDirectory); + + hr = S_OK; } LogId(REPORT_STANDARD, MSG_LAUNCHING_APPROVED_EXE, pLaunchApprovedExe->sczExecutablePath, sczCommandObfuscated); -- cgit v1.2.3-55-g6feb