Xamarin Public Jenkins (auto-signing) 6bdd276d05 Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
2017-04-10 11:41:01 +00:00

39 lines
1.4 KiB
C#

//------------------------------------------------------------------------------
// <copyright file="IntSecurity.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace System.ComponentModel {
using System;
using System.Security;
using System.Security.Permissions;
[HostProtection(SharedState = true)]
internal static class IntSecurity {
#if MONO_FEATURE_CAS
public static readonly CodeAccessPermission UnmanagedCode = new SecurityPermission(SecurityPermissionFlag.UnmanagedCode);
public static readonly CodeAccessPermission FullReflection = new ReflectionPermission(PermissionState.Unrestricted);
#endif
public static string UnsafeGetFullPath(string fileName) {
#if MONO_FEATURE_CAS
string full = fileName;
FileIOPermission fiop = new FileIOPermission(PermissionState.None);
fiop.AllFiles = FileIOPermissionAccess.PathDiscovery;
fiop.Assert();
try {
full = System.IO.Path.GetFullPath(fileName);
}
finally {
CodeAccessPermission.RevertAssert();
}
return full;
#else
return System.IO.Path.GetFullPath(fileName);
#endif
}
}
}