diff options
author | Alexander Köplinger <alkpli@microsoft.com> | 2019-05-27 16:31:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-27 16:31:25 +0300 |
commit | 8aaa24604328e8b484d742fe7b6f05e99ea1ed93 (patch) | |
tree | 424e44f3a3c2e1530547b5d2adc4337098ce7ffc /src | |
parent | bd858f2629346f9d3a63df58b664408da07d54e2 (diff) |
Remove Windows-specific p/invokes from tests (#288)
They cause issues on iOS where all p/invokes need to be resolved.
Diffstat (limited to 'src')
4 files changed, 22 insertions, 0 deletions
diff --git a/src/Common/tests/System/IO/PathFeatures.cs b/src/Common/tests/System/IO/PathFeatures.cs index 7062d9ee1a..8ff564c0a8 100644 --- a/src/Common/tests/System/IO/PathFeatures.cs +++ b/src/Common/tests/System/IO/PathFeatures.cs @@ -93,7 +93,11 @@ namespace System.IO return s_osEnabled == State.True; } +#if MONO && MOBILE + private static bool RtlAreLongPathsEnabled() => throw new PlatformNotSupportedException(); +#else [DllImport("ntdll", ExactSpelling = true)] private static extern bool RtlAreLongPathsEnabled(); +#endif } } diff --git a/src/Common/tests/System/Net/Capability.Sockets.cs b/src/Common/tests/System/Net/Capability.Sockets.cs index f6a59a9821..753cb1637f 100644 --- a/src/Common/tests/System/Net/Capability.Sockets.cs +++ b/src/Common/tests/System/Net/Capability.Sockets.cs @@ -9,9 +9,13 @@ namespace System.Net.Test.Common { public static partial class Capability { +#if MONO && MOBILE + private static int RtlGetVersion(ref RTL_OSVERSIONINFOW lpVersionInformation) => throw new PlatformNotSupportedException(); +#else // TODO: Using RtlGetVersion is temporary until issue #4741 gets resolved. [DllImport("ntdll", CharSet = CharSet.Unicode)] private static extern int RtlGetVersion(ref RTL_OSVERSIONINFOW lpVersionInformation); +#endif [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] private struct RTL_OSVERSIONINFOW diff --git a/src/System.IO.FileSystem/tests/PortedCommon/DllImports.cs b/src/System.IO.FileSystem/tests/PortedCommon/DllImports.cs index 1130df6d05..4b99ea9241 100644 --- a/src/System.IO.FileSystem/tests/PortedCommon/DllImports.cs +++ b/src/System.IO.FileSystem/tests/PortedCommon/DllImports.cs @@ -8,6 +8,15 @@ using System.Text; internal static class DllImports { +#if MONO && MOBILE + internal static int GetLogicalDrives() => throw new PlatformNotSupportedException(); + + internal static bool GetDiskFreeSpaceEx(String drive, out long freeBytesForUser, out long totalBytes, out long freeBytes) => throw new PlatformNotSupportedException(); + + internal static bool GetVolumeInformation(String drive, [Out]StringBuilder volumeName, int volumeNameBufLen, out int volSerialNumber, out int maxFileNameLen, out int fileSystemFlags, [Out]StringBuilder fileSystemName, int fileSystemNameBufLen) => throw new PlatformNotSupportedException(); + + internal static int GetDriveType(string drive) => throw new PlatformNotSupportedException(); +#else [DllImport("kernel32.dll", SetLastError = true)] internal static extern int GetLogicalDrives(); @@ -19,5 +28,6 @@ internal static class DllImports [DllImport("kernel32.dll", EntryPoint = "GetDriveTypeW", CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)] internal static extern int GetDriveType(string drive); +#endif } diff --git a/src/System.Runtime.Extensions/tests/System/Environment.ProcessorCount.cs b/src/System.Runtime.Extensions/tests/System/Environment.ProcessorCount.cs index 6ebeda11bc..ea02a8d076 100644 --- a/src/System.Runtime.Extensions/tests/System/Environment.ProcessorCount.cs +++ b/src/System.Runtime.Extensions/tests/System/Environment.ProcessorCount.cs @@ -64,8 +64,12 @@ namespace System.Tests private static extern long sysconf(int name); #endif +#if MONO && MOBILE + internal static void GetSystemInfo(ref SYSTEM_INFO lpSystemInfo) => throw new PlatformNotSupportedException(); +#else [DllImport("kernel32.dll", SetLastError = true)] internal static extern void GetSystemInfo(ref SYSTEM_INFO lpSystemInfo); +#endif [StructLayout(LayoutKind.Sequential)] internal struct SYSTEM_INFO |