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/libs/dutil/WixToolset.DUtil/apputil.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'src/libs/dutil/WixToolset.DUtil/apputil.cpp') diff --git a/src/libs/dutil/WixToolset.DUtil/apputil.cpp b/src/libs/dutil/WixToolset.DUtil/apputil.cpp index b70c8cfb..9e75082a 100644 --- a/src/libs/dutil/WixToolset.DUtil/apputil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/apputil.cpp @@ -87,31 +87,27 @@ DAPI_(HRESULT) LoadSystemLibraryWithPath( ) { HRESULT hr = S_OK; - DWORD cch = 0; - WCHAR wzPath[MAX_PATH] = { }; + LPWSTR sczDirectory = NULL; + LPWSTR sczPath = NULL; - cch = ::GetSystemDirectoryW(wzPath, MAX_PATH); - AppExitOnNullWithLastError(cch, hr, "Failed to get the Windows system directory."); + hr = PathGetSystemDirectory(&sczDirectory); + AppExitOnFailure(hr, "Failed to get the Windows system directory."); - if (L'\\' != wzPath[cch - 1]) - { - hr = ::StringCchCatNW(wzPath, MAX_PATH, L"\\", 1); - AppExitOnRootFailure(hr, "Failed to terminate the string with a backslash."); - } + hr = StrAllocFormatted(&sczPath, L"%ls%ls", sczDirectory, wzModuleName); + AppExitOnFailure(hr, "Failed to create the fully-qualified path to %ls.", wzModuleName); - hr = ::StringCchCatW(wzPath, MAX_PATH, wzModuleName); - AppExitOnRootFailure(hr, "Failed to create the fully-qualified path to %ls.", wzModuleName); - - *phModule = ::LoadLibraryExW(wzPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); - AppExitOnNullWithLastError(*phModule, hr, "Failed to load the library %ls.", wzModuleName); + *phModule = ::LoadLibraryExW(sczPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + AppExitOnNullWithLastError(*phModule, hr, "Failed to load the library %ls.", sczPath); if (psczPath) { - hr = StrAllocString(psczPath, wzPath, MAX_PATH); - AppExitOnFailure(hr, "Failed to copy the path to library."); + *psczPath = sczPath; + sczPath = NULL; } LExit: + ReleaseStr(sczDirectory); + return hr; } -- cgit v1.2.3-55-g6feb