Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 5b26270

Browse files
author
Pallavi Taneja
committed
Add ProcessStartInfo.PasswordInClearText to System.Diagnostics.Process portable library
System.Diagnostics.Process took dependency on System.Security.SecureString for credentials support. In the recent API Review (dotnet/apireviews#11) we decided to remove the dependency by adding a new property to ProcessStartInfo.PasswordInClearText that has a return type of string. This is achieved in two phases. 1. Remove credentials from System.Diagnostics.Process v4.0.0.0 contract to ensure that the contract can be supported on Net4.6 2. Add ProcessStartInfo.PasswordInClearText property and not expose any static Process.Start APIs for this scenario (these are advances sceanarios anyway). [tfs-changeset: 1516848]
1 parent 69ac65b commit 5b26270

21 files changed

+595
-298
lines changed

src/Common/src/Interop/Windows/mincore/Interop.CreateProcessWithLogon.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal partial class mincore
1313
internal static extern bool CreateProcessWithLogonW(
1414
string userName,
1515
string domain,
16-
IntPtr password,
16+
string passwordInClearText,
1717
LogonFlags logonFlags,
1818
[MarshalAs(UnmanagedType.LPTStr)] string appName,
1919
StringBuilder cmdLine,
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
// ------------------------------------------------------------------------------
4+
// Changes to this file must follow the http://aka.ms/api-review process.
5+
// ------------------------------------------------------------------------------
6+
7+
namespace System.Diagnostics
8+
{
9+
public partial class Process : System.IDisposable
10+
{
11+
public void Dispose() { }
12+
protected virtual void Dispose(bool disposing) { }
13+
}
14+
public partial class ProcessModuleCollection : System.Collections.ICollection
15+
{
16+
public int Count { get { return default(int); } }
17+
bool System.Collections.ICollection.IsSynchronized { get { return default(bool); } }
18+
object System.Collections.ICollection.SyncRoot { get { return default(object); } }
19+
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
20+
public System.Collections.IEnumerator GetEnumerator() { return default(System.Collections.IEnumerator); }
21+
}
22+
public partial class ProcessThreadCollection : System.Collections.ICollection
23+
{
24+
public int Count { get { return default(int); } }
25+
bool System.Collections.ICollection.IsSynchronized { get { return default(bool); } }
26+
object System.Collections.ICollection.SyncRoot { get { return default(object); } }
27+
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
28+
public System.Collections.IEnumerator GetEnumerator() { return default(System.Collections.IEnumerator); }
29+
}
30+
}
31+
namespace Microsoft.Win32.SafeHandles
32+
{
33+
// Members from SafeHandleMinusOneOrZeroIsInvalid needed after removing base
34+
[System.Security.SecurityCritical]
35+
public sealed partial class SafeProcessHandle : System.Runtime.InteropServices.SafeHandle
36+
{
37+
public override bool IsInvalid {[System.Security.SecurityCritical] get { return false; } }
38+
}
39+
}
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
// ------------------------------------------------------------------------------
4+
// Changes to this file must follow the http://aka.ms/api-review process.
5+
// ------------------------------------------------------------------------------
6+
7+
namespace Microsoft.Win32.SafeHandles
8+
{
9+
public sealed partial class SafeProcessHandle : System.Runtime.InteropServices.SafeHandle
10+
{
11+
public SafeProcessHandle(System.IntPtr existingHandle, bool ownsHandle) : base(default(System.IntPtr), default(bool)) { }
12+
protected override bool ReleaseHandle() { return default(bool); }
13+
}
14+
}
15+
namespace System.Diagnostics
16+
{
17+
public partial class DataReceivedEventArgs : System.EventArgs
18+
{
19+
internal DataReceivedEventArgs() { }
20+
public string Data { get { return default(string); } }
21+
}
22+
public delegate void DataReceivedEventHandler(object sender, System.Diagnostics.DataReceivedEventArgs e);
23+
public partial class Process
24+
{
25+
public Process() { }
26+
public int BasePriority { get { return default(int); } }
27+
[System.ComponentModel.DefaultValueAttribute(false)]
28+
public bool EnableRaisingEvents { get { return default(bool); } set { } }
29+
public int ExitCode { get { return default(int); } }
30+
public System.DateTime ExitTime { get { return default(System.DateTime); } }
31+
public bool HasExited { get { return default(bool); } }
32+
public int Id { get { return default(int); } }
33+
public string MachineName { get { return default(string); } }
34+
public System.Diagnostics.ProcessModule MainModule { get { return default(System.Diagnostics.ProcessModule); } }
35+
public System.IntPtr MaxWorkingSet { get { return default(System.IntPtr); } set { } }
36+
public System.IntPtr MinWorkingSet { get { return default(System.IntPtr); } set { } }
37+
public System.Diagnostics.ProcessModuleCollection Modules { get { return default(System.Diagnostics.ProcessModuleCollection); } }
38+
public long NonpagedSystemMemorySize64 { get { return default(long); } }
39+
public long PagedMemorySize64 { get { return default(long); } }
40+
public long PagedSystemMemorySize64 { get { return default(long); } }
41+
public long PeakPagedMemorySize64 { get { return default(long); } }
42+
public long PeakVirtualMemorySize64 { get { return default(long); } }
43+
public long PeakWorkingSet64 { get { return default(long); } }
44+
public bool PriorityBoostEnabled { get { return default(bool); } set { } }
45+
public System.Diagnostics.ProcessPriorityClass PriorityClass { get { return default(System.Diagnostics.ProcessPriorityClass); } set { } }
46+
public long PrivateMemorySize64 { get { return default(long); } }
47+
public System.TimeSpan PrivilegedProcessorTime { get { return default(System.TimeSpan); } }
48+
public string ProcessName { get { return default(string); } }
49+
public System.IntPtr ProcessorAffinity { get { return default(System.IntPtr); } set { } }
50+
public Microsoft.Win32.SafeHandles.SafeProcessHandle SafeHandle { get { return default(Microsoft.Win32.SafeHandles.SafeProcessHandle); } }
51+
public int SessionId { get { return default(int); } }
52+
public System.IO.StreamReader StandardError { get { return default(System.IO.StreamReader); } }
53+
public System.IO.StreamWriter StandardInput { get { return default(System.IO.StreamWriter); } }
54+
public System.IO.StreamReader StandardOutput { get { return default(System.IO.StreamReader); } }
55+
public System.Diagnostics.ProcessStartInfo StartInfo { get { return default(System.Diagnostics.ProcessStartInfo); } set { } }
56+
public System.DateTime StartTime { get { return default(System.DateTime); } }
57+
public System.Diagnostics.ProcessThreadCollection Threads { get { return default(System.Diagnostics.ProcessThreadCollection); } }
58+
public System.TimeSpan TotalProcessorTime { get { return default(System.TimeSpan); } }
59+
public System.TimeSpan UserProcessorTime { get { return default(System.TimeSpan); } }
60+
public long VirtualMemorySize64 { get { return default(long); } }
61+
public long WorkingSet64 { get { return default(long); } }
62+
public event System.Diagnostics.DataReceivedEventHandler ErrorDataReceived { add { } remove { } }
63+
public event System.EventHandler Exited { add { } remove { } }
64+
public event System.Diagnostics.DataReceivedEventHandler OutputDataReceived { add { } remove { } }
65+
public void BeginErrorReadLine() { }
66+
public void BeginOutputReadLine() { }
67+
public void CancelErrorRead() { }
68+
public void CancelOutputRead() { }
69+
public static void EnterDebugMode() { }
70+
public static System.Diagnostics.Process GetCurrentProcess() { return default(System.Diagnostics.Process); }
71+
public static System.Diagnostics.Process GetProcessById(int processId) { return default(System.Diagnostics.Process); }
72+
public static System.Diagnostics.Process GetProcessById(int processId, string machineName) { return default(System.Diagnostics.Process); }
73+
public static System.Diagnostics.Process[] GetProcesses() { return default(System.Diagnostics.Process[]); }
74+
public static System.Diagnostics.Process[] GetProcesses(string machineName) { return default(System.Diagnostics.Process[]); }
75+
public static System.Diagnostics.Process[] GetProcessesByName(string processName) { return default(System.Diagnostics.Process[]); }
76+
public static System.Diagnostics.Process[] GetProcessesByName(string processName, string machineName) { return default(System.Diagnostics.Process[]); }
77+
public void Kill() { }
78+
public static void LeaveDebugMode() { }
79+
protected void OnExited() { }
80+
public void Refresh() { }
81+
public bool Start() { return default(bool); }
82+
public static System.Diagnostics.Process Start(System.Diagnostics.ProcessStartInfo startInfo) { return default(System.Diagnostics.Process); }
83+
public static System.Diagnostics.Process Start(string fileName) { return default(System.Diagnostics.Process); }
84+
public static System.Diagnostics.Process Start(string fileName, string arguments) { return default(System.Diagnostics.Process); }
85+
public void WaitForExit() { }
86+
public bool WaitForExit(int milliseconds) { return default(bool); }
87+
}
88+
public partial class ProcessModule
89+
{
90+
internal ProcessModule() { }
91+
public System.IntPtr BaseAddress { get { return default(System.IntPtr); } }
92+
public System.IntPtr EntryPointAddress { get { return default(System.IntPtr); } }
93+
public string FileName { get { return default(string); } }
94+
public int ModuleMemorySize { get { return default(int); } }
95+
public string ModuleName { get { return default(string); } }
96+
public override string ToString() { return default(string); }
97+
}
98+
public partial class ProcessModuleCollection
99+
{
100+
protected ProcessModuleCollection() { }
101+
public ProcessModuleCollection(System.Diagnostics.ProcessModule[] processModules) { }
102+
public System.Diagnostics.ProcessModule this[int index] { get { return default(System.Diagnostics.ProcessModule); } }
103+
public bool Contains(System.Diagnostics.ProcessModule module) { return default(bool); }
104+
public void CopyTo(System.Diagnostics.ProcessModule[] array, int index) { }
105+
public int IndexOf(System.Diagnostics.ProcessModule module) { return default(int); }
106+
}
107+
public enum ProcessPriorityClass
108+
{
109+
AboveNormal = 32768,
110+
BelowNormal = 16384,
111+
High = 128,
112+
Idle = 64,
113+
Normal = 32,
114+
RealTime = 256,
115+
}
116+
public sealed partial class ProcessStartInfo
117+
{
118+
public ProcessStartInfo() { }
119+
public ProcessStartInfo(string fileName) { }
120+
public ProcessStartInfo(string fileName, string arguments) { }
121+
public string Arguments { get { return default(string); } set { } }
122+
public bool CreateNoWindow { get { return default(bool); } set { } }
123+
[System.ComponentModel.DefaultValueAttribute(null)]
124+
public System.Collections.Generic.IDictionary<string, string> Environment { get { return default(System.Collections.Generic.IDictionary<string, string>); } }
125+
public string FileName { get { return default(string); } set { } }
126+
public bool RedirectStandardError { get { return default(bool); } set { } }
127+
public bool RedirectStandardInput { get { return default(bool); } set { } }
128+
public bool RedirectStandardOutput { get { return default(bool); } set { } }
129+
public System.Text.Encoding StandardErrorEncoding { get { return default(System.Text.Encoding); } set { } }
130+
public System.Text.Encoding StandardOutputEncoding { get { return default(System.Text.Encoding); } set { } }
131+
public bool UseShellExecute { get { return default(bool); } set { } }
132+
public string WorkingDirectory { get { return default(string); } set { } }
133+
}
134+
public partial class ProcessThread
135+
{
136+
internal ProcessThread() { }
137+
public int BasePriority { get { return default(int); } }
138+
public int CurrentPriority { get { return default(int); } }
139+
public int Id { get { return default(int); } }
140+
public int IdealProcessor { set { } }
141+
public bool PriorityBoostEnabled { get { return default(bool); } set { } }
142+
public System.Diagnostics.ThreadPriorityLevel PriorityLevel { get { return default(System.Diagnostics.ThreadPriorityLevel); } set { } }
143+
public System.TimeSpan PrivilegedProcessorTime { get { return default(System.TimeSpan); } }
144+
public System.IntPtr ProcessorAffinity { set { } }
145+
public System.IntPtr StartAddress { get { return default(System.IntPtr); } }
146+
public System.DateTime StartTime { get { return default(System.DateTime); } }
147+
public System.Diagnostics.ThreadState ThreadState { get { return default(System.Diagnostics.ThreadState); } }
148+
public System.TimeSpan TotalProcessorTime { get { return default(System.TimeSpan); } }
149+
public System.TimeSpan UserProcessorTime { get { return default(System.TimeSpan); } }
150+
public System.Diagnostics.ThreadWaitReason WaitReason { get { return default(System.Diagnostics.ThreadWaitReason); } }
151+
public void ResetIdealProcessor() { }
152+
}
153+
public partial class ProcessThreadCollection
154+
{
155+
protected ProcessThreadCollection() { }
156+
public ProcessThreadCollection(System.Diagnostics.ProcessThread[] processThreads) { }
157+
public System.Diagnostics.ProcessThread this[int index] { get { return default(System.Diagnostics.ProcessThread); } }
158+
public int Add(System.Diagnostics.ProcessThread thread) { return default(int); }
159+
public bool Contains(System.Diagnostics.ProcessThread thread) { return default(bool); }
160+
public void CopyTo(System.Diagnostics.ProcessThread[] array, int index) { }
161+
public int IndexOf(System.Diagnostics.ProcessThread thread) { return default(int); }
162+
public void Insert(int index, System.Diagnostics.ProcessThread thread) { }
163+
public void Remove(System.Diagnostics.ProcessThread thread) { }
164+
}
165+
public enum ThreadPriorityLevel
166+
{
167+
AboveNormal = 1,
168+
BelowNormal = -1,
169+
Highest = 2,
170+
Idle = -15,
171+
Lowest = -2,
172+
Normal = 0,
173+
TimeCritical = 15,
174+
}
175+
public enum ThreadState
176+
{
177+
Initialized = 0,
178+
Ready = 1,
179+
Running = 2,
180+
Standby = 3,
181+
Terminated = 4,
182+
Transition = 6,
183+
Unknown = 7,
184+
Wait = 5,
185+
}
186+
public enum ThreadWaitReason
187+
{
188+
EventPairHigh = 7,
189+
EventPairLow = 8,
190+
ExecutionDelay = 4,
191+
Executive = 0,
192+
FreePage = 1,
193+
LpcReceive = 9,
194+
LpcReply = 10,
195+
PageIn = 2,
196+
PageOut = 12,
197+
Suspended = 5,
198+
SystemAllocation = 3,
199+
Unknown = 13,
200+
UserRequest = 6,
201+
VirtualMemory = 11,
202+
}
203+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
4+
<PropertyGroup>
5+
<AssemblyVersion>4.0.0.0</AssemblyVersion>
6+
<OutputType>Library</OutputType>
7+
</PropertyGroup>
8+
<ItemGroup>
9+
<Compile Include="System.Diagnostics.Process.cs" />
10+
<Compile Include="System.Diagnostics.Process.Manual.cs" />
11+
</ItemGroup>
12+
<ItemGroup>
13+
<None Include="project.json" />
14+
</ItemGroup>
15+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
16+
</Project>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"dependencies": {
3+
"System.Runtime": "4.0.0",
4+
"System.Runtime.Handles": "4.0.0",
5+
"System.IO": "4.0.0",
6+
"System.Text.Encoding": "4.0.0"
7+
},
8+
"frameworks": {
9+
"dotnet": {}
10+
}
11+
}

0 commit comments

Comments
 (0)