Skip to content

Commit 925b59a

Browse files
Merge pull request #1104 from dotnet/dev/vatsan/preview8-snap-rel30
Snap master -> release/3.0 at the end of Preview 7 (PR no.2)
2 parents be2c8c3 + 592ed67 commit 925b59a

File tree

641 files changed

+574
-3202
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

641 files changed

+574
-3202
lines changed

src/Microsoft.DotNet.Wpf/src/Common/Graphics/exports.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
using System.Diagnostics;
2626
using System.Collections.Generic;
2727
using System.Security;
28-
using System.Security.Permissions;
2928
using Microsoft.Win32.SafeHandles;
3029

3130
using UnsafeNativeMethods=MS.Win32.PresentationCore.UnsafeNativeMethods;

src/Microsoft.DotNet.Wpf/src/Common/Graphics/wgx_exports.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using System.Runtime.InteropServices;
1212

1313
using System.Security;
14-
using System.Security.Permissions;
1514
using MS.Internal.PresentationCore;
1615

1716
namespace MS.Internal

src/Microsoft.DotNet.Wpf/src/Common/Graphics/wgx_render.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
using System.Runtime.InteropServices;
1111
using System.Windows.Media;
1212
using System.Security;
13-
using System.Security.Permissions;
1413
using SR=MS.Internal.PresentationCore.SR;
1514
using SRID=MS.Internal.PresentationCore.SRID;
1615

src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/Common.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include "precomp.hxx"
99

1010
using namespace System::Security;
11-
using namespace System::Security::Permissions;
1211

