Run dotnet-format to improve formatting of source code (#13503)

This commit is contained in:
xtqqczze
2020-11-04 11:13:56 -08:00
committed by GitHub
parent beb074d4a2
commit 52ecb6d18e
20 changed files with 172 additions and 160 deletions
@@ -375,7 +375,7 @@ namespace Microsoft.Powershell.Commands.GetCounter.PdhNative
private static extern uint PdhValidatePath(string szFullPathBuffer);
[DllImport("pdh.dll", CharSet = CharSet.Unicode)]
private static extern uint PdhGetCounterInfo(IntPtr hCounter, [MarshalAs(UnmanagedType.U1)]bool bRetrieveExplainText, ref IntPtr pdwBufferSize, IntPtr lpBuffer);
private static extern uint PdhGetCounterInfo(IntPtr hCounter, [MarshalAs(UnmanagedType.U1)] bool bRetrieveExplainText, ref IntPtr pdwBufferSize, IntPtr lpBuffer);
[DllImport("pdh.dll", CharSet = CharSet.Unicode)]
private static extern uint PdhGetCounterTimeBase(IntPtr hCounter, out UInt64 pTimeBase);
@@ -2351,82 +2351,82 @@ namespace Microsoft.PowerShell.Commands
private void SetStartupInfo(ProcessStartInfo startinfo, ref ProcessNativeMethods.STARTUPINFO lpStartupInfo, ref int creationFlags)
{
// RedirectionStandardInput
if (_redirectstandardinput != null)
{
startinfo.RedirectStandardInput = true;
_redirectstandardinput = ResolveFilePath(_redirectstandardinput);
lpStartupInfo.hStdInput = GetSafeFileHandleForRedirection(_redirectstandardinput, ProcessNativeMethods.OPEN_EXISTING);
}
else
{
lpStartupInfo.hStdInput = new SafeFileHandle(ProcessNativeMethods.GetStdHandle(-10), false);
}
// RedirectionStandardInput
if (_redirectstandardinput != null)
{
startinfo.RedirectStandardInput = true;
_redirectstandardinput = ResolveFilePath(_redirectstandardinput);
lpStartupInfo.hStdInput = GetSafeFileHandleForRedirection(_redirectstandardinput, ProcessNativeMethods.OPEN_EXISTING);
}
else
{
lpStartupInfo.hStdInput = new SafeFileHandle(ProcessNativeMethods.GetStdHandle(-10), false);
}
// RedirectionStandardOutput
if (_redirectstandardoutput != null)
{
startinfo.RedirectStandardOutput = true;
_redirectstandardoutput = ResolveFilePath(_redirectstandardoutput);
lpStartupInfo.hStdOutput = GetSafeFileHandleForRedirection(_redirectstandardoutput, ProcessNativeMethods.CREATE_ALWAYS);
}
else
{
lpStartupInfo.hStdOutput = new SafeFileHandle(ProcessNativeMethods.GetStdHandle(-11), false);
}
// RedirectionStandardOutput
if (_redirectstandardoutput != null)
{
startinfo.RedirectStandardOutput = true;
_redirectstandardoutput = ResolveFilePath(_redirectstandardoutput);
lpStartupInfo.hStdOutput = GetSafeFileHandleForRedirection(_redirectstandardoutput, ProcessNativeMethods.CREATE_ALWAYS);
}
else
{
lpStartupInfo.hStdOutput = new SafeFileHandle(ProcessNativeMethods.GetStdHandle(-11), false);
}
// RedirectionStandardError
if (_redirectstandarderror != null)
// RedirectionStandardError
if (_redirectstandarderror != null)
{
startinfo.RedirectStandardError = true;
_redirectstandarderror = ResolveFilePath(_redirectstandarderror);
lpStartupInfo.hStdError = GetSafeFileHandleForRedirection(_redirectstandarderror, ProcessNativeMethods.CREATE_ALWAYS);
}
else
{
lpStartupInfo.hStdError = new SafeFileHandle(ProcessNativeMethods.GetStdHandle(-12), false);
}
// STARTF_USESTDHANDLES
lpStartupInfo.dwFlags = 0x100;
if (startinfo.CreateNoWindow)
{
// No new window: Inherit the parent process's console window
creationFlags = 0x00000000;
}
else
{
// CREATE_NEW_CONSOLE
creationFlags |= 0x00000010;
// STARTF_USESHOWWINDOW
lpStartupInfo.dwFlags |= 0x00000001;
// On headless SKUs like NanoServer and IoT, window style can only be the default value 'Normal'.
switch (startinfo.WindowStyle)
{
startinfo.RedirectStandardError = true;
_redirectstandarderror = ResolveFilePath(_redirectstandarderror);
lpStartupInfo.hStdError = GetSafeFileHandleForRedirection(_redirectstandarderror, ProcessNativeMethods.CREATE_ALWAYS);
}
else
{
lpStartupInfo.hStdError = new SafeFileHandle(ProcessNativeMethods.GetStdHandle(-12), false);
case ProcessWindowStyle.Normal:
// SW_SHOWNORMAL
lpStartupInfo.wShowWindow = 1;
break;
case ProcessWindowStyle.Minimized:
// SW_SHOWMINIMIZED
lpStartupInfo.wShowWindow = 2;
break;
case ProcessWindowStyle.Maximized:
// SW_SHOWMAXIMIZED
lpStartupInfo.wShowWindow = 3;
break;
case ProcessWindowStyle.Hidden:
// SW_HIDE
lpStartupInfo.wShowWindow = 0;
break;
}
}
// STARTF_USESTDHANDLES
lpStartupInfo.dwFlags = 0x100;
if (startinfo.CreateNoWindow)
{
// No new window: Inherit the parent process's console window
creationFlags = 0x00000000;
}
else
{
// CREATE_NEW_CONSOLE
creationFlags |= 0x00000010;
// STARTF_USESHOWWINDOW
lpStartupInfo.dwFlags |= 0x00000001;
// On headless SKUs like NanoServer and IoT, window style can only be the default value 'Normal'.
switch (startinfo.WindowStyle)
{
case ProcessWindowStyle.Normal:
// SW_SHOWNORMAL
lpStartupInfo.wShowWindow = 1;
break;
case ProcessWindowStyle.Minimized:
// SW_SHOWMINIMIZED
lpStartupInfo.wShowWindow = 2;
break;
case ProcessWindowStyle.Maximized:
// SW_SHOWMAXIMIZED
lpStartupInfo.wShowWindow = 3;
break;
case ProcessWindowStyle.Hidden:
// SW_HIDE
lpStartupInfo.wShowWindow = 0;
break;
}
}
// Create the new process suspended so we have a chance to get a corresponding Process object in case it terminates quickly.
creationFlags |= 0x00000004;
// Create the new process suspended so we have a chance to get a corresponding Process object in case it terminates quickly.
creationFlags |= 0x00000004;
}
/// <summary>
@@ -33,7 +33,7 @@ namespace Microsoft.PowerShell
/// Length of the passed in argument array.
/// </param>
[Obsolete("Callers should now use UnmanagedPSEntry.Start(string[], int)", error: true)]
public static int Start(string consoleFilePath, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 2)]string[] args, int argc)
public static int Start(string consoleFilePath, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 2)] string[] args, int argc)
{
return Start(args, argc);
}
@@ -47,7 +47,7 @@ namespace Microsoft.PowerShell
/// <param name="argc">
/// Length of the passed in argument array.
/// </param>
public static int Start([MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 1)]string[] args, int argc)
public static int Start([MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr, SizeParamIndex = 1)] string[] args, int argc)
{
if (args == null)
{
@@ -121,9 +121,9 @@ namespace System.Diagnostics.Eventing
[SecurityCritical]
internal static extern unsafe uint EventRegister(
[In] ref Guid providerId,
[In]EtwEnableCallback enableCallback,
[In]void* callbackContext,
[In][Out]ref long registrationHandle
[In] EtwEnableCallback enableCallback,
[In] void* callbackContext,
[In][Out] ref long registrationHandle
);
[DllImport(EventProviderDllName, ExactSpelling = true, EntryPoint = "EventUnregister", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
@@ -553,8 +553,8 @@ namespace System.Diagnostics.Eventing
[SecurityCritical]
internal static extern EventLogHandle EvtQuery(
EventLogHandle session,
[MarshalAs(UnmanagedType.LPWStr)]string path,
[MarshalAs(UnmanagedType.LPWStr)]string query,
[MarshalAs(UnmanagedType.LPWStr)] string path,
[MarshalAs(UnmanagedType.LPWStr)] string query,
int flags);
// SEEK
@@ -566,7 +566,7 @@ namespace System.Diagnostics.Eventing
long position,
EventLogHandle bookmark,
int timeout,
[MarshalAs(UnmanagedType.I4)]EvtSeekFlags flags
[MarshalAs(UnmanagedType.I4)] EvtSeekFlags flags
);
[DllImport(WEVTAPI, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
@@ -603,7 +603,7 @@ namespace System.Diagnostics.Eventing
internal static extern bool EvtGetEventInfo(
EventLogHandle eventHandle,
// int propertyId
[MarshalAs(UnmanagedType.I4)]EvtEventPropertyId propertyId,
[MarshalAs(UnmanagedType.I4)] EvtEventPropertyId propertyId,
int bufferSize,
IntPtr bufferPtr,
out int bufferUsed
@@ -614,7 +614,7 @@ namespace System.Diagnostics.Eventing
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool EvtGetQueryInfo(
EventLogHandle queryHandle,
[MarshalAs(UnmanagedType.I4)]EvtQueryPropertyId propertyId,
[MarshalAs(UnmanagedType.I4)] EvtQueryPropertyId propertyId,
int bufferSize,
IntPtr buffer,
ref int bufferRequired
@@ -686,7 +686,7 @@ namespace System.Diagnostics.Eventing
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool EvtGetEventMetadataProperty(
EventLogHandle eventMetadata,
[MarshalAs(UnmanagedType.I4)] EvtEventMetadataPropertyId propertyId,
[MarshalAs(UnmanagedType.I4)] EvtEventMetadataPropertyId propertyId,
int flags,
int eventMetadataPropertyBufferSize,
IntPtr eventMetadataPropertyBuffer,
@@ -708,7 +708,7 @@ namespace System.Diagnostics.Eventing
EventLogHandle channelEnum,
int channelPathBufferSize,
// StringBuilder channelPathBuffer,
[Out, MarshalAs(UnmanagedType.LPWStr)]StringBuilder channelPathBuffer,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder channelPathBuffer,
out int channelPathBufferUsed
);
@@ -725,7 +725,7 @@ namespace System.Diagnostics.Eventing
internal static extern bool EvtNextPublisherId(
EventLogHandle publisherEnum,
int publisherIdBufferSize,
[Out, MarshalAs(UnmanagedType.LPWStr)]StringBuilder publisherIdBuffer,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder publisherIdBuffer,
out int publisherIdBufferUsed
);
@@ -733,7 +733,7 @@ namespace System.Diagnostics.Eventing
[SecurityCritical]
internal static extern EventLogHandle EvtOpenChannelConfig(
EventLogHandle session,
[MarshalAs(UnmanagedType.LPWStr)]String channelPath,
[MarshalAs(UnmanagedType.LPWStr)] String channelPath,
int flags
);
@@ -750,7 +750,7 @@ namespace System.Diagnostics.Eventing
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool EvtSetChannelConfigProperty(
EventLogHandle channelConfig,
[MarshalAs(UnmanagedType.I4)]EvtChannelConfigPropertyId propertyId,
[MarshalAs(UnmanagedType.I4)] EvtChannelConfigPropertyId propertyId,
int flags,
ref EvtVariant propertyValue
);
@@ -760,7 +760,7 @@ namespace System.Diagnostics.Eventing
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool EvtGetChannelConfigProperty(
EventLogHandle channelConfig,
[MarshalAs(UnmanagedType.I4)]EvtChannelConfigPropertyId propertyId,
[MarshalAs(UnmanagedType.I4)] EvtChannelConfigPropertyId propertyId,
int flags,
int propertyValueBufferSize,
IntPtr propertyValueBuffer,
@@ -773,7 +773,7 @@ namespace System.Diagnostics.Eventing
internal static extern EventLogHandle EvtOpenLog(
EventLogHandle session,
[MarshalAs(UnmanagedType.LPWStr)] string path,
[MarshalAs(UnmanagedType.I4)]PathType flags
[MarshalAs(UnmanagedType.I4)] PathType flags
);
[DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)]
@@ -781,7 +781,7 @@ namespace System.Diagnostics.Eventing
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool EvtGetLogInfo(
EventLogHandle log,
[MarshalAs(UnmanagedType.I4)]EvtLogPropertyId propertyId,
[MarshalAs(UnmanagedType.I4)] EvtLogPropertyId propertyId,
int propertyValueBufferSize,
IntPtr propertyValueBuffer,
out int propertyValueBufferUsed
@@ -793,9 +793,9 @@ namespace System.Diagnostics.Eventing
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool EvtExportLog(
EventLogHandle session,
[MarshalAs(UnmanagedType.LPWStr)]string channelPath,
[MarshalAs(UnmanagedType.LPWStr)]string query,
[MarshalAs(UnmanagedType.LPWStr)]string targetFilePath,
[MarshalAs(UnmanagedType.LPWStr)] string channelPath,
[MarshalAs(UnmanagedType.LPWStr)] string query,
[MarshalAs(UnmanagedType.LPWStr)] string targetFilePath,
int flags
);
@@ -804,7 +804,7 @@ namespace System.Diagnostics.Eventing
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool EvtArchiveExportedLog(
EventLogHandle session,
[MarshalAs(UnmanagedType.LPWStr)]string logFilePath,
[MarshalAs(UnmanagedType.LPWStr)] string logFilePath,
int locale,
int flags
);
@@ -814,8 +814,8 @@ namespace System.Diagnostics.Eventing
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool EvtClearLog(
EventLogHandle session,
[MarshalAs(UnmanagedType.LPWStr)]string channelPath,
[MarshalAs(UnmanagedType.LPWStr)]string targetFilePath,
[MarshalAs(UnmanagedType.LPWStr)] string channelPath,
[MarshalAs(UnmanagedType.LPWStr)] string targetFilePath,
int flags
);
@@ -826,7 +826,7 @@ namespace System.Diagnostics.Eventing
Int32 valuePathsCount,
[MarshalAs(UnmanagedType.LPArray,ArraySubType = UnmanagedType.LPWStr)]
string[] valuePaths,
[MarshalAs(UnmanagedType.I4)]EvtRenderContextFlags flags
[MarshalAs(UnmanagedType.I4)] EvtRenderContextFlags flags
);
[DllImport(WEVTAPI, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
@@ -837,7 +837,7 @@ namespace System.Diagnostics.Eventing
EventLogHandle eventHandle,
EvtRenderFlags flags,
int buffSize,
[Out, MarshalAs(UnmanagedType.LPWStr)]StringBuilder buffer,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder buffer,
out int buffUsed,
out int propCount
);
@@ -877,9 +877,9 @@ namespace System.Diagnostics.Eventing
uint messageId,
int valueCount,
EvtStringVariant[] values,
[MarshalAs(UnmanagedType.I4)]EvtFormatMessageFlags flags,
[MarshalAs(UnmanagedType.I4)] EvtFormatMessageFlags flags,
int bufferSize,
[Out, MarshalAs(UnmanagedType.LPWStr)]StringBuilder buffer,
[Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder buffer,
out int bufferUsed
);
@@ -892,7 +892,7 @@ namespace System.Diagnostics.Eventing
uint messageId,
int valueCount,
IntPtr values,
[MarshalAs(UnmanagedType.I4)]EvtFormatMessageFlags flags,
[MarshalAs(UnmanagedType.I4)] EvtFormatMessageFlags flags,
int bufferSize,
IntPtr buffer,
out int bufferUsed
@@ -902,7 +902,7 @@ namespace System.Diagnostics.Eventing
[DllImport(WEVTAPI, CharSet = CharSet.Unicode, SetLastError = true)]
[SecurityCritical]
internal static extern EventLogHandle EvtOpenSession(
[MarshalAs(UnmanagedType.I4)]EvtLoginClass loginClass,
[MarshalAs(UnmanagedType.I4)] EvtLoginClass loginClass,
ref EvtRpcLogin login,
int timeout,
int flags
@@ -580,7 +580,7 @@ namespace System.Management.Automation
/// Base directory paths that are separated by semicolon ';'.
/// They will be the default paths to probe assemblies.
/// </param>
public static void SetPowerShellAssemblyLoadContext([MarshalAs(UnmanagedType.LPWStr)]string basePaths)
public static void SetPowerShellAssemblyLoadContext([MarshalAs(UnmanagedType.LPWStr)] string basePaths)
{
if (string.IsNullOrEmpty(basePaths))
throw new ArgumentNullException(nameof(basePaths));
@@ -1008,11 +1008,11 @@ namespace System.Management.Automation
internal static extern int GetPPid(int pid);
[DllImport(psLib, CharSet = CharSet.Ansi, SetLastError = true)]
internal static extern int GetLinkCount([MarshalAs(UnmanagedType.LPStr)]string filePath, out int linkCount);
internal static extern int GetLinkCount([MarshalAs(UnmanagedType.LPStr)] string filePath, out int linkCount);
[DllImport(psLib, CharSet = CharSet.Ansi, SetLastError = true)]
[return: MarshalAs(UnmanagedType.I1)]
internal static extern bool IsExecutable([MarshalAs(UnmanagedType.LPStr)]string filePath);
internal static extern bool IsExecutable([MarshalAs(UnmanagedType.LPStr)] string filePath);
[DllImport(psLib, CharSet = CharSet.Ansi)]
internal static extern uint GetCurrentThreadId();
@@ -1069,16 +1069,16 @@ namespace System.Management.Automation
internal static extern unsafe int SetDate(UnixTm* tm);
[DllImport(psLib, CharSet = CharSet.Ansi, SetLastError = true)]
internal static extern int CreateSymLink([MarshalAs(UnmanagedType.LPStr)]string filePath,
[MarshalAs(UnmanagedType.LPStr)]string target);
internal static extern int CreateSymLink([MarshalAs(UnmanagedType.LPStr)] string filePath,
[MarshalAs(UnmanagedType.LPStr)] string target);
[DllImport(psLib, CharSet = CharSet.Ansi, SetLastError = true)]
internal static extern int CreateHardLink([MarshalAs(UnmanagedType.LPStr)]string filePath,
[MarshalAs(UnmanagedType.LPStr)]string target);
internal static extern int CreateHardLink([MarshalAs(UnmanagedType.LPStr)] string filePath,
[MarshalAs(UnmanagedType.LPStr)] string target);
[DllImport(psLib, CharSet = CharSet.Ansi, SetLastError = true)]
[return: MarshalAs(UnmanagedType.LPStr)]
internal static extern string FollowSymLink([MarshalAs(UnmanagedType.LPStr)]string filePath);
internal static extern string FollowSymLink([MarshalAs(UnmanagedType.LPStr)] string filePath);
[DllImport(psLib, CharSet = CharSet.Ansi, SetLastError = true)]
[return: MarshalAs(UnmanagedType.LPStr)]
@@ -1086,11 +1086,11 @@ namespace System.Management.Automation
[DllImport(psLib, CharSet = CharSet.Ansi, SetLastError = true)]
[return: MarshalAs(UnmanagedType.I1)]
internal static extern bool IsSameFileSystemItem([MarshalAs(UnmanagedType.LPStr)]string filePathOne,
[MarshalAs(UnmanagedType.LPStr)]string filePathTwo);
internal static extern bool IsSameFileSystemItem([MarshalAs(UnmanagedType.LPStr)] string filePathOne,
[MarshalAs(UnmanagedType.LPStr)] string filePathTwo);
[DllImport(psLib, CharSet = CharSet.Ansi, SetLastError = true)]
internal static extern int GetInodeData([MarshalAs(UnmanagedType.LPStr)]string path,
internal static extern int GetInodeData([MarshalAs(UnmanagedType.LPStr)] string path,
out UInt64 device, out UInt64 inode);
/// <summary>
@@ -33,7 +33,7 @@ namespace System.Management.Automation
[MarshalAs(UnmanagedType.LPStruct)] Guid iid,
int lcid,
COM.INVOKEKIND wFlags,
[In, Out] [MarshalAs(UnmanagedType.LPArray)] COM.DISPPARAMS[] paramArray,
[In, Out][MarshalAs(UnmanagedType.LPArray)] COM.DISPPARAMS[] paramArray,
out object pVarResult,
out ComInvoker.EXCEPINFO pExcepInfo,
out uint puArgErr);
@@ -74,7 +74,7 @@ namespace System.Management.Automation.ComInterop
// See if we can find an existing type
foreach (Type t in s_generatedTypes)
{
int arity = int.Parse(t.Name.AsSpan("VariantArray".Length), NumberStyles.Integer, CultureInfo.InvariantCulture);
int arity = int.Parse(t.Name.AsSpan("VariantArray".Length), NumberStyles.Integer, CultureInfo.InvariantCulture);
if (size == arity)
{
return t;
@@ -2024,7 +2024,7 @@ namespace Microsoft.PowerShell.Commands
// perform necessary preparations if module has to be imported with NoClobber mode
if (filteredModuleNames != null)
{
foreach(string moduleName in filteredModuleNames)
foreach (string moduleName in filteredModuleNames)
{
PrepareNoClobberWinCompatModuleImport(moduleName, null, ref importModuleOptions);
}
@@ -2032,7 +2032,7 @@ namespace Microsoft.PowerShell.Commands
if (filteredModuleFullyQualifiedNames != null)
{
foreach(var moduleSpec in filteredModuleFullyQualifiedNames)
foreach (var moduleSpec in filteredModuleFullyQualifiedNames)
{
PrepareNoClobberWinCompatModuleImport(null, moduleSpec, ref importModuleOptions);
}
@@ -190,17 +190,20 @@ namespace System.Management.Automation
s_setterMethods.TryAdd(Tuple.Create(typeof(GetModuleCommand), "FullyQualifiedName"), (o, v) => ((GetModuleCommand)o).FullyQualifiedName = (ModuleSpecification[])v);
s_setterMethods.TryAdd(Tuple.Create(typeof(CommonParameters), "ErrorAction"),
(o, v) => {
(o, v) =>
{
v ??= LanguagePrimitives.ThrowInvalidCastException(null, typeof(ActionPreference));
((CommonParameters)o).ErrorAction = (ActionPreference)v;
});
s_setterMethods.TryAdd(Tuple.Create(typeof(CommonParameters), "WarningAction"),
(o, v) => {
(o, v) =>
{
v ??= LanguagePrimitives.ThrowInvalidCastException(null, typeof(ActionPreference));
((CommonParameters)o).WarningAction = (ActionPreference)v;
});
s_setterMethods.TryAdd(Tuple.Create(typeof(CommonParameters), "InformationAction"),
(o, v) => {
(o, v) =>
{
v ??= LanguagePrimitives.ThrowInvalidCastException(null, typeof(ActionPreference));
((CommonParameters)o).InformationAction = (ActionPreference)v;
});
@@ -82,7 +82,8 @@ namespace System.Management.Automation.Subsystem
ICommandPredictor predictor = predictors[i];
tasks[i] = Task.Factory.StartNew(
state => {
state =>
{
var predictor = (ICommandPredictor)state!;
List<PredictiveSuggestion>? texts = predictor.GetSuggestion(context, cancellationSource.Token);
return texts?.Count > 0 ? new PredictionResult(predictor.Id, predictor.Name, texts) : null;
@@ -2357,7 +2357,7 @@ namespace System.Management.Automation.Remoting.Client
/// </returns>
[DllImport(WSManNativeApi.WSManClientApiDll, SetLastError = false, CharSet = CharSet.Unicode)]
internal static extern int WSManInitialize(int flags,
[In, Out] ref IntPtr wsManAPIHandle);
[In, Out] ref IntPtr wsManAPIHandle);
/// <summary>
/// This API deinitializes the Winrm client stack; all operations will
@@ -2390,11 +2390,11 @@ namespace System.Management.Automation.Remoting.Client
/// <returns></returns>
[DllImport(WSManNativeApi.WSManClientApiDll, SetLastError = false, CharSet = CharSet.Unicode)]
internal static extern int WSManCreateSession(IntPtr wsManAPIHandle,
[MarshalAs(UnmanagedType.LPWStr)]string connection,
[MarshalAs(UnmanagedType.LPWStr)] string connection,
int flags,
IntPtr authenticationCredentials,
IntPtr proxyInfo,
[In, Out] ref IntPtr wsManSessionHandle);
[In, Out] ref IntPtr wsManSessionHandle);
/// <summary>
/// Frees memory of session and closes all related operations before returning;
@@ -2553,13 +2553,13 @@ namespace System.Management.Automation.Remoting.Client
[DllImport(WSManNativeApi.WSManClientApiDll, EntryPoint = "WSManCreateShellEx", SetLastError = false, CharSet = CharSet.Unicode)]
private static extern void WSManCreateShellExInternal(IntPtr wsManSessionHandle,
int flags,
[MarshalAs(UnmanagedType.LPWStr)]string resourceUri,
[MarshalAs(UnmanagedType.LPWStr)]string shellId,
[MarshalAs(UnmanagedType.LPWStr)] string resourceUri,
[MarshalAs(UnmanagedType.LPWStr)] string shellId,
IntPtr startupInfo,
IntPtr optionSet,
IntPtr openContent,
IntPtr asyncCallback,
[In, Out] ref IntPtr shellOperationHandle);
[In, Out] ref IntPtr shellOperationHandle);
/// <summary>
/// </summary>
@@ -2574,12 +2574,12 @@ namespace System.Management.Automation.Remoting.Client
[DllImport(WSManNativeApi.WSManClientApiDll, EntryPoint = "WSManConnectShell", SetLastError = false, CharSet = CharSet.Unicode)]
internal static extern void WSManConnectShellEx(IntPtr wsManSessionHandle,
int flags,
[MarshalAs(UnmanagedType.LPWStr)]string resourceUri,
[MarshalAs(UnmanagedType.LPWStr)]string shellId,
[MarshalAs(UnmanagedType.LPWStr)] string resourceUri,
[MarshalAs(UnmanagedType.LPWStr)] string shellId,
IntPtr optionSet,
IntPtr connectXml,
IntPtr asyncCallback,
[In, Out] ref IntPtr shellOperationHandle);
[In, Out] ref IntPtr shellOperationHandle);
/// <summary>
/// </summary>
@@ -2685,7 +2685,7 @@ namespace System.Management.Automation.Remoting.Client
int flags,
IntPtr desiredStreamSet,
IntPtr asyncCallback,
[In, Out] ref IntPtr receiveOperationHandle);
[In, Out] ref IntPtr receiveOperationHandle);
/// <summary>
/// Send data to the remote end.
@@ -2726,7 +2726,7 @@ namespace System.Management.Automation.Remoting.Client
IntPtr streamData,
bool endOfStream,
IntPtr asyncCallback,
[In, Out] ref IntPtr sendOperationHandle);
[In, Out] ref IntPtr sendOperationHandle);
/// <summary>
/// Closes a shell or a command; if the callback associated with the operation
@@ -306,10 +306,10 @@ namespace System.Management.Automation.Remoting
PSOpcode.Connect, PSTask.None,
PSKeyword.ManagedPlugin | PSKeyword.UseAlwaysAnalytic,
requestDetails.ToString(), senderInfo.UserInfo.Identity.Name, requestDetails.resourceUri);
ServerRemoteSession remoteShellSession = ServerRemoteSession.CreateServerRemoteSession(senderInfo,
requestDetails.resourceUri,
extraInfo,
serverTransportMgr);
ServerRemoteSession remoteShellSession = ServerRemoteSession.CreateServerRemoteSession(senderInfo,
requestDetails.resourceUri,
extraInfo,
serverTransportMgr);
if (remoteShellSession == null)
{
@@ -7699,7 +7699,7 @@ namespace Microsoft.PowerShell.Commands
/// </summary>
public class FileSystemContentReaderDynamicParameters : FileSystemContentDynamicParametersBase
{
internal FileSystemContentReaderDynamicParameters(FileSystemProvider provider) : base (provider) { }
internal FileSystemContentReaderDynamicParameters(FileSystemProvider provider) : base(provider) { }
/// <summary>
/// Gets or sets the delimiter to use when reading the file. Custom delimiters
@@ -3834,7 +3834,9 @@ namespace Microsoft.PowerShell.Commands
{
value = 0;
}
} break;
}
break;
case RegistryValueKind.ExpandString:
value = (value != null)
@@ -3871,7 +3873,9 @@ namespace Microsoft.PowerShell.Commands
{
value = 0;
}
} break;
}
break;
case RegistryValueKind.String:
value = (value != null)
@@ -617,23 +617,23 @@ namespace Microsoft.PowerShell
[DllImport("CRYPT32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool CryptProtectData(
[In] IntPtr pDataIn,
[In] string szDataDescr,
[In] IntPtr pOptionalEntropy,
[In] IntPtr pvReserved,
[In] IntPtr pPromptStruct,
[In] uint dwFlags,
[In] IntPtr pDataIn,
[In] string szDataDescr,
[In] IntPtr pOptionalEntropy,
[In] IntPtr pvReserved,
[In] IntPtr pPromptStruct,
[In] uint dwFlags,
[In, Out] IntPtr pDataBlob);
[DllImport("CRYPT32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool CryptUnprotectData(
[In] IntPtr pDataIn,
[In] IntPtr ppszDataDescr,
[In] IntPtr pOptionalEntropy,
[In] IntPtr pvReserved,
[In] IntPtr pPromptStruct,
[In] uint dwFlags,
[In] IntPtr pDataIn,
[In] IntPtr ppszDataDescr,
[In] IntPtr pOptionalEntropy,
[In] IntPtr pvReserved,
[In] IntPtr pPromptStruct,
[In] uint dwFlags,
[In, Out] IntPtr pDataBlob);
[DllImport("ntdll.dll", EntryPoint = "RtlZeroMemory", SetLastError = true)]
@@ -383,7 +383,9 @@ namespace Microsoft.PowerShell
{
TrustPublisher(signature);
policyCheckPassed = true;
} break;
}
break;
case RunPromptDecision.DoNotRun:
policyCheckPassed = false;
reasonMessage = StringUtil.Format(Authenticode.Reason_DoNotRun, path);
@@ -395,7 +397,9 @@ namespace Microsoft.PowerShell
reasonMessage = StringUtil.Format(Authenticode.Reason_NeverRun, path);
reason = new UnauthorizedAccessException(reasonMessage);
policyCheckPassed = false;
} break;
}
break;
}
return policyCheckPassed;
@@ -1605,7 +1605,7 @@ namespace System.Management.Automation
[DefaultDllImportSearchPathsAttribute(DllImportSearchPath.System32)]
[DllImportAttribute("amsi.dll", EntryPoint = "AmsiInitialize", CallingConvention = CallingConvention.StdCall)]
internal static extern int AmsiInitialize(
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPWStr)] string appName, ref System.IntPtr amsiContext);
[InAttribute()][MarshalAsAttribute(UnmanagedType.LPWStr)] string appName, ref System.IntPtr amsiContext);
/// Return Type: void
///amsiContext: HAMSICONTEXT->HAMSICONTEXT__*
@@ -1638,7 +1638,7 @@ namespace System.Management.Automation
[DllImportAttribute("amsi.dll", EntryPoint = "AmsiScanBuffer", CallingConvention = CallingConvention.StdCall)]
internal static extern int AmsiScanBuffer(
System.IntPtr amsiContext, System.IntPtr buffer, uint length,
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPWStr)] string contentName, System.IntPtr amsiSession, ref AMSI_RESULT result);
[InAttribute()][MarshalAsAttribute(UnmanagedType.LPWStr)] string contentName, System.IntPtr amsiSession, ref AMSI_RESULT result);
/// Return Type: HRESULT->LONG->int
///amsiContext: HAMSICONTEXT->HAMSICONTEXT__*
@@ -1649,8 +1649,8 @@ namespace System.Management.Automation
[DefaultDllImportSearchPathsAttribute(DllImportSearchPath.System32)]
[DllImportAttribute("amsi.dll", EntryPoint = "AmsiScanString", CallingConvention = CallingConvention.StdCall)]
internal static extern int AmsiScanString(
System.IntPtr amsiContext, [InAttribute()] [MarshalAsAttribute(UnmanagedType.LPWStr)] string @string,
[InAttribute()] [MarshalAsAttribute(UnmanagedType.LPWStr)] string contentName, System.IntPtr amsiSession, ref AMSI_RESULT result);
System.IntPtr amsiContext, [InAttribute()][MarshalAsAttribute(UnmanagedType.LPWStr)] string @string,
[InAttribute()][MarshalAsAttribute(UnmanagedType.LPWStr)] string contentName, System.IntPtr amsiSession, ref AMSI_RESULT result);
}
}
}
@@ -1151,7 +1151,7 @@ namespace System.Management.Automation.Security
///ppCertContext: void**
///phWVTStateData: HANDLE*
[DllImportAttribute("wintrust.dll", EntryPoint = "WTGetSignatureInfo", CallingConvention = CallingConvention.StdCall)]
internal static extern int WTGetSignatureInfo([InAttribute()] [MarshalAsAttribute(UnmanagedType.LPWStr)] string pszFile, [InAttribute()] System.IntPtr hFile, SIGNATURE_INFO_FLAGS sigInfoFlags, ref SIGNATURE_INFO psiginfo, ref System.IntPtr ppCertContext, ref System.IntPtr phWVTStateData);
internal static extern int WTGetSignatureInfo([InAttribute()][MarshalAsAttribute(UnmanagedType.LPWStr)] string pszFile, [InAttribute()] System.IntPtr hFile, SIGNATURE_INFO_FLAGS sigInfoFlags, ref SIGNATURE_INFO psiginfo, ref System.IntPtr ppCertContext, ref System.IntPtr phWVTStateData);
internal static void FreeWVTStateData(System.IntPtr phWVTStateData)
{
@@ -64,7 +64,7 @@ namespace System.Management.Automation.Internal
private static int ToInt32LE(byte[] bytes, int offset)
{
return (bytes[offset + 3] << 24) | (bytes[offset + 2] << 16) | (bytes[offset + 1 ] << 8) | bytes[offset];
return (bytes[offset + 3] << 24) | (bytes[offset + 2] << 16) | (bytes[offset + 1] << 8) | bytes[offset];
}
private static uint ToUInt32LE(byte[] bytes, int offset)
@@ -140,7 +140,7 @@ namespace System.Management.Automation.Internal
try
{
if ((blob[offset] != PUBLICKEYBLOB) || // PUBLICKEYBLOB (0x06)
if ((blob[offset] != PUBLICKEYBLOB) || // PUBLICKEYBLOB (0x06)
(blob[offset + 1] != CUR_BLOB_VERSION) || // Version (0x02)
(blob[offset + 2] != 0x00) || // Reserved (word)
(blob[offset + 3] != 0x00) ||