Skip to content

Commit

Permalink
Merge pull request wixtoolset#456 from robmen/clean-room-hijack
Browse files Browse the repository at this point in the history
When elevated place clean room in system Temp folder
  • Loading branch information
barnson committed Nov 16, 2017
2 parents 87f84b4 + 938381c commit c2b0b3f
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/burn/engine/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1104,13 +1104,29 @@ static HRESULT CalculateWorkingFolder(
{
HRESULT hr = S_OK;
RPC_STATUS rs = RPC_S_OK;
BOOL fElevated = FALSE;
WCHAR wzTempPath[MAX_PATH] = { };
UUID guid = {};
WCHAR wzGuid[39];

if (!vsczWorkingFolder)
{
if (0 == ::GetTempPathW(countof(wzTempPath), wzTempPath))
ProcElevated(::GetCurrentProcess(), &fElevated);

if (fElevated)
{
if (!::GetWindowsDirectoryW(wzTempPath, countof(wzTempPath)))
{
ExitWithLastError(hr, "Failed to get windows path for working folder.");
}

hr = PathFixedBackslashTerminate(wzTempPath, countof(wzTempPath));
ExitOnFailure(hr, "Failed to ensure windows path for working folder ended in backslash.");

hr = ::StringCchCatW(wzTempPath, countof(wzTempPath), L"Temp\\");
ExitOnFailure(hr, "Failed to concat Temp directory on windows path for working folder.");
}
else if (0 == ::GetTempPathW(countof(wzTempPath), wzTempPath))
{
ExitWithLastError(hr, "Failed to get temp path for working folder.");
}
Expand Down

0 comments on commit c2b0b3f

Please sign in to comment.