From 68ec803fc7f48bb0e0463dc45f6ce40e1f07dbf5 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 3 Jun 2022 17:50:50 -0500 Subject: Make sure base paths are fully qualified in Burn. --- src/libs/dutil/WixToolset.DUtil/inc/pathutil.h | 10 ++++++++++ src/libs/dutil/WixToolset.DUtil/path2utl.cpp | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) (limited to 'src/libs/dutil/WixToolset.DUtil') diff --git a/src/libs/dutil/WixToolset.DUtil/inc/pathutil.h b/src/libs/dutil/WixToolset.DUtil/inc/pathutil.h index f36e6ebc..971ef887 100644 --- a/src/libs/dutil/WixToolset.DUtil/inc/pathutil.h +++ b/src/libs/dutil/WixToolset.DUtil/inc/pathutil.h @@ -298,6 +298,16 @@ DAPI_(HRESULT) PathConcatRelativeToBase( __deref_out_z LPWSTR* psczCombined ); +/******************************************************************* + PathConcatRelativeToFullyQualifiedBase - ensures the base path is + fully qualified and then calls PathConcatRelativeToBase. +*******************************************************************/ +DAPI_(HRESULT) PathConcatRelativeToFullyQualifiedBase( + __in LPCWSTR wzBase, + __in_opt LPCWSTR wzRelative, + __deref_out_z LPWSTR* psczCombined + ); + /******************************************************************* PathCompareCanonicalized - canonicalizes the two paths using PathCanonicalizeForComparison which does not resolve relative paths into fully qualified paths. diff --git a/src/libs/dutil/WixToolset.DUtil/path2utl.cpp b/src/libs/dutil/WixToolset.DUtil/path2utl.cpp index c6ff608c..3c4b2f88 100644 --- a/src/libs/dutil/WixToolset.DUtil/path2utl.cpp +++ b/src/libs/dutil/WixToolset.DUtil/path2utl.cpp @@ -162,6 +162,25 @@ LExit: return hr; } +DAPI_(HRESULT) PathConcatRelativeToFullyQualifiedBase( + __in LPCWSTR wzBase, + __in_opt LPCWSTR wzRelative, + __deref_out_z LPWSTR* psczCombined + ) +{ + HRESULT hr = S_OK; + + if (!PathIsFullyQualified(wzBase)) + { + PathExitWithRootFailure(hr, E_INVALIDARG, "wzBase must be fully qualified: %ls.", wzBase); + } + + hr = PathConcatRelativeToBase(wzBase, wzRelative, psczCombined); + +LExit: + return hr; +} + DAPI_(HRESULT) PathCompareCanonicalized( __in_z LPCWSTR wzPath1, __in_z LPCWSTR wzPath2, -- cgit v1.2.3-55-g6feb