Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnsureTable() should bring in relevant Standard Actions which rely on the table declared #555

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public static class WindowsInstallerStandard
{
private static readonly Dictionary<string, WixActionSymbol> standardActionsById;
private static readonly HashSet<string> standardActionNames;
private static readonly Dictionary<string, WixActionSymbol[]> standardActionsByTableName = new Dictionary<string, WixActionSymbol[]>();

/// <summary>
/// References:
Expand Down Expand Up @@ -368,6 +369,26 @@ static WindowsInstallerStandard()

standardActionNames = new HashSet<string>(standardActions.Select(a => a.Action));
standardActionsById = standardActions.ToDictionary(a => a.Id.Id);

// Populate standard actions based on standard table names
standardActionsByTableName.Add("AppId", new[]
{
standardActionsById["AdvertiseExecuteSequence/RegisterClassInfo"],
standardActionsById["InstallExecuteSequence/UnregisterClassInfo"],
standardActionsById["InstallExecuteSequence/RegisterClassInfo"],
});
standardActionsByTableName.Add("AppSearch", new[]
{
standardActionsById["InstallUISequence/AppSearch"],
standardActionsById["InstallExecuteSequence/AppSearch"],
});
standardActionsByTableName.Add("BindImage", new[] { standardActionsById["InstallExecuteSequence/BindImage"] });
standardActionsByTableName.Add("RemoveFile", new[] { standardActionsById["InstallExecuteSequence/RemoveFiles"] });
standardActionsByTableName.Add("Registry", new[]
{
standardActionsById["InstallExecuteSequence/WriteRegistryValues"],
standardActionsById["InstallExecuteSequence/RemoveRegistryValues"],
});
}

/// <summary>
Expand Down Expand Up @@ -457,6 +478,14 @@ public static bool TryGetStandardAction(string sequenceName, string actioname, o
return standardActionsById.TryGetValue(String.Concat(sequenceName, "/", actioname), out standardAction);
}

/// <summary>
/// Try to get standard actions associated with a table definition.
/// </summary>
public static bool TryGetTableAssociatedStandardActions(string tableName, out WixActionSymbol[] standardActions)
{
return standardActionsByTableName.TryGetValue(tableName, out standardActions);
}

/// <summary>
/// Try to get standard directory name by id.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,21 @@ private Dictionary<string, WixActionSymbol> GetRequiredStandardActions()
overridableActionSymbols.Add(standardAction.Id.Id, standardAction);
}

// Get the Standard Actions associated with EnsureTable symbols.
foreach (var table in this.Section.Symbols.OfType<WixEnsureTableSymbol>())
{
if (WindowsInstallerStandard.TryGetTableAssociatedStandardActions(table.Table, out var standardActions))
{
foreach(var standardAction in standardActions)
{
if (!overridableActionSymbols.ContainsKey(standardAction.Id.Id))
{
overridableActionSymbols.Add(standardAction.Id.Id, standardAction);
}
}
}
}

return overridableActionSymbols;
}

Expand Down
Loading