You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
parent
1190d13a04
commit
6bdd276d05
7
external/corefx/src/System.Threading.AccessControl/dir.props
vendored
Normal file
7
external/corefx/src/System.Threading.AccessControl/dir.props
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\dir.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>4.0.2.0</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
8
external/corefx/src/System.Threading.AccessControl/pkg/System.Threading.AccessControl.builds
vendored
Normal file
8
external/corefx/src/System.Threading.AccessControl/pkg/System.Threading.AccessControl.builds
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<ItemGroup>
|
||||
<Project Include="System.Threading.AccessControl.pkgproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
|
||||
</Project>
|
14
external/corefx/src/System.Threading.AccessControl/pkg/System.Threading.AccessControl.pkgproj
vendored
Normal file
14
external/corefx/src/System.Threading.AccessControl/pkg/System.Threading.AccessControl.pkgproj
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ref\System.Threading.AccessControl.csproj">
|
||||
<SupportedFramework>net46;netcoreapp1.0</SupportedFramework>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\src\System.Threading.AccessControl.builds" />
|
||||
<NotSupportedOnTargetFramework Include="netcore50">
|
||||
<PackageTargetRuntime>win</PackageTargetRuntime>
|
||||
</NotSupportedOnTargetFramework>
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
8
external/corefx/src/System.Threading.AccessControl/ref/Configurations.props
vendored
Normal file
8
external/corefx/src/System.Threading.AccessControl/ref/Configurations.props
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
netstandard;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
45
external/corefx/src/System.Threading.AccessControl/ref/System.Threading.AccessControl.Manual.cs
vendored
Normal file
45
external/corefx/src/System.Threading.AccessControl/ref/System.Threading.AccessControl.Manual.cs
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
// ------------------------------------------------------------------------------
|
||||
// Changes to this file must follow the http://aka.ms/api-review process.
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace System.Security.AccessControl
|
||||
{
|
||||
[System.FlagsAttribute]
|
||||
[System.Security.SecurityCriticalAttribute]
|
||||
public enum EventWaitHandleRights
|
||||
{
|
||||
ChangePermissions = 262144,
|
||||
Delete = 65536,
|
||||
FullControl = 2031619,
|
||||
Modify = 2,
|
||||
ReadPermissions = 131072,
|
||||
Synchronize = 1048576,
|
||||
TakeOwnership = 524288,
|
||||
}
|
||||
|
||||
[System.Security.SecurityCriticalAttribute]
|
||||
public sealed partial class EventWaitHandleSecurity : System.Security.AccessControl.NativeObjectSecurity
|
||||
{
|
||||
public EventWaitHandleSecurity() : base(default(bool), default(System.Security.AccessControl.ResourceType)) { }
|
||||
public override System.Type AccessRightType { get { throw null; } }
|
||||
public override System.Type AccessRuleType { get { throw null; } }
|
||||
public override System.Type AuditRuleType { get { throw null; } }
|
||||
public override System.Security.AccessControl.AccessRule AccessRuleFactory(System.Security.Principal.IdentityReference identityReference, int accessMask, bool isInherited, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.AccessControlType type) { throw null; }
|
||||
public void AddAccessRule(System.Security.AccessControl.EventWaitHandleAccessRule rule) { }
|
||||
public void AddAuditRule(System.Security.AccessControl.EventWaitHandleAuditRule rule) { }
|
||||
public override System.Security.AccessControl.AuditRule AuditRuleFactory(System.Security.Principal.IdentityReference identityReference, int accessMask, bool isInherited, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.AuditFlags flags) { throw null; }
|
||||
public bool RemoveAccessRule(System.Security.AccessControl.EventWaitHandleAccessRule rule) { throw null; }
|
||||
public void RemoveAccessRuleAll(System.Security.AccessControl.EventWaitHandleAccessRule rule) { }
|
||||
public void RemoveAccessRuleSpecific(System.Security.AccessControl.EventWaitHandleAccessRule rule) { }
|
||||
public bool RemoveAuditRule(System.Security.AccessControl.EventWaitHandleAuditRule rule) { throw null; }
|
||||
public void RemoveAuditRuleAll(System.Security.AccessControl.EventWaitHandleAuditRule rule) { }
|
||||
public void RemoveAuditRuleSpecific(System.Security.AccessControl.EventWaitHandleAuditRule rule) { }
|
||||
public void ResetAccessRule(System.Security.AccessControl.EventWaitHandleAccessRule rule) { }
|
||||
public void SetAccessRule(System.Security.AccessControl.EventWaitHandleAccessRule rule) { }
|
||||
public void SetAuditRule(System.Security.AccessControl.EventWaitHandleAuditRule rule) { }
|
||||
}
|
||||
}
|
131
external/corefx/src/System.Threading.AccessControl/ref/System.Threading.AccessControl.cs
vendored
Normal file
131
external/corefx/src/System.Threading.AccessControl/ref/System.Threading.AccessControl.cs
vendored
Normal file
@ -0,0 +1,131 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
// ------------------------------------------------------------------------------
|
||||
// Changes to this file must follow the http://aka.ms/api-review process.
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace System.Security.AccessControl
|
||||
{
|
||||
[System.Security.SecurityCriticalAttribute]
|
||||
public sealed partial class EventWaitHandleAccessRule : System.Security.AccessControl.AccessRule
|
||||
{
|
||||
public EventWaitHandleAccessRule(System.Security.Principal.IdentityReference identity, System.Security.AccessControl.EventWaitHandleRights eventRights, System.Security.AccessControl.AccessControlType type) : base(default(System.Security.Principal.IdentityReference), default(int), default(bool), default(System.Security.AccessControl.InheritanceFlags), default(System.Security.AccessControl.PropagationFlags), default(System.Security.AccessControl.AccessControlType)) { }
|
||||
public EventWaitHandleAccessRule(string identity, System.Security.AccessControl.EventWaitHandleRights eventRights, System.Security.AccessControl.AccessControlType type) : base(default(System.Security.Principal.IdentityReference), default(int), default(bool), default(System.Security.AccessControl.InheritanceFlags), default(System.Security.AccessControl.PropagationFlags), default(System.Security.AccessControl.AccessControlType)) { }
|
||||
public System.Security.AccessControl.EventWaitHandleRights EventWaitHandleRights { get { throw null; } }
|
||||
}
|
||||
[System.Security.SecurityCriticalAttribute]
|
||||
public sealed partial class EventWaitHandleAuditRule : System.Security.AccessControl.AuditRule
|
||||
{
|
||||
public EventWaitHandleAuditRule(System.Security.Principal.IdentityReference identity, System.Security.AccessControl.EventWaitHandleRights eventRights, System.Security.AccessControl.AuditFlags flags) : base(default(System.Security.Principal.IdentityReference), default(int), default(bool), default(System.Security.AccessControl.InheritanceFlags), default(System.Security.AccessControl.PropagationFlags), default(System.Security.AccessControl.AuditFlags)) { }
|
||||
public System.Security.AccessControl.EventWaitHandleRights EventWaitHandleRights { get { throw null; } }
|
||||
}
|
||||
[System.Security.SecurityCriticalAttribute]
|
||||
public sealed partial class MutexAccessRule : System.Security.AccessControl.AccessRule
|
||||
{
|
||||
public MutexAccessRule(System.Security.Principal.IdentityReference identity, System.Security.AccessControl.MutexRights eventRights, System.Security.AccessControl.AccessControlType type) : base(default(System.Security.Principal.IdentityReference), default(int), default(bool), default(System.Security.AccessControl.InheritanceFlags), default(System.Security.AccessControl.PropagationFlags), default(System.Security.AccessControl.AccessControlType)) { }
|
||||
public MutexAccessRule(string identity, System.Security.AccessControl.MutexRights eventRights, System.Security.AccessControl.AccessControlType type) : base(default(System.Security.Principal.IdentityReference), default(int), default(bool), default(System.Security.AccessControl.InheritanceFlags), default(System.Security.AccessControl.PropagationFlags), default(System.Security.AccessControl.AccessControlType)) { }
|
||||
public System.Security.AccessControl.MutexRights MutexRights { get { throw null; } }
|
||||
}
|
||||
[System.Security.SecurityCriticalAttribute]
|
||||
public sealed partial class MutexAuditRule : System.Security.AccessControl.AuditRule
|
||||
{
|
||||
public MutexAuditRule(System.Security.Principal.IdentityReference identity, System.Security.AccessControl.MutexRights eventRights, System.Security.AccessControl.AuditFlags flags) : base(default(System.Security.Principal.IdentityReference), default(int), default(bool), default(System.Security.AccessControl.InheritanceFlags), default(System.Security.AccessControl.PropagationFlags), default(System.Security.AccessControl.AuditFlags)) { }
|
||||
public System.Security.AccessControl.MutexRights MutexRights { get { throw null; } }
|
||||
}
|
||||
[System.FlagsAttribute]
|
||||
[System.Security.SecurityCriticalAttribute]
|
||||
public enum MutexRights
|
||||
{
|
||||
ChangePermissions = 262144,
|
||||
Delete = 65536,
|
||||
FullControl = 2031617,
|
||||
Modify = 1,
|
||||
ReadPermissions = 131072,
|
||||
Synchronize = 1048576,
|
||||
TakeOwnership = 524288,
|
||||
}
|
||||
[System.Security.SecurityCriticalAttribute]
|
||||
public sealed partial class MutexSecurity : System.Security.AccessControl.NativeObjectSecurity
|
||||
{
|
||||
public MutexSecurity() : base(default(bool), default(System.Security.AccessControl.ResourceType)) { }
|
||||
public MutexSecurity(string name, System.Security.AccessControl.AccessControlSections includeSections) : base(default(bool), default(System.Security.AccessControl.ResourceType)) { }
|
||||
public override System.Type AccessRightType { get { throw null; } }
|
||||
public override System.Type AccessRuleType { get { throw null; } }
|
||||
public override System.Type AuditRuleType { get { throw null; } }
|
||||
public override System.Security.AccessControl.AccessRule AccessRuleFactory(System.Security.Principal.IdentityReference identityReference, int accessMask, bool isInherited, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.AccessControlType type) { throw null; }
|
||||
public void AddAccessRule(System.Security.AccessControl.MutexAccessRule rule) { }
|
||||
public void AddAuditRule(System.Security.AccessControl.MutexAuditRule rule) { }
|
||||
public override System.Security.AccessControl.AuditRule AuditRuleFactory(System.Security.Principal.IdentityReference identityReference, int accessMask, bool isInherited, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.AuditFlags flags) { throw null; }
|
||||
public bool RemoveAccessRule(System.Security.AccessControl.MutexAccessRule rule) { throw null; }
|
||||
public void RemoveAccessRuleAll(System.Security.AccessControl.MutexAccessRule rule) { }
|
||||
public void RemoveAccessRuleSpecific(System.Security.AccessControl.MutexAccessRule rule) { }
|
||||
public bool RemoveAuditRule(System.Security.AccessControl.MutexAuditRule rule) { throw null; }
|
||||
public void RemoveAuditRuleAll(System.Security.AccessControl.MutexAuditRule rule) { }
|
||||
public void RemoveAuditRuleSpecific(System.Security.AccessControl.MutexAuditRule rule) { }
|
||||
public void ResetAccessRule(System.Security.AccessControl.MutexAccessRule rule) { }
|
||||
public void SetAccessRule(System.Security.AccessControl.MutexAccessRule rule) { }
|
||||
public void SetAuditRule(System.Security.AccessControl.MutexAuditRule rule) { }
|
||||
}
|
||||
[System.Security.SecurityCriticalAttribute]
|
||||
public sealed partial class SemaphoreAccessRule : System.Security.AccessControl.AccessRule
|
||||
{
|
||||
public SemaphoreAccessRule(System.Security.Principal.IdentityReference identity, System.Security.AccessControl.SemaphoreRights eventRights, System.Security.AccessControl.AccessControlType type) : base(default(System.Security.Principal.IdentityReference), default(int), default(bool), default(System.Security.AccessControl.InheritanceFlags), default(System.Security.AccessControl.PropagationFlags), default(System.Security.AccessControl.AccessControlType)) { }
|
||||
public SemaphoreAccessRule(string identity, System.Security.AccessControl.SemaphoreRights eventRights, System.Security.AccessControl.AccessControlType type) : base(default(System.Security.Principal.IdentityReference), default(int), default(bool), default(System.Security.AccessControl.InheritanceFlags), default(System.Security.AccessControl.PropagationFlags), default(System.Security.AccessControl.AccessControlType)) { }
|
||||
public System.Security.AccessControl.SemaphoreRights SemaphoreRights { get { throw null; } }
|
||||
}
|
||||
[System.Security.SecurityCriticalAttribute]
|
||||
public sealed partial class SemaphoreAuditRule : System.Security.AccessControl.AuditRule
|
||||
{
|
||||
public SemaphoreAuditRule(System.Security.Principal.IdentityReference identity, System.Security.AccessControl.SemaphoreRights eventRights, System.Security.AccessControl.AuditFlags flags) : base(default(System.Security.Principal.IdentityReference), default(int), default(bool), default(System.Security.AccessControl.InheritanceFlags), default(System.Security.AccessControl.PropagationFlags), default(System.Security.AccessControl.AuditFlags)) { }
|
||||
public System.Security.AccessControl.SemaphoreRights SemaphoreRights { get { throw null; } }
|
||||
}
|
||||
[System.FlagsAttribute]
|
||||
[System.Security.SecurityCriticalAttribute]
|
||||
public enum SemaphoreRights
|
||||
{
|
||||
ChangePermissions = 262144,
|
||||
Delete = 65536,
|
||||
FullControl = 2031619,
|
||||
Modify = 2,
|
||||
ReadPermissions = 131072,
|
||||
Synchronize = 1048576,
|
||||
TakeOwnership = 524288,
|
||||
}
|
||||
[System.Security.SecurityCriticalAttribute]
|
||||
public sealed partial class SemaphoreSecurity : System.Security.AccessControl.NativeObjectSecurity
|
||||
{
|
||||
public SemaphoreSecurity() : base(default(bool), default(System.Security.AccessControl.ResourceType)) { }
|
||||
public SemaphoreSecurity(string name, System.Security.AccessControl.AccessControlSections includeSections) : base(default(bool), default(System.Security.AccessControl.ResourceType)) { }
|
||||
public override System.Type AccessRightType { get { throw null; } }
|
||||
public override System.Type AccessRuleType { get { throw null; } }
|
||||
public override System.Type AuditRuleType { get { throw null; } }
|
||||
public override System.Security.AccessControl.AccessRule AccessRuleFactory(System.Security.Principal.IdentityReference identityReference, int accessMask, bool isInherited, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.AccessControlType type) { throw null; }
|
||||
public void AddAccessRule(System.Security.AccessControl.SemaphoreAccessRule rule) { }
|
||||
public void AddAuditRule(System.Security.AccessControl.SemaphoreAuditRule rule) { }
|
||||
public override System.Security.AccessControl.AuditRule AuditRuleFactory(System.Security.Principal.IdentityReference identityReference, int accessMask, bool isInherited, System.Security.AccessControl.InheritanceFlags inheritanceFlags, System.Security.AccessControl.PropagationFlags propagationFlags, System.Security.AccessControl.AuditFlags flags) { throw null; }
|
||||
public bool RemoveAccessRule(System.Security.AccessControl.SemaphoreAccessRule rule) { throw null; }
|
||||
public void RemoveAccessRuleAll(System.Security.AccessControl.SemaphoreAccessRule rule) { }
|
||||
public void RemoveAccessRuleSpecific(System.Security.AccessControl.SemaphoreAccessRule rule) { }
|
||||
public bool RemoveAuditRule(System.Security.AccessControl.SemaphoreAuditRule rule) { throw null; }
|
||||
public void RemoveAuditRuleAll(System.Security.AccessControl.SemaphoreAuditRule rule) { }
|
||||
public void RemoveAuditRuleSpecific(System.Security.AccessControl.SemaphoreAuditRule rule) { }
|
||||
public void ResetAccessRule(System.Security.AccessControl.SemaphoreAccessRule rule) { }
|
||||
public void SetAccessRule(System.Security.AccessControl.SemaphoreAccessRule rule) { }
|
||||
public void SetAuditRule(System.Security.AccessControl.SemaphoreAuditRule rule) { }
|
||||
}
|
||||
}
|
||||
namespace System.Threading
|
||||
{
|
||||
[System.Security.SecurityCriticalAttribute]
|
||||
public static partial class ThreadingAclExtensions
|
||||
{
|
||||
public static System.Security.AccessControl.EventWaitHandleSecurity GetAccessControl(this System.Threading.EventWaitHandle handle) { throw null; }
|
||||
public static System.Security.AccessControl.MutexSecurity GetAccessControl(this System.Threading.Mutex mutex) { throw null; }
|
||||
public static System.Security.AccessControl.SemaphoreSecurity GetAccessControl(this System.Threading.Semaphore semaphore) { throw null; }
|
||||
public static void SetAccessControl(this System.Threading.EventWaitHandle handle, System.Security.AccessControl.EventWaitHandleSecurity eventSecurity) { }
|
||||
public static void SetAccessControl(this System.Threading.Mutex mutex, System.Security.AccessControl.MutexSecurity mutexSecurity) { }
|
||||
public static void SetAccessControl(this System.Threading.Semaphore semaphore, System.Security.AccessControl.SemaphoreSecurity semaphoreSecurity) { }
|
||||
}
|
||||
}
|
15
external/corefx/src/System.Threading.AccessControl/ref/System.Threading.AccessControl.csproj
vendored
Normal file
15
external/corefx/src/System.Threading.AccessControl/ref/System.Threading.AccessControl.csproj
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="System.Threading.AccessControl.cs" />
|
||||
<Compile Include="System.Threading.AccessControl.Manual.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\System.Security.AccessControl\ref\System.Security.AccessControl.csproj" />
|
||||
<ProjectReference Include="..\..\System.Security.Principal.Windows\ref\System.Security.Principal.Windows.csproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
10
external/corefx/src/System.Threading.AccessControl/src/Configurations.props
vendored
Normal file
10
external/corefx/src/System.Threading.AccessControl/src/Configurations.props
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
net46-Windows_NT;
|
||||
netstandard-Windows_NT;
|
||||
netstandard-Unix;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
123
external/corefx/src/System.Threading.AccessControl/src/Resources/Strings.resx
vendored
Normal file
123
external/corefx/src/System.Threading.AccessControl/src/Resources/Strings.resx
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="WaitHandleCannotBeOpenedException_InvalidHandle" xml:space="preserve">
|
||||
<value>A WaitHandle with system-wide name '{0}' cannot be created. A WaitHandle of a different type might have the same name.</value>
|
||||
</data>
|
||||
</root>
|
39
external/corefx/src/System.Threading.AccessControl/src/System.Threading.AccessControl.csproj
vendored
Normal file
39
external/corefx/src/System.Threading.AccessControl/src/System.Threading.AccessControl.csproj
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<PropertyGroup>
|
||||
<OSGroup Condition="'$(OSGroup)' == ''">Windows_NT</OSGroup>
|
||||
</PropertyGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyName>System.Threading.AccessControl</AssemblyName>
|
||||
<ProjectGuid>{E3ED83FD-3015-4BD8-A1B8-6294986E6CFA}</ProjectGuid>
|
||||
<GeneratePlatformNotSupportedAssembly Condition="'$(TargetsUnix)' == 'true'">true</GeneratePlatformNotSupportedAssembly>
|
||||
<IsPartialFacadeAssembly Condition="'$(TargetGroup)'=='net46'">true</IsPartialFacadeAssembly>
|
||||
</PropertyGroup>
|
||||
<!-- Default configurations to help VS understand the options -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net46-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net46-Windows_NT-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard-Windows_NT-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard-Unix-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard-Unix-Release|AnyCPU'" />
|
||||
<ItemGroup Condition="'$(TargetGroup)'=='netstandard' AND '$(TargetsWindows)'=='true'">
|
||||
<Compile Include="$(CommonPath)\Interop\Windows\Interop.Errors.cs">
|
||||
<Link>Common\Interop\Windows\Interop.Errors.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="System\Security\AccessControl\MutexSecurity.cs" />
|
||||
<Compile Include="System\Security\AccessControl\EventWaitHandleSecurity.cs" />
|
||||
<Compile Include="System\Security\AccessControl\SemaphoreSecurity.cs" />
|
||||
<Compile Include="System\Threading\ThreadingAclExtensions.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)'=='net46'">
|
||||
<TargetingPackReference Include="mscorlib" />
|
||||
<TargetingPackReference Include="System" />
|
||||
<Compile Include="System\Threading\ThreadingAclExtensions.net46.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Security.AccessControl" />
|
||||
<Reference Include="System.Security.Principal.Windows" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
@ -0,0 +1,275 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
/*============================================================
|
||||
**
|
||||
**
|
||||
**
|
||||
** Purpose: Managed ACL wrapper for Win32 events.
|
||||
**
|
||||
**
|
||||
===========================================================*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Security.Principal;
|
||||
using Microsoft.Win32;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace System.Security.AccessControl
|
||||
{
|
||||
// Derive this list of values from winnt.h and MSDN docs:
|
||||
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/synchronization_object_security_and_access_rights.asp
|
||||
|
||||
// Win32's interesting values are EVENT_MODIFY_STATE (0x0002) and
|
||||
// EVENT_ALL_ACCESS (0x1F0003). I don't know what 0x1 is, but Windows
|
||||
// includes it in EVENT_ALL_ACCESS.
|
||||
[Flags]
|
||||
public enum EventWaitHandleRights
|
||||
{
|
||||
Modify = 0x000002,
|
||||
Delete = 0x010000,
|
||||
ReadPermissions = 0x020000,
|
||||
ChangePermissions = 0x040000,
|
||||
TakeOwnership = 0x080000,
|
||||
Synchronize = 0x100000, // SYNCHRONIZE
|
||||
FullControl = 0x1F0003
|
||||
}
|
||||
|
||||
|
||||
public sealed class EventWaitHandleAccessRule : AccessRule
|
||||
{
|
||||
// Constructor for creating access rules for registry objects
|
||||
|
||||
public EventWaitHandleAccessRule(IdentityReference identity, EventWaitHandleRights eventRights, AccessControlType type)
|
||||
: this(identity, (int)eventRights, false, InheritanceFlags.None, PropagationFlags.None, type)
|
||||
{
|
||||
}
|
||||
|
||||
public EventWaitHandleAccessRule(String identity, EventWaitHandleRights eventRights, AccessControlType type)
|
||||
: this(new NTAccount(identity), (int)eventRights, false, InheritanceFlags.None, PropagationFlags.None, type)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Internal constructor to be called by public constructors
|
||||
// and the access rule factory methods of {File|Folder}Security
|
||||
//
|
||||
internal EventWaitHandleAccessRule(
|
||||
IdentityReference identity,
|
||||
int accessMask,
|
||||
bool isInherited,
|
||||
InheritanceFlags inheritanceFlags,
|
||||
PropagationFlags propagationFlags,
|
||||
AccessControlType type)
|
||||
: base(
|
||||
identity,
|
||||
accessMask,
|
||||
isInherited,
|
||||
inheritanceFlags,
|
||||
propagationFlags,
|
||||
type)
|
||||
{
|
||||
}
|
||||
|
||||
public EventWaitHandleRights EventWaitHandleRights
|
||||
{
|
||||
get { return (EventWaitHandleRights)base.AccessMask; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public sealed class EventWaitHandleAuditRule : AuditRule
|
||||
{
|
||||
public EventWaitHandleAuditRule(IdentityReference identity, EventWaitHandleRights eventRights, AuditFlags flags)
|
||||
: this(identity, (int)eventRights, false, InheritanceFlags.None, PropagationFlags.None, flags)
|
||||
{
|
||||
}
|
||||
|
||||
/* // Not in the spec
|
||||
public EventWaitHandleAuditRule(string identity, EventWaitHandleRights eventRights, AuditFlags flags)
|
||||
: this(new NTAccount(identity), (int) eventRights, false, InheritanceFlags.None, PropagationFlags.None, flags)
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
internal EventWaitHandleAuditRule(IdentityReference identity, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags)
|
||||
: base(identity, accessMask, isInherited, inheritanceFlags, propagationFlags, flags)
|
||||
{
|
||||
}
|
||||
|
||||
public EventWaitHandleRights EventWaitHandleRights
|
||||
{
|
||||
get { return (EventWaitHandleRights)base.AccessMask; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public sealed class EventWaitHandleSecurity : NativeObjectSecurity
|
||||
{
|
||||
public EventWaitHandleSecurity()
|
||||
: base(true, ResourceType.KernelObject)
|
||||
{
|
||||
}
|
||||
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
internal EventWaitHandleSecurity(String name, AccessControlSections includeSections)
|
||||
: base(true, ResourceType.KernelObject, name, includeSections, _HandleErrorCode, null)
|
||||
{
|
||||
// Let the underlying ACL API's demand unmanaged code permission.
|
||||
}
|
||||
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
internal EventWaitHandleSecurity(SafeWaitHandle handle, AccessControlSections includeSections)
|
||||
: base(true, ResourceType.KernelObject, handle, includeSections, _HandleErrorCode, null)
|
||||
{
|
||||
// Let the underlying ACL API's demand unmanaged code permission.
|
||||
}
|
||||
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
private static Exception _HandleErrorCode(int errorCode, string name, SafeHandle handle, object context)
|
||||
{
|
||||
System.Exception exception = null;
|
||||
|
||||
switch (errorCode)
|
||||
{
|
||||
case Interop.Errors.ERROR_INVALID_NAME:
|
||||
case Interop.Errors.ERROR_INVALID_HANDLE:
|
||||
case Interop.Errors.ERROR_FILE_NOT_FOUND:
|
||||
if ((name != null) && (name.Length != 0))
|
||||
exception = new WaitHandleCannotBeOpenedException(SR.Format(SR.WaitHandleCannotBeOpenedException_InvalidHandle, name));
|
||||
else
|
||||
exception = new WaitHandleCannotBeOpenedException();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return exception;
|
||||
}
|
||||
|
||||
public override AccessRule AccessRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
|
||||
{
|
||||
return new EventWaitHandleAccessRule(identityReference, accessMask, isInherited, inheritanceFlags, propagationFlags, type);
|
||||
}
|
||||
|
||||
public override AuditRule AuditRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags)
|
||||
{
|
||||
return new EventWaitHandleAuditRule(identityReference, accessMask, isInherited, inheritanceFlags, propagationFlags, flags);
|
||||
}
|
||||
|
||||
internal AccessControlSections GetAccessControlSectionsFromChanges()
|
||||
{
|
||||
AccessControlSections persistRules = AccessControlSections.None;
|
||||
if (AccessRulesModified)
|
||||
persistRules = AccessControlSections.Access;
|
||||
if (AuditRulesModified)
|
||||
persistRules |= AccessControlSections.Audit;
|
||||
if (OwnerModified)
|
||||
persistRules |= AccessControlSections.Owner;
|
||||
if (GroupModified)
|
||||
persistRules |= AccessControlSections.Group;
|
||||
return persistRules;
|
||||
}
|
||||
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
internal void Persist(SafeWaitHandle handle)
|
||||
{
|
||||
//
|
||||
// Let the underlying ACL API's demand unmanaged code.
|
||||
//
|
||||
|
||||
WriteLock();
|
||||
|
||||
try
|
||||
{
|
||||
AccessControlSections persistSections = GetAccessControlSectionsFromChanges();
|
||||
|
||||
if (persistSections == AccessControlSections.None)
|
||||
return; // Don't need to persist anything.
|
||||
|
||||
base.Persist(handle, persistSections);
|
||||
|
||||
OwnerModified = GroupModified = AuditRulesModified = AccessRulesModified = false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
WriteUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddAccessRule(EventWaitHandleAccessRule rule)
|
||||
{
|
||||
base.AddAccessRule(rule);
|
||||
}
|
||||
|
||||
public void SetAccessRule(EventWaitHandleAccessRule rule)
|
||||
{
|
||||
base.SetAccessRule(rule);
|
||||
}
|
||||
|
||||
public void ResetAccessRule(EventWaitHandleAccessRule rule)
|
||||
{
|
||||
base.ResetAccessRule(rule);
|
||||
}
|
||||
|
||||
public bool RemoveAccessRule(EventWaitHandleAccessRule rule)
|
||||
{
|
||||
return base.RemoveAccessRule(rule);
|
||||
}
|
||||
|
||||
public void RemoveAccessRuleAll(EventWaitHandleAccessRule rule)
|
||||
{
|
||||
base.RemoveAccessRuleAll(rule);
|
||||
}
|
||||
|
||||
public void RemoveAccessRuleSpecific(EventWaitHandleAccessRule rule)
|
||||
{
|
||||
base.RemoveAccessRuleSpecific(rule);
|
||||
}
|
||||
|
||||
public void AddAuditRule(EventWaitHandleAuditRule rule)
|
||||
{
|
||||
base.AddAuditRule(rule);
|
||||
}
|
||||
|
||||
public void SetAuditRule(EventWaitHandleAuditRule rule)
|
||||
{
|
||||
base.SetAuditRule(rule);
|
||||
}
|
||||
|
||||
public bool RemoveAuditRule(EventWaitHandleAuditRule rule)
|
||||
{
|
||||
return base.RemoveAuditRule(rule);
|
||||
}
|
||||
|
||||
public void RemoveAuditRuleAll(EventWaitHandleAuditRule rule)
|
||||
{
|
||||
base.RemoveAuditRuleAll(rule);
|
||||
}
|
||||
|
||||
public void RemoveAuditRuleSpecific(EventWaitHandleAuditRule rule)
|
||||
{
|
||||
base.RemoveAuditRuleSpecific(rule);
|
||||
}
|
||||
|
||||
public override Type AccessRightType
|
||||
{
|
||||
get { return typeof(EventWaitHandleRights); }
|
||||
}
|
||||
|
||||
public override Type AccessRuleType
|
||||
{
|
||||
get { return typeof(EventWaitHandleAccessRule); }
|
||||
}
|
||||
|
||||
public override Type AuditRuleType
|
||||
{
|
||||
get { return typeof(EventWaitHandleAuditRule); }
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,272 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
/*============================================================
|
||||
**
|
||||
**
|
||||
**
|
||||
** Purpose: Managed ACL wrapper for Win32 mutexes.
|
||||
**
|
||||
**
|
||||
===========================================================*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Security.Principal;
|
||||
using Microsoft.Win32;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace System.Security.AccessControl
|
||||
{
|
||||
// Derive this list of values from winnt.h and MSDN docs:
|
||||
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/synchronization_object_security_and_access_rights.asp
|
||||
|
||||
// In order to call ReleaseMutex, you must have an ACL granting you
|
||||
// MUTEX_MODIFY_STATE rights (0x0001). The other interesting value
|
||||
// in a Mutex's ACL is MUTEX_ALL_ACCESS (0x1F0001).
|
||||
// You need SYNCHRONIZE to be able to open a handle to a mutex.
|
||||
[Flags]
|
||||
public enum MutexRights
|
||||
{
|
||||
Modify = 0x000001,
|
||||
Delete = 0x010000,
|
||||
ReadPermissions = 0x020000,
|
||||
ChangePermissions = 0x040000,
|
||||
TakeOwnership = 0x080000,
|
||||
Synchronize = 0x100000, // SYNCHRONIZE
|
||||
FullControl = 0x1F0001
|
||||
}
|
||||
|
||||
|
||||
public sealed class MutexAccessRule : AccessRule
|
||||
{
|
||||
// Constructor for creating access rules for registry objects
|
||||
|
||||
public MutexAccessRule(IdentityReference identity, MutexRights eventRights, AccessControlType type)
|
||||
: this(identity, (int)eventRights, false, InheritanceFlags.None, PropagationFlags.None, type)
|
||||
{
|
||||
}
|
||||
|
||||
public MutexAccessRule(String identity, MutexRights eventRights, AccessControlType type)
|
||||
: this(new NTAccount(identity), (int)eventRights, false, InheritanceFlags.None, PropagationFlags.None, type)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Internal constructor to be called by public constructors
|
||||
// and the access rule factory methods of {File|Folder}Security
|
||||
//
|
||||
internal MutexAccessRule(
|
||||
IdentityReference identity,
|
||||
int accessMask,
|
||||
bool isInherited,
|
||||
InheritanceFlags inheritanceFlags,
|
||||
PropagationFlags propagationFlags,
|
||||
AccessControlType type)
|
||||
: base(
|
||||
identity,
|
||||
accessMask,
|
||||
isInherited,
|
||||
inheritanceFlags,
|
||||
propagationFlags,
|
||||
type)
|
||||
{
|
||||
}
|
||||
|
||||
public MutexRights MutexRights
|
||||
{
|
||||
get { return (MutexRights)base.AccessMask; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public sealed class MutexAuditRule : AuditRule
|
||||
{
|
||||
public MutexAuditRule(IdentityReference identity, MutexRights eventRights, AuditFlags flags)
|
||||
: this(identity, (int)eventRights, false, InheritanceFlags.None, PropagationFlags.None, flags)
|
||||
{
|
||||
}
|
||||
|
||||
/* // Not in the spec
|
||||
public MutexAuditRule(string identity, MutexRights eventRights, AuditFlags flags)
|
||||
: this(new NTAccount(identity), (int) eventRights, false, InheritanceFlags.None, PropagationFlags.None, flags)
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
internal MutexAuditRule(IdentityReference identity, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags)
|
||||
: base(identity, accessMask, isInherited, inheritanceFlags, propagationFlags, flags)
|
||||
{
|
||||
}
|
||||
|
||||
public MutexRights MutexRights
|
||||
{
|
||||
get { return (MutexRights)base.AccessMask; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public sealed class MutexSecurity : NativeObjectSecurity
|
||||
{
|
||||
public MutexSecurity()
|
||||
: base(true, ResourceType.KernelObject)
|
||||
{
|
||||
}
|
||||
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
public MutexSecurity(String name, AccessControlSections includeSections)
|
||||
: base(true, ResourceType.KernelObject, name, includeSections, _HandleErrorCode, null)
|
||||
{
|
||||
// Let the underlying ACL API's demand unmanaged code permission.
|
||||
}
|
||||
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
internal MutexSecurity(SafeWaitHandle handle, AccessControlSections includeSections)
|
||||
: base(true, ResourceType.KernelObject, handle, includeSections, _HandleErrorCode, null)
|
||||
{
|
||||
// Let the underlying ACL API's demand unmanaged code permission.
|
||||
}
|
||||
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
private static Exception _HandleErrorCode(int errorCode, string name, SafeHandle handle, object context)
|
||||
{
|
||||
System.Exception exception = null;
|
||||
|
||||
switch (errorCode)
|
||||
{
|
||||
case Interop.Errors.ERROR_INVALID_NAME:
|
||||
case Interop.Errors.ERROR_INVALID_HANDLE:
|
||||
case Interop.Errors.ERROR_FILE_NOT_FOUND:
|
||||
if ((name != null) && (name.Length != 0))
|
||||
exception = new WaitHandleCannotBeOpenedException(SR.Format(SR.WaitHandleCannotBeOpenedException_InvalidHandle, name));
|
||||
else
|
||||
exception = new WaitHandleCannotBeOpenedException();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return exception;
|
||||
}
|
||||
|
||||
public override AccessRule AccessRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
|
||||
{
|
||||
return new MutexAccessRule(identityReference, accessMask, isInherited, inheritanceFlags, propagationFlags, type);
|
||||
}
|
||||
|
||||
public override AuditRule AuditRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags)
|
||||
{
|
||||
return new MutexAuditRule(identityReference, accessMask, isInherited, inheritanceFlags, propagationFlags, flags);
|
||||
}
|
||||
|
||||
internal AccessControlSections GetAccessControlSectionsFromChanges()
|
||||
{
|
||||
AccessControlSections persistRules = AccessControlSections.None;
|
||||
if (AccessRulesModified)
|
||||
persistRules = AccessControlSections.Access;
|
||||
if (AuditRulesModified)
|
||||
persistRules |= AccessControlSections.Audit;
|
||||
if (OwnerModified)
|
||||
persistRules |= AccessControlSections.Owner;
|
||||
if (GroupModified)
|
||||
persistRules |= AccessControlSections.Group;
|
||||
return persistRules;
|
||||
}
|
||||
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
internal void Persist(SafeWaitHandle handle)
|
||||
{
|
||||
// Let the underlying ACL API's demand unmanaged code.
|
||||
|
||||
WriteLock();
|
||||
|
||||
try
|
||||
{
|
||||
AccessControlSections persistSections = GetAccessControlSectionsFromChanges();
|
||||
if (persistSections == AccessControlSections.None)
|
||||
return; // Don't need to persist anything.
|
||||
|
||||
base.Persist(handle, persistSections);
|
||||
OwnerModified = GroupModified = AuditRulesModified = AccessRulesModified = false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
WriteUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddAccessRule(MutexAccessRule rule)
|
||||
{
|
||||
base.AddAccessRule(rule);
|
||||
}
|
||||
|
||||
public void SetAccessRule(MutexAccessRule rule)
|
||||
{
|
||||
base.SetAccessRule(rule);
|
||||
}
|
||||
|
||||
public void ResetAccessRule(MutexAccessRule rule)
|
||||
{
|
||||
base.ResetAccessRule(rule);
|
||||
}
|
||||
|
||||
public bool RemoveAccessRule(MutexAccessRule rule)
|
||||
{
|
||||
return base.RemoveAccessRule(rule);
|
||||
}
|
||||
|
||||
public void RemoveAccessRuleAll(MutexAccessRule rule)
|
||||
{
|
||||
base.RemoveAccessRuleAll(rule);
|
||||
}
|
||||
|
||||
public void RemoveAccessRuleSpecific(MutexAccessRule rule)
|
||||
{
|
||||
base.RemoveAccessRuleSpecific(rule);
|
||||
}
|
||||
|
||||
public void AddAuditRule(MutexAuditRule rule)
|
||||
{
|
||||
base.AddAuditRule(rule);
|
||||
}
|
||||
|
||||
public void SetAuditRule(MutexAuditRule rule)
|
||||
{
|
||||
base.SetAuditRule(rule);
|
||||
}
|
||||
|
||||
public bool RemoveAuditRule(MutexAuditRule rule)
|
||||
{
|
||||
return base.RemoveAuditRule(rule);
|
||||
}
|
||||
|
||||
public void RemoveAuditRuleAll(MutexAuditRule rule)
|
||||
{
|
||||
base.RemoveAuditRuleAll(rule);
|
||||
}
|
||||
|
||||
public void RemoveAuditRuleSpecific(MutexAuditRule rule)
|
||||
{
|
||||
base.RemoveAuditRuleSpecific(rule);
|
||||
}
|
||||
|
||||
public override Type AccessRightType
|
||||
{
|
||||
get { return typeof(MutexRights); }
|
||||
}
|
||||
|
||||
public override Type AccessRuleType
|
||||
{
|
||||
get { return typeof(MutexAccessRule); }
|
||||
}
|
||||
|
||||
public override Type AuditRuleType
|
||||
{
|
||||
get { return typeof(MutexAuditRule); }
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,262 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
/*============================================================
|
||||
**
|
||||
**
|
||||
** Purpose: Managed ACL wrapper for Win32 semaphores.
|
||||
**
|
||||
**
|
||||
===========================================================*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Security.Principal;
|
||||
using Microsoft.Win32;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace System.Security.AccessControl
|
||||
{
|
||||
// Derive this list of values from winnt.h and MSDN docs:
|
||||
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/synchronization_object_security_and_access_rights.asp
|
||||
|
||||
// Win32's interesting values are SEMAPHORE_MODIFY_STATE (0x2) and
|
||||
// SEMAPHORE_ALL_ACCESS (0x1F0003). I don't know what 0x1 is.
|
||||
[Flags]
|
||||
public enum SemaphoreRights
|
||||
{
|
||||
Modify = 0x000002,
|
||||
Delete = 0x010000,
|
||||
ReadPermissions = 0x020000,
|
||||
ChangePermissions = 0x040000,
|
||||
TakeOwnership = 0x080000,
|
||||
Synchronize = 0x100000, // SYNCHRONIZE
|
||||
FullControl = 0x1F0003
|
||||
}
|
||||
|
||||
public sealed class SemaphoreAccessRule : AccessRule
|
||||
{
|
||||
// Constructor for creating access rules for registry objects
|
||||
|
||||
public SemaphoreAccessRule(IdentityReference identity, SemaphoreRights eventRights, AccessControlType type)
|
||||
: this(identity, (int)eventRights, false, InheritanceFlags.None, PropagationFlags.None, type)
|
||||
{
|
||||
}
|
||||
|
||||
public SemaphoreAccessRule(String identity, SemaphoreRights eventRights, AccessControlType type)
|
||||
: this(new NTAccount(identity), (int)eventRights, false, InheritanceFlags.None, PropagationFlags.None, type)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Internal constructor to be called by public constructors
|
||||
// and the access rule factory methods of {File|Folder}Security
|
||||
//
|
||||
internal SemaphoreAccessRule(
|
||||
IdentityReference identity,
|
||||
int accessMask,
|
||||
bool isInherited,
|
||||
InheritanceFlags inheritanceFlags,
|
||||
PropagationFlags propagationFlags,
|
||||
AccessControlType type)
|
||||
: base(
|
||||
identity,
|
||||
accessMask,
|
||||
isInherited,
|
||||
inheritanceFlags,
|
||||
propagationFlags,
|
||||
type)
|
||||
{
|
||||
}
|
||||
|
||||
public SemaphoreRights SemaphoreRights
|
||||
{
|
||||
get { return (SemaphoreRights)base.AccessMask; }
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class SemaphoreAuditRule : AuditRule
|
||||
{
|
||||
public SemaphoreAuditRule(IdentityReference identity, SemaphoreRights eventRights, AuditFlags flags)
|
||||
: this(identity, (int)eventRights, false, InheritanceFlags.None, PropagationFlags.None, flags)
|
||||
{
|
||||
}
|
||||
|
||||
/* // Not in the spec
|
||||
public SemaphoreAuditRule(string identity, SemaphoreRights eventRights, AuditFlags flags)
|
||||
: this(new NTAccount(identity), (int) eventRights, false, InheritanceFlags.None, PropagationFlags.None, flags)
|
||||
{
|
||||
}
|
||||
*/
|
||||
|
||||
internal SemaphoreAuditRule(IdentityReference identity, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags)
|
||||
: base(identity, accessMask, isInherited, inheritanceFlags, propagationFlags, flags)
|
||||
{
|
||||
}
|
||||
|
||||
public SemaphoreRights SemaphoreRights
|
||||
{
|
||||
get { return (SemaphoreRights)base.AccessMask; }
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class SemaphoreSecurity : NativeObjectSecurity
|
||||
{
|
||||
public SemaphoreSecurity()
|
||||
: base(true, ResourceType.KernelObject)
|
||||
{
|
||||
}
|
||||
|
||||
public SemaphoreSecurity(String name, AccessControlSections includeSections)
|
||||
: base(true, ResourceType.KernelObject, name, includeSections, _HandleErrorCode, null)
|
||||
{
|
||||
// Let the underlying ACL API's demand unmanaged code permission.
|
||||
}
|
||||
|
||||
internal SemaphoreSecurity(SafeWaitHandle handle, AccessControlSections includeSections)
|
||||
: base(true, ResourceType.KernelObject, handle, includeSections, _HandleErrorCode, null)
|
||||
{
|
||||
// Let the underlying ACL API's demand unmanaged code permission.
|
||||
}
|
||||
|
||||
private static Exception _HandleErrorCode(int errorCode, string name, SafeHandle handle, object context)
|
||||
{
|
||||
System.Exception exception = null;
|
||||
|
||||
switch (errorCode)
|
||||
{
|
||||
case Interop.Errors.ERROR_INVALID_NAME:
|
||||
case Interop.Errors.ERROR_INVALID_HANDLE:
|
||||
case Interop.Errors.ERROR_FILE_NOT_FOUND:
|
||||
if ((name != null) && (name.Length != 0))
|
||||
exception = new WaitHandleCannotBeOpenedException(SR.Format(SR.WaitHandleCannotBeOpenedException_InvalidHandle, name));
|
||||
else
|
||||
exception = new WaitHandleCannotBeOpenedException();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return exception;
|
||||
}
|
||||
|
||||
public override AccessRule AccessRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AccessControlType type)
|
||||
{
|
||||
return new SemaphoreAccessRule(identityReference, accessMask, isInherited, inheritanceFlags, propagationFlags, type);
|
||||
}
|
||||
|
||||
public override AuditRule AuditRuleFactory(IdentityReference identityReference, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags flags)
|
||||
{
|
||||
return new SemaphoreAuditRule(identityReference, accessMask, isInherited, inheritanceFlags, propagationFlags, flags);
|
||||
}
|
||||
|
||||
internal AccessControlSections GetAccessControlSectionsFromChanges()
|
||||
{
|
||||
AccessControlSections persistRules = AccessControlSections.None;
|
||||
if (AccessRulesModified)
|
||||
persistRules = AccessControlSections.Access;
|
||||
if (AuditRulesModified)
|
||||
persistRules |= AccessControlSections.Audit;
|
||||
if (OwnerModified)
|
||||
persistRules |= AccessControlSections.Owner;
|
||||
if (GroupModified)
|
||||
persistRules |= AccessControlSections.Group;
|
||||
return persistRules;
|
||||
}
|
||||
|
||||
internal void Persist(SafeWaitHandle handle)
|
||||
{
|
||||
// Let the underlying ACL API's demand unmanaged code.
|
||||
|
||||
WriteLock();
|
||||
|
||||
try
|
||||
{
|
||||
AccessControlSections persistSections = GetAccessControlSectionsFromChanges();
|
||||
if (persistSections == AccessControlSections.None)
|
||||
return; // Don't need to persist anything.
|
||||
|
||||
base.Persist(handle, persistSections);
|
||||
OwnerModified = GroupModified = AuditRulesModified = AccessRulesModified = false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
WriteUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddAccessRule(SemaphoreAccessRule rule)
|
||||
{
|
||||
base.AddAccessRule(rule);
|
||||
}
|
||||
|
||||
public void SetAccessRule(SemaphoreAccessRule rule)
|
||||
{
|
||||
base.SetAccessRule(rule);
|
||||
}
|
||||
|
||||
public void ResetAccessRule(SemaphoreAccessRule rule)
|
||||
{
|
||||
base.ResetAccessRule(rule);
|
||||
}
|
||||
|
||||
public bool RemoveAccessRule(SemaphoreAccessRule rule)
|
||||
{
|
||||
return base.RemoveAccessRule(rule);
|
||||
}
|
||||
|
||||
public void RemoveAccessRuleAll(SemaphoreAccessRule rule)
|
||||
{
|
||||
base.RemoveAccessRuleAll(rule);
|
||||
}
|
||||
|
||||
public void RemoveAccessRuleSpecific(SemaphoreAccessRule rule)
|
||||
{
|
||||
base.RemoveAccessRuleSpecific(rule);
|
||||
}
|
||||
|
||||
public void AddAuditRule(SemaphoreAuditRule rule)
|
||||
{
|
||||
base.AddAuditRule(rule);
|
||||
}
|
||||
|
||||
public void SetAuditRule(SemaphoreAuditRule rule)
|
||||
{
|
||||
base.SetAuditRule(rule);
|
||||
}
|
||||
|
||||
public bool RemoveAuditRule(SemaphoreAuditRule rule)
|
||||
{
|
||||
return base.RemoveAuditRule(rule);
|
||||
}
|
||||
|
||||
public void RemoveAuditRuleAll(SemaphoreAuditRule rule)
|
||||
{
|
||||
base.RemoveAuditRuleAll(rule);
|
||||
}
|
||||
|
||||
public void RemoveAuditRuleSpecific(SemaphoreAuditRule rule)
|
||||
{
|
||||
base.RemoveAuditRuleSpecific(rule);
|
||||
}
|
||||
|
||||
public override Type AccessRightType
|
||||
{
|
||||
get { return typeof(SemaphoreRights); }
|
||||
}
|
||||
|
||||
public override Type AccessRuleType
|
||||
{
|
||||
get { return typeof(SemaphoreAccessRule); }
|
||||
}
|
||||
|
||||
public override Type AuditRuleType
|
||||
{
|
||||
get { return typeof(SemaphoreAuditRule); }
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
// Ported from EventWaitHandle.cs, Mutex.cs, Semaphore.cs and made extension methods (or renamed statics, where necessary) to allow
|
||||
// extending the class without System.Threading needing to rely on System.Security.AccessControl
|
||||
|
||||
using System;
|
||||
using System.Security.AccessControl;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace System.Threading
|
||||
{
|
||||
public static class ThreadingAclExtensions
|
||||
{
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
public static EventWaitHandleSecurity GetAccessControl(this EventWaitHandle handle)
|
||||
{
|
||||
return new EventWaitHandleSecurity(handle.GetSafeWaitHandle(), AccessControlSections.Access | AccessControlSections.Owner | AccessControlSections.Group);
|
||||
}
|
||||
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
public static void SetAccessControl(this EventWaitHandle handle, EventWaitHandleSecurity eventSecurity)
|
||||
{
|
||||
if (eventSecurity == null)
|
||||
throw new ArgumentNullException(nameof(eventSecurity));
|
||||
Contract.EndContractBlock();
|
||||
|
||||
eventSecurity.Persist(handle.GetSafeWaitHandle());
|
||||
}
|
||||
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
public static MutexSecurity GetAccessControl(this Mutex mutex)
|
||||
{
|
||||
return new MutexSecurity(mutex.GetSafeWaitHandle(), AccessControlSections.Access | AccessControlSections.Owner | AccessControlSections.Group);
|
||||
}
|
||||
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
public static void SetAccessControl(this Mutex mutex, MutexSecurity mutexSecurity)
|
||||
{
|
||||
if (mutexSecurity == null)
|
||||
throw new ArgumentNullException(nameof(mutexSecurity));
|
||||
Contract.EndContractBlock();
|
||||
|
||||
mutexSecurity.Persist(mutex.GetSafeWaitHandle());
|
||||
}
|
||||
|
||||
public static SemaphoreSecurity GetAccessControl(this Semaphore semaphore)
|
||||
{
|
||||
return new SemaphoreSecurity(semaphore.GetSafeWaitHandle(), AccessControlSections.Access | AccessControlSections.Owner | AccessControlSections.Group);
|
||||
}
|
||||
|
||||
public static void SetAccessControl(this Semaphore semaphore, SemaphoreSecurity semaphoreSecurity)
|
||||
{
|
||||
if (semaphoreSecurity == null)
|
||||
throw new ArgumentNullException(nameof(semaphoreSecurity));
|
||||
|
||||
semaphoreSecurity.Persist(semaphore.GetSafeWaitHandle());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Security.AccessControl;
|
||||
|
||||
namespace System.Threading
|
||||
{
|
||||
public static class ThreadingAclExtensions
|
||||
{
|
||||
public static EventWaitHandleSecurity GetAccessControl(this EventWaitHandle handle)
|
||||
{
|
||||
return handle.GetAccessControl();
|
||||
}
|
||||
|
||||
public static void SetAccessControl(this EventWaitHandle handle, EventWaitHandleSecurity eventSecurity)
|
||||
{
|
||||
handle.SetAccessControl(eventSecurity);
|
||||
}
|
||||
|
||||
public static MutexSecurity GetAccessControl(this Mutex mutex)
|
||||
{
|
||||
return mutex.GetAccessControl();
|
||||
}
|
||||
|
||||
public static void SetAccessControl(this Mutex mutex, MutexSecurity mutexSecurity)
|
||||
{
|
||||
mutex.SetAccessControl(mutexSecurity);
|
||||
}
|
||||
|
||||
public static SemaphoreSecurity GetAccessControl(this Semaphore semaphore)
|
||||
{
|
||||
return semaphore.GetAccessControl();
|
||||
}
|
||||
|
||||
public static void SetAccessControl(this Semaphore semaphore, SemaphoreSecurity semaphoreSecurity)
|
||||
{
|
||||
semaphore.SetAccessControl(semaphoreSecurity);
|
||||
}
|
||||
}
|
||||
}
|
8
external/corefx/src/System.Threading.AccessControl/tests/Configurations.props
vendored
Normal file
8
external/corefx/src/System.Threading.AccessControl/tests/Configurations.props
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
netstandard1.3-Windows_NT;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
17
external/corefx/src/System.Threading.AccessControl/tests/MutexSecurityTests.cs
vendored
Normal file
17
external/corefx/src/System.Threading.AccessControl/tests/MutexSecurityTests.cs
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using Xunit;
|
||||
|
||||
namespace System.Security.AccessControl
|
||||
{
|
||||
public class MutexSecurityTests
|
||||
{
|
||||
[Fact]
|
||||
public void Ctor_Success()
|
||||
{
|
||||
new MutexSecurity();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<ItemGroup>
|
||||
<Project Include="System.Threading.AccessControl.Tests.csproj">
|
||||
<OSGroup>Windows_NT</OSGroup>
|
||||
<TestTFMs>netcoreapp;netcoreapp1.0;net46</TestTFMs>
|
||||
</Project>
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
|
||||
</Project>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{D77FBA6C-1AA6-45A4-93E2-97A370672C53}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard1.3-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard1.3-Windows_NT-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="MutexSecurityTests.cs" />
|
||||
<Compile Include="ThreadingAclExtensionsTests.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
49
external/corefx/src/System.Threading.AccessControl/tests/ThreadingAclExtensionsTests.cs
vendored
Normal file
49
external/corefx/src/System.Threading.AccessControl/tests/ThreadingAclExtensionsTests.cs
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Security.AccessControl;
|
||||
using Xunit;
|
||||
|
||||
namespace System.Threading.Tests
|
||||
{
|
||||
public static class ThreadingAclExtensionsTests
|
||||
{
|
||||
[Fact]
|
||||
[PlatformSpecific(TestPlatforms.Windows)]
|
||||
public static void ExistenceTest_Windows()
|
||||
{
|
||||
var e = new ManualResetEvent(true);
|
||||
var s = new Semaphore(1, 1);
|
||||
var m = new Mutex();
|
||||
|
||||
Assert.NotNull(e.GetAccessControl());
|
||||
Assert.Throws<ArgumentNullException>(() => e.SetAccessControl(null));
|
||||
e.SetAccessControl(new EventWaitHandleSecurity());
|
||||
|
||||
Assert.NotNull(s.GetAccessControl());
|
||||
Assert.Throws<ArgumentNullException>(() => s.SetAccessControl(null));
|
||||
s.SetAccessControl(new SemaphoreSecurity());
|
||||
|
||||
Assert.NotNull(m.GetAccessControl());
|
||||
Assert.Throws<ArgumentNullException>(() => m.SetAccessControl(null));
|
||||
m.SetAccessControl(new MutexSecurity());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[PlatformSpecific(TestPlatforms.AnyUnix)]
|
||||
public static void ExistenceTest_Unix()
|
||||
{
|
||||
var e = new ManualResetEvent(true);
|
||||
var s = new Semaphore(1, 1);
|
||||
var m = new Mutex();
|
||||
|
||||
Assert.Throws<PlatformNotSupportedException>(() => e.GetAccessControl());
|
||||
Assert.Throws<PlatformNotSupportedException>(() => e.SetAccessControl(new EventWaitHandleSecurity()));
|
||||
Assert.Throws<PlatformNotSupportedException>(() => s.GetAccessControl());
|
||||
Assert.Throws<PlatformNotSupportedException>(() => s.SetAccessControl(new SemaphoreSecurity()));
|
||||
Assert.Throws<PlatformNotSupportedException>(() => m.GetAccessControl());
|
||||
Assert.Throws<PlatformNotSupportedException>(() => m.SetAccessControl(new MutexSecurity()));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user