mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 04:36:39 +00:00
spelling: comments in src/System.Management.Automation/engine/remoting/fanin
This commit is contained in:
1 parent
435c4e3474
commit
ef44569f9d
11 files changed
+98
-98
No files matched your search
@@ -191,14 +191,14 @@ namespace System.Management.Automation.Remoting
|
||||
/// <summary>
|
||||
/// Event that is raised when a remote object is available. The event is raised
|
||||
/// from a WSMan transport thread. Since this thread can hold on to a HTTP
|
||||
/// connection, the event handler should compelete processing as fast as possible.
|
||||
/// connection, the event handler should complete processing as fast as possible.
|
||||
/// Importantly the event handler should not generate any call that results in a
|
||||
/// user request like host.ReadLine().
|
||||
/// </summary>
|
||||
internal event EventHandler<RemoteDataEventArgs> DataReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Listen to this event to observe the PowerShell guid of the process'ed object.
|
||||
/// Listen to this event to observe the PowerShell guid of the processed object.
|
||||
/// </summary>
|
||||
public event EventHandler PowerShellGuidObserver;
|
||||
|
||||
@@ -228,7 +228,7 @@ namespace System.Management.Automation.Remoting
|
||||
/// This may be null..in which case type rehydration does not happen.
|
||||
/// At construction time we may not have typetable (server runspace
|
||||
/// is created only when a request from the client)..so this is
|
||||
/// a property on the base tranpsort manager to allow for setting at
|
||||
/// a property on the base transport manager to allow for setting at
|
||||
/// a later time.
|
||||
/// </summary>
|
||||
internal TypeTable TypeTable
|
||||
@@ -453,7 +453,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
/// Event that is raised when a create operation on transport has been successfully completed
|
||||
/// The event is raised
|
||||
/// from a WSMan transport thread. Since this thread can hold on to a HTTP
|
||||
/// connection, the event handler should compelete processing as fast as possible.
|
||||
/// connection, the event handler should complete processing as fast as possible.
|
||||
/// Importantly the event handler should not generate any call that results in a
|
||||
/// user request like host.ReadLine().
|
||||
///
|
||||
@@ -464,7 +464,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
/// <summary>
|
||||
/// Event that is raised when a remote connection is successfully closed. The event is raised
|
||||
/// from a WSMan transport thread. Since this thread can hold on to a HTTP
|
||||
/// connection, the event handler should compelete processing as fast as possible.
|
||||
/// connection, the event handler should complete processing as fast as possible.
|
||||
/// Importantly the event handler should not generate any call that results in a
|
||||
/// user request like host.ReadLine().
|
||||
///
|
||||
@@ -477,7 +477,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
internal event EventHandler<EventArgs> CloseCompleted;
|
||||
|
||||
/// <summary>
|
||||
/// Indicated successfull completion of a connect operation on transport
|
||||
/// Indicated successful completion of a connect operation on transport
|
||||
///
|
||||
/// Errors are reported through WSManTransportErrorOccured
|
||||
/// event.
|
||||
@@ -485,7 +485,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
internal event EventHandler<EventArgs> ConnectCompleted;
|
||||
|
||||
/// <summary>
|
||||
/// Indicated successfull completion of a disconnect operation on transport
|
||||
/// Indicated successful completion of a disconnect operation on transport
|
||||
///
|
||||
/// Errors are reported through WSManTransportErrorOccured
|
||||
/// event.
|
||||
@@ -493,7 +493,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
internal event EventHandler<EventArgs> DisconnectCompleted;
|
||||
|
||||
/// <summary>
|
||||
/// Indicated successfull completion of a reconnect operation on transport
|
||||
/// Indicated successful completion of a reconnect operation on transport
|
||||
///
|
||||
/// Errors are reported through WSManTransportErrorOccured
|
||||
/// event.
|
||||
@@ -524,7 +524,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets the data collection which is used by this tranport manager to send
|
||||
/// Gets the data collection which is used by this transport manager to send
|
||||
/// data to the server.
|
||||
/// </summary>
|
||||
internal PrioritySendDataCollection DataToBeSentCollection
|
||||
@@ -927,7 +927,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
internal class CallbackNotificationInformation
|
||||
{
|
||||
// only one of the following 2 should be present..
|
||||
// anyway transportException takes precendence over remoteObject.
|
||||
// anyway transportException takes precedence over remoteObject.
|
||||
internal RemoteDataObject<PSObject> remoteObject;
|
||||
internal TransportErrorOccuredEventArgs transportError;
|
||||
// Used by ServicePendingCallbacks to give the control to derived classes for
|
||||
@@ -937,7 +937,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
|
||||
#endregion
|
||||
|
||||
#region Abstract / Virtural methods
|
||||
#region Abstract / Virtual methods
|
||||
|
||||
internal abstract void CreateAsync();
|
||||
|
||||
@@ -996,7 +996,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
|
||||
try
|
||||
{
|
||||
// looks like Dispose is not called for this tranpsort manager
|
||||
// looks like Dispose is not called for this transport manager
|
||||
// try closing the transport manager.
|
||||
CloseAsync();
|
||||
}
|
||||
@@ -1252,8 +1252,8 @@ namespace System.Management.Automation.Remoting.Server
|
||||
#region Helper Methods
|
||||
|
||||
/// <summary>
|
||||
/// Sends an object from the server end. The object is fragmented and each fragement is sent
|
||||
/// separately. The call blocks until all the fragements are sent to the client. If there
|
||||
/// Sends an object from the server end. The object is fragmented and each fragment is sent
|
||||
/// separately. The call blocks until all the fragments are sent to the client. If there
|
||||
/// is a failure sending any of the fragments WSManTransportErrorOccured event is raised.
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
@@ -1266,16 +1266,16 @@ namespace System.Management.Automation.Remoting.Server
|
||||
/// </param>
|
||||
internal void SendDataToClient<T>(RemoteDataObject<T> data, bool flush, bool reportPending = false)
|
||||
{
|
||||
// make sure only one data packet can be sent in its entirity at any
|
||||
// make sure only one data packet can be sent in its entirety at any
|
||||
// given point of time using this transport manager.
|
||||
lock (_syncObject)
|
||||
{
|
||||
// Win8: 491001 Icm -computername $env:COMPUTERNAME {Get-NetIpInterface} fails with Unexpected ObjectId
|
||||
// This is because the output object has some extentded script properties. Getter of one of the
|
||||
// script proprties is calling write-progress. Write-Progress in turn results in a progress record
|
||||
// This is because the output object has some extended script properties. Getter of one of the
|
||||
// script properties is calling write-progress. Write-Progress in turn results in a progress record
|
||||
// being sent to client. This breaks the fragmentation rule when the original object (without progress)
|
||||
// does not fit in fragmented packet.
|
||||
// ******************** repro using powershll *********************************
|
||||
// ******************** repro using powershell *********************************
|
||||
// icm . {
|
||||
// $a = new-object psobject
|
||||
// $a.pstypenames.Insert(0, "Microsoft.PowerShell.Test.Bug491001")
|
||||
@@ -1286,12 +1286,12 @@ namespace System.Management.Automation.Remoting.Server
|
||||
// }
|
||||
// 1. The value of "name" property is huge 50kb and cannot fit in one fragment (with fragment size 32kb)
|
||||
// 2. The value of "Verbose" is actually writing a progress record
|
||||
// 3. The value of "zname" proprty is also huge
|
||||
// 4. Notice the ascending order of propery names. This is because seralizer seralizes properties in sort order
|
||||
// 3. The value of "zname" property is also huge
|
||||
// 4. Notice the ascending order of property names. This is because serializer serializes properties in sort order
|
||||
// ******************** End of repro ******************************************
|
||||
// To fix the issue, I am creating a Queue and enqueuing the data objects if we are already serializaing another data object
|
||||
// Notice this is in lock() above. An object is serialized in its entirity in one thread. So, in my example above "name",
|
||||
// "verbose","zname" properties are serialized in one thread. So lock() estenially protects from serialing other objects
|
||||
// To fix the issue, I am creating a Queue and enqueuing the data objects if we are already serializing another data object
|
||||
// Notice this is in lock() above. An object is serialized in its entirety in one thread. So, in my example above "name",
|
||||
// "verbose","zname" properties are serialized in one thread. So lock() essentially protects from serializing other objects
|
||||
// and not this (parent)object.
|
||||
RemoteDataObject dataToBeSent = RemoteDataObject.CreateFrom(data.Destination, data.DataType,
|
||||
data.RunspacePoolId, data.PowerShellId,
|
||||
@@ -1362,8 +1362,8 @@ namespace System.Management.Automation.Remoting.Server
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends an object to the server end. The object is fragmented and each fragement is sent
|
||||
/// separately. The call blocks until all the fragements are sent to the client. If there
|
||||
/// Sends an object to the server end. The object is fragmented and each fragment is sent
|
||||
/// separately. The call blocks until all the fragments are sent to the client. If there
|
||||
/// is a failure sending any of the fragments WSManTransportErrorOccured event is raised.
|
||||
/// </summary>
|
||||
/// <param name="psObjectData"></param>
|
||||
|
||||
+11
-11
@@ -332,7 +332,7 @@ namespace System.Management.Automation.Remoting
|
||||
{
|
||||
}
|
||||
|
||||
// if we are here, that means we are unble to load the type specified
|
||||
// if we are here, that means we are unable to load the type specified
|
||||
// in the config xml.. notify the same.
|
||||
throw PSTraceSource.NewArgumentException("typeToLoad", RemotingErrorIdStrings.UnableToLoadType,
|
||||
EndPointConfigurationTypeName, ConfigurationDataFromXML.INITPARAMETERSTOKEN);
|
||||
@@ -340,7 +340,7 @@ namespace System.Management.Automation.Remoting
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// InitialSessionStateProvider is used by 3rd parties to provide shell configurtion
|
||||
/// InitialSessionStateProvider is used by 3rd parties to provide shell configuration
|
||||
/// on the remote server.
|
||||
/// </summary>
|
||||
public abstract class PSSessionConfiguration : IDisposable
|
||||
@@ -356,7 +356,7 @@ namespace System.Management.Automation.Remoting
|
||||
#region public interfaces
|
||||
|
||||
/// <summary>
|
||||
/// Derived classes must override this to supply an InitialSesionState
|
||||
/// Derived classes must override this to supply an InitialSessionState
|
||||
/// to be used to construct a Runspace for the user
|
||||
/// </summary>
|
||||
/// <param name="senderInfo">
|
||||
@@ -426,7 +426,7 @@ namespace System.Management.Automation.Remoting
|
||||
#region IDisposable Overrides
|
||||
|
||||
/// <summary>
|
||||
/// Disose this configuration object. This will be called when a Runspace/RunspacePool
|
||||
/// Dispose this configuration object. This will be called when a Runspace/RunspacePool
|
||||
/// created using InitialSessionState from this object is Closed.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
@@ -587,7 +587,7 @@ namespace System.Management.Automation.Remoting
|
||||
{
|
||||
}
|
||||
|
||||
// if we are here, that means we are unble to load the type specified
|
||||
// if we are here, that means we are unable to load the type specified
|
||||
// in the config xml.. notify the same.
|
||||
throw PSTraceSource.NewArgumentException("typeToLoad", RemotingErrorIdStrings.UnableToLoadType,
|
||||
typeToLoad, ConfigurationDataFromXML.INITPARAMETERSTOKEN);
|
||||
@@ -601,7 +601,7 @@ namespace System.Management.Automation.Remoting
|
||||
/// <summary>
|
||||
/// Sets the application's current working directory to <paramref name="applicationBase"/> and
|
||||
/// loads the assembly <paramref name="assemblyName"/>. Once the assembly is loaded, the application's
|
||||
/// current working directory is set back to the orginal value.
|
||||
/// current working directory is set back to the original value.
|
||||
/// </summary>
|
||||
/// <param name="applicationBase"></param>
|
||||
/// <param name="assemblyName"></param>
|
||||
@@ -654,7 +654,7 @@ namespace System.Management.Automation.Remoting
|
||||
}
|
||||
}
|
||||
|
||||
// Even if there is erro changing current working directory..try to load the assembly
|
||||
// Even if there is error changing current working directory..try to load the assembly
|
||||
// This is to allow assembly loading from GAC
|
||||
Assembly result = null;
|
||||
try
|
||||
@@ -2068,7 +2068,7 @@ namespace System.Management.Automation.Remoting
|
||||
// Win8: 627752 Cannot load microsoft.powershell.core module as part of DISC
|
||||
// Convert Microsoft.PowerShell.Core module -> Microsoft.PowerShell.Core snapin.
|
||||
// Doing this Import only in SessionType.Empty case, because other cases already do this.
|
||||
// In V3, Micorosft.PowerShell.Core module is not installed externally.
|
||||
// In V3, Microsoft.PowerShell.Core module is not installed externally.
|
||||
iss.ImportCorePSSnapIn();
|
||||
}
|
||||
// silently ignore Microsoft.PowerShell.Core for other cases ie., SessionType.RestrictedRemoteServer && SessionType.Default
|
||||
@@ -2316,7 +2316,7 @@ namespace System.Management.Automation.Remoting
|
||||
}
|
||||
}
|
||||
|
||||
// Now apply visibilty logic
|
||||
// Now apply visibility logic
|
||||
if (cmdletVisibilityApplied || functionVisiblityApplied || aliasVisibilityApplied || providerVisibiltyApplied)
|
||||
{
|
||||
if (sessionType == SessionType.Default)
|
||||
@@ -2758,7 +2758,7 @@ namespace System.Management.Automation.Remoting
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to get a hastable array from an object
|
||||
/// Attempts to get a hashtable array from an object
|
||||
/// </summary>
|
||||
/// <param name="hashObj"></param>
|
||||
/// <returns></returns>
|
||||
@@ -2802,7 +2802,7 @@ namespace System.Management.Automation.Remoting
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attemps to get a string array from a hashtable
|
||||
/// Attempts to get a string array from a hashtable
|
||||
/// </summary>
|
||||
/// <param name="hashObj"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
@@ -483,7 +483,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
_dataProcessingCallbacks.CloseAckPacketReceived += new OutOfProcessUtils.CloseAckPacketReceived(OnCloseAckReceived);
|
||||
|
||||
dataToBeSent.Fragmentor = base.Fragmentor;
|
||||
// session transport manager can recieve unlimited data..however each object is limited
|
||||
// session transport manager can receive unlimited data..however each object is limited
|
||||
// by maxRecvdObjectSize. this is to allow clients to use a session for an unlimited time..
|
||||
// also the messages that can be sent to a session are limited and very controlled.
|
||||
// However a command transport manager can be restricted to receive only a fixed amount of data
|
||||
@@ -708,7 +708,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
}
|
||||
|
||||
// dont let the writer write new data as the process is exited.
|
||||
// Not asssigning null to stdInWriter to fix the race condition between OnExited() and CloseAsync() methods.
|
||||
// Not assigning null to stdInWriter to fix the race condition between OnExited() and CloseAsync() methods.
|
||||
//
|
||||
stdInWriter.StopWriting();
|
||||
}
|
||||
@@ -1044,7 +1044,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
return;
|
||||
}
|
||||
|
||||
// Send one fragement
|
||||
// Send one fragment
|
||||
SendOneItem();
|
||||
}
|
||||
|
||||
@@ -2242,7 +2242,7 @@ namespace System.Management.Automation.Remoting.Server
|
||||
|
||||
lock (_syncObject)
|
||||
{
|
||||
// the dictinoary is cleared by ServerPowershellDataStructure handler
|
||||
// the dictionary is cleared by ServerPowershellDataStructure handler
|
||||
// once the clean up is complete for the transport manager
|
||||
Dbg.Assert(!_cmdTransportManagers.ContainsKey(powerShellCmdId), "key already exists");
|
||||
_cmdTransportManagers.Add(powerShellCmdId, cmdTM);
|
||||
|
||||
@@ -276,7 +276,7 @@ namespace System.Management.Automation.Remoting
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of authentication used.
|
||||
/// For a WSMan service autheticated user this will be one of the following:
|
||||
/// For a WSMan service authenticated user this will be one of the following:
|
||||
/// WSMAN_DEFAULT_AUTHENTICATION
|
||||
/// WSMAN_NO_AUTHENTICATION
|
||||
/// WSMAN_AUTH_DIGEST
|
||||
@@ -306,11 +306,11 @@ namespace System.Management.Automation.Remoting
|
||||
#region Public Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Constructor used to construt a PSIdentity object
|
||||
/// Constructor used to construct a PSIdentity object
|
||||
/// </summary>
|
||||
/// <param name="authType">
|
||||
/// Type of authentication used to authenticate this user.
|
||||
/// For a WSMan service autheticated user this will be one of the following:
|
||||
/// For a WSMan service authenticated user this will be one of the following:
|
||||
/// WSMAN_DEFAULT_AUTHENTICATION
|
||||
/// WSMAN_NO_AUTHENTICATION
|
||||
/// WSMAN_AUTH_DIGEST
|
||||
@@ -327,7 +327,7 @@ namespace System.Management.Automation.Remoting
|
||||
/// Name of the user
|
||||
/// </param>
|
||||
/// <param name="cert">
|
||||
/// Certificate details if Certifiate authentication is used.
|
||||
/// Certificate details if Certificate authentication is used.
|
||||
/// </param>
|
||||
public PSIdentity(string authType, bool isAuthenticated, string userName, PSCertificateDetails cert)
|
||||
{
|
||||
@@ -367,7 +367,7 @@ namespace System.Management.Automation.Remoting
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Constructor used to construt a PSCertificateDetails object
|
||||
/// Constructor used to construct a PSCertificateDetails object
|
||||
/// </summary>
|
||||
/// <param name="subject">
|
||||
/// Subject of the certificate.
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace System.Management.Automation.Remoting
|
||||
Default = 0,
|
||||
|
||||
/// <summary>
|
||||
/// PromptReponse may be sent with or without priority considerations.
|
||||
/// PromptResponse may be sent with or without priority considerations.
|
||||
/// Large data objects will be fragmented so that each fragmented piece can
|
||||
/// fit into one message.
|
||||
/// </summary>
|
||||
@@ -62,7 +62,7 @@ namespace System.Management.Automation.Remoting
|
||||
/// Callback that is called once a fragmented data is available to send.
|
||||
/// </summary>
|
||||
/// <param name="data">
|
||||
/// Fragemented object that can be sent to the remote end.
|
||||
/// Fragmented object that can be sent to the remote end.
|
||||
/// </param>
|
||||
/// <param name="priorityType">
|
||||
/// Priority stream to which <paramref name="data"/> belongs to.
|
||||
@@ -124,7 +124,7 @@ namespace System.Management.Automation.Remoting
|
||||
Dbg.Assert(null != _dataToBeSent, "Serialized streams are not initialized");
|
||||
|
||||
// make sure the only one object is fragmented and added to the collection
|
||||
// at any give time. This way the order of fragmenets is maintained
|
||||
// at any give time. This way the order of fragment is maintained
|
||||
// in the SendDataCollection(s).
|
||||
lock (_syncObjects[(int)priority])
|
||||
{
|
||||
@@ -172,7 +172,7 @@ namespace System.Management.Automation.Remoting
|
||||
/// synchronized way.
|
||||
///
|
||||
/// While getting a fragment the following algorithm is used:
|
||||
/// 1. If this is the first time or if the last fragement read is an EndFragment,
|
||||
/// 1. If this is the first time or if the last fragment read is an EndFragment,
|
||||
/// then a new set of fragments is chosen based on the implicit priority.
|
||||
/// PromptResponse is higher in priority order than default.
|
||||
/// 2. If last fragment read is not an EndFragment, then next fragment is chosen from
|
||||
@@ -189,7 +189,7 @@ namespace System.Management.Automation.Remoting
|
||||
/// is undefined.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A FragementRemoteObject if available, otherwise null.
|
||||
/// A FragmentRemoteObject if available, otherwise null.
|
||||
/// </returns>
|
||||
internal byte[] ReadOrRegisterCallback(OnDataAvailableCallback callback,
|
||||
out DataPriorityType priorityType)
|
||||
@@ -284,16 +284,16 @@ namespace System.Management.Automation.Remoting
|
||||
private MemoryStream _pendingDataStream;
|
||||
// the idea is to maintain 1 whole object.
|
||||
// 1 whole object may contain any number of fragments. blob from
|
||||
// each fragement is written to this stream.
|
||||
// each fragment is written to this stream.
|
||||
private MemoryStream _dataToProcessStream;
|
||||
private long _currentObjectId;
|
||||
private long _currentFrgId;
|
||||
// max deseriazlied object size in bytes
|
||||
// max deserialized object size in bytes
|
||||
private Nullable<int> _maxReceivedObjectSize;
|
||||
private int _totalReceivedObjectSizeSoFar;
|
||||
private bool _isCreateByClientTM;
|
||||
|
||||
// this indicates if any off sync fragments canbe ignored
|
||||
// this indicates if any off sync fragments can be ignored
|
||||
// this gets reset (to false) upon receiving the next "start" fragment along the stream
|
||||
private bool _canIgnoreOffSyncFragments = false;
|
||||
|
||||
@@ -375,7 +375,7 @@ namespace System.Management.Automation.Remoting
|
||||
|
||||
/// <summary>
|
||||
/// Prepares the collection for a stream connect
|
||||
/// When reconneting from same client, its possible that fragment stream get interrupted if server is dropping data
|
||||
/// When reconnecting from same client, its possible that fragment stream get interrupted if server is dropping data
|
||||
/// When connecting from a new client, its possible to get trailing fragments of a previously partially transmitted object
|
||||
/// Logic based on this flag, ensures such offsync/trailing fragments get ignored until the next full object starts flowing
|
||||
/// </summary>
|
||||
@@ -401,7 +401,7 @@ namespace System.Management.Automation.Remoting
|
||||
/// Defragmented Object if any, otherwise null.
|
||||
/// </returns>
|
||||
/// <exception cref="PSRemotingTransportException">
|
||||
/// 1. Fragmet Ids not in sequence
|
||||
/// 1. Fragment Ids not in sequence
|
||||
/// 2. Object Ids does not match
|
||||
/// 3. The current deserialized object size of the received data exceeded
|
||||
/// allowed maximum object size. The current deserialized object size is {0}.
|
||||
@@ -518,7 +518,7 @@ namespace System.Management.Automation.Remoting
|
||||
}
|
||||
}
|
||||
|
||||
// appears like stream doesn't have individual postion marker for read and write
|
||||
// appears like stream doesn't have individual position marker for read and write
|
||||
// since we are going to read from now...
|
||||
_pendingDataStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
@@ -612,7 +612,7 @@ namespace System.Management.Automation.Remoting
|
||||
{
|
||||
try
|
||||
{
|
||||
// appears like stream doesn't individual postion marker for read and write
|
||||
// appears like stream doesn't individual position marker for read and write
|
||||
// since we are going to read from now..i am resetting position to 0.
|
||||
_dataToProcessStream.Seek(0, SeekOrigin.Begin);
|
||||
RemoteDataObject<PSObject> remoteObject = RemoteDataObject<PSObject>.CreateFrom(_dataToProcessStream, _defragmentor);
|
||||
@@ -726,7 +726,7 @@ namespace System.Management.Automation.Remoting
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Construct a priority recieve data collection
|
||||
/// Construct a priority receive data collection
|
||||
/// </summary>
|
||||
/// <param name="defragmentor">Defragmentor used to deserialize an object.</param>
|
||||
/// <param name="createdByClientTM">
|
||||
@@ -811,7 +811,7 @@ namespace System.Management.Automation.Remoting
|
||||
/// Data to process.
|
||||
/// </param>
|
||||
/// <param name="priorityType">
|
||||
/// Priorty stream this data belongs to.
|
||||
/// Priority stream this data belongs to.
|
||||
/// </param>
|
||||
/// <param name="callback">
|
||||
/// Callback to call once a complete deserialized object is available.
|
||||
@@ -820,7 +820,7 @@ namespace System.Management.Automation.Remoting
|
||||
/// Defragmented Object if any, otherwise null.
|
||||
/// </returns>
|
||||
/// <exception cref="PSRemotingTransportException">
|
||||
/// 1. Fragmet Ids not in sequence
|
||||
/// 1. Fragment Ids not in sequence
|
||||
/// 2. Object Ids does not match
|
||||
/// 3. The current deserialized object size of the received data exceeded
|
||||
/// allowed maximum object size. The current deserialized object size is {0}.
|
||||
|
||||
@@ -238,7 +238,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
/// </summary>
|
||||
WSMAN_FLAG_AUTH_DIGEST = 0x2,
|
||||
/// <summary>
|
||||
/// Use negotiate authentication for a remote operation (may use kerboros or ntlm)
|
||||
/// Use negotiate authentication for a remote operation (may use kerberos or ntlm)
|
||||
/// </summary>
|
||||
WSMAN_FLAG_AUTH_NEGOTIATE = 0x4,
|
||||
/// <summary>
|
||||
@@ -355,7 +355,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// gets a structure represenation (used for marshalling)
|
||||
/// gets a structure representation (used for marshalling)
|
||||
/// </summary>
|
||||
internal WSManUserNameCredentialStruct CredentialStruct
|
||||
{
|
||||
@@ -508,7 +508,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
/// </summary>
|
||||
WSMAN_OPTION_UNENCRYPTED_MESSAGES = 20,
|
||||
/// <summary>
|
||||
/// int - 1 Send all network packets for remote operatons in UTF16; 0 - default is UTF8
|
||||
/// int - 1 Send all network packets for remote operations in UTF16; 0 - default is UTF8
|
||||
/// </summary>
|
||||
WSMAN_OPTION_UTF16 = 21,
|
||||
/// <summary>
|
||||
@@ -607,7 +607,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
|
||||
#region WSManData
|
||||
/// <summary>
|
||||
/// types of suppored WSMan data.
|
||||
/// types of supported WSMan data.
|
||||
/// PowerShell uses only Text and DWORD (in some places).
|
||||
/// </summary>
|
||||
internal enum WSManDataType : uint
|
||||
@@ -712,7 +712,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the buffer lenfth of data.
|
||||
/// Gets the buffer length of data.
|
||||
/// </summary>
|
||||
internal int BufferLength
|
||||
{
|
||||
@@ -748,7 +748,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// implict IntPtr conversion
|
||||
/// implicit IntPtr conversion
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
@@ -1085,7 +1085,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Option set struct used to pass optional infromation
|
||||
/// Option set struct used to pass optional information
|
||||
/// with WSManCreateShellEx
|
||||
/// </summary>
|
||||
internal struct WSManOptionSet : IDisposable
|
||||
@@ -1899,7 +1899,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Used in the shell compeletion function delegate to refer to the data.
|
||||
/// Used in the shell completion function delegate to refer to the data.
|
||||
/// </summary>
|
||||
internal class WSManReceiveDataResult
|
||||
{
|
||||
@@ -1916,7 +1916,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
/// Constructs a WSManReceiveDataResult from the unmanaged pointer.
|
||||
/// This involves copying data from unmanaged memory to managed heap.
|
||||
/// Currently PowerShell supports only text data on the wire, so this
|
||||
/// method asserst if the data is not text.
|
||||
/// method asserts if the data is not text.
|
||||
/// </summary>
|
||||
/// <param name="unmanagedData">
|
||||
/// Pointer to unmanaged data.
|
||||
@@ -2104,7 +2104,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Managed represenation of WSMAN_SENDER_DETAILS
|
||||
/// Managed representation of WSMAN_SENDER_DETAILS
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||
private struct WSManSenderDetailsInternal
|
||||
@@ -2324,7 +2324,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
/// <summary>
|
||||
/// This API deinitializes the Winrm client stack; all operations will
|
||||
/// finish before this API will return; this is a sync call;
|
||||
/// it is highly recommended that all operations are explictly cancelled
|
||||
/// it is highly recommended that all operations are explicitly cancelled
|
||||
/// and all sessions are closed before calling this API
|
||||
/// Returns non zero error code upon failure.
|
||||
/// </summary>
|
||||
@@ -2494,7 +2494,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
/// callback to notify when the create operation completes.
|
||||
/// </param>
|
||||
/// <param name="shellOperationHandle">
|
||||
/// An out parameter referening a WSMan shell operation handle
|
||||
/// An out parameter referencing a WSMan shell operation handle
|
||||
/// for this shell.
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
@@ -2596,7 +2596,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
/// callback to notify when the operation completes.
|
||||
/// </param>
|
||||
/// <param name="commandOperationHandle">
|
||||
/// An out parameter referening a WSMan shell operation handle
|
||||
/// An out parameter referencing a WSMan shell operation handle
|
||||
/// for this command.
|
||||
/// </param>
|
||||
[DllImport(WSManNativeApi.WSManClientApiDll, EntryPoint = "WSManRunShellCommandEx", SetLastError = false, CharSet = CharSet.Unicode)]
|
||||
@@ -2643,7 +2643,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
/// <param name="flags"> </param>
|
||||
/// <param name="desiredStreamSet"></param>
|
||||
/// <param name="asyncCallback">
|
||||
/// callback which receives the data asynchronoulsy.
|
||||
/// callback which receives the data asynchronously.
|
||||
/// </param>
|
||||
/// <param name="receiveOperationHandle">
|
||||
/// handle to use to cancel the operation.
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace System.Management.Automation.Remoting
|
||||
|
||||
/// <summary>
|
||||
/// Enables dependency injection after the static constructor is called.
|
||||
/// This may be overridden in unit tests to enable different behavoir.
|
||||
/// This may be overridden in unit tests to enable different behavior.
|
||||
/// It is static because static instances of this class use the facade. Otherwise,
|
||||
/// it would be passed in via a parameterized constructor.
|
||||
/// </summary>
|
||||
@@ -159,7 +159,7 @@ namespace System.Management.Automation.Remoting
|
||||
static WSManPluginInstance()
|
||||
{
|
||||
// NOTE - the order is important here:
|
||||
// because handler from WindowsErrorReporting is going to terminate the proces
|
||||
// because handler from WindowsErrorReporting is going to terminate the process
|
||||
// we want it to fire last
|
||||
|
||||
#if !CORECLR
|
||||
@@ -312,7 +312,7 @@ namespace System.Management.Automation.Remoting
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a shell session wrapper to track and service future interacations.
|
||||
// Create a shell session wrapper to track and service future interactions.
|
||||
mgdShellSession = new WSManPluginShellSession(requestDetails, serverTransportMgr, remoteShellSession, context);
|
||||
AddToActiveShellSessions(mgdShellSession);
|
||||
mgdShellSession.SessionClosed += new EventHandler<EventArgs>(HandleShellSessionClosed);
|
||||
@@ -791,7 +791,7 @@ namespace System.Management.Automation.Remoting
|
||||
return;
|
||||
}
|
||||
|
||||
// this connect is on a commad
|
||||
// this connect is on a command
|
||||
WSManPluginCommandSession mgdCmdSession = mgdShellSession.GetCommandSession(commandContext);
|
||||
if (null == mgdCmdSession)
|
||||
{
|
||||
@@ -1471,7 +1471,7 @@ namespace System.Management.Automation.Remoting
|
||||
/// Sets thread properties like UI Culture, Culture etc..This is needed as code is transitioning from
|
||||
/// unmanaged heap to managed heap...and thread properties are not set correctly during this
|
||||
/// transition.
|
||||
/// Currently WSMan provider supplies only UI Culture related data..so only UI Cutlure is set.
|
||||
/// Currently WSMan provider supplies only UI Culture related data..so only UI Culture is set.
|
||||
/// </summary>
|
||||
/// <param name="requestDetails"></param>
|
||||
internal static void SetThreadProperties(
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace System.Management.Automation.Remoting
|
||||
// cases if GCRoot is used, CLR will pick up the first AppDomain in the list
|
||||
// to get the managed handle. Delegates are not just function pointers, they
|
||||
// also contain a reference to the AppDomain that created it. However the catch
|
||||
// is that delegates must be marshelled into their respective unmanaged function
|
||||
// is that delegates must be marshalled into their respective unmanaged function
|
||||
// pointers (otherwise we end up storing the delegate into a GCRoot).
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace System.Management.Automation.Remoting
|
||||
// request context passed by WSMan while sending Plugin data.
|
||||
internal WSManNativeApi.WSManPluginRequest sendRequestDetails;
|
||||
internal WSManPluginOperationShutdownContext shutDownContext;
|
||||
// tracker used in conjunction with WSMan API to identigy a particular
|
||||
// tracker used in conjunction with WSMan API to identify a particular
|
||||
// shell context.
|
||||
internal RegisteredWaitHandle registeredShutDownWaitHandle;
|
||||
internal WSManPluginServerTransportManager transportMgr;
|
||||
@@ -72,7 +72,7 @@ namespace System.Management.Automation.Remoting
|
||||
// Dispose of unmanaged resources.
|
||||
Dispose(true);
|
||||
// This object will be cleaned up by the Dispose method.
|
||||
// Therefore, you should call GC.SupressFinalize to
|
||||
// Therefore, you should call GC.SuppressFinalize to
|
||||
// take this object off the finalization queue
|
||||
// and prevent finalization code for this object
|
||||
// from executing a second time.
|
||||
@@ -323,7 +323,7 @@ namespace System.Management.Automation.Remoting
|
||||
Close(reasonForClose);
|
||||
}
|
||||
|
||||
// handle prepare from tranport by reporting context to WSMan.
|
||||
// handle prepare from transport by reporting context to WSMan.
|
||||
internal void HandlePrepareFromTransportManager(Object sender, EventArgs eventArgs)
|
||||
{
|
||||
ReportContext();
|
||||
@@ -481,7 +481,7 @@ namespace System.Management.Automation.Remoting
|
||||
WSManNativeApi.PS_XML_NAMESPACE,
|
||||
Convert.ToBase64String(outputData));
|
||||
|
||||
//TODO: curretly using OperationComplete to report back the responseXml. This will need to change to use WSManReportObject
|
||||
//TODO: currently using OperationComplete to report back the responseXml. This will need to change to use WSManReportObject
|
||||
//that is currently internal.
|
||||
WSManPluginInstance.ReportOperationComplete(requestDetails, WSManPluginErrorCodes.NoError, responseData);
|
||||
}
|
||||
@@ -641,7 +641,7 @@ namespace System.Management.Automation.Remoting
|
||||
while (cmdSessionEnumerator.MoveNext())
|
||||
{
|
||||
WSManPluginCommandSession cmdSession = cmdSessionEnumerator.Current;
|
||||
// we are not interested in session closed events anymore as we are intiating the close
|
||||
// we are not interested in session closed events anymore as we are initiating the close
|
||||
// anyway/
|
||||
cmdSession.SessionClosed -= new EventHandler<EventArgs>(this.HandleCommandSessionClosed);
|
||||
cmdSession.Close(reasonForClose);
|
||||
@@ -712,7 +712,7 @@ namespace System.Management.Automation.Remoting
|
||||
if (!isRcvOp)
|
||||
{
|
||||
// Initiate close on the active command sessions and then clear the internal
|
||||
// Command Sesison dictionary
|
||||
// Command Session dictionary
|
||||
CloseAndClearCommandSessions(reasonForClose);
|
||||
// raise session closed event and let dependent code to release resources.
|
||||
// null check is not performed here because the handler will take care of this.
|
||||
|
||||
+1
-1
@@ -391,7 +391,7 @@ namespace System.Management.Automation.Remoting
|
||||
private WSManPluginServerTransportManager _serverTransportMgr;
|
||||
private System.Guid _cmdId;
|
||||
|
||||
// Create Cmd Transport Manager for this sessn trnsprt manager
|
||||
// Create Cmd Transport Manager for this sessn transport manager
|
||||
internal WSManPluginCommandTransportManager(WSManPluginServerTransportManager srvrTransportMgr)
|
||||
: base(srvrTransportMgr.Fragmentor.FragmentSize, srvrTransportMgr.CryptoHelper)
|
||||
{
|
||||
|
||||
@@ -122,8 +122,8 @@ namespace System.Management.Automation.Remoting.Client
|
||||
PSRemotingTransportException e;
|
||||
|
||||
//For the first two special error conditions, it is remotely possible that the wsmanSessionTM is null when the failures are returned
|
||||
//as part of command TM operations (could be returned becuase of RC retries under the hood)
|
||||
//Not worth to handle these cases seperately as there are very corner scenarios, but need to make sure wsmanSessionTM is not referenced
|
||||
//as part of command TM operations (could be returned because of RC retries under the hood)
|
||||
//Not worth to handle these cases separately as there are very corner scenarios, but need to make sure wsmanSessionTM is not referenced
|
||||
|
||||
|
||||
// Destination server is reporting that URI redirect is required for this user.
|
||||
@@ -576,7 +576,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
dataToBeSent.Fragmentor = base.Fragmentor;
|
||||
_sessionName = sessionName;
|
||||
|
||||
// session transport manager can recieve unlimited data..however each object is limited
|
||||
// session transport manager can receive unlimited data..however each object is limited
|
||||
// by maxRecvdObjectSize. this is to allow clients to use a session for an unlimited time..
|
||||
// also the messages that can be sent to a session are limited and very controlled.
|
||||
// However a command transport manager can be restricted to receive only a fixed amount of data
|
||||
@@ -931,7 +931,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
_openContent = new WSManNativeApi.WSManData_ManToUn(base64EncodedDataInXml);
|
||||
}
|
||||
|
||||
//THERE SHOULD BE NO ADDITIONAL DATA. If there is, it means we are not able to push all initial negotaion related data
|
||||
//THERE SHOULD BE NO ADDITIONAL DATA. If there is, it means we are not able to push all initial negotiation related data
|
||||
// as part of Connect SOAP. The connect algorithm is based on this assumption. So bail out.
|
||||
additionalData = dataToBeSent.ReadOrRegisterCallback(null, out additionalDataType);
|
||||
if (additionalData != null)
|
||||
@@ -973,7 +973,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
WSManNativeApi.WSManConnectShellEx(_wsManSessionHandle,
|
||||
flags,
|
||||
ConnectionInfo.ShellUri,
|
||||
RunspacePoolInstanceId.ToString().ToUpperInvariant(), //wsman is case sensetive wrt shellId. so consistently using upper case
|
||||
RunspacePoolInstanceId.ToString().ToUpperInvariant(), //wsman is case sensitive wrt shellId. so consistently using upper case
|
||||
IntPtr.Zero,
|
||||
_openContent,
|
||||
_connectSessionCallback,
|
||||
@@ -1067,7 +1067,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
uIdleTimeout,
|
||||
_sessionName);
|
||||
|
||||
// additional content with create shell call. Piggy back first fragement from
|
||||
// additional content with create shell call. Piggy back first fragment from
|
||||
// the dataToBeSent buffer.
|
||||
if (null == _openContent)
|
||||
{
|
||||
@@ -3035,7 +3035,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
}
|
||||
|
||||
// WSMan API do not allow a signal/input/receive be sent until RunShellCommand is
|
||||
// successfull (ie., callback is received)..so note that a signal is to be sent
|
||||
// successful (ie., callback is received)..so note that a signal is to be sent
|
||||
// here and return.
|
||||
if (!_isCreateCallbackReceived)
|
||||
{
|
||||
@@ -3315,7 +3315,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
}
|
||||
}
|
||||
|
||||
// Send remaing cmd / parameter fragments.
|
||||
// Send remaining cmd / parameter fragments.
|
||||
lock (cmdTM.syncObject)
|
||||
{
|
||||
cmdTM._isCreateCallbackReceived = true;
|
||||
@@ -3350,7 +3350,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
cmdTM.SendOneItem();
|
||||
|
||||
// WSMan API does not allow a signal/input/receive be sent until RunShellCommand is
|
||||
// successfull (ie., callback is received)
|
||||
// successful (ie., callback is received)
|
||||
if (cmdTM._isStopSignalPending)
|
||||
{
|
||||
cmdTM.SendStopSignal();
|
||||
@@ -3802,7 +3802,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
if (serializedPipeline.Length > 0)
|
||||
{
|
||||
data = serializedPipeline.ReadOrRegisterCallback(null);
|
||||
// if there are no command / parameter fragements need to be sent
|
||||
// if there are no command / parameter fragments need to be sent
|
||||
// start receiving data. Reason: Command will start its execution
|
||||
// once command string + parameters are sent.
|
||||
if (serializedPipeline.Length == 0)
|
||||
@@ -3925,7 +3925,7 @@ namespace System.Management.Automation.Remoting.Client
|
||||
}
|
||||
|
||||
receiveDataInitiated = true;
|
||||
// recive callback
|
||||
// receive callback
|
||||
_receivedFromRemote = new WSManNativeApi.WSManShellAsync(new IntPtr(_cmdContextId), s_cmdReceiveCallback);
|
||||
WSManNativeApi.WSManReceiveShellOutputEx(_wsManShellOperationHandle,
|
||||
_wsManCmdOperationHandle, startInDisconnectedMode ? (int)WSManNativeApi.WSManShellFlag.WSMAN_FLAG_RECEIVE_DELAY_OUTPUT_STREAM : 0,
|
||||
|
||||
Reference in new issue
Block a user