1312
namespace MS { namespace Internal { namespace Text { namespace TextInterface { namespace Native
1413
{
@@ -95,27 +94,8 @@ private ref class Util sealed
9594
/// </summary>
9695
static bool IsFullTrustCaller()
9796
{
98-
#ifndef _CLR_NETCORE
99-
try
100-
{
101-
if (_fullTrustPermissionSet == nullptr)
102-
{
103-
_fullTrustPermissionSet = gcnew PermissionSet(PermissionState::Unrestricted);
104-
}
105-
_fullTrustPermissionSet->Demand();
106-
}
107-
catch (SecurityException^)
108-
{
109-
return false;
110-
}
111-
#endif
11297
return true;
11398
}
114-
115-
#ifndef _CLR_NETCORE
116-
private:
117-
static PermissionSet^ _fullTrustPermissionSet = nullptr;
118-
#endif
11999
};
120100

121101
#define ConvertHresultToException(hr, msg) Native::Util::ConvertHresultToException(hr)

src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/Factory.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using namespace System::Runtime::InteropServices;
1010
using namespace MS::Internal::Text::TextInterface::Interfaces;
1111
#ifndef _CLR_NETCORE
12-
using namespace System::Security::Permissions;
1312
#endif
1413
using namespace System::Threading;
1514

src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/FontFile.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include "FontFile.h"
66
#include "DWriteTypeConverter.h"
77

8-
using namespace System::Security::Permissions;
98

109
namespace MS { namespace Internal { namespace Text { namespace TextInterface
1110
{

src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/ItemProps.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "NativePointerWrapper.h"
1111

1212
using namespace System::Security;
13-
using namespace System::Security::Permissions;
1413
using namespace MS::Internal::Text::TextInterface::Generics;
1514

1615
namespace MS { namespace Internal { namespace Text { namespace TextInterface

src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/TrueTypeSubsetter/TtfDelta/ttmem.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "fsassert.h"
2222

2323
using namespace System::Security;
24-
using namespace System::Security::Permissions;
2524

2625
void * Mem_Alloc(size_t size)
2726
{

src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ using namespace System::Reflection;
2323
using namespace System::Runtime::CompilerServices;
2424
using namespace System::Runtime::InteropServices;
2525
using namespace System::Security;
26-
using namespace System::Security::Permissions;
2726
using namespace System::Diagnostics;
2827

2928
[assembly:DependencyAttribute("System,", LoadHint::Always)];

src/Microsoft.DotNet.Wpf/src/Extensions/PresentationFramework-SystemDrawing/PresentationFramework-SystemDrawing.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,5 @@
2828
</ItemGroup>
2929
<ItemGroup>
3030
<PackageReference Include="$(SystemDrawingCommonPackage)" Version="$(SystemDrawingCommonVersion)" />
31-
<PackageReference Include="System.Security.Permissions" Version="$(SystemSecurityPermissionsPackageVersion)" />
3231
</ItemGroup>
3332
</Project>

src/Microsoft.DotNet.Wpf/src/Extensions/PresentationFramework-SystemDrawing/SystemDrawingExtension.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,6 @@ internal override Stream GetCommentFromGifStream(Stream stream)
123123
return new MemoryStream(piComment.Value);
124124
}
125125

126-
// return a new safe-printing permission
127-
internal override CodeAccessPermission NewSafePrintingPermission()
128-
{
129-
return new PrintingPermission(PrintingPermissionLevel.SafePrinting);
130-
}
131-
132-
// return a new default-printing permission
133-
internal override CodeAccessPermission NewDefaultPrintingPermission()
134-
{
135-
return new PrintingPermission(PrintingPermissionLevel.DefaultPrinting);
136-
}
137-
138126
// write a metafile stream to the output stream in PNG format
139127
internal override void SaveMetafileToImageStream(MemoryStream metafileStream, Stream imageStream)
140128
{

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/CompilationUnit.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System;
6-
using System.Security.Permissions;
76

87
namespace MS.Internal
98
{

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/FileUnit.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System;
6-
using System.Security.Permissions;
76

87
namespace MS.Internal
98
{

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/MarkupCompiler.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
using System.Reflection;
2020
using System.Globalization;
2121
using System.ComponentModel;
22-
using System.Security.Permissions;
2322
using System.Security.Cryptography;
2423

2524
using System.CodeDom;

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Shared/SourceFileInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
//---------------------------------------------------------------------------
1515

1616
using System;
17-
using System.Security.Permissions;
1817
using System.IO;
1918

2019
namespace MS.Internal

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/MarkupCompilePass1.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
using System.IO;
1515
using System.Collections;
1616
using System.Security;
17-
using System.Security.Permissions;
1817

1918
using System.Globalization;
2019
using System.Diagnostics;

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/MarkupCompilePass2.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using System.IO;
1414
using System.Collections;
1515
using System.Security;
16-
using System.Security.Permissions;
1716
using System.Text;
1817

1918
using System.Globalization;

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/Win32/UnsafeNativeMethodsPenimc.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
using System;
88
using System.Security;
9-
using System.Security.Permissions;
109
using System.Threading;
1110
using System.Runtime.InteropServices;
1211
using System.Runtime.ConstrainedExecution;

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/Win32/UnsafeNativeMethodsPointer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using System.Diagnostics;
1010
using System.Runtime.InteropServices;
1111
using System.Security;
12-
using System.Security.Permissions;
1312
using System.Text;
1413

1514
namespace MS.Win32.Pointer

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/Win32/UnsafeNativeMethodsTablet.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System;
77
using System.Text;
88
using System.Security;
9-
using System.Security.Permissions;
109
using System.Runtime.InteropServices;
1110
using System.Runtime.ConstrainedExecution;
1211
using System.Windows.Ink;

src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/internal/AppModel/CustomCredentialPolicy.cs

Lines changed: 15 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
using System.Net;
3333
using System.Runtime.InteropServices;
3434
using System.Security;
35-
using System.Security.Permissions;
3635

3736
using MS.Internal.PresentationCore;
3837
using MS.Win32;
@@ -48,13 +47,6 @@ static CustomCredentialPolicy()
4847
_initialized = false;
4948
}
5049

51-
public CustomCredentialPolicy()
52-
{
53-
_environmentPermissionSet = new PermissionSet(null);
54-
_environmentPermissionSet.AddPermission(new EnvironmentPermission(EnvironmentPermissionAccess.Read, "USERDOMAIN"));
55-
_environmentPermissionSet.AddPermission(new EnvironmentPermission(EnvironmentPermissionAccess.Read, "USERNAME"));
56-
}
57-
5850
static internal void EnsureCustomCredentialPolicy()
5951
{
6052
if (!_initialized)
@@ -63,23 +55,15 @@ static internal void EnsureCustomCredentialPolicy()
6355
{
6456
if (!_initialized)
6557
{
66-
new SecurityPermission(SecurityPermissionFlag.ControlPolicy).Assert(); // BlessedAssert:
67-
try
58+
// We should allow an application to set its own credential policy, if it has permssion to.
59+
// We do not want to overwrite the application's setting.
60+
// Check whether it is already set before setting it.
61+
// The default of this property is null. It demands ControlPolicy permission to be set.
62+
if (AuthenticationManager.CredentialPolicy == null)
6863
{
69-
// We should allow an application to set its own credential policy, if it has permssion to.
70-
// We do not want to overwrite the application's setting.
71-
// Check whether it is already set before setting it.
72-
// The default of this property is null. It demands ControlPolicy permission to be set.
73-
if (AuthenticationManager.CredentialPolicy == null)
74-
{
75-
AuthenticationManager.CredentialPolicy = new CustomCredentialPolicy();
76-
}
77-
_initialized = true;
78-
}
79-
finally
80-
{
81-
CodeAccessPermission.RevertAssert();
64+
AuthenticationManager.CredentialPolicy = new CustomCredentialPolicy();
8265
}
66+
_initialized = true;
8367
}
8468
}
8569
}
@@ -92,13 +76,13 @@ public bool ShouldSendCredential(Uri challengeUri, WebRequest request, NetworkCr
9276
switch (MapUrlToZone(challengeUri))
9377
{
9478
// Always send credentials (including default credentials) to these zones
95-
case SecurityZone.Intranet:
96-
case SecurityZone.Trusted:
97-
case SecurityZone.MyComputer:
79+
case NativeMethods.URLZONE_INTRANET:
80+
case NativeMethods.URLZONE_TRUSTED:
81+
case NativeMethods.URLZONE_LOCAL_MACHINE:
9882
return true;
9983
// Don't send default credentials to any of these zones
100-
case SecurityZone.Internet:
101-
case SecurityZone.Untrusted:
84+
case NativeMethods.URLZONE_INTERNET:
85+
case NativeMethods.URLZONE_UNTRUSTED:
10286
default:
10387
return !IsDefaultCredentials(credential);
10488
}
@@ -108,40 +92,16 @@ public bool ShouldSendCredential(Uri challengeUri, WebRequest request, NetworkCr
10892

10993
private bool IsDefaultCredentials(NetworkCredential credential)
11094
{
111-
_environmentPermissionSet.Assert(); // BlessedAssert:
112-
try
113-
{
114-
return credential == CredentialCache.DefaultCredentials;
115-
}
116-
finally
117-
{
118-
CodeAccessPermission.RevertAssert();
119-
}
95+
return credential == CredentialCache.DefaultCredentials;
12096
}
12197

122-
internal static SecurityZone MapUrlToZone(Uri uri)
98+
internal static int MapUrlToZone(Uri uri)
12399
{
124100
EnsureSecurityManager();
125101

126102
int targetZone;
127103
_securityManager.MapUrlToZone(BindUriHelper.UriToString(uri), out targetZone, 0);
128-
129-
// The enum is directly mappable, but taking no chances...
130-
switch (targetZone)
131-
{
132-
case NativeMethods.URLZONE_LOCAL_MACHINE:
133-
return SecurityZone.MyComputer;
134-
case NativeMethods.URLZONE_INTERNET:
135-
return SecurityZone.Internet;
136-
case NativeMethods.URLZONE_INTRANET:
137-
return SecurityZone.Intranet;
138-
case NativeMethods.URLZONE_TRUSTED:
139-
return SecurityZone.Trusted;
140-
case NativeMethods.URLZONE_UNTRUSTED:
141-
return SecurityZone.Untrusted;
142-
}
143-
144-
return SecurityZone.NoZone;
104+
return targetZone;
145105
}
146106

147107
private static void EnsureSecurityManager()
@@ -170,7 +130,5 @@ private class InternetSecurityManager
170130
private static object _lockObj;
171131

172132
private static bool _initialized;
173-
174-
PermissionSet _environmentPermissionSet;
175133
}
176134
}

0 commit comments

Comments
 (0)