Skip to content

Commit 8ee6d6c

Browse files
PowerShellTeamandyleejordan
authored andcommitted
Update files from Source Depot changeset [SD:715912]
Corresponds to 77eda782aa78ba8b7a36c51ee619629ce6c990f2 in psl-monad.
1 parent d9b1166 commit 8ee6d6c

74 files changed

Lines changed: 1360 additions & 1320 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Microsoft.PowerShell.Commands.Management/commands/management/CIMHelper.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -244,21 +244,6 @@ namespace Extensions
244244

245245
internal static class CIMExtensions
246246
{
247-
/// <summary>
248-
/// An "overload" of the
249-
/// <see cref="Microsoft.Management.Infrastructure.CimSession"/>.QueryInstances
250-
/// method that takes only the query string as a parameter
251-
/// </summary>
252-
/// <param name="session">The CimSession to be queried</param>
253-
/// <param name="query">A string containing the query to be run</param>
254-
/// <returns>
255-
/// An IEnumerable interface that can be used to enumerate the instances
256-
/// </returns>
257-
internal static IEnumerable<CimInstance> QueryInstances(this CimSession session, string query)
258-
{
259-
return session.QueryInstances(CIMHelper.DefaultNamespace, CIMHelper.DefaultQueryDialect, query);
260-
}
261-
262247
/// <summary>
263248
/// An "overload" of the
264249
/// <see cref="Microsoft.Management.Infrastructure.CimSession"/>.QueryInstances

src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs

Lines changed: 99 additions & 25 deletions
Large diffs are not rendered by default.

src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2249,7 +2249,7 @@ protected override void BeginProcessing()
22492249
// Wait for the job object to finish
22502250
jobObject.WaitOne(waithandle);
22512251
}
2252-
else
2252+
else if (!process.HasExited)
22532253
{
22542254
// WinBlue: 27537 Start-Process -Wait doesn't work in a remote session on Windows 7 or lower.
22552255
process.Exited += new EventHandler(myProcess_Exited);

src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,6 +1677,7 @@ public string Status
16771677
/// <summary>
16781678
///
16791679
/// </summary>
1680+
[ArchitectureSensitive]
16801681
protected override void ProcessRecord()
16811682
{
16821683

@@ -2064,6 +2065,7 @@ public string[] DependsOn
20642065
/// <summary>
20652066
/// Create the service
20662067
/// </summary>
2068+
[ArchitectureSensitive]
20672069
protected override void BeginProcessing()
20682070
{
20692071
Diagnostics.Assert(!String.IsNullOrEmpty(Name),

src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ private void ProcessPaths(List<string> resolvedPaths)
347347
string activeExtension = null;
348348
foreach (string path in resolvedPaths)
349349
{
350-
string currentExtension = System.IO.Path.GetExtension(path).ToUpper();
350+
string currentExtension = System.IO.Path.GetExtension(path).ToUpperInvariant();
351351

352352
switch (currentExtension)
353353
{
@@ -1063,10 +1063,20 @@ private void CheckTypesForDuplicates(Assembly assembly)
10631063
private static PortableExecutableReference ObjectDeclaredAssemblyReference =
10641064
MetadataReference.CreateFromFile(ClrFacade.GetAssemblies(typeof(object).FullName).First().Location);
10651065

1066+
// CoreCLR RC2 bits don't have SecureString. We are using a separate assembly with SecureString implementation.
1067+
// This fact is an implementation detail and should not require the user to specify one more assembly,
1068+
// if they want to use SecureString in Add-Type -TypeDefinition.
1069+
// So this assembly should be in the default assemblies list to provide the best experience.
1070+
//
1071+
// TODO: This reference should be removed, if we take CoreCLR version that has SecureString implementation.
1072+
private static PortableExecutableReference SecureStringAssemblyReference =
1073+
MetadataReference.CreateFromFile(typeof(System.Security.SecureString).GetTypeInfo().Assembly.Location);
1074+
10661075
private static MetadataReference[] defaultAssemblies = new MetadataReference[]
10671076
{
10681077
ObjectImplementationAssemblyReference,
10691078
ObjectDeclaredAssemblyReference,
1079+
SecureStringAssemblyReference,
10701080
MetadataReference.CreateFromFile(typeof(PSObject).GetTypeInfo().Assembly.Location)
10711081
};
10721082

@@ -1210,6 +1220,7 @@ private void CompileSourceToAssembly(string source)
12101220
var tempReferences = ReferencedAssemblies.Select(a => MetadataReference.CreateFromFile(ResolveReferencedAssembly(a))).ToList();
12111221
tempReferences.Add(ObjectImplementationAssemblyReference);
12121222
tempReferences.Add(ObjectDeclaredAssemblyReference);
1223+
tempReferences.Add(SecureStringAssemblyReference);
12131224
references = tempReferences.ToArray();
12141225
}
12151226

src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2526,7 +2526,7 @@ private string GenerateReimportingOfModules()
25262526
)
25272527
";
25282528

2529-
// index 0 - "-ContainerId <container id>" (ContainerId is used instead of ContainerName due to its uniqueness)
2529+
// index 0 - "-ContainerId <container id>"
25302530
// index 1 - "-RunAsAdministrator" or empty string
25312531
// index 2 - "-ConfigurationName <configuration name>" or empty string
25322532
private const string NewContainerRunspaceTemplate = @"

src/Microsoft.PowerShell.Commands.Utility/commands/utility/SetDateCommand.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public DisplayHintType DisplayHint
8383
/// <summary>
8484
/// set the date
8585
/// </summary>
86+
[ArchitectureSensitive]
8687
protected override void ProcessRecord()
8788
{
8889
DateTime dateToUse;

src/Microsoft.PowerShell.Commands.Utility/resources/UtilityCommonStrings.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,7 @@
171171
<data name="CouldNotParseAsPowerShellDataFile" xml:space="preserve">
172172
<value>The file '{0}' could not be parsed as a PowerShell Data File.</value>
173173
</data>
174+
<data name="TypeNotSupported" xml:space="preserve">
175+
<value>'{0}' is not supported in this system.</value>
176+
</data>
174177
</root>

src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -623,29 +623,6 @@ internal static ConsoleHandle GetActiveScreenBufferHandle()
623623
return _outputHandle.Value;
624624
}
625625

626-
internal enum StandardHandleId : uint
627-
{
628-
// From winnt.h
629-
// #define STD_INPUT_HANDLE ((DWORD)-10)
630-
// #define STD_OUTPUT_HANDLE ((DWORD)-11)
631-
// #define STD_ERROR_HANDLE ((DWORD)-12)
632-
633-
Input = 0xFFFFFFF6,
634-
Output = 0xFFFFFFF5,
635-
Error = 0xFFFFFFF4
636-
}
637-
638-
internal static NakedWin32Handle GetStdHandle(StandardHandleId handleId)
639-
{
640-
unchecked
641-
{
642-
// Suppress the PreFAST warning about not using Marshal.GetLastWin32Error() to
643-
// get the error code.
644-
#pragma warning disable 56523
645-
return NativeMethods.GetStdHandle((DWORD)handleId);
646-
}
647-
}
648-
649626
#endregion
650627

651628
#region Mode
@@ -3492,9 +3469,6 @@ internal enum FileType
34923469
[DllImport(PinvokeDllNames.GetLargestConsoleWindowSizeDllName, SetLastError = true, CharSet = CharSet.Unicode)]
34933470
internal static extern COORD GetLargestConsoleWindowSize(NakedWin32Handle consoleOutput);
34943471

3495-
[DllImport(PinvokeDllNames.GetStdHandleDllName, SetLastError = true, CharSet = CharSet.Unicode)]
3496-
internal static extern NakedWin32Handle GetStdHandle(DWORD handleId);
3497-
34983472
[DllImport(PinvokeDllNames.ReadConsoleDllName, SetLastError = true, CharSet = CharSet.Unicode)]
34993473
internal static extern bool ReadConsole
35003474
(

src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1421,7 +1421,7 @@ private uint DoRunspaceLoop(string initialCommand, bool skipProfiles, Collection
14211421

14221422
if (ExitCode == ExitCodeInitFailure) { break; }
14231423

1424-
if (!noExit && !ui.ReadFromStdin)
1424+
if (!noExit && (!ui.ReadFromStdin || Console.In.Peek() == -1))
14251425
{
14261426
// Wait for runspace to open, init, and run init script before
14271427
// setting ShouldEndSession, to allow debugger to work.

0 commit comments

Comments
 (0)