diff --git a/nuspec/chocolatey/chocolatey/tools/chocolateysetup.psm1 b/nuspec/chocolatey/chocolatey/tools/chocolateysetup.psm1 index f47db73b1d..da3b3f6dfc 100644 --- a/nuspec/chocolatey/chocolatey/tools/chocolateysetup.psm1 +++ b/nuspec/chocolatey/chocolatey/tools/chocolateysetup.psm1 @@ -463,8 +463,21 @@ function Install-ChocolateyFiles { Get-ChildItem -Path "$_" | ForEach-Object { #Write-Debug "Checking child path $_ ($($_.FullName))" if (Test-Path $_.FullName) { - Write-Debug "Removing $_ unless matches .log" - Remove-Item $_.FullName -Exclude *.log -Recurse -Force -ErrorAction SilentlyContinue + # If this is an upgrade, we can't *delete* Chocolatey.PowerShell.dll, as it will be currently loaded and thus locked. + # Instead, rename it with a .old suffix. The code in the installer module will delete the .old file next time it runs. + # This works similarly to how we move rather than overwriting choco.exe itself. + if ($_.Name -ne "Chocolatey.PowerShell.dll") { + Write-Debug "Removing $_ unless matches .log" + Remove-Item $_.FullName -Exclude *.log -Recurse -Force -ErrorAction SilentlyContinue + } + else { + $oldPath = "$($_.FullName).old" + Write-Debug "Moving $_ to $oldPath" + + # Remove any still-existing Chocolatey.PowerShell.dll.old files before moving/renaming the current one. + Get-Item -Path $oldPath -ErrorAction SilentlyContinue | Remove-Item -Force + Move-Item $_.Fullname -Destination $oldPath + } } } } diff --git a/nuspec/nuget/Chocolatey.PowerShell/Chocolatey.PowerShell.nuspec b/nuspec/nuget/Chocolatey.PowerShell/Chocolatey.PowerShell.nuspec new file mode 100644 index 0000000000..af6167d522 --- /dev/null +++ b/nuspec/nuget/Chocolatey.PowerShell/Chocolatey.PowerShell.nuspec @@ -0,0 +1,33 @@ + + + + Chocolatey.PowerShell + 0.9.9 + Chocolatey Software, Inc + Chocolatey CLI PowerShell Helpers + Chocolatey Software, Inc + https://github.com/chocolatey/choco + https://chocolatey.org/assets/images/nupkg/chocolateyicon.png + https://raw.githubusercontent.com/chocolatey/choco/master/LICENSE + false + 2024 Chocolatey Software, Inc + chocolatey powershell + Chocolatey CLI's PowerShell helper commands + +Chocolatey is a package manager for Windows (like apt-get but for Windows). + +This is the Chocolatey PowerShell Library (API / DLL) package which contains the PowerShell helper commands used in Chocolatey CLI itself. + +### Information + +- [Chocolatey Website and Community Package Repository](https://community.chocolatey.org) +- [Mailing List](http://groups.google.com/group/chocolatey) / [Release Announcements Only Mailing List](https://groups.google.com/group/chocolatey-announce) / [Build Status Mailing List](http://groups.google.com/group/chocolatey-build-status) +- [Twitter](https://twitter.com/chocolateynuget) / [Facebook](https://www.facebook.com/ChocolateySoftware) / [GitHub](https://github.com/chocolatey) +- [Blog](https://blog.chocolatey.org/) / [Newsletter](https://chocolatey.us8.list-manage1.com/subscribe?u=86a6d80146a0da7f2223712e4&id=73b018498d) +- [Documentation](https://docs.chocolatey.org/en-us/) / [Support](https://chocolatey.org/support) + + +See all - https://docs.chocolatey.org/en-us/choco/release-notes + + + diff --git a/recipe.cake b/recipe.cake index dda5937fef..ed259dc94a 100644 --- a/recipe.cake +++ b/recipe.cake @@ -15,7 +15,8 @@ Func> getILMergeConfigs = () => var targetPlatform = "v4,C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.8"; var assembliesToILMerge = GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/*.{exe|dll}") - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/choco.exe") - - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/System.Management.Automation.dll"); + - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/System.Management.Automation.dll") + - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco/Chocolatey.PowerShell.dll"); Information("The following assemblies have been selected to be ILMerged for choco.exe..."); foreach (var assemblyToILMerge in assembliesToILMerge) @@ -34,10 +35,11 @@ Func> getILMergeConfigs = () => AssemblyPaths = assembliesToILMerge }); assembliesToILMerge = GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/*.{exe|dll}") - - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/choco.exe") - - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/chocolatey.dll") - - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/log4net.dll") - - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/System.Management.Automation.dll"); + - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/choco.exe") + - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/chocolatey.dll") + - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/log4net.dll") + - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/System.Management.Automation.dll") + - GetFiles(BuildParameters.Paths.Directories.PublishedLibraries + "/chocolatey/Chocolatey.PowerShell.dll"); Information("The following assemblies have been selected to be ILMerged for chocolatey.dll..."); foreach (var assemblyToILMerge in assembliesToILMerge) @@ -58,10 +60,11 @@ Func> getILMergeConfigs = () => if (DirectoryExists(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/")) { var no7zAssembliesToILMerge = GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/*.{exe|dll}") - - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/choco.exe") - - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/System.Management.Automation.dll") - - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/chocolatey.tests*.dll") - - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/{Moq|nunit|Should|testcentric}*.dll"); + - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/choco.exe") + - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/System.Management.Automation.dll") + - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/chocolatey.tests*.dll") + - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/{Moq|nunit|Should|testcentric}*.dll") + - GetFiles(BuildParameters.Paths.Directories.PublishedApplications + "/choco-no7zip/Chocolatey.PowerShell.dll"); Information("The following assemblies have been selected to be ILMerged for choco.exe No7zip Version..."); foreach (var assemblyToILMerge in no7zAssembliesToILMerge) @@ -121,13 +124,15 @@ Func getFilesToSign = () => var filesToSign = GetFiles(BuildParameters.Paths.Directories.NuGetNuspecDirectory + "/lib/chocolatey.dll") + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe") + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/tools/{checksum|shimgen}.exe") - + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/redirects/*.exe"); + + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/redirects/*.exe") + + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/helpers/Chocolatey.PowerShell.dll"); if (DirectoryExists(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip")) { filesToSign += GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/choco.exe") + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/tools/{checksum|shimgen}.exe") - + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/redirects/*.exe"); + + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/redirects/*.exe") + + GetFiles(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "-no7zip/tools/chocolateyInstall/helpers/Chocolatey.PowerShell.dll"); } Information("The following assemblies have been selected to be signed..."); @@ -172,6 +177,10 @@ Task("Prepare-Chocolatey-Packages") StartProcess(BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/choco.exe", new ProcessSettings{ Arguments = "unpackself -f -y --allow-unofficial-build --run-actual" }); + // Copy Chocolatey.PowerShell.dll and its help.xml file + CopyFile(BuildParameters.Paths.Directories.PublishedLibraries + "/Chocolatey.PowerShell/Chocolatey.PowerShell.dll", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/helpers/Chocolatey.PowerShell.dll"); + CopyFile(BuildParameters.Paths.Directories.PublishedLibraries + "/Chocolatey.PowerShell/Chocolatey.PowerShell.dll-help.xml", BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/helpers/Chocolatey.PowerShell.dll-help.xml"); + // Tidy up logs and config folder which are not required var logsDirectory = BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/logs"; var configDirectory = BuildParameters.Paths.Directories.ChocolateyNuspecDirectory + "/tools/chocolateyInstall/config"; @@ -260,6 +269,10 @@ Task("Prepare-ChocolateyNo7zip-Package") StartProcess(nuspecDirectory + "/tools/chocolateyInstall/choco.exe", new ProcessSettings{ Arguments = "unpackself -f -y --allow-unofficial-build" }); + // Copy Chocolatey.PowerShell.dll and help.xml file + CopyFile(BuildParameters.Paths.Directories.PublishedLibraries + "/Chocolatey.PowerShell/Chocolatey.PowerShell.dll", nuspecDirectory + "/tools/chocolateyInstall/helpers/Chocolatey.PowerShell.dll"); + CopyFile(BuildParameters.Paths.Directories.PublishedLibraries + "/Chocolatey.PowerShell/Chocolatey.PowerShell.dll-help.xml", nuspecDirectory + "/tools/chocolateyInstall/helpers/Chocolatey.PowerShell.dll-help.xml"); + // Tidy up logs and config folder which are not required var logsDirectory = nuspecDirectory + "/tools/chocolateyInstall/logs"; var configDirectory = nuspecDirectory + "/tools/chocolateyInstall/config"; diff --git a/src/Chocolatey.PowerShell/Chocolatey.PowerShell.csproj b/src/Chocolatey.PowerShell/Chocolatey.PowerShell.csproj new file mode 100644 index 0000000000..33222714dc --- /dev/null +++ b/src/Chocolatey.PowerShell/Chocolatey.PowerShell.csproj @@ -0,0 +1,82 @@ + + + + + Debug + AnyCPU + {88396C46-8089-4814-A7D1-E18777FF6083} + Library + Properties + Chocolatey.PowerShell + Chocolatey.PowerShell + v4.8 + 512 + true + 7.3 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + true + bin\ReleaseOfficial\ + TRACE;FORCE_CHOCOLATEY_OFFICIAL_KEY + true + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + false + + + + + + + + + + + + False + ..\..\lib\PowerShell\System.Management.Automation.dll + + + + + + + + + + + + + + + + + + Properties\SolutionVersion.cs + + + + + + + \ No newline at end of file diff --git a/src/Chocolatey.PowerShell/Commands/GetEnvironmentVariableCommand.cs b/src/Chocolatey.PowerShell/Commands/GetEnvironmentVariableCommand.cs new file mode 100644 index 0000000000..9e25124fba --- /dev/null +++ b/src/Chocolatey.PowerShell/Commands/GetEnvironmentVariableCommand.cs @@ -0,0 +1,50 @@ +// Copyright © 2017 - 2024 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Management.Automation; +using Chocolatey.PowerShell.Helpers; +using Chocolatey.PowerShell.Shared; + +namespace Chocolatey.PowerShell.Commands +{ + [Cmdlet(VerbsCommon.Get, "EnvironmentVariable")] + [OutputType(typeof(string))] + public sealed class GetEnvironmentVariableCommand : ChocolateyCmdlet + { + [Parameter(Mandatory = true, Position = 0)] + public string Name { get; set; } + + [Parameter(Mandatory = true, Position = 1)] + public EnvironmentVariableTarget Scope { get; set; } + + [Parameter] + public SwitchParameter PreserveVariables { get; set; } + + // Avoid logging environment variable names by accident. + protected override bool Logging { get; } = false; + + protected override void End() + { + if (PreserveVariables) + { + WriteVerbose("Choosing not to expand environment names"); + } + + WriteObject(EnvironmentHelper.GetVariable(this, Name, Scope, PreserveVariables)); + } + } +} diff --git a/src/Chocolatey.PowerShell/Commands/GetEnvironmentVariableNamesCommand.cs b/src/Chocolatey.PowerShell/Commands/GetEnvironmentVariableNamesCommand.cs new file mode 100644 index 0000000000..c466001808 --- /dev/null +++ b/src/Chocolatey.PowerShell/Commands/GetEnvironmentVariableNamesCommand.cs @@ -0,0 +1,40 @@ +// Copyright © 2017 - 2024 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Management.Automation; +using Chocolatey.PowerShell.Helpers; +using Chocolatey.PowerShell.Shared; + +namespace Chocolatey.PowerShell.Commands +{ + [Cmdlet(VerbsCommon.Get, "EnvironmentVariableNames")] + [OutputType(typeof(string))] + public class GetEnvironmentVariableNamesCommand : ChocolateyCmdlet + { + [Parameter(Position = 0)] + public EnvironmentVariableTarget Scope { get; set; } + + // Do not log function call + protected override bool Logging { get; } = false; + + + protected override void End() + { + WriteObject(EnvironmentHelper.GetVariableNames(Scope)); + } + } +} diff --git a/src/Chocolatey.PowerShell/Commands/InstallChocolateyPathCommand.cs b/src/Chocolatey.PowerShell/Commands/InstallChocolateyPathCommand.cs new file mode 100644 index 0000000000..c9da5edd3b --- /dev/null +++ b/src/Chocolatey.PowerShell/Commands/InstallChocolateyPathCommand.cs @@ -0,0 +1,41 @@ +// Copyright © 2017 - 2024 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Management.Automation; +using Chocolatey.PowerShell.Helpers; +using Chocolatey.PowerShell.Shared; + +namespace Chocolatey.PowerShell.Commands +{ + [Cmdlet(VerbsLifecycle.Install, "ChocolateyPath")] + [OutputType(typeof(void))] + public class InstallChocolateyPathCommand : ChocolateyCmdlet + { + [Parameter(Mandatory = true, Position = 0)] + [Alias("PathToInstall")] + public string Path { get; set; } + + [Parameter(Position = 1)] + [Alias("Scope", "Type")] + public EnvironmentVariableTarget PathType { get; set; } = EnvironmentVariableTarget.User; + + protected override void End() + { + Paths.InstallPathEntry(this, Path, PathType); + } + } +} diff --git a/src/Chocolatey.PowerShell/Commands/SetEnvironmentVariableCommand.cs b/src/Chocolatey.PowerShell/Commands/SetEnvironmentVariableCommand.cs new file mode 100644 index 0000000000..a73c996aa5 --- /dev/null +++ b/src/Chocolatey.PowerShell/Commands/SetEnvironmentVariableCommand.cs @@ -0,0 +1,42 @@ +// Copyright © 2017 - 2024 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Management.Automation; +using Chocolatey.PowerShell.Helpers; +using Chocolatey.PowerShell.Shared; + +namespace Chocolatey.PowerShell.Commands +{ + [Cmdlet(VerbsCommon.Set, "EnvironmentVariable")] + [OutputType(typeof(void))] + public sealed class SetEnvironmentVariableCommand : ChocolateyCmdlet + { + [Parameter(Mandatory = true, Position = 0)] + public string Name { get; set; } + + [Parameter(Position = 1)] + public string Value { get; set; } = string.Empty; + + [Parameter(Position = 2)] + public EnvironmentVariableTarget Scope { get; set; } + + protected override void End() + { + EnvironmentHelper.SetVariable(this, Name, Scope, Value); + } + } +} diff --git a/src/Chocolatey.PowerShell/Commands/TestProcessAdminRightsCommand.cs b/src/Chocolatey.PowerShell/Commands/TestProcessAdminRightsCommand.cs new file mode 100644 index 0000000000..2765697137 --- /dev/null +++ b/src/Chocolatey.PowerShell/Commands/TestProcessAdminRightsCommand.cs @@ -0,0 +1,36 @@ +// Copyright © 2017 - 2024 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System.Management.Automation; +using Chocolatey.PowerShell.Helpers; +using Chocolatey.PowerShell.Shared; + +namespace Chocolatey.PowerShell.Commands +{ + [Cmdlet(VerbsDiagnostic.Test, "ProcessAdminRights")] + [OutputType(typeof(bool))] + public sealed class TestProcessAdminRightsCommand : ChocolateyCmdlet + { + protected override void Process() + { + var isAdmin = ProcessInformation.IsElevated(); + + WriteDebug($"Test-ProcessAdminRights: returning {isAdmin}"); + + WriteObject(isAdmin); + } + } +} diff --git a/src/Chocolatey.PowerShell/Commands/UninstallChocolateyPathCommand.cs b/src/Chocolatey.PowerShell/Commands/UninstallChocolateyPathCommand.cs new file mode 100644 index 0000000000..92faf6a826 --- /dev/null +++ b/src/Chocolatey.PowerShell/Commands/UninstallChocolateyPathCommand.cs @@ -0,0 +1,41 @@ +// Copyright © 2017 - 2024 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Management.Automation; +using Chocolatey.PowerShell.Helpers; +using Chocolatey.PowerShell.Shared; + +namespace Chocolatey.PowerShell.Commands +{ + [Cmdlet(VerbsLifecycle.Uninstall, "ChocolateyPath")] + [OutputType(typeof(void))] + public class UninstallChocolateyPathCommand : ChocolateyCmdlet + { + [Parameter(Mandatory = true, Position = 0)] + [Alias("PathToUninstall")] + public string Path { get; set; } + + [Parameter(Position = 1)] + [Alias("Scope", "Type")] + public EnvironmentVariableTarget PathType { get; set; } = EnvironmentVariableTarget.User; + + protected override void End() + { + Paths.UninstallPathEntry(this, Path, PathType); + } + } +} diff --git a/src/Chocolatey.PowerShell/Commands/UpdateSessionEnvironmentCommand.cs b/src/Chocolatey.PowerShell/Commands/UpdateSessionEnvironmentCommand.cs new file mode 100644 index 0000000000..65c32d514e --- /dev/null +++ b/src/Chocolatey.PowerShell/Commands/UpdateSessionEnvironmentCommand.cs @@ -0,0 +1,48 @@ +// Copyright © 2017 - 2024 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System.Management.Automation; +using Chocolatey.PowerShell.Helpers; +using Chocolatey.PowerShell.Shared; + +namespace Chocolatey.PowerShell.Commands +{ + [Cmdlet(VerbsData.Update, "SessionEnvironment")] + [OutputType(typeof(void))] + public sealed class UpdateSessionEnvironmentCommand : ChocolateyCmdlet + { + protected override void End() + { + var calledByAlias = MyInvocation?.InvocationName.ToLower() == "refreshenv"; + + if (calledByAlias) + { + WriteObject("Refreshing environment variables from the registry for powershell.exe. Please wait..."); + } + else + { + WriteVerbose("Refreshing environment variables from the registry."); + } + + EnvironmentHelper.UpdateSession(this); + + if (calledByAlias) + { + WriteObject("Finished"); + } + } + } +} diff --git a/src/Chocolatey.PowerShell/Helpers/Elevation.cs b/src/Chocolatey.PowerShell/Helpers/Elevation.cs new file mode 100644 index 0000000000..a8fc6cb8b5 --- /dev/null +++ b/src/Chocolatey.PowerShell/Helpers/Elevation.cs @@ -0,0 +1,75 @@ +// Copyright © 2017 - 2024 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Management.Automation; + +namespace Chocolatey.PowerShell.Helpers +{ + /// + /// Helpers for checking and handling if the process is elevated or not. + /// + public static class Elevation + { + /// + /// Ensures a command is run in an elevated context. + /// + /// The return type of the . + /// The cmdlet calling the method. + /// The C# code path that is typically executed if the process is elevated. + /// The PowerShell fallback command that will re-enter the code path after elevation. + /// The return value of the or the when executed. + public static object RunElevated(PSCmdlet cmdlet, Func action, string fallbackCommand) + { + if (ProcessInformation.IsElevated()) + { + return action(); + } + + // We're going to quote the string in order to pass it to the command, + // so escape any double quotes passed in with PowerShell escape chars + // to ensure they're passed in correctly. + if (fallbackCommand.IndexOf('"') != -1) + { + fallbackCommand.Replace("\"", "`\""); + } + + // This elevation path is known not to work, because this command does *not* invoke the new process with + // BOTH UseShellExecute=true and Verb=RunAs (see https://github.com/chocolatey/choco/issues/434). + // This code remains here to mimic the current elevation checks used for the other code path, and is + // expected to be removed or completely overhaulted and replaced in the near-ish future. + return cmdlet.InvokeCommand.InvokeScript($"Start-ChocolateyProcessAsAdmin -statements \"{fallbackCommand}\""); + } + + /// + /// Ensures a command is run in an elevated context. + /// + /// The cmdlet calling the method. + /// The C# code path that is typically executed if the process is elevated. + /// The PowerShell fallback command that will re-enter the code path after elevation. + /// The return value of the or the when executed. + public static void RunElevated(PSCmdlet cmdlet, Action action, string fallbackCommand) + { + object wrappedAction() + { + action(); + return null; + } + + RunElevated(cmdlet, wrappedAction, fallbackCommand); + } + } +} diff --git a/src/Chocolatey.PowerShell/Helpers/EnvironmentHelper.cs b/src/Chocolatey.PowerShell/Helpers/EnvironmentHelper.cs new file mode 100644 index 0000000000..468c7bb3b7 --- /dev/null +++ b/src/Chocolatey.PowerShell/Helpers/EnvironmentHelper.cs @@ -0,0 +1,248 @@ +// Copyright © 2017 - 2024 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using Chocolatey.PowerShell.Shared; +using Chocolatey.PowerShell.Win32; +using Microsoft.Win32; + +namespace Chocolatey.PowerShell.Helpers +{ + public static class EnvironmentHelper + { + private const string MachineEnvironmentRegistryKeyName = @"SYSTEM\CurrentControlSet\Control\Session Manager\Environment\"; + private const string UserEnvironmentRegistryKeyName = "Environment"; + + /// + /// Gets the value of the environment variable with the target , expanding environment names that may be present in the value. + /// + /// The cmdlet running the method. + /// The name of the environment variable to retrieve. + /// The scope to look in for the environment variable. + /// The value of the environment variable as a string. + public static string GetVariable(PSCmdlet cmdlet, string name, EnvironmentVariableTarget scope) + { + return GetVariable(cmdlet, name, scope, preserveVariables: false); + } + + /// + /// Gets the value of the environment variable with the target . + /// + /// The cmdlet running the method. + /// The name of the environment variable to retrieve. + /// The scope to look in for the environment variable. + /// Whether to preserve environment variable names in the retrieved value. If false, environment names will be expanded. + /// The value of the environment variable as a string. + public static string GetVariable(PSCmdlet cmdlet, string name, EnvironmentVariableTarget scope, bool preserveVariables) + { + if (scope == EnvironmentVariableTarget.Process) + { + return Environment.GetEnvironmentVariable(name, scope); + } + + var value = string.Empty; + + try + { + using (var registryKey = GetEnvironmentKey(scope)) + { + var options = preserveVariables ? RegistryValueOptions.DoNotExpandEnvironmentNames : RegistryValueOptions.None; + if (!(registryKey is null)) + { + value = (string)registryKey.GetValue(name, string.Empty, options); + } + } + } + catch (Exception error) + { + cmdlet.WriteDebug($"Unable to retrieve the {name} environment variable. Details: {error.Message}"); + } + + if (string.IsNullOrEmpty(value)) + { + value = Environment.GetEnvironmentVariable(name, scope); + } + + return value ?? string.Empty; + } + + /// + /// Gets the registry key associated with the targeted scope of Environment variables. + /// + /// The scope of the environment variables to look up. + /// The registry key associated with the targeted of environment variables. + /// Thrown if is not or . + private static RegistryKey GetEnvironmentKey(EnvironmentVariableTarget scope, bool writable = false) + { + switch (scope) + { + case EnvironmentVariableTarget.User: + return Registry.CurrentUser.OpenSubKey(UserEnvironmentRegistryKeyName, writable); + case EnvironmentVariableTarget.Machine: + return Registry.LocalMachine.OpenSubKey(MachineEnvironmentRegistryKeyName, writable); + default: + throw new NotSupportedException($"The environment variable scope value '{scope}' is not supported."); + } + } + + + /// + /// Gets the list of environment variables in the specified . + /// + /// The scope to lookup environment variable names in. + /// + public static string[] GetVariableNames(EnvironmentVariableTarget scope) + { + if (scope == EnvironmentVariableTarget.Process) + { + return Environment.GetEnvironmentVariables().Keys.Cast().ToArray(); + } + + try + { + using (var registryKey = GetEnvironmentKey(scope)) + { + return registryKey.GetValueNames(); + } + } + catch + { + // HKCU:\Environment may not exist in all Windows OSes + return Array.Empty(); + } + } + + /// + /// Sets the value of an environment variable at the target , and updates the current session environment. + /// + /// The cmdlet calling the method. + /// The name of the environment variable to set. + /// The scope to set the environment variable in. + /// The value to set the environment variable to. + public static void SetVariable(PSCmdlet cmdlet, string name, EnvironmentVariableTarget scope, string value) + { + if (scope == EnvironmentVariableTarget.Process) + { + Environment.SetEnvironmentVariable(name, value); + return; + } + + using (var registryKey = GetEnvironmentKey(scope, writable: true)) + { + var registryType = RegistryValueKind.String; + + try + { + if (registryKey.GetValueNames().Contains(name)) + { + registryType = registryKey.GetValueKind(name); + } + } + catch + { + // The value doesn't exist yet, suppress the error. + } + + if (name.ToUpper() == EnvironmentVariables.Path) + { + registryType = RegistryValueKind.ExpandString; + } + + cmdlet.WriteDebug($"Registry type for {name} is/will be {registryType}"); + + registryKey.SetValue(name, value, registryType); + } + + try + { + // Trigger environment refresh in explorer.exe: + // 1. Notify all windows of environment block change + NativeMethods.SendMessageTimeout( + hWnd: (IntPtr)NativeMethods.HWND_BROADCAST, + Msg: NativeMethods.WM_SETTINGCHANGE, + wParam: UIntPtr.Zero, + lParam: "Environment", + fuFlags: 2, + uTimeout: 5000, + out UIntPtr result); + + // 2. Set a user environment variable making the system refresh + var setxPath = string.Format(@"{0}\System32\setx.exe", GetVariable(cmdlet, EnvironmentVariables.SystemRoot, EnvironmentVariableTarget.Process)); + cmdlet.InvokeCommand.InvokeScript($"& \"{setxPath}\" {EnvironmentVariables.ChocolateyLastPathUpdate} \"{DateTime.Now.ToFileTime()}\""); + } + catch (Exception error) + { + cmdlet.WriteWarning($"Failure attempting to let Explorer know about updated environment settings.\n {error.Message}"); + } + + UpdateSession(cmdlet); + } + + /// + /// Updates the current session environment, ensuring environment changes are reflected in the current session. + /// + /// The cmdlet calling the method. + public static void UpdateSession(PSCmdlet cmdlet) + { + var userName = GetVariable(cmdlet, EnvironmentVariables.Username, EnvironmentVariableTarget.Process); + var architecture = GetVariable(cmdlet, EnvironmentVariables.ProcessorArchitecture, EnvironmentVariableTarget.Process); + var psModulePath = GetVariable(cmdlet, EnvironmentVariables.PSModulePath, EnvironmentVariableTarget.Process); + + var scopeList = new List() { EnvironmentVariableTarget.Process, EnvironmentVariableTarget.Machine }; + + var computerName = GetVariable(cmdlet, EnvironmentVariables.ComputerName, EnvironmentVariableTarget.Process); + + // User scope should override (be checked after) machine scope, but only if we're not running as SYSTEM + if (userName != computerName && userName != EnvironmentVariables.System) + { + scopeList.Add(EnvironmentVariableTarget.User); + } + + foreach (var scope in scopeList) + { + foreach (var name in GetVariableNames(scope)) + { + var value = GetVariable(cmdlet, name, scope); + SetVariable(cmdlet, name, EnvironmentVariableTarget.Process, value); + } + } + + // Update PATH, combining both scopes' values. + var paths = new string[2]; + paths[0] = GetVariable(cmdlet, EnvironmentVariables.Path, EnvironmentVariableTarget.Machine); + paths[1] = GetVariable(cmdlet, EnvironmentVariables.Path, EnvironmentVariableTarget.User); + + SetVariable(cmdlet, EnvironmentVariables.Path, EnvironmentVariableTarget.Process, string.Join(";", paths)); + + // Preserve PSModulePath as it's almost always updated by process, preserve it + SetVariable(cmdlet, EnvironmentVariables.PSModulePath, EnvironmentVariableTarget.Process, psModulePath); + + // Preserve user and architecture + if (!string.IsNullOrEmpty(userName)) + { + SetVariable(cmdlet, EnvironmentVariables.Username, EnvironmentVariableTarget.Process, userName); + } + + if (!string.IsNullOrEmpty(architecture)) + { + SetVariable(cmdlet, EnvironmentVariables.ProcessorArchitecture, EnvironmentVariableTarget.Process, architecture); + } + } + } +} diff --git a/src/Chocolatey.PowerShell/Helpers/PSHelper.cs b/src/Chocolatey.PowerShell/Helpers/PSHelper.cs new file mode 100644 index 0000000000..a18bca9fce --- /dev/null +++ b/src/Chocolatey.PowerShell/Helpers/PSHelper.cs @@ -0,0 +1,53 @@ +// Copyright © 2017 - 2024 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System.Management.Automation; + +namespace Chocolatey.PowerShell.Helpers +{ + /// + /// Helper methods for cmdlets to make interfacing with PowerShell easier. + /// + public static class PSHelper + { + /// + /// Writes objects to the output pipeline of the , enumerating collections. + /// + /// The cmdlet calling the method. + /// + public static void WriteObject(PSCmdlet cmdlet, object output) + { + cmdlet.WriteObject(output, enumerateCollection: true); + } + + /// + /// Helper method to mimic Write-Host from C#, falls back to Write-Verbose when a host is not available. + /// + /// The cmdlet calling the method. + /// The message to write to the host. + public static void WriteHost(PSCmdlet cmdlet, string message) + { + if (!(cmdlet.Host is null)) + { + cmdlet.Host.UI.WriteLine(message); + } + else + { + cmdlet.WriteVerbose(message); + } + } + } +} diff --git a/src/Chocolatey.PowerShell/Helpers/Paths.cs b/src/Chocolatey.PowerShell/Helpers/Paths.cs new file mode 100644 index 0000000000..d1e58f02f1 --- /dev/null +++ b/src/Chocolatey.PowerShell/Helpers/Paths.cs @@ -0,0 +1,166 @@ +// Copyright © 2017 - 2024 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using Chocolatey.PowerShell.Shared; + +namespace Chocolatey.PowerShell.Helpers +{ + internal static class Paths + { + private const string PathSplitPattern = "(?<=\\G(?:[^;\"]|\"[^\"]*\")*);"; + + private static readonly Regex _pathSplitRegex = new Regex(PathSplitPattern, RegexOptions.Compiled); + + /// + /// Split the given at each semicolon, excepting if the semicolon is in double quotes. + /// Blank entries are preserved, such as those caused by a trailing semicolon. + /// + /// A PATH string to parse and split into a list of entries. + /// The list of entries, with any surrounding quotes trimmed from each entry. + internal static string[] ParsePathString(string pathString) + { + var pathList = _pathSplitRegex.Split(pathString ?? string.Empty); + + // Strip any quotes from the PATH entries, if present + for (var i = 0; i < pathList.Length; i++) + { + var entry = pathList[i]; + if (entry.Length >= 2 && entry.StartsWith("\"", StringComparison.Ordinal) && entry.EndsWith("\"", StringComparison.Ordinal)) + { + pathList[i] = entry.Substring(1, entry.Length - 2); + } + } + + return pathList; + } + + /// + /// Case-insensitively find the index of the given in the list of . + /// + /// The list of paths to look in. + /// The value to search for. + /// + internal static int FindPathIndex(List paths, string value) + { + // Ensure we trim any trailing directory separators (slashes) off the end of both the input value to find and the values to compare against. + var valueWithoutTrailingSlash = value.TrimEnd(Path.DirectorySeparatorChar); + + return paths.FindIndex(s => s.TrimEnd(Path.DirectorySeparatorChar).Equals(valueWithoutTrailingSlash, StringComparison.OrdinalIgnoreCase)); + } + + /// + /// Construct a PATH string from a list of entries and add quotes around any entries that contain PATH-reserved characters (; on Windows). + /// + /// The list of paths to format. + /// A correctly-formatted PATH string containing all the input paths, each quoted if necessary. + internal static string GetPathString(IList paths) + { + var result = new StringBuilder(); + + // Quote paths if necessary + for (var i = 0; i < paths.Count; i++) + { + if (result.Length > 0) + { + result.Append(Path.PathSeparator); + } + + var path = paths[i]; + if (path?.IndexOf(Path.PathSeparator) > -1 && !path.StartsWith("\"") && !path.EndsWith("\"")) + { + result.Append($"\"{path}\""); + } + else + { + result.Append(path); + } + } + + return result.ToString(); + } + + /// + /// Installs/adds a new PATH entry at the target . + /// + /// The cmdlet running the method. + /// The path entry to add/install. + /// The target scope of the PATH variable to modify. + public static void InstallPathEntry(PSCmdlet cmdlet, string pathEntry, EnvironmentVariableTarget scope) + { + var pathEntries = new List(ParsePathString(EnvironmentHelper.GetVariable(cmdlet, EnvironmentVariables.Path, scope, preserveVariables: true))); + if (FindPathIndex(pathEntries, pathEntry) == -1) + { + PSHelper.WriteHost(cmdlet, $"PATH environment variable does not have {pathEntry} in it. Adding..."); + + pathEntries.Add(pathEntry); + var newPath = GetPathString(pathEntries); + + void updatePath() + { + EnvironmentHelper.SetVariable(cmdlet, EnvironmentVariables.Path, scope, newPath); + } + + if (scope == EnvironmentVariableTarget.Machine) + { + Elevation.RunElevated(cmdlet, updatePath, $"Install-ChocolateyPath -PathToInstall '{pathEntry}' -PathType {scope}"); + } + else + { + updatePath(); + } + } + } + + /// + /// Uninstalls/removes a PATH entry at the target . + /// + /// The cmdlet running the method. + /// The path entry to remove/uninstall. + /// The target scope of the PATH variable to modify. + public static void UninstallPathEntry(PSCmdlet cmdlet, string pathEntry, EnvironmentVariableTarget scope) + { + var pathEntries = new List(ParsePathString(EnvironmentHelper.GetVariable(cmdlet, EnvironmentVariables.Path, scope, preserveVariables: true))); + var removeIndex = FindPathIndex(pathEntries, pathEntry); + if (removeIndex >= 0) + { + PSHelper.WriteHost(cmdlet, $"Found {pathEntry} in PATH environment variable. Removing..."); + + pathEntries.RemoveAt(removeIndex); + var newPath = GetPathString(pathEntries); + + void updatePath() + { + EnvironmentHelper.SetVariable(cmdlet, EnvironmentVariables.Path, scope, newPath); + } + + if (scope == EnvironmentVariableTarget.Machine) + { + Elevation.RunElevated(cmdlet, updatePath, $"Uninstall-ChocolateyPath -PathToInstall '{pathEntry}' -PathType {scope}"); + } + else + { + updatePath(); + } + } + } + } +} diff --git a/src/Chocolatey.PowerShell/Helpers/ProcessInformation.cs b/src/Chocolatey.PowerShell/Helpers/ProcessInformation.cs new file mode 100644 index 0000000000..1237742abe --- /dev/null +++ b/src/Chocolatey.PowerShell/Helpers/ProcessInformation.cs @@ -0,0 +1,57 @@ +// Copyright © 2017 - 2024 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System.Runtime.InteropServices; +using System.Security.Principal; + +namespace Chocolatey.PowerShell.Helpers +{ + public static class ProcessInformation + { + /// + /// Helper method for determining current OS platform. + /// + /// True if the current OS is Windows. + public static bool IsWindows() + { + return RuntimeInformation.IsOSPlatform(OSPlatform.Windows); + } + + /// + /// Determines whether the current process has administrative rights. + /// + /// True if running on Windows and the process has administrative rights. + public static bool IsElevated() + { + if (!IsWindows()) + { + return false; + } + + using (var identity = WindowsIdentity.GetCurrent(TokenAccessLevels.Query | TokenAccessLevels.Duplicate)) + { + if (identity is null) + { + return false; + } + + var principal = new WindowsPrincipal(identity); + + return principal.IsInRole(WindowsBuiltInRole.Administrator); + } + } + } +} diff --git a/src/Chocolatey.PowerShell/Properties/AssemblyInfo.cs b/src/Chocolatey.PowerShell/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..7e2f53a358 --- /dev/null +++ b/src/Chocolatey.PowerShell/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +// Copyright © 2017 - 2024 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System.Runtime.InteropServices; + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("88396c46-8089-4814-a7d1-e18777ff6083")] \ No newline at end of file diff --git a/src/Chocolatey.PowerShell/Shared/ChocolateyCmdlet.cs b/src/Chocolatey.PowerShell/Shared/ChocolateyCmdlet.cs new file mode 100644 index 0000000000..458975cb8c --- /dev/null +++ b/src/Chocolatey.PowerShell/Shared/ChocolateyCmdlet.cs @@ -0,0 +1,141 @@ +// Copyright © 2017 - 2024 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System.Collections; +using System.Management.Automation; +using System.Text; +using Chocolatey.PowerShell.Helpers; + +namespace Chocolatey.PowerShell.Shared +{ + /// + /// Base class for all Chocolatey cmdlets. + /// Contains a number of helpers and common code that is used by all cmdlets. + /// + public abstract class ChocolateyCmdlet : PSCmdlet + { + /// + /// For compatibility reasons, we always add the -IgnoredArguments parameter, so that newly added parameters + /// won't break things too much if a package is run with an older version of Chocolatey. + /// + [Parameter(ValueFromRemainingArguments = true)] + public object[] IgnoredArguments { get; set; } + + /// + /// Sets whether the cmdlet writes its parameters and name to the debug log when it is called and + /// when it completes its operation (after End() is called). + /// This should remain set to true for all commands that are considered part of the public Chocolatey CLI API, + /// unless there are concerns about potentially sensitive information making it into a log file from the parameters of the command. + /// + protected virtual bool Logging { get; } = true; + + protected sealed override void BeginProcessing() + { + WriteCmdletCallDebugMessage(); + Begin(); + } + + /// + /// Override this method to define the cmdlet's begin {} block behaviour. + /// Note that parameters that are defined as ValueFromPipeline or ValueFromPipelineByPropertyName + /// will not be available for the duration of this method. + /// + protected virtual void Begin() + { + } + + protected sealed override void ProcessRecord() + { + Process(); + } + + /// + /// Override this method to define the cmdlet's process {} block behaviour. + /// This is called once for every item the cmdlet receives to a pipeline parameter, or only once if the value is supplied directly. + /// Parameters that are defined as ValueFromPipeline or ValueFromPipelineByPropertyName will be available during this method call. + /// + protected virtual void Process() + { + } + + protected sealed override void EndProcessing() + { + End(); + WriteCmdletCompletionDebugMessage(); + } + + /// + /// Override this method to define the cmdlet's end {} block behaviour. + /// Note that parameters that are defined as ValueFromPipeline or ValueFromPipelineByPropertyName + /// may not be available or have complete data during this method call. + /// + protected virtual void End() + { + } + + protected void WriteHost(string message) + { + PSHelper.WriteHost(this, message); + } + + protected new void WriteObject(object value) + { + PSHelper.WriteObject(this, value); + } + + protected void WriteCmdletCallDebugMessage() + { + if (!Logging) + { + return; + } + + var logMessage = new StringBuilder() + .Append("Running ") + .Append(MyInvocation.InvocationName); + + foreach (var param in MyInvocation.BoundParameters) + { + var paramNameLower = param.Key.ToLower(); + + if (paramNameLower == "ignoredarguments") + { + continue; + } + + var paramValue = paramNameLower == "sensitivestatements" || paramNameLower == "password" + ? "[REDACTED]" + : param.Value is IList list + ? string.Join(" ", list) + : LanguagePrimitives.ConvertTo(param.Value, typeof(string)); + + logMessage.Append($" -{param.Key} '{paramValue}'"); + } + + WriteDebug(logMessage.ToString()); + } + + protected void WriteCmdletCompletionDebugMessage() + { + if (!Logging) + { + return; + } + + WriteDebug($"Finishing '{MyInvocation.InvocationName}'"); + } + } +} diff --git a/src/Chocolatey.PowerShell/Shared/EnvironmentVariables.cs b/src/Chocolatey.PowerShell/Shared/EnvironmentVariables.cs new file mode 100644 index 0000000000..117478640f --- /dev/null +++ b/src/Chocolatey.PowerShell/Shared/EnvironmentVariables.cs @@ -0,0 +1,30 @@ +// Copyright © 2017 - 2024 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +namespace Chocolatey.PowerShell.Shared +{ + public static class EnvironmentVariables + { + public const string ChocolateyLastPathUpdate = "ChocolateyLastPathUpdate"; + public const string ComputerName = "COMPUTERNAME"; + public const string Path = "PATH"; + public const string ProcessorArchitecture = "PROCESSOR_ARCHITECTURE"; + public const string PSModulePath = "PSModulePath"; + public const string System = "SYSTEM"; + public const string SystemRoot = "SystemRoot"; + public const string Username = "USERNAME"; + } +} diff --git a/src/Chocolatey.PowerShell/Win32/NativeMethods.cs b/src/Chocolatey.PowerShell/Win32/NativeMethods.cs new file mode 100644 index 0000000000..0f2c0eb540 --- /dev/null +++ b/src/Chocolatey.PowerShell/Win32/NativeMethods.cs @@ -0,0 +1,35 @@ +// Copyright © 2017 - 2024 Chocolatey Software, Inc +// Copyright © 2011 - 2017 RealDimensions Software, LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Runtime.InteropServices; + +namespace Chocolatey.PowerShell.Win32 +{ + internal static class NativeMethods + { + internal const int HWND_BROADCAST = 0xffff; + internal const int WM_SETTINGCHANGE = 0x1a; + + /// + /// See https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendmessagetimeoutw for documentation. + /// + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + internal static extern IntPtr SendMessageTimeout( + IntPtr hWnd, uint Msg, UIntPtr wParam, string lParam, + uint fuFlags, uint uTimeout, out UIntPtr lpdwResult); + } +} diff --git a/src/chocolatey.console/chocolatey.console.csproj b/src/chocolatey.console/chocolatey.console.csproj index 92cfc151e8..3da9b03260 100644 --- a/src/chocolatey.console/chocolatey.console.csproj +++ b/src/chocolatey.console/chocolatey.console.csproj @@ -224,6 +224,10 @@ {5563DC61-35FD-4FAB-B331-9AE1FDB23F80} chocolatey + + {88396c46-8089-4814-a7d1-e18777ff6083} + Chocolatey.PowerShell + @@ -238,4 +242,10 @@ --> + + + + + + \ No newline at end of file diff --git a/src/chocolatey.resources/chocolatey.resources.csproj b/src/chocolatey.resources/chocolatey.resources.csproj index 9ac71dba5f..207c9f7487 100644 --- a/src/chocolatey.resources/chocolatey.resources.csproj +++ b/src/chocolatey.resources/chocolatey.resources.csproj @@ -82,7 +82,6 @@ - @@ -91,7 +90,6 @@ - @@ -108,14 +106,6 @@ - - - - - - - - diff --git a/src/chocolatey.resources/helpers/chocolateyInstaller.psm1 b/src/chocolatey.resources/helpers/chocolateyInstaller.psm1 index 4e863f9f87..bdd2c64ad9 100644 --- a/src/chocolatey.resources/helpers/chocolateyInstaller.psm1 +++ b/src/chocolatey.resources/helpers/chocolateyInstaller.psm1 @@ -46,13 +46,46 @@ Get-Item -Path "$helpersPath\functions\*.ps1" | . $_.FullName } +$currentAssemblies = [System.AppDomain]::CurrentDomain.GetAssemblies() + +# Import commands from Chocolatey.PowerShell.dll +$chocolateyCmdlets = @{} + +$dllPath = "$helpersPath\Chocolatey.PowerShell.dll" +if (Test-Path $dllPath) { + # Try to import from already-loaded assembly, otherwise fallback to importing from dll + $cmdletsAssembly = $currentAssemblies | + Where-Object { $_.GetName().Name -eq 'Chocolatey.PowerShell' } | + Select-Object -First 1 + + if ($cmdletsAssembly) { + Import-Module $cmdletsAssembly.Location -Force + } + else { + Import-Module $dllPath + } + + # Cache module commands for helping resolve lookups + $chocolateyCmdlets.Default = @( (Get-Module Chocolatey.PowerShell).ExportedCmdlets.Keys ) + + Write-Debug "Cmdlets exported from Chocolatey.PowerShell.dll" + $chocolateyCmdlets.Default | Write-Debug + + # Set aliases for imported cmdlets + Set-Alias refreshenv Update-SessionEnvironment + + # Check for & remove Chocolatey.PowerShell.dll.old left-over from an upgrade/reinstall + $dllOldPath = "$dllPath.old" + if (Test-Path $dllOldPath) { + Remove-Item -Path $dllOldPath -Force -ErrorAction SilentlyContinue + } +} + # Export built-in functions prior to loading extensions so that # extension-specific loading behavior can be used based on built-in # functions. This allows those overrides to be much more deterministic Export-ModuleMember -Function * -Alias * -Cmdlet * -$currentAssemblies = [System.AppDomain]::CurrentDomain.GetAssemblies() - # Load community extensions if they exist $extensionsPath = Join-Path $helpersPath -ChildPath '..\extensions' if (Test-Path $extensionsPath) { @@ -68,13 +101,19 @@ if (Test-Path $extensionsPath) { Select-Object -First 1 if ($licensedAssembly) { - # It's already loaded, just import the existing assembly as a module for PowerShell to use - Import-Module $licensedAssembly + # Import-Module -Assembly doesn't work if the parent module is reimported, so force the import by path. + Import-Module $licensedAssembly.Location -Force } else { # Fallback: load the extension DLL from the path directly. Import-Module $licensedExtensionPath } + + # Store commands from licensed module, stripping any 'Cmdlet' suffix from the command name + $chocolateyCmdlets.Licensed = @( (Get-Module chocolatey.licensed).ExportedCmdlets.Keys | ForEach-Object { $_ -replace "Cmdlet$" } ) + + Write-Debug "Cmdlets exported from chocolatey.licensed" + $chocolateyCmdlets.Licensed | Write-Debug } catch { # Only write a warning if the Licensed extension failed to load in some way. @@ -91,6 +130,46 @@ if (Test-Path $extensionsPath) { } } +# Exercise caution and test _thoroughly_ with AND without the licensed extension installed +# when making any changes here. And make sure to update this comment if needed when any +# changes are being made. +# +# This code overrides PowerShell's default command lookup semantics as follows: +# +# 1. If the command being looked up is available in chocolatey.licensed.dll as +# a cmdlet with OR without a "Cmdlet" suffix in its name, resolve to this command. +# (in other words, looking for `Get-ChocolateyThing` will _also_ accept something +# called `Get-ChocolateyThingCmdlet` if it's from the licensed extension) +# 2. If nothing comes back from the licensed extension, then look through the cmdlets +# exported from the Chocolatey.PowerShell.dll module. If we find a match, make sure +# we resolve to this command from the Chocolatey.PowerShell.dll module. +# 3. Finally, if neither of the above find the command being looked up, do nothing and allow +# PowerShell to use its default command lookup semantics. +# +# In effect we ensure that any command calls that match the name of one of our commands +# will resolve to _our_ commands (preferring licensed cmdlets in the case of a name collision), +# preventing packages from overriding them with their own commands and potentially breaking things. +$ExecutionContext.InvokeCommand.PreCommandLookupAction = { + param($command, $eventArgs) + + # Don't run this handler for stuff PowerShell is looking up internally + if ($eventArgs.CommandOrigin -eq 'Runspace') { + $resolvedCommand = if ($command -in $chocolateyCmdlets.Licensed) { + Get-Command "$command*" -Module 'chocolatey.licensed' -CommandType Cmdlet -ErrorAction Ignore | + Where-Object { $_.Name -match "^$command(Cmdlet)?$" } | + Select-Object -First 1 + } + elseif ($command -in $chocolateyCmdlets.Default) { + Get-Command $command -Module "Chocolatey.PowerShell" -CommandType Cmdlet -ErrorAction Ignore + } + + if ($resolvedCommand) { + $eventArgs.Command = $resolvedCommand + $eventArgs.StopSearch = $true + } + } +}.GetNewClosure() + # todo: explore removing this for a future version Export-ModuleMember -Function * -Alias * -Cmdlet * diff --git a/src/chocolatey.resources/helpers/chocolateyProfile.psm1 b/src/chocolatey.resources/helpers/chocolateyProfile.psm1 index 920ee490aa..56aab372d2 100644 --- a/src/chocolatey.resources/helpers/chocolateyProfile.psm1 +++ b/src/chocolatey.resources/helpers/chocolateyProfile.psm1 @@ -20,10 +20,9 @@ if (Get-Module chocolateyProfile) { $thisDirectory = (Split-Path -Parent $MyInvocation.MyCommand.Definition) +Import-Module "$thisDirectory\Chocolatey.PowerShell.dll" -Cmdlet "Get-EnvironmentVariable", "Get-EnvironmentVariableNames", "Update-SessionEnvironment" + . $thisDirectory\functions\Write-FunctionCallLogMessage.ps1 -. $thisDirectory\functions\Get-EnvironmentVariable.ps1 -. $thisDirectory\functions\Get-EnvironmentVariableNames.ps1 -. $thisDirectory\functions\Update-SessionEnvironment.ps1 . $thisDirectory\ChocolateyTabExpansion.ps1 Export-ModuleMember -Alias refreshenv -Function 'Update-SessionEnvironment', 'TabExpansion' diff --git a/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariable.ps1 b/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariable.ps1 deleted file mode 100644 index 0d893fc30d..0000000000 --- a/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariable.ps1 +++ /dev/null @@ -1,322 +0,0 @@ -# Copyright © 2017 - 2021 Chocolatey Software, Inc. -# Copyright © 2015 - 2017 RealDimensions Software, LLC -# Copyright © 2011 - 2015 RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -function Get-EnvironmentVariable { - <# -.SYNOPSIS -Gets an Environment Variable. - -.DESCRIPTION -This will will get an environment variable based on the variable name -and scope while accounting whether to expand the variable or not -(e.g.: `%TEMP%`-> `C:\User\Username\AppData\Local\Temp`). - -.NOTES -This helper reduces the number of lines one would have to write to get -environment variables, mainly when not expanding the variables is a -must. - -.PARAMETER Name -The environment variable you want to get the value from. - -.PARAMETER Scope -The environment variable target scope. This is `Process`, `User`, or -`Machine`. - -.PARAMETER PreserveVariables -A switch parameter stating whether you want to expand the variables or -not. Defaults to false. - -.PARAMETER IgnoredArguments -Allows splatting with arguments that do not apply. Do not use directly. - -.EXAMPLE -Get-EnvironmentVariable -Name 'TEMP' -Scope User -PreserveVariables - -.EXAMPLE -Get-EnvironmentVariable -Name 'PATH' -Scope Machine - -.LINK -Get-EnvironmentVariableNames - -.LINK -Set-EnvironmentVariable -#> - [CmdletBinding()] - [OutputType([string])] - param( - [Parameter(Mandatory = $true)][string] $Name, - [Parameter(Mandatory = $true)][System.EnvironmentVariableTarget] $Scope, - [Parameter(Mandatory = $false)][switch] $PreserveVariables = $false, - [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments - ) - - # Do not log function call, it may expose variable names - ## Called from chocolateysetup.psm1 - wrap any Write-Host in try/catch - - [string] $MACHINE_ENVIRONMENT_REGISTRY_KEY_NAME = "SYSTEM\CurrentControlSet\Control\Session Manager\Environment\"; - [Microsoft.Win32.RegistryKey] $win32RegistryKey = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey($MACHINE_ENVIRONMENT_REGISTRY_KEY_NAME) - if ($Scope -eq [System.EnvironmentVariableTarget]::User) { - [string] $USER_ENVIRONMENT_REGISTRY_KEY_NAME = "Environment"; - [Microsoft.Win32.RegistryKey] $win32RegistryKey = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey($USER_ENVIRONMENT_REGISTRY_KEY_NAME) - } - elseif ($Scope -eq [System.EnvironmentVariableTarget]::Process) { - return [Environment]::GetEnvironmentVariable($Name, $Scope) - } - - [Microsoft.Win32.RegistryValueOptions] $registryValueOptions = [Microsoft.Win32.RegistryValueOptions]::None - - if ($PreserveVariables) { - Write-Verbose "Choosing not to expand environment names" - $registryValueOptions = [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames - } - - [string] $environmentVariableValue = [string]::Empty - - try { - #Write-Verbose "Getting environment variable $Name" - if ($win32RegistryKey -ne $null) { - # Some versions of Windows do not have HKCU:\Environment - $environmentVariableValue = $win32RegistryKey.GetValue($Name, [string]::Empty, $registryValueOptions) - } - } - catch { - Write-Debug "Unable to retrieve the $Name environment variable. Details: $_" - } - finally { - if ($win32RegistryKey -ne $null) { - $win32RegistryKey.Close() - } - } - - if ($environmentVariableValue -eq $null -or $environmentVariableValue -eq '') { - $environmentVariableValue = [Environment]::GetEnvironmentVariable($Name, $Scope) - } - - return $environmentVariableValue -} - -# SIG # Begin signature block -# MIInKwYJKoZIhvcNAQcCoIInHDCCJxgCAQExDzANBglghkgBZQMEAgEFADB5Bgor -# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCB9Qfj9olJseG+H -# BaZcC/4CnnBSGfF/XwAHL3FQVwzI+qCCIK4wggWNMIIEdaADAgECAhAOmxiO+dAt -# 5+/bUOIIQBhaMA0GCSqGSIb3DQEBDAUAMGUxCzAJBgNVBAYTAlVTMRUwEwYDVQQK -# EwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xJDAiBgNV -# BAMTG0RpZ2lDZXJ0IEFzc3VyZWQgSUQgUm9vdCBDQTAeFw0yMjA4MDEwMDAwMDBa -# Fw0zMTExMDkyMzU5NTlaMGIxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2Vy -# dCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xITAfBgNVBAMTGERpZ2lD -# ZXJ0IFRydXN0ZWQgUm9vdCBHNDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC -# ggIBAL/mkHNo3rvkXUo8MCIwaTPswqclLskhPfKK2FnC4SmnPVirdprNrnsbhA3E -# MB/zG6Q4FutWxpdt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57U0ARpHhnoVr8mNS -# rY/751XraP1E/ZWfEz32+uCWWpnIZm6ZSfsQH1PRuM+gjJNuJDkv/ojg/qxdVhzY -# 29nmpn8Lh//Ldb6nzQBNLu/ebIihOjw8534T06XbOAZKlof3PtWMh+z0xxT5Tk2o -# VOfJermGkGm6AvZPoEhR4dC25Nh7Kki33bgC1yv2//IufGDwfscmYxB97ZzM1hh3 -# FANBx1oaR6n+d1/i/dUwILh052205CSCIt46CSrW/6hFNYO14U+/GlYA6uxqysA= -# SIG # End signature block diff --git a/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariableNames.ps1 b/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariableNames.ps1 deleted file mode 100644 index b5d82cce9f..0000000000 --- a/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariableNames.ps1 +++ /dev/null @@ -1,279 +0,0 @@ -# Copyright © 2017 - 2021 Chocolatey Software, Inc. -# Copyright © 2015 - 2017 RealDimensions Software, LLC -# Copyright © 2011 - 2015 RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -function Get-EnvironmentVariableNames([System.EnvironmentVariableTarget] $Scope) { - <# -.SYNOPSIS -Gets all environment variable names. - -.DESCRIPTION -Provides a list of environment variable names based on the scope. This -can be used to loop through the list and generate names. - -.NOTES -Process dumps the current environment variable names in memory / -session. The other scopes refer to the registry values. - -.INPUTS -None - -.OUTPUTS -A list of environment variables names. - -.PARAMETER Scope -The environment variable target scope. This is `Process`, `User`, or -`Machine`. - -.EXAMPLE -Get-EnvironmentVariableNames -Scope Machine - -.LINK -Get-EnvironmentVariable - -.LINK -Set-EnvironmentVariable -#> - - # Do not log function call - - # HKCU:\Environment may not exist in all Windows OSes (such as Server Core). - switch ($Scope) { - 'User' { - Get-Item 'HKCU:\Environment' -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Property - } - 'Machine' { - Get-Item 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' | Select-Object -ExpandProperty Property - } - 'Process' { - Get-ChildItem Env:\ | Select-Object -ExpandProperty Key - } - default { - throw "Unsupported environment scope: $Scope" - } - } -} - -# SIG # Begin signature block -# MIInKwYJKoZIhvcNAQcCoIInHDCCJxgCAQExDzANBglghkgBZQMEAgEFADB5Bgor -# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAjLpes7qRLZYPU -# k0lAMgbDTUkWmbblbAB93PaWhMVotKCCIK4wggWNMIIEdaADAgECAhAOmxiO+dAt -# 5+/bUOIIQBhaMA0GCSqGSIb3DQEBDAUAMGUxCzAJBgNVBAYTAlVTMRUwEwYDVQQK -# EwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xJDAiBgNV -# BAMTG0RpZ2lDZXJ0IEFzc3VyZWQgSUQgUm9vdCBDQTAeFw0yMjA4MDEwMDAwMDBa -# Fw0zMTExMDkyMzU5NTlaMGIxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2Vy -# dCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xITAfBgNVBAMTGERpZ2lD -# ZXJ0IFRydXN0ZWQgUm9vdCBHNDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC -# ggIBAL/mkHNo3rvkXUo8MCIwaTPswqclLskhPfKK2FnC4SmnPVirdprNrnsbhA3E -# MB/zG6Q4FutWxpdtHauyefLKEdLkX9YFPFIPUh/GnhWlfr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y9+tab2BvK2WzPTH/Y1kPF82O7L97BaBoyba8WVgIy8rE/kxq3TUIH1nH8gBB -# q/VE0NU95NmxkBSpLjxvIxLvHtxY07p3aneE2ofB30FFC9msqYW0eAqsAWrH8nTu -# 1h6Fx/avSLOvMcJMsUpajNIfv5QWdXZ7qfAwtVWggzBMQ06635EojJKZAJTNFI2x -# 27ZzMMlObcl3k25x8rqEzAhEZxhImtfDu4vrXIbouQO8hJF+SM2yrYOAJmmEbp4= -# SIG # End signature block diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyPath.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyPath.ps1 deleted file mode 100644 index 1d269893df..0000000000 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyPath.ps1 +++ /dev/null @@ -1,336 +0,0 @@ -# Copyright © 2017 - 2021 Chocolatey Software, Inc. -# Copyright © 2015 - 2017 RealDimensions Software, LLC -# Copyright © 2011 - 2015 RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -function Install-ChocolateyPath { - <# -.SYNOPSIS -**NOTE:** Administrative Access Required when `-PathType 'Machine'.` - -This puts a directory to the PATH environment variable. - -.DESCRIPTION -Looks at both PATH environment variables to ensure a path variable -correctly shows up on the right PATH. - -.NOTES -This command will assert UAC/Admin privileges on the machine if -`-PathType 'Machine'`. - -This is used when the application/tool is not being linked by Chocolatey -(not in the lib folder). - -.INPUTS -None - -.OUTPUTS -None - -.PARAMETER PathToInstall -The full path to a location to add / ensure is in the PATH. - -.PARAMETER PathType -Which PATH to add it to. If specifying `Machine`, this requires admin -privileges to run correctly. - -.PARAMETER IgnoredArguments -Allows splatting with arguments that do not apply. Do not use directly. - -.EXAMPLE -Install-ChocolateyPath -PathToInstall "$($env:SystemDrive)\tools\gittfs" - -.EXAMPLE -Install-ChocolateyPath "$($env:SystemDrive)\Program Files\MySQL\MySQL Server 5.5\bin" -PathType 'Machine' - -.LINK -Install-ChocolateyEnvironmentVariable - -.LINK -Get-EnvironmentVariable - -.LINK -Set-EnvironmentVariable - -.LINK -Get-ToolsLocation -#> - param( - [parameter(Mandatory = $true, Position = 0)][string] $pathToInstall, - [parameter(Mandatory = $false, Position = 1)][System.EnvironmentVariableTarget] $pathType = [System.EnvironmentVariableTarget]::User, - [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments - ) - - Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters - ## Called from chocolateysetup.psm1 - wrap any Write-Host in try/catch - - $originalPathToInstall = $pathToInstall - - #get the PATH variable - Update-SessionEnvironment - $envPath = $env:PATH - if (!$envPath.ToLower().Contains($pathToInstall.ToLower())) { - try { - Write-Host "PATH environment variable does not have $pathToInstall in it. Adding..." - } - catch { - Write-Verbose "PATH environment variable does not have $pathToInstall in it. Adding..." - } - - $actualPath = Get-EnvironmentVariable -Name 'Path' -Scope $pathType -PreserveVariables - - $statementTerminator = ";" - #does the path end in ';'? - $hasStatementTerminator = $actualPath -ne $null -and $actualPath.EndsWith($statementTerminator) - # if the last digit is not ;, then we are adding it - If (!$hasStatementTerminator -and $actualPath -ne $null) { - $pathToInstall = $statementTerminator + $pathToInstall - } - if (!$pathToInstall.EndsWith($statementTerminator)) { - $pathToInstall = $pathToInstall + $statementTerminator - } - $actualPath = $actualPath + $pathToInstall - - if ($pathType -eq [System.EnvironmentVariableTarget]::Machine) { - if (Test-ProcessAdminRights) { - Set-EnvironmentVariable -Name 'Path' -Value $actualPath -Scope $pathType - } - else { - $psArgs = "Install-ChocolateyPath -pathToInstall `'$originalPathToInstall`' -pathType `'$pathType`'" - Start-ChocolateyProcessAsAdmin "$psArgs" - } - } - else { - Set-EnvironmentVariable -Name 'Path' -Value $actualPath -Scope $pathType - } - - #add it to the local path as well so users will be off and running - $envPSPath = $env:PATH - $env:Path = $envPSPath + $statementTerminator + $pathToInstall - } -} - -# [System.Text.RegularExpressions.Regex]::Match($Path,[System.Text.RegularExpressions.Regex]::Escape('locationtoMatch') + '(?>;)?', '', [System.Text.RegularExpressions.RegexOptions]::IgnoreCase) - -# SIG # Begin signature block -# MIInKwYJKoZIhvcNAQcCoIInHDCCJxgCAQExDzANBglghkgBZQMEAgEFADB5Bgor -# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCB13/9RBBrszjJO -# Cug4VHdEezFFfFOvHkseTFzWw/UU5KCCIK4wggWNMIIEdaADAgECAhAOmxiO+dAt -# 5+/bUOIIQBhaMA0GCSqGSIb3DQEBDAUAMGUxCzAJBgNVBAYTAlVTMRUwEwYDVQQK -# EwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xJDAiBgNV -# BAMTG0RpZ2lDZXJ0IEFzc3VyZWQgSUQgUm9vdCBDQTAeFw0yMjA4MDEwMDAwMDBa -# Fw0zMTExMDkyMzU5NTlaMGIxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2Vy -# dCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xITAfBgNVBAMTGERpZ2lD -# ZXJ0IFRydXN0ZWQgUm9vdCBHNDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC -# ggIBAL/mkHNo3rvkXUo8MCIwaTPswqclLskhPfKK2FnC4SmnPVirdprNrnsbhA3E -# MB/zG6Q4FutWxpdtHauyefLKEdLkX9YFPFIPUh/GnhWlfr6fqVcWWVVyr2iTcMKy -# unWZanMylNEQRBAu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aRvjEjd+jic+o5OjYwNJgzE4k46Zq -# UUjWmYEGg9GUsgwk3GpnIB5pwIj6iGJQFAitoz9iRr5kQ3SrJfHlZWLJ9q010s8z -# tQdIDV6MdU7yJIIT/630UBOFI7tVTgT6v+Uszoc3Em4c7mDt2v3u6EFIESAjzvIC -# CeEiBZTEgGkbzcnPPmAIckNDL3j1+ZsHQA1ZlUmD7qUbJc6jbKpGYEjSOf3imN4= -# SIG # End signature block diff --git a/src/chocolatey.resources/helpers/functions/Set-EnvironmentVariable.ps1 b/src/chocolatey.resources/helpers/functions/Set-EnvironmentVariable.ps1 deleted file mode 100644 index 56a89b88e0..0000000000 --- a/src/chocolatey.resources/helpers/functions/Set-EnvironmentVariable.ps1 +++ /dev/null @@ -1,340 +0,0 @@ -# Copyright © 2017 - 2021 Chocolatey Software, Inc. -# Copyright © 2015 - 2017 RealDimensions Software, LLC -# Copyright © 2011 - 2015 RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -function Set-EnvironmentVariable { - <# -.SYNOPSIS -**NOTE:** Administrative Access Required when `-Scope 'Machine'.` - -DO NOT USE. Not part of the public API. Use -`Install-ChocolateyEnvironmentVariable` instead. - - -.DESCRIPTION -Saves an environment variable. - -.NOTES -This command will assert UAC/Admin privileges on the machine if -`-Scope 'Machine'`. - -.INPUTS -None - -.OUTPUTS -None - -.PARAMETER Name - -.PARAMETER Value - -.PARAMETER IgnoredArguments -Allows splatting with arguments that do not apply. Do not use directly. - -.LINK -Install-ChocolateyEnvironmentVariable - -.LINK -Uninstall-ChocolateyEnvironmentVariable - -.LINK -Install-ChocolateyPath - -.LINK -Get-EnvironmentVariable -#> - param ( - [parameter(Mandatory = $true, Position = 0)][string] $Name, - [parameter(Mandatory = $false, Position = 1)][string] $Value, - [parameter(Mandatory = $false, Position = 2)] - [System.EnvironmentVariableTarget] $Scope, - [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments - ) - - Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters - - if ($Scope -eq [System.EnvironmentVariableTarget]::Process -or $Value -eq $null -or $Value -eq '') { - return [Environment]::SetEnvironmentVariable($Name, $Value, $Scope) - } - - [string]$keyHive = 'HKEY_LOCAL_MACHINE' - [string]$registryKey = "SYSTEM\CurrentControlSet\Control\Session Manager\Environment\" - [Microsoft.Win32.RegistryKey] $win32RegistryKey = [Microsoft.Win32.Registry]::LocalMachine.OpenSubKey($registryKey) - if ($Scope -eq [System.EnvironmentVariableTarget]::User) { - $keyHive = 'HKEY_CURRENT_USER' - $registryKey = "Environment" - [Microsoft.Win32.RegistryKey] $win32RegistryKey = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey($registryKey) - } - - [Microsoft.Win32.RegistryValueKind]$registryType = [Microsoft.Win32.RegistryValueKind]::String - try { - if ($win32RegistryKey.GetValueNames() -contains $Name) { - $registryType = $win32RegistryKey.GetValueKind($Name) - } - } - catch { - # the value doesn't yet exist - # move along, nothing to see here - } - Write-Debug "Registry type for $Name is/will be $registryType" - - if ($Name -eq 'PATH') { - $registryType = [Microsoft.Win32.RegistryValueKind]::ExpandString - } - - [Microsoft.Win32.Registry]::SetValue($keyHive + "\" + $registryKey, $Name, $Value, $registryType) - - try { - # make everything refresh - # because sometimes explorer.exe just doesn't get the message that things were updated. - if (-not ("win32.nativemethods" -as [type])) { - # import sendmessagetimeout from win32 - Add-Type -Namespace Win32 -Name NativeMethods -MemberDefinition @" -[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] -public static extern IntPtr SendMessageTimeout( - IntPtr hWnd, uint Msg, UIntPtr wParam, string lParam, - uint fuFlags, uint uTimeout, out UIntPtr lpdwResult); -"@ - } - - $HWND_BROADCAST = [intptr]0xffff; - $WM_SETTINGCHANGE = 0x1a; - $result = [uintptr]::zero - - # notify all windows of environment block change - [win32.nativemethods]::SendMessageTimeout($HWND_BROADCAST, $WM_SETTINGCHANGE, [uintptr]::Zero, "Environment", 2, 5000, [ref]$result) | Out-Null - - # Set a user environment variable making the system refresh - $setx = "$($env:SystemRoot)\System32\setx.exe" - & "$setx" ChocolateyLastPathUpdate `"$((Get-Date).ToFileTime())`" | Out-Null - } - catch { - Write-Warning "Failure attempting to let Explorer know about updated environment settings.`n $($_.Exception.Message)" - } - - Update-SessionEnvironment -} - -# SIG # Begin signature block -# MIInKwYJKoZIhvcNAQcCoIInHDCCJxgCAQExDzANBglghkgBZQMEAgEFADB5Bgor -# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCCBkgOQ4Avnj1iK -# H7oaZfnNGQVkYLA6zfCUaBqhOLwzBaCCIK4wggWNMIIEdaADAgECAhAOmxiO+dAt -# 5+/bUOIIQBhaMA0GCSqGSIb3DQEBDAUAMGUxCzAJBgNVBAYTAlVTMRUwEwYDVQQK -# EwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xJDAiBgNV -# BAMTG0RpZ2lDZXJ0IEFzc3VyZWQgSUQgUm9vdCBDQTAeFw0yMjA4MDEwMDAwMDBa -# Fw0zMTExMDkyMzU5NTlaMGIxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2Vy -# dCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xITAfBgNVBAMTGERpZ2lD -# ZXJ0IFRydXN0ZWQgUm9vdCBHNDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC -# ggIBAL/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ESh0vf+OojYJTNsPjQSE6OFI -# REFNIYUHYdglMPtWOVrblJfhwBA3VlnUJ5f0+V2vQn0U/9oxKIFFW4MRWhKQlcRr -# OURDhRJ0KIzmtB3IufVYBVY6tB4XPAy3c54Ooa1RQ83THBxi+Fq6yhWMeMK9Sipy -# 03o2Wxa7dwKBBkqQCTVYZEUl+56uo+J2wEbqITlf+fkFQoykJwCD8xW3AynEf9La -# PmOXUA24O0E99FLlSLlWJ2KszR1zYkIQlabZ4k4K/l7j1GOetvYio8xBtB1C80+X -# r2+iv7/OqXTDqvQ8L2MrERD/EBSmtdRVuRaHOuj/0L/MupRopFZLzj0i0EJqPqA= -# SIG # End signature block diff --git a/src/chocolatey.resources/helpers/functions/Test-ProcessAdminRights.ps1 b/src/chocolatey.resources/helpers/functions/Test-ProcessAdminRights.ps1 deleted file mode 100644 index fdd76ed80f..0000000000 --- a/src/chocolatey.resources/helpers/functions/Test-ProcessAdminRights.ps1 +++ /dev/null @@ -1,259 +0,0 @@ -# Copyright © 2017 - 2021 Chocolatey Software, Inc. -# Copyright © 2015 - 2017 RealDimensions Software, LLC -# Copyright © 2011 - 2015 RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -function Test-ProcessAdminRights { - <# -.SYNOPSIS -Tests whether the current process is running with administrative rights. - -.DESCRIPTION -This function checks whether the current process has administrative -rights by checking if the current user identity is a member of the -Administrators group. It returns `$true` if the current process is -running with administrative rights, `$false` otherwise. - -On Windows Vista and later, with UAC enabled, the returned value -represents the actual rights available to the process, e.g. if it -returns `$true`, the process is running elevated. - -.INPUTS -None - -.OUTPUTS -System.Boolean -#> - - # do not log function call - ## Called from chocolateysetup.psm1 - wrap any Write-Host in try/catch - - $currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent([Security.Principal.TokenAccessLevels]'Query,Duplicate')) - $isAdmin = $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) - Write-Debug "Test-ProcessAdminRights: returning $isAdmin" - - return $isAdmin -} - -# SIG # Begin signature block -# MIInKwYJKoZIhvcNAQcCoIInHDCCJxgCAQExDzANBglghkgBZQMEAgEFADB5Bgor -# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAR0wqxYfxdPERM -# yExbZo1h+K2/BvVNPalCu8zBojzsbaCCIK4wggWNMIIEdaADAgECAhAOmxiO+dAt -# 5+/bUOIIQBhaMA0GCSqGSIb3DQEBDAUAMGUxCzAJBgNVBAYTAlVTMRUwEwYDVQQK -# EwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xJDAiBgNV -# BAMTG0RpZ2lDZXJ0IEFzc3VyZWQgSUQgUm9vdCBDQTAeFw0yMjA4MDEwMDAwMDBa -# Fw0zMTExMDkyMzU5NTlaMGIxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2Vy -# dCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5jb20xITAfBgNVBAMTGERpZ2lD -# ZXJ0IFRydXN0ZWQgUm9vdCBHNDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC -# ggIBAL/mkHNo3rvkXUo8MCIwaTPswqclLskhPfKK2FnC4SmnPVirdprNrnsbhA3E -# MB/zG6Q4FutWxpdtHauyefLKEdLkX9YFPFIPUh/GnhWlfr6fqVcWWVVyr2iTcMKy -# unWZanMylNEQRBAu34Lz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W31XjRfHOc6CJ4r1um1daBIOPSk1xhGRbfBJG -# Nhj1Fl4+EQ0kivbaC48wdpvgFee+7Xc3yVigwP6RN6VqawYgkNY7rYKy6pbsvO4y -# gvNEmlmFno980xooViETEMKOss+vtDRbMHAJpKDpVttJba/nAMVe2pFq+lmNSfaf -# I7buoWy8+DiOGDqIp3rFwmvWdHtq4maGB5Q4rXiVp1pbhEqZbUXk/eQJA8L5MtU= -# SIG # End signature block diff --git a/src/chocolatey.resources/helpers/functions/Update-SessionEnvironment.ps1 b/src/chocolatey.resources/helpers/functions/Update-SessionEnvironment.ps1 deleted file mode 100644 index 53950f22b3..0000000000 --- a/src/chocolatey.resources/helpers/functions/Update-SessionEnvironment.ps1 +++ /dev/null @@ -1,318 +0,0 @@ -# Copyright © 2017 - 2021 Chocolatey Software, Inc. -# Copyright © 2015 - 2017 RealDimensions Software, LLC -# Copyright © 2011 - 2015 RealDimensions Software, LLC & original authors/contributors from https://github.com/chocolatey/chocolatey -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -function Update-SessionEnvironment { - <# -.SYNOPSIS -Updates the environment variables of the current powershell session with -any environment variable changes that may have occurred during a -Chocolatey package install. - -.DESCRIPTION -When Chocolatey installs a package, the package author may add or change -certain environment variables that will affect how the application runs -or how it is accessed. Often, these changes are not visible to the -current PowerShell session. This means the user needs to open a new -PowerShell session before these settings take effect which can render -the installed application nonfunctional until that time. - -Use the Update-SessionEnvironment command to refresh the current -PowerShell session with all environment settings possibly performed by -Chocolatey package installs. - -.NOTES -This method is also added to the user's PowerShell profile as -`refreshenv`. When called as `refreshenv`, the method will provide -additional output. - -Preserves `PSModulePath` as set by the process. - -.INPUTS -None - -.OUTPUTS -None -#> - - Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters - - $refreshEnv = $false - $invocation = $MyInvocation - if ($invocation.InvocationName -eq 'refreshenv') { - $refreshEnv = $true - } - - if ($refreshEnv) { - Write-Output 'Refreshing environment variables from the registry for powershell.exe. Please wait...' - } - else { - Write-Verbose 'Refreshing environment variables from the registry.' - } - - $userName = $env:USERNAME - $architecture = $env:PROCESSOR_ARCHITECTURE - $psModulePath = $env:PSModulePath - - #ordering is important here, $user should override $machine... - $ScopeList = 'Process', 'Machine' - if ('SYSTEM', "${env:COMPUTERNAME}`$" -notcontains $userName) { - # but only if not running as the SYSTEM/machine in which case user can be ignored. - $ScopeList += 'User' - } - foreach ($Scope in $ScopeList) { - Get-EnvironmentVariableNames -Scope $Scope | - ForEach-Object { - Set-Item "Env:$_" -Value (Get-EnvironmentVariable -Scope $Scope -Name $_) - } - } - - #Path gets special treatment b/c it munges the two together - $paths = 'Machine', 'User' | - ForEach-Object { - (Get-EnvironmentVariable -Name 'PATH' -Scope $_) -split ';' - } | - Select-Object -Unique - $Env:PATH = $paths -join ';' - - # PSModulePath is almost always updated by process, so we want to preserve it. - $env:PSModulePath = $psModulePath - - # reset user and architecture - if ($userName) { - $env:USERNAME = $userName; - } - if ($architecture) { - $env:PROCESSOR_ARCHITECTURE = $architecture; - } - - if ($refreshEnv) { - Write-Output 'Finished' - } -} - -Set-Alias refreshenv Update-SessionEnvironment - -# SIG # Begin signature block -# MIInKwYJKoZIhvcNAQcCoIInHDCCJxgCAQExDzANBglghkgBZQMEAgEFADB5Bgor -# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCD5/RFzaOhm0x0b -# z1A/0EhtNvspeG0kMbMPNfRQBUzivKCCIK4wggWNMIIEdaADAgECAhAOmxiO+dAt -# 5+/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DX0/gBo/wI/qhiYP24/d0hy2oS2ArTKcfvnQZ1qTrcwDQYJ -# KoZIhvcNAQEBBQAEggIAcNHBWZk9mgrZySSVO843nQMsQ4jN0c95bnD+o0jGySNc -# 1EV6rNMBuJWbRgpsT3xawrhx+w7IPWcrs8wNmsuC8R1QWyCHv6d1F9QeB3sWiILr -# OTxU6Isf5Oy6qlESZGH5yUJ5ITrEQNzFUQatp1FPmYrELUUGBb9Xvdf1c7C2jL98 -# pH0FACM2GTe+UAQUidojlqu1dMlKlWvG0Wtkw7ZGce95/SODF7cuRoU1dbpzgPAT -# aS0r1AEb1D7zzq+fovF0OaFPvW2YNGu45/MVQiTsZkPvbLPDYtzqkHDbMc1Ykbm+ -# ptLeK1LkWowwk7Jd5NAZjze4VGnG5XL1wNx+eL+fiHG8EyqR5rPYf1b6F7VNNTCk -# UNZyqpOiTtlZwkuOY2L/kkSii7+aihq0LM+32u9sYJvZnvOIYh+/0s4ZKbVXmp11 -# 9HPEhC6S7sUF7NLphU4MOruaIYGAjhtk7Jets/R0IMfHXy6WANcuhMGsfIxZEhB3 -# 3srrSZqmEE79ky10jC8l6e4n5LuvBZnYP6gglvtPNyOw30l77cRaV5eqM4QfzyjT -# ZVNmqYSRZzhw7NRcFHF3JV1eG0DzhAd4TOOcEwk5dSY73AvYV6ozoXBZpm0Dcceh -# cUoGPfasi6P+cFzksP1V+TCv5jnN0NjLX04d3vdZe7iIgI54gva93aYIaAhYLoE= -# SIG # End signature block diff --git a/src/chocolatey.sln b/src/chocolatey.sln index c2b6ac88fa..8bbca092e6 100644 --- a/src/chocolatey.sln +++ b/src/chocolatey.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.32901.82 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "chocolatey.console", "chocolatey.console\chocolatey.console.csproj", "{E24E3386-244F-4404-9E6E-5B53818EA903}" EndProject @@ -54,6 +54,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "chocolatey", "chocolatey", EndProject Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "chocolatey.install", "chocolatey.install\chocolatey.install.wixproj", "{6B96B4AE-8FD2-4719-AAFB-BA027B798089}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Chocolatey.PowerShell", "Chocolatey.PowerShell\Chocolatey.PowerShell.csproj", "{88396C46-8089-4814-A7D1-E18777FF6083}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -240,6 +242,42 @@ Global {6B96B4AE-8FD2-4719-AAFB-BA027B798089}.WIX|Mixed Platforms.Build.0 = WIX|x86 {6B96B4AE-8FD2-4719-AAFB-BA027B798089}.WIX|x86.ActiveCfg = WIX|x86 {6B96B4AE-8FD2-4719-AAFB-BA027B798089}.WIX|x86.Build.0 = WIX|x86 + {88396C46-8089-4814-A7D1-E18777FF6083}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.Debug|x86.ActiveCfg = Debug|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.Debug|x86.Build.0 = Debug|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.NoResources|Any CPU.ActiveCfg = Debug|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.NoResources|Any CPU.Build.0 = Debug|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.NoResources|Mixed Platforms.ActiveCfg = Debug|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.NoResources|Mixed Platforms.Build.0 = Debug|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.NoResources|x86.ActiveCfg = Debug|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.NoResources|x86.Build.0 = Debug|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.Release|Any CPU.ActiveCfg = Release|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.Release|Any CPU.Build.0 = Release|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.Release|x86.ActiveCfg = Release|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.Release|x86.Build.0 = Release|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.ReleaseOfficial|Any CPU.ActiveCfg = ReleaseOfficial|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.ReleaseOfficial|Any CPU.Build.0 = ReleaseOfficial|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.ReleaseOfficial|Mixed Platforms.ActiveCfg = ReleaseOfficial|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.ReleaseOfficial|Mixed Platforms.Build.0 = ReleaseOfficial|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.ReleaseOfficial|x86.ActiveCfg = ReleaseOfficial|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.ReleaseOfficial|x86.Build.0 = ReleaseOfficial|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.ReleaseOfficialNo7zip|Any CPU.ActiveCfg = ReleaseOfficial|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.ReleaseOfficialNo7zip|Any CPU.Build.0 = ReleaseOfficial|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.ReleaseOfficialNo7zip|Mixed Platforms.ActiveCfg = ReleaseOfficial|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.ReleaseOfficialNo7zip|Mixed Platforms.Build.0 = ReleaseOfficial|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.ReleaseOfficialNo7zip|x86.ActiveCfg = ReleaseOfficial|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.ReleaseOfficialNo7zip|x86.Build.0 = ReleaseOfficial|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.WIX|Any CPU.ActiveCfg = Debug|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.WIX|Any CPU.Build.0 = Debug|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.WIX|Mixed Platforms.ActiveCfg = Debug|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.WIX|Mixed Platforms.Build.0 = Debug|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.WIX|x86.ActiveCfg = Debug|Any CPU + {88396C46-8089-4814-A7D1-E18777FF6083}.WIX|x86.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/chocolatey/infrastructure.app/ApplicationParameters.cs b/src/chocolatey/infrastructure.app/ApplicationParameters.cs index 933221208e..8125f81d03 100644 --- a/src/chocolatey/infrastructure.app/ApplicationParameters.cs +++ b/src/chocolatey/infrastructure.app/ApplicationParameters.cs @@ -61,6 +61,11 @@ public static class ApplicationParameters public static readonly string LicensedAssemblyLocation = _fileSystem.FileExists(_fileSystem.CombinePaths(InstallLocation, "chocolatey.licensed.dll")) ? _fileSystem.CombinePaths(InstallLocation, "chocolatey.licensed.dll") : _fileSystem.CombinePaths(InstallLocation, "extensions", "chocolatey", "chocolatey.licensed.dll"); #endif + internal static readonly string ChocolateyPowerShellAssemblySimpleName = "Chocolatey.PowerShell"; + internal static readonly string ChocolateyPowerShellAssemblyLocation = _fileSystem.FileExists(_fileSystem.CombinePaths(InstallLocation, "Chocolatey.PowerShell.dll")) + ? _fileSystem.CombinePaths(InstallLocation, "Chocolatey.PowerShell.dll") + : _fileSystem.CombinePaths(InstallLocation, "helpers", "Chocolatey.PowerShell.dll"); + public static readonly string CommonAppDataChocolatey = _fileSystem.CombinePaths(System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonApplicationData), Name); public static readonly string LoggingLocation = _fileSystem.CombinePaths(InstallLocation, "logs"); public static readonly string LoggingFile = @"chocolatey.log"; @@ -164,7 +169,6 @@ public static class Environment /// public static int DefaultWaitForExitInSeconds = 2700; public static int DefaultWebRequestTimeoutInSeconds = 30; - public static readonly string[] ConfigFileExtensions = new string[] { ".autoconf", ".config", ".conf", ".cfg", ".jsc", ".json", ".jsonp", ".ini", ".xml", ".yaml" }; public static readonly string ConfigFileTransformExtension = ".install.xdt"; public static readonly string[] ShimDirectorFileExtensions = new string[] { ".gui", ".ignore" }; diff --git a/src/chocolatey/infrastructure/registration/AssemblyResolution.cs b/src/chocolatey/infrastructure/registration/AssemblyResolution.cs index 1d3129871a..bdebbb3d1e 100644 --- a/src/chocolatey/infrastructure/registration/AssemblyResolution.cs +++ b/src/chocolatey/infrastructure/registration/AssemblyResolution.cs @@ -139,6 +139,13 @@ public static IAssembly LoadAssembly(string assemblySimpleName, string assemblyF { try { + // If we're trying to load Chocolatey.PowerShell (e.g., as a dependency of the licensed extension, + // we may need to alter the load file path. + if (assemblySimpleName == ApplicationParameters.ChocolateyPowerShellAssemblySimpleName) + { + assemblyFileLocation = ApplicationParameters.ChocolateyPowerShellAssemblyLocation; + } + IAssembly tempAssembly; #if FORCE_CHOCOLATEY_OFFICIAL_KEY tempAssembly = Assembly.Load(FileSystem.ReadFileBytes(assemblyFileLocation)); @@ -371,7 +378,8 @@ public static System.Reflection.Assembly ResolveExtensionOrMergedAssembly(object // There are things that are ILMerged into Chocolatey. Anything with // the right public key except extensions should use the choco/chocolatey assembly if (!requestedAssembly.Name.EndsWith(".resources", StringComparison.OrdinalIgnoreCase) - && !requestedAssembly.Name.IsEqualTo(ApplicationParameters.LicensedChocolateyAssemblySimpleName)) + && !requestedAssembly.Name.IsEqualTo(ApplicationParameters.LicensedChocolateyAssemblySimpleName) + && !requestedAssembly.Name.IsEqualTo(ApplicationParameters.ChocolateyPowerShellAssemblySimpleName)) { return typeof(ConsoleApplication).Assembly; }