From 8810aa8908ed7887616d86dd5fb821fcfa92f444 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 3 Jun 2022 17:50:22 -0500 Subject: Update Burn algorithm for picking elevated temp path to use SystemTemp. --- .../Manual/BafThmutilTesting/BafThmUtilTesting.cpp | 30 ++++++++++++++++++++++ .../TestData/Manual/BafThmutilTesting/precomp.h | 3 +++ 2 files changed, 33 insertions(+) (limited to 'src/test') diff --git a/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp b/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp index 3cf994fc..bc942dc8 100644 --- a/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp +++ b/src/test/burn/TestData/Manual/BafThmutilTesting/BafThmUtilTesting.cpp @@ -30,6 +30,7 @@ static THEME_ASSIGN_CONTROL_ID vrgInitControls[] = { { BAFTHMUTILTESTING_CONTROL_PROGRESSBAR_STANDARD, L"StandardProgressBar" }, }; +static HRESULT LogUserSid(); static void CALLBACK BafThmUtilTestingTraceError( __in_z LPCSTR szFile, __in int iLine, @@ -494,6 +495,8 @@ HRESULT WINAPI CreateBAFunctions( pResults->pvBAFunctionsProcContext = pBAFunctions; pBAFunctions = NULL; + LogUserSid(); + LExit: ReleaseObject(pBAFunctions); ReleaseObject(pEngine); @@ -501,6 +504,33 @@ LExit: return hr; } +static HRESULT LogUserSid() +{ + HRESULT hr = S_OK; + TOKEN_USER* pTokenUser = NULL; + LPWSTR sczSid = NULL; + + hr = ProcTokenUser(::GetCurrentProcess(), &pTokenUser); + BalExitOnFailure(hr, "Failed to get user from process token."); + + if (!::ConvertSidToStringSidW(pTokenUser->User.Sid, &sczSid)) + { + BalExitWithLastError(hr, "Failed to convert sid to string."); + } + + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Current User SID: %ls", sczSid); + +LExit: + ReleaseMem(pTokenUser); + + if (sczSid) + { + ::LocalFree(sczSid); + } + + return hr; +} + static void CALLBACK BafThmUtilTestingTraceError( __in_z LPCSTR /*szFile*/, __in int /*iLine*/, diff --git a/src/test/burn/TestData/Manual/BafThmutilTesting/precomp.h b/src/test/burn/TestData/Manual/BafThmutilTesting/precomp.h index e7cd39dc..2e14786a 100644 --- a/src/test/burn/TestData/Manual/BafThmutilTesting/precomp.h +++ b/src/test/burn/TestData/Manual/BafThmutilTesting/precomp.h @@ -16,12 +16,15 @@ #include #include #include +#include #include "dutil.h" #include "dictutil.h" #include "fileutil.h" #include "locutil.h" +#include "memutil.h" #include "pathutil.h" +#include "procutil.h" #include "strutil.h" #include "thmutil.h" #include "regutil.h" -- cgit v1.2.3-55-g6feb