Skip to content

Commit

Permalink
Initial commit to port System.Diagnostics.Process
Browse files Browse the repository at this point in the history
Commit migrated from dotnet/corefx@fb83ed2
  • Loading branch information
dotnet-bot committed Dec 19, 2014
1 parent b6543ce commit 4a000ea
Show file tree
Hide file tree
Showing 26 changed files with 6,872 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/libraries/System.Diagnostics.Process.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Diagnostics.Process", "System.Diagnostics.Process\src\System.Diagnostics.Process.csproj", "{63634289-90D7-4947-8BF3-DBBE98D76C85}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{63634289-90D7-4947-8BF3-DBBE98D76C85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.Debug|Any CPU.Build.0 = Debug|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.Release|Any CPU.ActiveCfg = Release|Any CPU
{63634289-90D7-4947-8BF3-DBBE98D76C85}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
470 changes: 470 additions & 0 deletions src/libraries/System.Diagnostics.Process/src/Interop/Interop.Manual.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

/*============================================================
**
** Class: SafeProcessHandle
**
** A wrapper for a process handle
**
**
===========================================================*/

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace Microsoft.Win32.SafeHandles
{
[System.Security.SecurityCriticalAttribute]
public sealed class SafeProcessHandle : SafeHandle
{
internal static SafeProcessHandle InvalidHandle = new SafeProcessHandle(IntPtr.Zero);

internal SafeProcessHandle() : base(IntPtr.Zero, true) { }

internal SafeProcessHandle(IntPtr handle)
: base(IntPtr.Zero, true)
{
SetHandle(handle);
}

public SafeProcessHandle(IntPtr handle, bool ownsHandle)
: base(IntPtr.Zero, ownsHandle)
{
SetHandle(handle);
}

internal void InitialSetHandle(IntPtr h)
{
Debug.Assert(IsInvalid, "Safe handle should only be set once");
base.handle = h;
}

public override bool IsInvalid
{
[System.Security.SecurityCritical]
get
{ return handle == new IntPtr(0) || handle == new IntPtr(-1); }
}

[System.Security.SecurityCritical]
override protected bool ReleaseHandle()
{
return Interop.mincore.CloseHandle(handle);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

/*============================================================
**
** Class: SafeThreadHandle
**
**
** A wrapper for a thread handle
**
**
===========================================================*/

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeThreadHandle : SafeHandle
{
internal SafeThreadHandle()
: base(IntPtr.Zero, true)
{
}

internal void InitialSetHandle(IntPtr h)
{
Debug.Assert(IsInvalid, "Safe handle should only be set once");
base.SetHandle(h);
}

public override bool IsInvalid
{
[System.Security.SecurityCritical]
get
{ return handle == new IntPtr(0) || handle == new IntPtr(-1); }
}

override protected bool ReleaseHandle()
{
return Interop.mincore.CloseHandle(handle);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

/*============================================================
**
** Class: SafeTokenHandle
**
** A wrapper for a process handle
**
**
===========================================================*/

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace Microsoft.Win32.SafeHandles
{
[System.Security.SecurityCriticalAttribute]
internal sealed class SafeTokenHandle : SafeHandle
{
internal static SafeTokenHandle InvalidHandle = new SafeTokenHandle(IntPtr.Zero);

internal SafeTokenHandle() : base(IntPtr.Zero, true) { }

internal SafeTokenHandle(IntPtr handle)
: base(IntPtr.Zero, true)
{
SetHandle(handle);
}

public SafeTokenHandle(IntPtr handle, bool ownsHandle)
: base(IntPtr.Zero, ownsHandle)
{
SetHandle(handle);
}

internal void InitialSetHandle(IntPtr h)
{
Debug.Assert(IsInvalid, "Safe handle should only be set once");
base.handle = h;
}

public override bool IsInvalid
{
[System.Security.SecurityCritical]
get
{ return handle == new IntPtr(0) || handle == new IntPtr(-1); }
}

[System.Security.SecurityCritical]
override protected bool ReleaseHandle()
{
return Interop.mincore.CloseHandle(handle);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyCopyright("\x00a9 Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyFileVersion("999.999.999.0")]
[assembly: AssemblyInformationalVersion("999.999.999.0")]
[assembly: AssemblyVersion("999.999.999.0")]
[assembly: AssemblyTitle("System.Diagnostics.Process")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("System.Diagnostics.Process")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
Loading

0 comments on commit 4a000ea

Please sign in to comment.