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/logging.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src/burn/engine/logging.cpp') diff --git a/src/burn/engine/logging.cpp b/src/burn/engine/logging.cpp index 1020d01f..68f0c35b 100644 --- a/src/burn/engine/logging.cpp +++ b/src/burn/engine/logging.cpp @@ -211,7 +211,7 @@ extern "C" void LoggingOpenFailed() LPCWSTR* lpStrings = const_cast(&LOG_FAILED_EVENT_LOG_MESSAGE); WORD wNumStrings = 1; - hr = LogOpen(NULL, L"Setup", L"_Failed", L"txt", FALSE, FALSE, NULL); + hr = LogOpen(NULL, L"Setup", L"_Failed", L"log", FALSE, FALSE, NULL); if (SUCCEEDED(hr)) { ExitFunction(); @@ -965,19 +965,14 @@ static HRESULT GetNonSessionSpecificTempFolder( ) { HRESULT hr = S_OK; - WCHAR wzTempFolder[MAX_PATH] = { }; + LPWSTR sczTempFolder = NULL; SIZE_T cchTempFolder = 0; DWORD dwSessionId = 0; LPWSTR sczSessionId = 0; SIZE_T cchSessionId = 0; - if (!::GetTempPathW(countof(wzTempFolder), wzTempFolder)) - { - ExitWithLastError(hr, "Failed to get temp folder."); - } - - hr = ::StringCchLengthW(wzTempFolder, countof(wzTempFolder), reinterpret_cast(&cchTempFolder)); - ExitOnFailure(hr, "Failed to get length of temp folder."); + hr = PathGetTempPath(&sczTempFolder, &cchTempFolder); + ExitOnFailure(hr, "Failed to get temp folder."); // If our session id is in the TEMP path then remove that part so we get the non-session // specific temporary folder. @@ -989,17 +984,18 @@ static HRESULT GetNonSessionSpecificTempFolder( hr = ::StringCchLengthW(sczSessionId, STRSAFE_MAX_CCH, reinterpret_cast(&cchSessionId)); ExitOnFailure(hr, "Failed to get length of session id string."); - if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, wzTempFolder + cchTempFolder - cchSessionId, static_cast(cchSessionId), sczSessionId, static_cast(cchSessionId))) + if (CSTR_EQUAL == ::CompareStringW(LOCALE_NEUTRAL, 0, sczTempFolder + cchTempFolder - cchSessionId, static_cast(cchSessionId), sczSessionId, static_cast(cchSessionId))) { cchTempFolder -= cchSessionId; } } - hr = StrAllocString(psczNonSessionTempFolder, wzTempFolder, cchTempFolder); + hr = StrAllocString(psczNonSessionTempFolder, sczTempFolder, cchTempFolder); ExitOnFailure(hr, "Failed to copy temp folder."); LExit: ReleaseStr(sczSessionId); + ReleaseStr(sczTempFolder); return hr; } -- cgit v1.2.3-55-g6feb