Skip to content

Commit

Permalink
Remove clean.room
Browse files Browse the repository at this point in the history
  • Loading branch information
robmen committed Mar 3, 2024
1 parent 14cd643 commit 20b5793
Show file tree
Hide file tree
Showing 21 changed files with 25 additions and 1,467 deletions.
1,012 changes: 0 additions & 1,012 deletions src/api/burn/balutil/BalBaseBootstrapperApplicationProc.cpp

This file was deleted.

34 changes: 0 additions & 34 deletions src/api/burn/mbanative/mbanative.cpp

This file was deleted.

1 change: 0 additions & 1 deletion src/api/burn/mbanative/mbanative.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
</PropertyGroup>

<ItemGroup>
<ClCompile Include="mbanative.cpp" />
<ClCompile Include="precomp.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
Expand Down
13 changes: 2 additions & 11 deletions src/burn/engine/apply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1433,17 +1433,8 @@ static HRESULT LayoutBundle(

progress.pCacheContext = pContext;

hr = VariableGetString(pContext->pVariables, BURN_BUNDLE_SOURCE_PROCESS_PATH, &sczBundlePath);
if (FAILED(hr))
{
if (E_NOTFOUND != hr)
{
ExitOnFailure(hr, "Failed to get path to bundle source process path to layout.");
}

hr = PathForCurrentProcess(&sczBundlePath, NULL);
ExitOnFailure(hr, "Failed to get path to bundle to layout.");
}
hr = PathForCurrentProcess(&sczBundlePath, NULL);
ExitOnFailure(hr, "Failed to get path to bundle to layout.");

hr = PathConcatRelativeToFullyQualifiedBase(pContext->wzLayoutDirectory, wzExecutableName, &sczDestinationPath);
ExitOnFailure(hr, "Failed to concat layout path for bundle.");
Expand Down
22 changes: 5 additions & 17 deletions src/burn/engine/cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "precomp.h"

static const LPCWSTR BUNDLE_CLEAN_ROOM_WORKING_FOLDER_NAME = L".cr";
static const LPCWSTR BUNDLE_WORKING_FOLDER_NAME = L".be";
static const LPCWSTR UNVERIFIED_CACHE_FOLDER_NAME = L".unverified";
static const LPCWSTR PACKAGE_CACHE_FOLDER_NAME = L"Package Cache";
Expand Down Expand Up @@ -242,8 +241,7 @@ extern "C" HRESULT CacheInitialize(
extern "C" HRESULT CacheInitializeSources(
__in BURN_CACHE* pCache,
__in BURN_REGISTRATION* pRegistration,
__in BURN_VARIABLES* pVariables,
__in BURN_ENGINE_COMMAND* pInternalCommand
__in BURN_VARIABLES* pVariables
)
{
Assert(!pCache->fInitializedCacheSources);
Expand All @@ -255,7 +253,6 @@ extern "C" HRESULT CacheInitializeSources(
LPWSTR sczOriginalSource = NULL;
LPWSTR sczOriginalSourceFolder = NULL;
BOOL fPathEqual = FALSE;
LPCWSTR wzSourceProcessPath = pInternalCommand->sczSourceProcessPath;

hr = PathForCurrentProcess(&sczCurrentPath, NULL);
ExitOnFailure(hr, "Failed to get current process path.");
Expand All @@ -272,31 +269,22 @@ extern "C" HRESULT CacheInitializeSources(

pCache->fRunningFromCache = fPathEqual;

// If a source process path was not provided (e.g. we are not being
// run in a clean room) then use the current process path as the
// source process path.
if (!wzSourceProcessPath)
{
wzSourceProcessPath = sczCurrentPath;
}

hr = PathGetDirectory(wzSourceProcessPath, &pCache->sczSourceProcessFolder);
hr = PathGetDirectory(sczCurrentPath, &pCache->sczSourceProcessFolder);
ExitOnFailure(hr, "Failed to initialize cache source folder.");

// If we're not running from the cache, ensure the original source is set.
if (!pCache->fRunningFromCache)
{
// If the original source has not been set already then set it where the bundle is
// running from right now. This value will be persisted and we'll use it when launched
// from the clean room or package cache since none of our packages will be relative to
// those locations.
// from the package cache since none of our packages will be relative to those locations.
hr = VariableGetString(pVariables, BURN_BUNDLE_ORIGINAL_SOURCE, &sczOriginalSource);
if (E_NOTFOUND == hr)
{
hr = VariableSetString(pVariables, BURN_BUNDLE_ORIGINAL_SOURCE, wzSourceProcessPath, FALSE, FALSE);
hr = VariableSetString(pVariables, BURN_BUNDLE_ORIGINAL_SOURCE, sczCurrentPath, FALSE, FALSE);
ExitOnFailure(hr, "Failed to set original source variable.");

hr = StrAllocString(&sczOriginalSource, wzSourceProcessPath, 0);
hr = StrAllocString(&sczOriginalSource, sczCurrentPath, 0);
ExitOnFailure(hr, "Failed to copy current path to original source.");
}

Expand Down
3 changes: 1 addition & 2 deletions src/burn/engine/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ HRESULT CacheInitialize(
HRESULT CacheInitializeSources(
__in BURN_CACHE* pCache,
__in BURN_REGISTRATION* pRegistration,
__in BURN_VARIABLES* pVariables,
__in BURN_ENGINE_COMMAND* pInternalCommand
__in BURN_VARIABLES* pVariables
);
HRESULT CacheEnsureAcquisitionFolder(
__in BURN_CACHE* pCache
Expand Down
180 changes: 1 addition & 179 deletions src/burn/engine/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ static HRESULT EscapeAndAppendArgumentToCommandLineFormattedArgs(
__in __format_string LPCWSTR wzFormat,
__in va_list args
);
static HRESULT AppendLayoutToCommandLine(
__in BOOTSTRAPPER_ACTION action,
__in_z LPCWSTR wzLayoutDirectory,
__deref_inout_z LPWSTR* psczCommandLine
);
static HRESULT GetSanitizedCommandLine(
__in BURN_ENGINE_COMMAND* pInternalCommand,
__in BOOTSTRAPPER_COMMAND* pCommand,
Expand Down Expand Up @@ -151,18 +146,6 @@ extern "C" HRESULT CoreInitialize(
ExitOnFailure(hr, "Failed to overwrite the bundle active parent built-in variable.");
}

if (pEngineState->internalCommand.sczSourceProcessPath)
{
hr = VariableSetString(&pEngineState->variables, BURN_BUNDLE_SOURCE_PROCESS_PATH, pEngineState->internalCommand.sczSourceProcessPath, TRUE, FALSE);
ExitOnFailure(hr, "Failed to set source process path variable.");

hr = PathGetDirectory(pEngineState->internalCommand.sczSourceProcessPath, &sczSourceProcessFolder);
ExitOnFailure(hr, "Failed to get source process folder from path.");

hr = VariableSetString(&pEngineState->variables, BURN_BUNDLE_SOURCE_PROCESS_FOLDER, sczSourceProcessFolder, TRUE, FALSE);
ExitOnFailure(hr, "Failed to set source process folder variable.");
}

// Set BURN_BUNDLE_ORIGINAL_SOURCE, if it was passed in on the command line.
// Needs to be done after ManifestLoadXmlFromBuffer.
if (pEngineState->internalCommand.sczOriginalSource)
Expand All @@ -173,7 +156,7 @@ extern "C" HRESULT CoreInitialize(

if (BURN_MODE_NORMAL == pEngineState->internalCommand.mode || BURN_MODE_EMBEDDED == pEngineState->internalCommand.mode)
{
hr = CacheInitializeSources(&pEngineState->cache, &pEngineState->registration, &pEngineState->variables, &pEngineState->internalCommand);
hr = CacheInitializeSources(&pEngineState->cache, &pEngineState->registration, &pEngineState->variables);
ExitOnFailure(hr, "Failed to initialize internal cache source functionality.");
}

Expand Down Expand Up @@ -1087,95 +1070,6 @@ static HRESULT CoreRecreateCommandLine(
return hr;
}

extern "C" HRESULT CoreCreateCleanRoomCommandLine(
__deref_inout_z LPWSTR* psczCommandLine,
__in BURN_ENGINE_STATE* pEngineState,
__in_z LPCWSTR wzCleanRoomBundlePath,
__in_z LPCWSTR wzCurrentProcessPath,
__inout HANDLE* phFileAttached,
__inout HANDLE* phFileSelf
)
{
HRESULT hr = S_OK;
BOOTSTRAPPER_COMMAND* pCommand = &pEngineState->command;
BURN_ENGINE_COMMAND* pInternalCommand = &pEngineState->internalCommand;

// The clean room switch must always be at the front of the command line so
// the EngineInCleanRoom function will operate correctly.
hr = StrAllocFormatted(psczCommandLine, L"-%ls=\"%ls\"", BURN_COMMANDLINE_SWITCH_CLEAN_ROOM, wzCurrentProcessPath);
ExitOnFailure(hr, "Failed to allocate parameters for unelevated process.");

// Send a file handle for the child Burn process to access the attached container.
hr = CoreAppendFileHandleAttachedToCommandLine(pEngineState->section.hEngineFile, phFileAttached, psczCommandLine);
ExitOnFailure(hr, "Failed to append %ls", BURN_COMMANDLINE_SWITCH_FILEHANDLE_ATTACHED);

// Grab a file handle for the child Burn process.
hr = CoreAppendFileHandleSelfToCommandLine(wzCleanRoomBundlePath, phFileSelf, psczCommandLine, NULL);
ExitOnFailure(hr, "Failed to append %ls", BURN_COMMANDLINE_SWITCH_FILEHANDLE_SELF);

hr = CoreAppendSplashScreenWindowToCommandLine(pCommand->hwndSplashScreen, psczCommandLine);
ExitOnFailure(hr, "Failed to append %ls", BURN_COMMANDLINE_SWITCH_SPLASH_SCREEN);

if (pInternalCommand->sczLogFile)
{
LPCWSTR wzLogParameter = (BURN_LOGGING_ATTRIBUTE_EXTRADEBUG & pInternalCommand->dwLoggingAttributes) ? L"xlog" : L"log";
hr = StrAllocConcatFormatted(psczCommandLine, L" /%ls", wzLogParameter);
ExitOnFailure(hr, "Failed to append logging switch.");

hr = AppAppendCommandLineArgument(psczCommandLine, pInternalCommand->sczLogFile);
ExitOnFailure(hr, "Failed to append custom log path.");
}

hr = AppendLayoutToCommandLine(pCommand->action, pCommand->wzLayoutDirectory, psczCommandLine);
ExitOnFailure(hr, "Failed to append layout.");

switch (pInternalCommand->automaticUpdates)
{
case BURN_AU_PAUSE_ACTION_NONE:
hr = StrAllocConcat(psczCommandLine, L" /noaupause", 0);
ExitOnFailure(hr, "Failed to append /noaupause.");
break;
case BURN_AU_PAUSE_ACTION_IFELEVATED_NORESUME:
hr = StrAllocConcat(psczCommandLine, L" /keepaupaused", 0);
ExitOnFailure(hr, "Failed to append /keepaupaused.");
break;
}

// TODO: This should only be added if it was enabled from the command line.
if (pInternalCommand->fDisableSystemRestore)
{
hr = StrAllocConcat(psczCommandLine, L" /disablesystemrestore", 0);
ExitOnFailure(hr, "Failed to append /disablesystemrestore.");
}

if (pInternalCommand->sczOriginalSource)
{
hr = StrAllocConcat(psczCommandLine, L" /originalsource", 0);
ExitOnFailure(hr, "Failed to append /originalsource.");

hr = AppAppendCommandLineArgument(psczCommandLine, pInternalCommand->sczOriginalSource);
ExitOnFailure(hr, "Failed to append original source.");
}

if (pEngineState->embeddedConnection.sczName)
{
hr = StrAllocConcatFormatted(psczCommandLine, L" -%ls %ls %ls %u", BURN_COMMANDLINE_SWITCH_EMBEDDED, pEngineState->embeddedConnection.sczName, pEngineState->embeddedConnection.sczSecret, pEngineState->embeddedConnection.dwProcessId);
ExitOnFailure(hr, "Failed to allocate embedded command.");
}

if (pInternalCommand->sczIgnoreDependencies)
{
hr = StrAllocConcatFormatted(psczCommandLine, L" /%ls=%ls", BURN_COMMANDLINE_SWITCH_IGNOREDEPENDENCIES, pInternalCommand->sczIgnoreDependencies);
ExitOnFailure(hr, "Failed to append ignored dependencies to command-line.");
}

hr = CoreRecreateCommandLine(psczCommandLine, pCommand->action, pInternalCommand, pCommand, pCommand->relationType, pCommand->fPassthrough);
ExitOnFailure(hr, "Failed to recreate clean room command-line.");

LExit:
return hr;
}

extern "C" HRESULT CoreCreatePassthroughBundleCommandLine(
__deref_inout_z LPWSTR* psczCommandLine,
__in BURN_ENGINE_COMMAND* pInternalCommand,
Expand All @@ -1201,9 +1095,6 @@ extern "C" HRESULT CoreCreateResumeCommandLine(
{
HRESULT hr = S_OK;

hr = StrAllocFormatted(psczCommandLine, L"/%ls", BURN_COMMANDLINE_SWITCH_CLEAN_ROOM);
ExitOnFailure(hr, "Failed to alloc resume command-line.");

if (BURN_LOGGING_ATTRIBUTE_EXTRADEBUG & pPlan->pInternalCommand->dwLoggingAttributes)
{
hr = StrAllocConcatFormatted(psczCommandLine, L" /%ls=%ls", BURN_COMMANDLINE_SWITCH_LOG_MODE, L"x");
Expand Down Expand Up @@ -1694,40 +1585,6 @@ extern "C" HRESULT CoreParseCommandLine(

i += 2;
}
else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_CLEAN_ROOM), BURN_COMMANDLINE_SWITCH_CLEAN_ROOM, lstrlenW(BURN_COMMANDLINE_SWITCH_CLEAN_ROOM)))
{
if (0 != i)
{
fInvalidCommandLine = TRUE;
TraceLog(E_INVALIDARG, "Clean room command-line switch must be first argument on command-line.");
}

if (BURN_MODE_UNKNOWN == pInternalCommand->mode)
{
pInternalCommand->mode = BURN_MODE_NORMAL;
}
else
{
fInvalidCommandLine = TRUE;
TraceLog(E_INVALIDARG, "Multiple mode command-line switches were provided.");
}

// Get a pointer to the next character after the switch.
LPCWSTR wzParam = &argv[i][1 + lstrlenW(BURN_COMMANDLINE_SWITCH_CLEAN_ROOM)];
if (L'\0' != wzParam[0])
{
if (L'=' != wzParam[0])
{
fInvalidCommandLine = TRUE;
TraceLog(E_INVALIDARG, "Invalid switch: %ls", argv[i]);
}
else if (L'\0' != wzParam[1])
{
hr = PathExpand(&pInternalCommand->sczSourceProcessPath, wzParam + 1, PATH_EXPAND_FULLPATH);
ExitOnFailure(hr, "Failed to copy source process path.");
}
}
}
else if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, NORM_IGNORECASE, &argv[i][1], lstrlenW(BURN_COMMANDLINE_SWITCH_SYSTEM_COMPONENT), BURN_COMMANDLINE_SWITCH_SYSTEM_COMPONENT, lstrlenW(BURN_COMMANDLINE_SWITCH_SYSTEM_COMPONENT)))
{
// Get a pointer to the next character after the switch.
Expand Down Expand Up @@ -1762,15 +1619,7 @@ extern "C" HRESULT CoreParseCommandLine(
switch (pInternalCommand->mode)
{
case BURN_MODE_UNKNOWN:
#if TODO_DELETE
// Set mode to UNTRUSTED to ensure multiple modes weren't specified.
pInternalCommand->mode = BURN_MODE_UNTRUSTED;
break;
#endif
case BURN_MODE_NORMAL:
// The initialization code already assumes that the
// clean room switch is at the beginning of the command line,
// so it's safe to assume that the mode is NORMAL in the clean room.
pInternalCommand->mode = BURN_MODE_EMBEDDED;
break;
default:
Expand Down Expand Up @@ -2014,9 +1863,6 @@ extern "C" HRESULT CoreParseCommandLine(

if (BURN_MODE_UNKNOWN == pInternalCommand->mode)
{
#if TODO_DELETE
pInternalCommand->mode = BURN_MODE_UNTRUSTED;
#endif
pInternalCommand->mode = BURN_MODE_NORMAL;
}

Expand Down Expand Up @@ -2212,30 +2058,6 @@ static HRESULT EscapeAndAppendArgumentToCommandLineFormattedArgs(
return hr;
}

static HRESULT AppendLayoutToCommandLine(
__in BOOTSTRAPPER_ACTION action,
__in_z LPCWSTR wzLayoutDirectory,
__deref_inout_z LPWSTR* psczCommandLine
)
{
HRESULT hr = S_OK;

if (BOOTSTRAPPER_ACTION_LAYOUT == action || wzLayoutDirectory)
{
hr = StrAllocConcat(psczCommandLine, L" /layout", 0);
ExitOnFailure(hr, "Failed to append layout switch.");

if (wzLayoutDirectory)
{
hr = AppAppendCommandLineArgument(psczCommandLine, wzLayoutDirectory);
ExitOnFailure(hr, "Failed to append layout directory.");
}
}

LExit:
return hr;
}

static HRESULT GetSanitizedCommandLine(
__in BURN_ENGINE_COMMAND* pInternalCommand,
__in BOOTSTRAPPER_COMMAND* pCommand,
Expand Down
Loading

0 comments on commit 20b5793

Please sign in to comment.