diff options
Diffstat (limited to 'netcore/System.Private.CoreLib/shared/Interop')
181 files changed, 0 insertions, 5147 deletions
diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/Interop.Errors.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/Interop.Errors.cs deleted file mode 100644 index 943df86c229..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/Interop.Errors.cs +++ /dev/null @@ -1,210 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - /// <summary>Common Unix errno error codes.</summary> - internal enum Error - { - // These values were defined in src/Native/System.Native/fxerrno.h - // - // They compare against values obtained via Interop.Sys.GetLastError() not Marshal.GetLastWin32Error() - // which obtains the raw errno that varies between unixes. The strong typing as an enum is meant to - // prevent confusing the two. Casting to or from int is suspect. Use GetLastErrorInfo() if you need to - // correlate these to the underlying platform values or obtain the corresponding error message. - // - - SUCCESS = 0, - - E2BIG = 0x10001, // Argument list too long. - EACCES = 0x10002, // Permission denied. - EADDRINUSE = 0x10003, // Address in use. - EADDRNOTAVAIL = 0x10004, // Address not available. - EAFNOSUPPORT = 0x10005, // Address family not supported. - EAGAIN = 0x10006, // Resource unavailable, try again (same value as EWOULDBLOCK), - EALREADY = 0x10007, // Connection already in progress. - EBADF = 0x10008, // Bad file descriptor. - EBADMSG = 0x10009, // Bad message. - EBUSY = 0x1000A, // Device or resource busy. - ECANCELED = 0x1000B, // Operation canceled. - ECHILD = 0x1000C, // No child processes. - ECONNABORTED = 0x1000D, // Connection aborted. - ECONNREFUSED = 0x1000E, // Connection refused. - ECONNRESET = 0x1000F, // Connection reset. - EDEADLK = 0x10010, // Resource deadlock would occur. - EDESTADDRREQ = 0x10011, // Destination address required. - EDOM = 0x10012, // Mathematics argument out of domain of function. - EDQUOT = 0x10013, // Reserved. - EEXIST = 0x10014, // File exists. - EFAULT = 0x10015, // Bad address. - EFBIG = 0x10016, // File too large. - EHOSTUNREACH = 0x10017, // Host is unreachable. - EIDRM = 0x10018, // Identifier removed. - EILSEQ = 0x10019, // Illegal byte sequence. - EINPROGRESS = 0x1001A, // Operation in progress. - EINTR = 0x1001B, // Interrupted function. - EINVAL = 0x1001C, // Invalid argument. - EIO = 0x1001D, // I/O error. - EISCONN = 0x1001E, // Socket is connected. - EISDIR = 0x1001F, // Is a directory. - ELOOP = 0x10020, // Too many levels of symbolic links. - EMFILE = 0x10021, // File descriptor value too large. - EMLINK = 0x10022, // Too many links. - EMSGSIZE = 0x10023, // Message too large. - EMULTIHOP = 0x10024, // Reserved. - ENAMETOOLONG = 0x10025, // Filename too long. - ENETDOWN = 0x10026, // Network is down. - ENETRESET = 0x10027, // Connection aborted by network. - ENETUNREACH = 0x10028, // Network unreachable. - ENFILE = 0x10029, // Too many files open in system. - ENOBUFS = 0x1002A, // No buffer space available. - ENODEV = 0x1002C, // No such device. - ENOENT = 0x1002D, // No such file or directory. - ENOEXEC = 0x1002E, // Executable file format error. - ENOLCK = 0x1002F, // No locks available. - ENOLINK = 0x10030, // Reserved. - ENOMEM = 0x10031, // Not enough space. - ENOMSG = 0x10032, // No message of the desired type. - ENOPROTOOPT = 0x10033, // Protocol not available. - ENOSPC = 0x10034, // No space left on device. - ENOSYS = 0x10037, // Function not supported. - ENOTCONN = 0x10038, // The socket is not connected. - ENOTDIR = 0x10039, // Not a directory or a symbolic link to a directory. - ENOTEMPTY = 0x1003A, // Directory not empty. - ENOTRECOVERABLE = 0x1003B, // State not recoverable. - ENOTSOCK = 0x1003C, // Not a socket. - ENOTSUP = 0x1003D, // Not supported (same value as EOPNOTSUP). - ENOTTY = 0x1003E, // Inappropriate I/O control operation. - ENXIO = 0x1003F, // No such device or address. - EOVERFLOW = 0x10040, // Value too large to be stored in data type. - EOWNERDEAD = 0x10041, // Previous owner died. - EPERM = 0x10042, // Operation not permitted. - EPIPE = 0x10043, // Broken pipe. - EPROTO = 0x10044, // Protocol error. - EPROTONOSUPPORT = 0x10045, // Protocol not supported. - EPROTOTYPE = 0x10046, // Protocol wrong type for socket. - ERANGE = 0x10047, // Result too large. - EROFS = 0x10048, // Read-only file system. - ESPIPE = 0x10049, // Invalid seek. - ESRCH = 0x1004A, // No such process. - ESTALE = 0x1004B, // Reserved. - ETIMEDOUT = 0x1004D, // Connection timed out. - ETXTBSY = 0x1004E, // Text file busy. - EXDEV = 0x1004F, // Cross-device link. - ESOCKTNOSUPPORT = 0x1005E, // Socket type not supported. - EPFNOSUPPORT = 0x10060, // Protocol family not supported. - ESHUTDOWN = 0x1006C, // Socket shutdown. - EHOSTDOWN = 0x10070, // Host is down. - ENODATA = 0x10071, // No data available. - - // Custom Error codes to track errors beyond kernel interface. - EHOSTNOTFOUND = 0x20001, // Name lookup failed - - // POSIX permits these to have the same value and we make them always equal so - // that CoreFX cannot introduce a dependency on distinguishing between them that - // would not work on all platforms. - EOPNOTSUPP = ENOTSUP, // Operation not supported on socket. - EWOULDBLOCK = EAGAIN, // Operation would block. - } - - - // Represents a platform-agnostic Error and underlying platform-specific errno - internal struct ErrorInfo - { - private Error _error; - private int _rawErrno; - - internal ErrorInfo(int errno) - { - _error = Interop.Sys.ConvertErrorPlatformToPal(errno); - _rawErrno = errno; - } - - internal ErrorInfo(Error error) - { - _error = error; - _rawErrno = -1; - } - - internal Error Error - { - get { return _error; } - } - - internal int RawErrno - { - get { return _rawErrno == -1 ? (_rawErrno = Interop.Sys.ConvertErrorPalToPlatform(_error)) : _rawErrno; } - } - - internal string GetErrorMessage() - { - return Interop.Sys.StrError(RawErrno); - } - - public override string ToString() - { - return $"RawErrno: {RawErrno} Error: {Error} GetErrorMessage: {GetErrorMessage()}"; // No localization required; text is member names used for debugging purposes - } - } - - internal static partial class Sys - { - internal static Error GetLastError() - { - return ConvertErrorPlatformToPal(Marshal.GetLastWin32Error()); - } - - internal static ErrorInfo GetLastErrorInfo() - { - return new ErrorInfo(Marshal.GetLastWin32Error()); - } - - internal static unsafe string StrError(int platformErrno) - { - int maxBufferLength = 1024; // should be long enough for most any UNIX error - byte* buffer = stackalloc byte[maxBufferLength]; - byte* message = StrErrorR(platformErrno, buffer, maxBufferLength); - - if (message == null) - { - // This means the buffer was not large enough, but still contains - // as much of the error message as possible and is guaranteed to - // be null-terminated. We're not currently resizing/retrying because - // maxBufferLength is large enough in practice, but we could do - // so here in the future if necessary. - message = buffer; - } - - return Marshal.PtrToStringAnsi((IntPtr)message)!; - } - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ConvertErrorPlatformToPal")] - internal static extern Error ConvertErrorPlatformToPal(int platformErrno); - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ConvertErrorPalToPlatform")] - internal static extern int ConvertErrorPalToPlatform(Error error); - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_StrErrorR")] - private static extern unsafe byte* StrErrorR(int platformErrno, byte* buffer, int bufferSize); - } -} - -// NOTE: extension method can't be nested inside Interop class. -internal static class InteropErrorExtensions -{ - // Intended usage is e.g. Interop.Error.EFAIL.Info() for brevity - // vs. new Interop.ErrorInfo(Interop.Error.EFAIL) for synthesizing - // errors. Errors originated from the system should be obtained - // via GetLastErrorInfo(), not GetLastError().Info() as that will - // convert twice, which is not only inefficient but also lossy if - // we ever encounter a raw errno that no equivalent in the Error - // enum. - public static Interop.ErrorInfo Info(this Interop.Error error) - { - return new Interop.ErrorInfo(error); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/Interop.IOErrors.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/Interop.IOErrors.cs deleted file mode 100644 index 666220ea194..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/Interop.IOErrors.cs +++ /dev/null @@ -1,173 +0,0 @@ -// 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. - -#nullable enable -using System; -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - private static void ThrowExceptionForIoErrno(ErrorInfo errorInfo, string? path, bool isDirectory, Func<ErrorInfo, ErrorInfo>? errorRewriter) - { - Debug.Assert(errorInfo.Error != Error.SUCCESS); - Debug.Assert(errorInfo.Error != Error.EINTR, "EINTR errors should be handled by the native shim and never bubble up to managed code"); - - if (errorRewriter != null) - { - errorInfo = errorRewriter(errorInfo); - } - - throw Interop.GetExceptionForIoErrno(errorInfo, path, isDirectory); - } - - internal static void CheckIo(Error error, string? path = null, bool isDirectory = false, Func<ErrorInfo, ErrorInfo>? errorRewriter = null) - { - if (error != Interop.Error.SUCCESS) - { - ThrowExceptionForIoErrno(error.Info(), path, isDirectory, errorRewriter); - } - } - - /// <summary> - /// Validates the result of system call that returns greater than or equal to 0 on success - /// and less than 0 on failure, with errno set to the error code. - /// If the system call failed for any reason, an exception is thrown. Otherwise, the system call succeeded. - /// </summary> - /// <param name="result">The result of the system call.</param> - /// <param name="path">The path with which this error is associated. This may be null.</param> - /// <param name="isDirectory">true if the <paramref name="path"/> is known to be a directory; otherwise, false.</param> - /// <param name="errorRewriter">Optional function to change an error code prior to processing it.</param> - /// <returns> - /// On success, returns the non-negative result long that was validated. - /// </returns> - internal static long CheckIo(long result, string? path = null, bool isDirectory = false, Func<ErrorInfo, ErrorInfo>? errorRewriter = null) - { - if (result < 0) - { - ThrowExceptionForIoErrno(Sys.GetLastErrorInfo(), path, isDirectory, errorRewriter); - } - - return result; - } - - /// <summary> - /// Validates the result of system call that returns greater than or equal to 0 on success - /// and less than 0 on failure, with errno set to the error code. - /// If the system call failed for any reason, an exception is thrown. Otherwise, the system call succeeded. - /// </summary> - /// <returns> - /// On success, returns the non-negative result int that was validated. - /// </returns> - internal static int CheckIo(int result, string? path = null, bool isDirectory = false, Func<ErrorInfo, ErrorInfo>? errorRewriter = null) - { - CheckIo((long)result, path, isDirectory, errorRewriter); - - return result; - } - - /// <summary> - /// Validates the result of system call that returns greater than or equal to 0 on success - /// and less than 0 on failure, with errno set to the error code. - /// If the system call failed for any reason, an exception is thrown. Otherwise, the system call succeeded. - /// </summary> - /// <returns> - /// On success, returns the non-negative result IntPtr that was validated. - /// </returns> - internal static IntPtr CheckIo(IntPtr result, string? path = null, bool isDirectory = false, Func<ErrorInfo, ErrorInfo>? errorRewriter = null) - { - CheckIo((long)result, path, isDirectory, errorRewriter); - - return result; - } - - /// <summary> - /// Validates the result of system call that returns greater than or equal to 0 on success - /// and less than 0 on failure, with errno set to the error code. - /// If the system call failed for any reason, an exception is thrown. Otherwise, the system call succeeded. - /// </summary> - /// <returns> - /// On success, returns the valid SafeFileHandle that was validated. - /// </returns> - internal static TSafeHandle CheckIo<TSafeHandle>(TSafeHandle handle, string? path = null, bool isDirectory = false, Func<ErrorInfo, ErrorInfo>? errorRewriter = null) - where TSafeHandle : SafeHandle - { - if (handle.IsInvalid) - { - ThrowExceptionForIoErrno(Sys.GetLastErrorInfo(), path, isDirectory, errorRewriter); - } - - return handle; - } - - /// <summary> - /// Gets an Exception to represent the supplied error info. - /// </summary> - /// <param name="errorInfo">The error info</param> - /// <param name="path">The path with which this error is associated. This may be null.</param> - /// <param name="isDirectory">true if the <paramref name="path"/> is known to be a directory; otherwise, false.</param> - /// <returns></returns> - internal static Exception GetExceptionForIoErrno(ErrorInfo errorInfo, string? path = null, bool isDirectory = false) - { - // Translate the errno into a known set of exception types. For cases where multiple errnos map - // to the same exception type, include an inner exception with the details. - switch (errorInfo.Error) - { - case Error.ENOENT: - if (isDirectory) - { - return !string.IsNullOrEmpty(path) ? - new DirectoryNotFoundException(SR.Format(SR.IO_PathNotFound_Path, path)) : - new DirectoryNotFoundException(SR.IO_PathNotFound_NoPathName); - } - else - { - return !string.IsNullOrEmpty(path) ? - new FileNotFoundException(SR.Format(SR.IO_FileNotFound_FileName, path), path) : - new FileNotFoundException(SR.IO_FileNotFound); - } - - case Error.EACCES: - case Error.EBADF: - case Error.EPERM: - Exception inner = GetIOException(errorInfo); - return !string.IsNullOrEmpty(path) ? - new UnauthorizedAccessException(SR.Format(SR.UnauthorizedAccess_IODenied_Path, path), inner) : - new UnauthorizedAccessException(SR.UnauthorizedAccess_IODenied_NoPathName, inner); - - case Error.ENAMETOOLONG: - return !string.IsNullOrEmpty(path) ? - new PathTooLongException(SR.Format(SR.IO_PathTooLong_Path, path)) : - new PathTooLongException(SR.IO_PathTooLong); - - case Error.EWOULDBLOCK: - return !string.IsNullOrEmpty(path) ? - new IOException(SR.Format(SR.IO_SharingViolation_File, path), errorInfo.RawErrno) : - new IOException(SR.IO_SharingViolation_NoFileName, errorInfo.RawErrno); - - case Error.ECANCELED: - return new OperationCanceledException(); - - case Error.EFBIG: - return new ArgumentOutOfRangeException("value", SR.ArgumentOutOfRange_FileLengthTooBig); - - case Error.EEXIST: - if (!string.IsNullOrEmpty(path)) - { - return new IOException(SR.Format(SR.IO_FileExists_Name, path), errorInfo.RawErrno); - } - goto default; - - default: - return GetIOException(errorInfo); - } - } - - internal static Exception GetIOException(Interop.ErrorInfo errorInfo) - { - return new IOException(errorInfo.GetErrorMessage(), errorInfo.RawErrno); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/Interop.Libraries.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/Interop.Libraries.cs deleted file mode 100644 index 02d00924450..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/Interop.Libraries.cs +++ /dev/null @@ -1,12 +0,0 @@ -// 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. - -internal static partial class Interop -{ - internal static partial class Libraries - { - internal const string GlobalizationNative = "System.Globalization.Native"; - internal const string SystemNative = "System.Native"; - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Calendar.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Calendar.cs deleted file mode 100644 index 764bdaf85af..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Calendar.cs +++ /dev/null @@ -1,33 +0,0 @@ -// 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.Globalization; -using System.Runtime.InteropServices; -using System.Text; - -internal static partial class Interop -{ - internal static partial class Globalization - { - internal delegate void EnumCalendarInfoCallback( - [MarshalAs(UnmanagedType.LPWStr)] string calendarString, - IntPtr context); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetCalendars")] - internal static extern int GetCalendars(string localeName, CalendarId[] calendars, int calendarsCapacity); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetCalendarInfo")] - internal static extern unsafe ResultCode GetCalendarInfo(string localeName, CalendarId calendarId, CalendarDataType calendarDataType, char* result, int resultCapacity); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_EnumCalendarInfo")] - internal static extern bool EnumCalendarInfo(EnumCalendarInfoCallback callback, string localeName, CalendarId calendarId, CalendarDataType calendarDataType, IntPtr context); - - [DllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetLatestJapaneseEra")] - internal static extern int GetLatestJapaneseEra(); - - [DllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetJapaneseEraStartDate")] - internal static extern bool GetJapaneseEraStartDate(int era, out int startYear, out int startMonth, out int startDay); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Casing.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Casing.cs deleted file mode 100644 index 503a864d693..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Casing.cs +++ /dev/null @@ -1,23 +0,0 @@ -// 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.Runtime.InteropServices; -using System.Security; -using System.Text; - -internal static partial class Interop -{ - internal static partial class Globalization - { - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ChangeCase")] - internal static extern unsafe void ChangeCase(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ChangeCaseInvariant")] - internal static extern unsafe void ChangeCaseInvariant(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ChangeCaseTurkish")] - internal static extern unsafe void ChangeCaseTurkish(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Collation.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Collation.cs deleted file mode 100644 index 7d0175473d7..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Collation.cs +++ /dev/null @@ -1,59 +0,0 @@ -// 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.Globalization; -using System.Runtime.InteropServices; -using System.Security; - -internal static partial class Interop -{ - internal static partial class Globalization - { - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Ansi, EntryPoint = "GlobalizationNative_GetSortHandle")] - internal static extern unsafe ResultCode GetSortHandle(string localeName, out IntPtr sortHandle); - - [DllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_CloseSortHandle")] - internal static extern unsafe void CloseSortHandle(IntPtr handle); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_CompareString")] - internal static extern unsafe int CompareString(IntPtr sortHandle, char* lpStr1, int cwStr1Len, char* lpStr2, int cwStr2Len, CompareOptions options); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IndexOf")] - internal static extern unsafe int IndexOf(IntPtr sortHandle, char* target, int cwTargetLength, char* pSource, int cwSourceLength, CompareOptions options, int* matchLengthPtr); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_LastIndexOf")] - internal static extern unsafe int LastIndexOf(IntPtr sortHandle, char* target, int cwTargetLength, char* pSource, int cwSourceLength, CompareOptions options); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IndexOfOrdinalIgnoreCase")] - internal static extern unsafe int IndexOfOrdinalIgnoreCase(string target, int cwTargetLength, char* pSource, int cwSourceLength, bool findLast); - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IndexOfOrdinalIgnoreCase")] - internal static extern unsafe int IndexOfOrdinalIgnoreCase(char* target, int cwTargetLength, char* pSource, int cwSourceLength, bool findLast); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_StartsWith")] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern unsafe bool StartsWith(IntPtr sortHandle, char* target, int cwTargetLength, char* source, int cwSourceLength, CompareOptions options); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_EndsWith")] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern unsafe bool EndsWith(IntPtr sortHandle, char* target, int cwTargetLength, char* source, int cwSourceLength, CompareOptions options); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_StartsWith")] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern unsafe bool StartsWith(IntPtr sortHandle, string target, int cwTargetLength, string source, int cwSourceLength, CompareOptions options); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_EndsWith")] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern unsafe bool EndsWith(IntPtr sortHandle, string target, int cwTargetLength, string source, int cwSourceLength, CompareOptions options); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetSortKey")] - internal static extern unsafe int GetSortKey(IntPtr sortHandle, char* str, int strLength, byte* sortKey, int sortKeyLength, CompareOptions options); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_CompareStringOrdinalIgnoreCase")] - internal static extern unsafe int CompareStringOrdinalIgnoreCase(char* lpStr1, int cwStr1Len, char* lpStr2, int cwStr2Len); - - [DllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetSortVersion")] - internal static extern int GetSortVersion(IntPtr sortHandle); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.ICU.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.ICU.cs deleted file mode 100644 index a16c813b2f5..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.ICU.cs +++ /dev/null @@ -1,16 +0,0 @@ -// 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.Runtime.InteropServices; -using System.Runtime.CompilerServices; - -internal static partial class Interop -{ - internal static partial class Globalization - { - [DllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_LoadICU")] - internal static extern int LoadICU(); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Idna.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Idna.cs deleted file mode 100644 index 89b6c3cebec..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Idna.cs +++ /dev/null @@ -1,21 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Globalization - { - internal const int AllowUnassigned = 0x1; - internal const int UseStd3AsciiRules = 0x2; - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ToAscii")] - internal static extern unsafe int ToAscii(uint flags, char* src, int srcLen, char* dstBuffer, int dstBufferCapacity); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ToUnicode")] - internal static extern unsafe int ToUnicode(uint flags, char* src, int srcLen, char* dstBuffer, int dstBufferCapacity); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Locale.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Locale.cs deleted file mode 100644 index b563752bc00..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Locale.cs +++ /dev/null @@ -1,39 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Globalization - { - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleName")] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern unsafe bool GetLocaleName(string localeName, char* value, int valueLength); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleInfoString")] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern unsafe bool GetLocaleInfoString(string localeName, uint localeStringData, char* value, int valueLength); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetDefaultLocaleName")] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern unsafe bool GetDefaultLocaleName(char* value, int valueLength); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleTimeFormat")] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern unsafe bool GetLocaleTimeFormat(string localeName, bool shortFormat, char* value, int valueLength); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleInfoInt")] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool GetLocaleInfoInt(string localeName, uint localeNumberData, ref int value); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleInfoGroupingSizes")] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool GetLocaleInfoGroupingSizes(string localeName, uint localeGroupingData, ref int primaryGroupSize, ref int secondaryGroupSize); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocales")] - internal static extern int GetLocales([Out] char[]? value, int valueLength); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Normalization.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Normalization.cs deleted file mode 100644 index d442da0ea13..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Normalization.cs +++ /dev/null @@ -1,19 +0,0 @@ -// 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.Runtime.InteropServices; -using System.Text; - -internal static partial class Interop -{ - internal static partial class Globalization - { - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IsNormalized")] - internal static extern int IsNormalized(NormalizationForm normalizationForm, string src, int srcLen); - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_NormalizeString")] - internal static extern int NormalizeString(NormalizationForm normalizationForm, string src, int srcLen, [Out] char[] dstBuffer, int dstBufferCapacity); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.ResultCode.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.ResultCode.cs deleted file mode 100644 index 4a9933f9291..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.ResultCode.cs +++ /dev/null @@ -1,18 +0,0 @@ -// 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. - -internal static partial class Interop -{ - internal static partial class Globalization - { - // needs to be kept in sync with ResultCode in System.Globalization.Native - internal enum ResultCode - { - Success = 0, - UnknownError = 1, - InsufficentBuffer = 2, - OutOfMemory = 3 - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.TimeZoneInfo.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.TimeZoneInfo.cs deleted file mode 100644 index df488b6ffa1..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.TimeZoneInfo.cs +++ /dev/null @@ -1,28 +0,0 @@ -// 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.Runtime.InteropServices; -using System.Text; - -internal static partial class Interop -{ - internal static partial class Globalization - { - // needs to be kept in sync with TimeZoneDisplayNameType in System.Globalization.Native - internal enum TimeZoneDisplayNameType - { - Generic = 0, - Standard = 1, - DaylightSavings = 2, - } - - [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetTimeZoneDisplayName")] - internal static extern unsafe ResultCode GetTimeZoneDisplayName( - string localeName, - string timeZoneId, - TimeZoneDisplayNameType type, - char* result, - int resultLength); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Utils.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Utils.cs deleted file mode 100644 index 627ab56c918..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Globalization.Native/Interop.Utils.cs +++ /dev/null @@ -1,48 +0,0 @@ -// 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.Diagnostics; -using System.Buffers; -using System.Text; - -internal static partial class Interop -{ - /// <summary> - /// Helper for making interop calls that return a string, but we don't know - /// the correct size of buffer to make. So invoke the interop call with an - /// increasing buffer until the size is big enough. - /// </summary> - internal static bool CallStringMethod<TArg1, TArg2, TArg3>( - SpanFunc<char, TArg1, TArg2, TArg3, Interop.Globalization.ResultCode> interopCall, - TArg1 arg1, TArg2 arg2, TArg3 arg3, - out string? result) - { - const int InitialSize = 256; // arbitrary stack allocation size - const int MaxHeapSize = 1280; // max from previous version of the code, starting at 80 and doubling four times - - Span<char> buffer = stackalloc char[InitialSize]; - Interop.Globalization.ResultCode resultCode = interopCall(buffer, arg1, arg2, arg3); - - if (resultCode == Interop.Globalization.ResultCode.Success) - { - result = buffer.Slice(0, buffer.IndexOf('\0')).ToString(); - return true; - } - - if (resultCode == Interop.Globalization.ResultCode.InsufficentBuffer) - { - // Increase the string size and try again - buffer = new char[MaxHeapSize]; - if (interopCall(buffer, arg1, arg2, arg3) == Interop.Globalization.ResultCode.Success) - { - result = buffer.Slice(0, buffer.IndexOf('\0')).ToString(); - return true; - } - } - - result = null; - return false; - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Access.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Access.cs deleted file mode 100644 index a723f572a5b..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Access.cs +++ /dev/null @@ -1,23 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - internal enum AccessMode : int - { - F_OK = 0, /* Check for existence */ - X_OK = 1, /* Check for execute */ - W_OK = 2, /* Check for write */ - R_OK = 4, /* Check for read */ - } - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Access", SetLastError = true)] - internal static extern int Access(string path, AccessMode mode); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.ChDir.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.ChDir.cs deleted file mode 100644 index 3c66995182a..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.ChDir.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ChDir", SetLastError = true)] - internal static extern int ChDir(string path); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Close.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Close.cs deleted file mode 100644 index 8d192398a03..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Close.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Close", SetLastError = true)] - internal static extern int Close(IntPtr fd); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.FLock.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.FLock.cs deleted file mode 100644 index 22934a3e77d..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.FLock.cs +++ /dev/null @@ -1,31 +0,0 @@ -// 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.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - internal enum LockOperations : int - { - LOCK_SH = 1, /* shared lock */ - LOCK_EX = 2, /* exclusive lock */ - LOCK_NB = 4, /* don't block when locking*/ - LOCK_UN = 8, /* unlock */ - } - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FLock", SetLastError = true)] - internal static extern int FLock(SafeFileHandle fd, LockOperations operation); - - /// <summary> - /// Exposing this for SafeFileHandle.ReleaseHandle() to call. - /// Normal callers should use FLock(SafeFileHandle fd). - /// </summary> - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FLock", SetLastError = true)] - internal static extern int FLock(IntPtr fd, LockOperations operation); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.FSync.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.FSync.cs deleted file mode 100644 index e3ab9709313..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.FSync.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FSync", SetLastError = true)] - internal static extern int FSync(SafeFileHandle fd); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.FTruncate.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.FTruncate.cs deleted file mode 100644 index 5dad650362d..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.FTruncate.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FTruncate", SetLastError = true)] - internal static extern int FTruncate(SafeFileHandle fd, long length); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetCpuUtilization.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetCpuUtilization.cs deleted file mode 100644 index a630a3e82c3..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetCpuUtilization.cs +++ /dev/null @@ -1,24 +0,0 @@ -// 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.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal unsafe partial class Sys - { - [StructLayout(LayoutKind.Sequential)] - internal struct ProcessCpuInformation - { - internal ulong lastRecordedCurrentTime; - internal ulong lastRecordedKernelTime; - internal ulong lastRecordedUserTime; - } - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetCpuUtilization")] - internal static extern unsafe int GetCpuUtilization(ref ProcessCpuInformation previousCpuInfo); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetCwd.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetCwd.cs deleted file mode 100644 index b339ab2f596..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetCwd.cs +++ /dev/null @@ -1,73 +0,0 @@ -// 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.Buffers; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetCwd", SetLastError = true)] - private static extern unsafe byte* GetCwd(byte* buffer, int bufferLength); - - internal static unsafe string GetCwd() - { - const int StackLimit = 256; - - // First try to get the path into a buffer on the stack - byte* stackBuf = stackalloc byte[StackLimit]; - string? result = GetCwdHelper(stackBuf, StackLimit); - if (result != null) - { - return result; - } - - // If that was too small, try increasing large buffer sizes - int bufferSize = StackLimit; - while (true) - { - checked { bufferSize *= 2; } - byte[] buf = ArrayPool<byte>.Shared.Rent(bufferSize); - try - { - fixed (byte* ptr = &buf[0]) - { - result = GetCwdHelper(ptr, buf.Length); - if (result != null) - { - return result; - } - } - } - finally - { - ArrayPool<byte>.Shared.Return(buf); - } - } - } - - private static unsafe string? GetCwdHelper(byte* ptr, int bufferSize) - { - // Call the real getcwd - byte* result = GetCwd(ptr, bufferSize); - - // If it returned non-null, the null-terminated path is in the buffer - if (result != null) - { - return Marshal.PtrToStringAnsi((IntPtr)ptr); - } - - // Otherwise, if it failed due to the buffer being too small, return null; - // for anything else, throw. - ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo(); - if (errorInfo.Error == Interop.Error.ERANGE) - { - return null; - } - throw Interop.GetExceptionForIoErrno(errorInfo); - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetEUid.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetEUid.cs deleted file mode 100644 index 8b525fa3272..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetEUid.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetEUid")] - internal static extern uint GetEUid(); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetHostName.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetHostName.cs deleted file mode 100644 index f2555b0fc82..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetHostName.cs +++ /dev/null @@ -1,40 +0,0 @@ -// 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.Diagnostics; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetHostName", SetLastError = true)] - private static extern unsafe int GetHostName(byte* name, int nameLength); - - internal static unsafe string GetHostName() - { - const int HOST_NAME_MAX = 255; - const int ArrLength = HOST_NAME_MAX + 1; - - byte* name = stackalloc byte[ArrLength]; - int err = GetHostName(name, ArrLength); - if (err != 0) - { - // This should never happen. According to the man page, - // the only possible errno for gethostname is ENAMETOOLONG, - // which should only happen if the buffer we supply isn't big - // enough, and we're using a buffer size that the man page - // says is the max for POSIX (and larger than the max for Linux). - Debug.Fail($"GetHostName failed with error {err}"); - throw new InvalidOperationException($"{nameof(GetHostName)}: {err}"); - } - - // If the hostname is truncated, it is unspecified whether the returned buffer includes a terminating null byte. - name[ArrLength - 1] = 0; - - return Marshal.PtrToStringAnsi((IntPtr)name)!; - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetPid.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetPid.cs deleted file mode 100644 index 02d259db7d1..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetPid.cs +++ /dev/null @@ -1,17 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPid")] - internal static extern int GetPid(); - } - - internal static uint GetCurrentProcessId() => (uint)Sys.GetPid(); -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetPwUid.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetPwUid.cs deleted file mode 100644 index 28b2309d03e..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetPwUid.cs +++ /dev/null @@ -1,31 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - internal unsafe struct Passwd - { - internal const int InitialBufferSize = 256; - - internal byte* Name; - internal byte* Password; - internal uint UserId; - internal uint GroupId; - internal byte* UserInfo; - internal byte* HomeDirectory; - internal byte* Shell; - } - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPwUidR", SetLastError = false)] - internal static extern unsafe int GetPwUidR(uint uid, out Passwd pwd, byte* buf, int bufLen); - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPwNamR", SetLastError = false)] - internal static extern unsafe int GetPwNamR(string name, out Passwd pwd, byte* buf, int bufLen); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetRandomBytes.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetRandomBytes.cs deleted file mode 100644 index 858506935ae..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetRandomBytes.cs +++ /dev/null @@ -1,21 +0,0 @@ -// 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.Diagnostics; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal unsafe partial class Sys - { - [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetNonCryptographicallySecureRandomBytes")] - internal static extern unsafe void GetNonCryptographicallySecureRandomBytes(byte* buffer, int length); - } - - internal static unsafe void GetRandomBytes(byte* buffer, int length) - { - Sys.GetNonCryptographicallySecureRandomBytes(buffer, length); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetSystemTimeAsTicks.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetSystemTimeAsTicks.cs deleted file mode 100644 index f02ecac13b9..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetSystemTimeAsTicks.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal unsafe partial class Sys - { - [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetSystemTimeAsTicks")] - internal static extern long GetSystemTimeAsTicks(); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetTimestamp.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetTimestamp.cs deleted file mode 100644 index 53acdbc3cc3..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetTimestamp.cs +++ /dev/null @@ -1,18 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetTimestampResolution", ExactSpelling = true)] - internal static extern ulong GetTimestampResolution(); - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetTimestamp", ExactSpelling = true)] - [SuppressGCTransition] - internal static extern ulong GetTimestamp(); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetUnixName.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetUnixName.cs deleted file mode 100644 index fb925b9dca9..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetUnixName.cs +++ /dev/null @@ -1,21 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetUnixName")] - private static extern IntPtr GetUnixNamePrivate(); - - internal static string GetUnixName() - { - IntPtr ptr = GetUnixNamePrivate(); - return Marshal.PtrToStringAnsi(ptr)!; - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetUnixRelease.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetUnixRelease.cs deleted file mode 100644 index 5e41ae98046..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.GetUnixRelease.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetUnixRelease", CharSet = CharSet.Ansi, SetLastError = true)] - public static extern string GetUnixRelease(); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.LSeek.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.LSeek.cs deleted file mode 100644 index 7f8df7c6bf9..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.LSeek.cs +++ /dev/null @@ -1,22 +0,0 @@ -// 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.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - internal enum SeekWhence - { - SEEK_SET = 0, - SEEK_CUR = 1, - SEEK_END = 2 - } - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LSeek", SetLastError = true)] - internal static extern long LSeek(SafeFileHandle fd, long offset, SeekWhence whence); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.LockFileRegion.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.LockFileRegion.cs deleted file mode 100644 index 1deb9a43132..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.LockFileRegion.cs +++ /dev/null @@ -1,21 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - internal enum LockType : short - { - F_WRLCK = 1, // exclusive or write lock - F_UNLCK = 2 // unlock - } - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LockFileRegion", SetLastError=true)] - internal static extern int LockFileRegion(SafeHandle fd, long offset, long length, LockType lockType); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.MksTemps.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.MksTemps.cs deleted file mode 100644 index 14c2d989130..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.MksTemps.cs +++ /dev/null @@ -1,17 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_MksTemps", SetLastError = true)] - internal static extern IntPtr MksTemps( - byte[] template, - int suffixlen); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.MountPoints.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.MountPoints.cs deleted file mode 100644 index 134dcb92037..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.MountPoints.cs +++ /dev/null @@ -1,40 +0,0 @@ -// 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.Collections.Generic; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private unsafe delegate void MountPointFound(byte* name); - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetAllMountPoints", SetLastError = true)] - private static extern int GetAllMountPoints(MountPointFound mpf); - - internal static string[] GetAllMountPoints() - { - int count = 0; - var found = new string[4]; - - unsafe - { - int result = GetAllMountPoints((byte* name) => - { - if (count == found.Length) - { - Array.Resize(ref found, count * 2); - } - found[count++] = Marshal.PtrToStringAnsi((IntPtr)name)!; - }); - } - - Array.Resize(ref found, count); - return found; - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Open.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Open.cs deleted file mode 100644 index a9a994c78c0..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Open.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Open", SetLastError = true)] - internal static extern SafeFileHandle Open(string filename, OpenFlags flags, int mode); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.OpenFlags.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.OpenFlags.cs deleted file mode 100644 index f9e54c3cbcf..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.OpenFlags.cs +++ /dev/null @@ -1,27 +0,0 @@ -// 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; - -internal static partial class Interop -{ - internal static partial class Sys - { - [Flags] - internal enum OpenFlags - { - // Access modes (mutually exclusive) - O_RDONLY = 0x0000, - O_WRONLY = 0x0001, - O_RDWR = 0x0002, - - // Flags (combinable) - O_CLOEXEC = 0x0010, - O_CREAT = 0x0020, - O_EXCL = 0x0040, - O_TRUNC = 0x0080, - O_SYNC = 0x0100, - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.PathConf.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.PathConf.cs deleted file mode 100644 index 7213cb02640..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.PathConf.cs +++ /dev/null @@ -1,28 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - internal enum PathConfName : int - { - PC_LINK_MAX = 1, - PC_MAX_CANON = 2, - PC_MAX_INPUT = 3, - PC_NAME_MAX = 4, - PC_PATH_MAX = 5, - PC_PIPE_BUF = 6, - PC_CHOWN_RESTRICTED = 7, - PC_NO_TRUNC = 8, - PC_VDISABLE = 9, - } - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PathConf", SetLastError = true)] - private static extern int PathConf(string path, PathConfName name); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Permissions.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Permissions.cs deleted file mode 100644 index f1d13787d25..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Permissions.cs +++ /dev/null @@ -1,32 +0,0 @@ -// 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; - -internal static partial class Interop -{ - internal static partial class Sys - { - [Flags] - internal enum Permissions - { - Mask = S_IRWXU | S_IRWXG | S_IRWXO, - - S_IRWXU = S_IRUSR | S_IWUSR | S_IXUSR, - S_IRUSR = 0x100, - S_IWUSR = 0x80, - S_IXUSR = 0x40, - - S_IRWXG = S_IRGRP | S_IWGRP | S_IXGRP, - S_IRGRP = 0x20, - S_IWGRP = 0x10, - S_IXGRP = 0x8, - - S_IRWXO = S_IROTH | S_IWOTH | S_IXOTH, - S_IROTH = 0x4, - S_IWOTH = 0x2, - S_IXOTH = 0x1, - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.PosixFAdvise.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.PosixFAdvise.cs deleted file mode 100644 index ad8b73aed21..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.PosixFAdvise.cs +++ /dev/null @@ -1,36 +0,0 @@ -// 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.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - internal enum FileAdvice : int - { - POSIX_FADV_NORMAL = 0, /* no special advice, the default value */ - POSIX_FADV_RANDOM = 1, /* random I/O access */ - POSIX_FADV_SEQUENTIAL = 2, /* sequential I/O access */ - POSIX_FADV_WILLNEED = 3, /* will need specified pages */ - POSIX_FADV_DONTNEED = 4, /* don't need the specified pages */ - POSIX_FADV_NOREUSE = 5, /* data will only be accessed once */ - } - - /// <summary> - /// Notifies the OS kernel that the specified file will be accessed in a particular way soon; this allows the kernel to - /// potentially optimize the access pattern of the file. - /// </summary> - /// <param name="fd">The file descriptor of the file</param> - /// <param name="offset">The start of the region to advise about</param> - /// <param name="length">The number of bytes of the region (until the end of the file if 0)</param> - /// <param name="advice">The type of advice to give the kernel about the specified region</param> - /// <returns> - /// Returns 0 on success; otherwise, the error code is returned - /// </returns> - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PosixFAdvise", SetLastError = false /* this is explicitly called out in the man page */)] - internal static extern int PosixFAdvise(SafeFileHandle fd, long offset, long length, FileAdvice advice); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Read.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Read.cs deleted file mode 100644 index 233feabdbb6..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Read.cs +++ /dev/null @@ -1,25 +0,0 @@ -// 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.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - /// <summary> - /// Reads a number of bytes from an open file descriptor into a specified buffer. - /// </summary> - /// <param name="fd">The open file descriptor to try to read from</param> - /// <param name="buffer">The buffer to read info into</param> - /// <param name="count">The size of the buffer</param> - /// <returns> - /// Returns the number of bytes read on success; otherwise, -1 is returned - /// Note - on fail. the position of the stream may change depending on the platform; consult man 2 read for more info - /// </returns> - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Read", SetLastError = true)] - internal static extern unsafe int Read(SafeHandle fd, byte* buffer, int count); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.ReadDir.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.ReadDir.cs deleted file mode 100644 index cacb3664db0..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.ReadDir.cs +++ /dev/null @@ -1,69 +0,0 @@ -// 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.Diagnostics; -using System.Runtime.InteropServices; -using System.Text; - -internal static partial class Interop -{ - internal static partial class Sys - { - internal enum NodeType : int - { - DT_UNKNOWN = 0, - DT_FIFO = 1, - DT_CHR = 2, - DT_DIR = 4, - DT_BLK = 6, - DT_REG = 8, - DT_LNK = 10, - DT_SOCK = 12, - DT_WHT = 14 - } - - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct DirectoryEntry - { - internal byte* Name; - internal int NameLength; - internal NodeType InodeType; - internal const int NameBufferSize = 256; // sizeof(dirent->d_name) == NAME_MAX + 1 - - internal ReadOnlySpan<char> GetName(Span<char> buffer) - { - // -1 for null terminator (buffer will not include one), - // and -1 because GetMaxCharCount pessimistically assumes the buffer may start with a partial surrogate - Debug.Assert(buffer.Length >= Encoding.UTF8.GetMaxCharCount(NameBufferSize - 1 - 1)); - - Debug.Assert(Name != null, "should not have a null name"); - - ReadOnlySpan<byte> nameBytes = (NameLength == -1) - // In this case the struct was allocated via struct dirent *readdir(DIR *dirp); - ? new ReadOnlySpan<byte>(Name, new ReadOnlySpan<byte>(Name, NameBufferSize).IndexOf<byte>(0)) - : new ReadOnlySpan<byte>(Name, NameLength); - - Debug.Assert(nameBytes.Length > 0, "we shouldn't have gotten a garbage value from the OS"); - - int charCount = Encoding.UTF8.GetChars(nameBytes, buffer); - ReadOnlySpan<char> value = buffer.Slice(0, charCount); - Debug.Assert(NameLength != -1 || !value.Contains('\0'), "should not have embedded nulls if we parsed the end of string"); - return value; - } - } - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_OpenDir", SetLastError = true)] - internal static extern IntPtr OpenDir(string path); - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetReadDirRBufferSize", SetLastError = false)] - internal static extern int GetReadDirRBufferSize(); - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ReadDirR", SetLastError = false)] - internal static extern unsafe int ReadDirR(IntPtr dir, byte* buffer, int bufferSize, out DirectoryEntry outputEntry); - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_CloseDir", SetLastError = true)] - internal static extern int CloseDir(IntPtr dir); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.ReadLink.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.ReadLink.cs deleted file mode 100644 index b945bc982c5..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.ReadLink.cs +++ /dev/null @@ -1,64 +0,0 @@ -// 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. - -#nullable enable -using System.Runtime.InteropServices; -using System.Buffers; -using System.Text; - -internal static partial class Interop -{ - internal static partial class Sys - { - /// <summary> - /// Takes a path to a symbolic link and attempts to place the link target path into the buffer. If the buffer is too - /// small, the path will be truncated. No matter what, the buffer will not be null terminated. - /// </summary> - /// <param name="path">The path to the symlink</param> - /// <param name="buffer">The buffer to hold the output path</param> - /// <param name="bufferSize">The size of the buffer</param> - /// <returns> - /// Returns the number of bytes placed into the buffer on success; bufferSize if the buffer is too small; and -1 on error. - /// </returns> - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ReadLink", SetLastError = true)] - private static extern unsafe int ReadLink(string path, byte[] buffer, int bufferSize); - - /// <summary> - /// Takes a path to a symbolic link and returns the link target path. - /// </summary> - /// <param name="path">The path to the symlink</param> - /// <returns> - /// Returns the link to the target path on success; and null otherwise. - /// </returns> - public static string? ReadLink(string path) - { - int bufferSize = 256; - while (true) - { - byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferSize); - try - { - int resultLength = Interop.Sys.ReadLink(path, buffer, buffer.Length); - if (resultLength < 0) - { - // error - return null; - } - else if (resultLength < buffer.Length) - { - // success - return Encoding.UTF8.GetString(buffer, 0, resultLength); - } - } - finally - { - ArrayPool<byte>.Shared.Return(buffer); - } - - // buffer was too small, loop around again and try with a larger buffer. - bufferSize *= 2; - } - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Stat.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Stat.cs deleted file mode 100644 index d06fbda7185..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Stat.cs +++ /dev/null @@ -1,66 +0,0 @@ -// 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.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - // Even though csc will by default use a sequential layout, a CS0649 warning as error - // is produced for un-assigned fields when no StructLayout is specified. - // - // Explicitly saying Sequential disables that warning/error for consumers which only - // use Stat in debug builds. - [StructLayout(LayoutKind.Sequential)] - internal struct FileStatus - { - internal FileStatusFlags Flags; - internal int Mode; - internal uint Uid; - internal uint Gid; - internal long Size; - internal long ATime; - internal long ATimeNsec; - internal long MTime; - internal long MTimeNsec; - internal long CTime; - internal long CTimeNsec; - internal long BirthTime; - internal long BirthTimeNsec; - internal long Dev; - internal long Ino; - internal uint UserFlags; - } - - internal static class FileTypes - { - internal const int S_IFMT = 0xF000; - internal const int S_IFIFO = 0x1000; - internal const int S_IFCHR = 0x2000; - internal const int S_IFDIR = 0x4000; - internal const int S_IFREG = 0x8000; - internal const int S_IFLNK = 0xA000; - internal const int S_IFSOCK = 0xC000; - } - - [Flags] - internal enum FileStatusFlags - { - None = 0, - HasBirthTime = 1, - } - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FStat", SetLastError = true)] - internal static extern int FStat(SafeFileHandle fd, out FileStatus output); - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Stat", SetLastError = true)] - internal static extern int Stat(string path, out FileStatus output); - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LStat", SetLastError = true)] - internal static extern int LStat(string path, out FileStatus output); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.SysConf.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.SysConf.cs deleted file mode 100644 index be0c0dee7bb..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.SysConf.cs +++ /dev/null @@ -1,20 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - internal enum SysConfName - { - _SC_CLK_TCK = 1, - _SC_PAGESIZE = 2 - } - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SysConf", SetLastError = true)] - internal static extern long SysConf(SysConfName name); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.SysLog.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.SysLog.cs deleted file mode 100644 index 2edde6fbc11..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.SysLog.cs +++ /dev/null @@ -1,58 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - internal enum SysLogPriority : int - { - // Priorities - LOG_EMERG = 0, /* system is unusable */ - LOG_ALERT = 1, /* action must be taken immediately */ - LOG_CRIT = 2, /* critical conditions */ - LOG_ERR = 3, /* error conditions */ - LOG_WARNING = 4, /* warning conditions */ - LOG_NOTICE = 5, /* normal but significant condition */ - LOG_INFO = 6, /* informational */ - LOG_DEBUG = 7, /* debug-level messages */ - // Facilities - LOG_KERN = (0<<3), /* kernel messages */ - LOG_USER = (1<<3), /* random user-level messages */ - LOG_MAIL = (2<<3), /* mail system */ - LOG_DAEMON = (3<<3), /* system daemons */ - LOG_AUTH = (4<<3), /* authorization messages */ - LOG_SYSLOG = (5<<3), /* messages generated internally by syslogd */ - LOG_LPR = (6<<3), /* line printer subsystem */ - LOG_NEWS = (7<<3), /* network news subsystem */ - LOG_UUCP = (8<<3), /* UUCP subsystem */ - LOG_CRON = (9<<3), /* clock daemon */ - LOG_AUTHPRIV = (10<<3), /* authorization messages (private) */ - LOG_FTP = (11<<3), /* ftp daemon */ - // Between FTP and Local is reserved for system use - LOG_LOCAL0 = (16<<3), /* reserved for local use */ - LOG_LOCAL1 = (17<<3), /* reserved for local use */ - LOG_LOCAL2 = (18<<3), /* reserved for local use */ - LOG_LOCAL3 = (19<<3), /* reserved for local use */ - LOG_LOCAL4 = (20<<3), /* reserved for local use */ - LOG_LOCAL5 = (21<<3), /* reserved for local use */ - LOG_LOCAL6 = (22<<3), /* reserved for local use */ - LOG_LOCAL7 = (23<<3), /* reserved for local use */ - } - - /// <summary> - /// Write a message to the system logger, which in turn writes the message to the system console, log files, etc. - /// See man 3 syslog for more info - /// </summary> - /// <param name="priority"> - /// The OR of a priority and facility in the SysLogPriority enum to declare the priority and facility of the log entry - /// </param> - /// <param name="message">The message to put in the log entry</param> - /// <param name="arg1">Like printf, the argument is passed to the variadic part of the C++ function to wildcards in the message</param> - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SysLog")] - internal static extern void SysLog(SysLogPriority priority, string message, string arg1); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Unlink.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Unlink.cs deleted file mode 100644 index 829210fa7e0..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Unlink.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Sys - { - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Unlink", SetLastError = true)] - internal static extern int Unlink(string pathname); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Write.cs b/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Write.cs deleted file mode 100644 index fb06d463beb..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.Write.cs +++ /dev/null @@ -1,27 +0,0 @@ -// 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.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class Sys - { - /// <summary> - /// Writes the specified buffer to the provided open file descriptor - /// </summary> - /// <param name="fd">The file descriptor to try and write to</param> - /// <param name="buffer">The data to attempt to write</param> - /// <param name="bufferSize">The amount of data to write, in bytes</param> - /// <returns> - /// Returns the number of bytes written on success; otherwise, returns -1 and sets errno - /// </returns> - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Write", SetLastError = true)] - internal static extern unsafe int Write(SafeHandle fd, byte* buffer, int bufferSize); - - [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Write", SetLastError = true)] - internal static extern unsafe int Write(int fd, byte* buffer, int bufferSize); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.ActivityControl.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.ActivityControl.cs deleted file mode 100644 index 093755659de..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.ActivityControl.cs +++ /dev/null @@ -1,18 +0,0 @@ -// 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. - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - internal enum ActivityControl : uint - { - EVENT_ACTIVITY_CTRL_GET_ID = 1, - EVENT_ACTIVITY_CTRL_SET_ID = 2, - EVENT_ACTIVITY_CTRL_CREATE_ID = 3, - EVENT_ACTIVITY_CTRL_GET_SET_ID = 4, - EVENT_ACTIVITY_CTRL_CREATE_SET_ID = 5 - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EVENT_INFO_CLASS.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EVENT_INFO_CLASS.cs deleted file mode 100644 index fae4d2e5c30..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EVENT_INFO_CLASS.cs +++ /dev/null @@ -1,16 +0,0 @@ -// 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. - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - internal enum EVENT_INFO_CLASS - { - BinaryTrackInfo, - SetEnableAllKeywords, - SetTraits, - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EtwEnableCallback.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EtwEnableCallback.cs deleted file mode 100644 index 33f6ae631d9..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EtwEnableCallback.cs +++ /dev/null @@ -1,33 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - internal const int EVENT_CONTROL_CODE_DISABLE_PROVIDER = 0; - internal const int EVENT_CONTROL_CODE_ENABLE_PROVIDER = 1; - internal const int EVENT_CONTROL_CODE_CAPTURE_STATE = 2; - - [StructLayout(LayoutKind.Sequential)] - internal struct EVENT_FILTER_DESCRIPTOR - { - public long Ptr; - public int Size; - public int Type; - } - - internal unsafe delegate void EtwEnableCallback( - in Guid sourceId, - int isEnabled, - byte level, - long matchAnyKeywords, - long matchAllKeywords, - EVENT_FILTER_DESCRIPTOR* filterData, - void* callbackContext); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventActivityIdControl.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventActivityIdControl.cs deleted file mode 100644 index 2d73e3e50a7..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventActivityIdControl.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - [DllImport(Libraries.Advapi32, ExactSpelling = true)] - internal static extern int EventActivityIdControl(ActivityControl ControlCode, ref Guid ActivityId); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventRegister.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventRegister.cs deleted file mode 100644 index 1c1af36bfc0..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventRegister.cs +++ /dev/null @@ -1,19 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - [DllImport(Libraries.Advapi32, ExactSpelling = true)] - internal static extern unsafe uint EventRegister( - in Guid providerId, - EtwEnableCallback enableCallback, - void* callbackContext, - ref long registrationHandle); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventSetInformation.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventSetInformation.cs deleted file mode 100644 index b3a8851428c..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventSetInformation.cs +++ /dev/null @@ -1,18 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - [DllImport(Libraries.Advapi32, ExactSpelling = true)] - internal static extern unsafe int EventSetInformation( - long registrationHandle, - EVENT_INFO_CLASS informationClass, - void* eventInformation, - int informationLength); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventTraceGuidsEx.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventTraceGuidsEx.cs deleted file mode 100644 index d85b2e5ba5f..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventTraceGuidsEx.cs +++ /dev/null @@ -1,58 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - internal enum TRACE_QUERY_INFO_CLASS - { - TraceGuidQueryList, - TraceGuidQueryInfo, - TraceGuidQueryProcess, - TraceStackTracingInfo, - MaxTraceSetInfoClass - } - - [StructLayout(LayoutKind.Sequential)] - internal struct TRACE_GUID_INFO - { - public int InstanceCount; - public int Reserved; - } - - [StructLayout(LayoutKind.Sequential)] - internal struct TRACE_PROVIDER_INSTANCE_INFO - { - public int NextOffset; - public int EnableCount; - public int Pid; - public int Flags; - } - - [StructLayout(LayoutKind.Sequential)] - internal struct TRACE_ENABLE_INFO - { - public int IsEnabled; - public byte Level; - public byte Reserved1; - public ushort LoggerId; - public int EnableProperty; - public int Reserved2; - public long MatchAnyKeyword; - public long MatchAllKeyword; - } - - [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true)] - internal static extern unsafe int EnumerateTraceGuidsEx( - TRACE_QUERY_INFO_CLASS TraceQueryInfoClass, - void* InBuffer, - int InBufferSize, - void* OutBuffer, - int OutBufferSize, - out int ReturnLength); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventUnregister.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventUnregister.cs deleted file mode 100644 index 1943cb314e4..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventUnregister.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - [DllImport(Libraries.Advapi32, ExactSpelling = true)] - internal static extern uint EventUnregister(long registrationHandle); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventWriteString.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventWriteString.cs deleted file mode 100644 index 9c60558e129..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventWriteString.cs +++ /dev/null @@ -1,18 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - [DllImport(Libraries.Advapi32, ExactSpelling = true)] - internal static extern int EventWriteString( - long registrationHandle, - byte level, - long keyword, - string msg); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventWriteTransfer.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventWriteTransfer.cs deleted file mode 100644 index 1bc116fdd66..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.EventWriteTransfer.cs +++ /dev/null @@ -1,49 +0,0 @@ -// 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.Runtime.InteropServices; -#if ES_BUILD_STANDALONE -using Microsoft.Diagnostics.Tracing; -#else -using System.Diagnostics.Tracing; -#endif - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - /// <summary> - /// Call the ETW native API EventWriteTransfer and checks for invalid argument error. - /// The implementation of EventWriteTransfer on some older OSes (Windows 2008) does not accept null relatedActivityId. - /// So, for these cases we will retry the call with an empty Guid. - /// </summary> - internal static unsafe int EventWriteTransfer( - long registrationHandle, - in EventDescriptor eventDescriptor, - Guid* activityId, - Guid* relatedActivityId, - int userDataCount, - EventProvider.EventData* userData) - { - int HResult = EventWriteTransfer_PInvoke(registrationHandle, in eventDescriptor, activityId, relatedActivityId, userDataCount, userData); - if (HResult == Errors.ERROR_INVALID_PARAMETER && relatedActivityId == null) - { - Guid emptyGuid = Guid.Empty; - HResult = EventWriteTransfer_PInvoke(registrationHandle, in eventDescriptor, activityId, &emptyGuid, userDataCount, userData); - } - - return HResult; - } - - [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, EntryPoint = "EventWriteTransfer")] - private static extern unsafe int EventWriteTransfer_PInvoke( - long registrationHandle, - in EventDescriptor eventDescriptor, - Guid* activityId, - Guid* relatedActivityId, - int userDataCount, - EventProvider.EventData* userData); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.LookupAccountNameW.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.LookupAccountNameW.cs deleted file mode 100644 index a254e694af5..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.LookupAccountNameW.cs +++ /dev/null @@ -1,21 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)] - internal static extern bool LookupAccountNameW( - string? lpSystemName, - ref char lpAccountName, - ref byte Sid, - ref uint cbSid, - ref char ReferencedDomainName, - ref uint cchReferencedDomainName, - out uint peUse); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegCloseKey.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegCloseKey.cs deleted file mode 100644 index c4a69448e03..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegCloseKey.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - [DllImport(Libraries.Advapi32)] - internal static extern int RegCloseKey(IntPtr hKey); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegCreateKeyEx.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegCreateKeyEx.cs deleted file mode 100644 index bb9da06c11d..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegCreateKeyEx.cs +++ /dev/null @@ -1,31 +0,0 @@ -// 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. - -#nullable enable -#if REGISTRY_ASSEMBLY -using Microsoft.Win32.SafeHandles; -#else -using Internal.Win32.SafeHandles; -#endif -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - // Note: RegCreateKeyEx won't set the last error on failure - it returns - // an error code if it fails. - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegCreateKeyExW")] - internal static extern int RegCreateKeyEx( - SafeRegistryHandle hKey, - string lpSubKey, - int Reserved, - string? lpClass, - int dwOptions, - int samDesired, - ref Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs, - out SafeRegistryHandle hkResult, - out int lpdwDisposition); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegDeleteKeyEx.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegDeleteKeyEx.cs deleted file mode 100644 index 487caf8b6d7..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegDeleteKeyEx.cs +++ /dev/null @@ -1,19 +0,0 @@ -// 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. - -#if REGISTRY_ASSEMBLY -using Microsoft.Win32.SafeHandles; -#else -using Internal.Win32.SafeHandles; -#endif -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegDeleteKeyExW")] - internal static extern int RegDeleteKeyEx(SafeRegistryHandle hKey, string lpSubKey, int samDesired, int Reserved); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegDeleteValue.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegDeleteValue.cs deleted file mode 100644 index 43cf683c2bd..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegDeleteValue.cs +++ /dev/null @@ -1,20 +0,0 @@ -// 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. - -#nullable enable -#if REGISTRY_ASSEMBLY -using Microsoft.Win32.SafeHandles; -#else -using Internal.Win32.SafeHandles; -#endif -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegDeleteValueW")] - internal static extern int RegDeleteValue(SafeRegistryHandle hKey, string? lpValueName); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegEnumKeyEx.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegEnumKeyEx.cs deleted file mode 100644 index 11165cc91a9..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegEnumKeyEx.cs +++ /dev/null @@ -1,28 +0,0 @@ -// 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. - -#nullable enable -#if REGISTRY_ASSEMBLY -using Microsoft.Win32.SafeHandles; -#else -using Internal.Win32.SafeHandles; -#endif -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegEnumKeyExW")] - internal static extern unsafe int RegEnumKeyEx( - SafeRegistryHandle hKey, - int dwIndex, - char[] lpName, - ref int lpcbName, - int[]? lpReserved, - [Out] char[]? lpClass, - int[]? lpcbClass, - long[]? lpftLastWriteTime); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegEnumValue.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegEnumValue.cs deleted file mode 100644 index e2ab45dea19..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegEnumValue.cs +++ /dev/null @@ -1,29 +0,0 @@ -// 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. - -#nullable enable -#if REGISTRY_ASSEMBLY -using Microsoft.Win32.SafeHandles; -#else -using Internal.Win32.SafeHandles; -#endif -using System; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegEnumValueW")] - internal static extern unsafe int RegEnumValue( - SafeRegistryHandle hKey, - int dwIndex, - char[] lpValueName, - ref int lpcbValueName, - IntPtr lpReserved_MustBeZero, - int[]? lpType, - byte[]? lpData, - int[]? lpcbData); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegFlushKey.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegFlushKey.cs deleted file mode 100644 index ccbecb60897..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegFlushKey.cs +++ /dev/null @@ -1,19 +0,0 @@ -// 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. - -#if REGISTRY_ASSEMBLY -using Microsoft.Win32.SafeHandles; -#else -using Internal.Win32.SafeHandles; -#endif -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - [DllImport(Libraries.Advapi32)] - internal static extern int RegFlushKey(SafeRegistryHandle hKey); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegOpenKeyEx.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegOpenKeyEx.cs deleted file mode 100644 index 5f5b6b6e372..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegOpenKeyEx.cs +++ /dev/null @@ -1,35 +0,0 @@ -// 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. - -#nullable enable -#if REGISTRY_ASSEMBLY -using Microsoft.Win32.SafeHandles; -#else -using Internal.Win32.SafeHandles; -#endif -using System; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegOpenKeyExW")] - internal static extern int RegOpenKeyEx( - SafeRegistryHandle hKey, - string? lpSubKey, - int ulOptions, - int samDesired, - out SafeRegistryHandle hkResult); - - - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegOpenKeyExW")] - internal static extern int RegOpenKeyEx( - IntPtr hKey, - string? lpSubKey, - int ulOptions, - int samDesired, - out SafeRegistryHandle hkResult); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegQueryInfoKey.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegQueryInfoKey.cs deleted file mode 100644 index c2bb82fab56..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegQueryInfoKey.cs +++ /dev/null @@ -1,34 +0,0 @@ -// 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. - -#nullable enable -#if REGISTRY_ASSEMBLY -using Microsoft.Win32.SafeHandles; -#else -using Internal.Win32.SafeHandles; -#endif -using System; -using System.Runtime.InteropServices; -using System.Text; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegQueryInfoKeyW")] - internal static extern int RegQueryInfoKey( - SafeRegistryHandle hKey, - [Out] char[]? lpClass, - int[]? lpcbClass, - IntPtr lpReserved_MustBeZero, - ref int lpcSubKeys, - int[]? lpcbMaxSubKeyLen, - int[]? lpcbMaxClassLen, - ref int lpcValues, - int[]? lpcbMaxValueNameLen, - int[]? lpcbMaxValueLen, - int[]? lpcbSecurityDescriptor, - int[]? lpftLastWriteTime); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegQueryValueEx.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegQueryValueEx.cs deleted file mode 100644 index 72b8aa8f7bc..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegQueryValueEx.cs +++ /dev/null @@ -1,53 +0,0 @@ -// 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. - -#nullable enable -#if REGISTRY_ASSEMBLY -using Microsoft.Win32.SafeHandles; -#else -using Internal.Win32.SafeHandles; -#endif -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegQueryValueExW")] - internal static extern int RegQueryValueEx( - SafeRegistryHandle hKey, - string? lpValueName, - int[]? lpReserved, - ref int lpType, - [Out] byte[]? lpData, - ref int lpcbData); - - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegQueryValueExW")] - internal static extern int RegQueryValueEx( - SafeRegistryHandle hKey, - string? lpValueName, - int[]? lpReserved, - ref int lpType, - ref int lpData, - ref int lpcbData); - - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegQueryValueExW")] - internal static extern int RegQueryValueEx( - SafeRegistryHandle hKey, - string? lpValueName, - int[]? lpReserved, - ref int lpType, - ref long lpData, - ref int lpcbData); - - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegQueryValueExW")] - internal static extern int RegQueryValueEx( - SafeRegistryHandle hKey, - string? lpValueName, - int[]? lpReserved, - ref int lpType, - [Out] char[]? lpData, - ref int lpcbData); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegSetValueEx.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegSetValueEx.cs deleted file mode 100644 index 847d28fa1c5..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegSetValueEx.cs +++ /dev/null @@ -1,62 +0,0 @@ -// 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. - -#nullable enable -#if REGISTRY_ASSEMBLY -using Microsoft.Win32.SafeHandles; -#else -using Internal.Win32.SafeHandles; -#endif -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegSetValueExW")] - internal static extern int RegSetValueEx( - SafeRegistryHandle hKey, - string? lpValueName, - int Reserved, - int dwType, - byte[]? lpData, - int cbData); - - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegSetValueExW")] - internal static extern int RegSetValueEx( - SafeRegistryHandle hKey, - string? lpValueName, - int Reserved, - int dwType, - char[]? lpData, - int cbData); - - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegSetValueExW")] - internal static extern int RegSetValueEx( - SafeRegistryHandle hKey, - string? lpValueName, - int Reserved, - int dwType, - ref int lpData, - int cbData); - - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegSetValueExW")] - internal static extern int RegSetValueEx( - SafeRegistryHandle hKey, - string? lpValueName, - int Reserved, - int dwType, - ref long lpData, - int cbData); - - [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, BestFitMapping = false, EntryPoint = "RegSetValueExW")] - internal static extern int RegSetValueEx( - SafeRegistryHandle hKey, - string? lpValueName, - int Reserved, - int dwType, - string? lpData, - int cbData); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegistryConstants.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegistryConstants.cs deleted file mode 100644 index 48ea1f27c52..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Advapi32/Interop.RegistryConstants.cs +++ /dev/null @@ -1,65 +0,0 @@ -// 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. - -internal static partial class Interop -{ - internal static partial class Advapi32 - { - internal static class RegistryOptions - { - internal const int REG_OPTION_NON_VOLATILE = 0x0000; // (default) keys are persisted beyond reboot/unload - internal const int REG_OPTION_VOLATILE = 0x0001; // All keys created by the function are volatile - internal const int REG_OPTION_CREATE_LINK = 0x0002; // They key is a symbolic link - internal const int REG_OPTION_BACKUP_RESTORE = 0x0004; // Use SE_BACKUP_NAME process special privileges - } - - internal static class RegistryView - { - internal const int KEY_WOW64_64KEY = 0x0100; - internal const int KEY_WOW64_32KEY = 0x0200; - } - - internal static class RegistryOperations - { - internal const int KEY_QUERY_VALUE = 0x0001; - internal const int KEY_SET_VALUE = 0x0002; - internal const int KEY_CREATE_SUB_KEY = 0x0004; - internal const int KEY_ENUMERATE_SUB_KEYS = 0x0008; - internal const int KEY_NOTIFY = 0x0010; - internal const int KEY_CREATE_LINK = 0x0020; - internal const int KEY_READ = ((STANDARD_RIGHTS_READ | - KEY_QUERY_VALUE | - KEY_ENUMERATE_SUB_KEYS | - KEY_NOTIFY) - & - (~SYNCHRONIZE)); - - internal const int KEY_WRITE = ((STANDARD_RIGHTS_WRITE | - KEY_SET_VALUE | - KEY_CREATE_SUB_KEY) - & - (~SYNCHRONIZE)); - - internal const int SYNCHRONIZE = 0x00100000; - internal const int READ_CONTROL = 0x00020000; - internal const int STANDARD_RIGHTS_READ = READ_CONTROL; - internal const int STANDARD_RIGHTS_WRITE = READ_CONTROL; - } - - internal static class RegistryValues - { - internal const int REG_NONE = 0; // No value type - internal const int REG_SZ = 1; // Unicode nul terminated string - internal const int REG_EXPAND_SZ = 2; // Unicode nul terminated string - // (with environment variable references) - internal const int REG_BINARY = 3; // Free form binary - internal const int REG_DWORD = 4; // 32-bit number - internal const int REG_DWORD_LITTLE_ENDIAN = 4; // 32-bit number (same as REG_DWORD) - internal const int REG_DWORD_BIG_ENDIAN = 5; // 32-bit number - internal const int REG_LINK = 6; // Symbolic Link (Unicode) - internal const int REG_MULTI_SZ = 7; // Multiple Unicode strings - internal const int REG_QWORD = 11; // 64-bit number - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.BCryptGenRandom.GetRandomBytes.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.BCryptGenRandom.GetRandomBytes.cs deleted file mode 100644 index 42824c7eb73..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.BCryptGenRandom.GetRandomBytes.cs +++ /dev/null @@ -1,28 +0,0 @@ -// 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.Diagnostics; - -internal static partial class Interop -{ - internal static unsafe void GetRandomBytes(byte* buffer, int length) - { - Debug.Assert(buffer != null); - Debug.Assert(length >= 0); - - BCrypt.NTSTATUS status = BCrypt.BCryptGenRandom(IntPtr.Zero, buffer, length, BCrypt.BCRYPT_USE_SYSTEM_PREFERRED_RNG); - if (status != BCrypt.NTSTATUS.STATUS_SUCCESS) - { - if (status == BCrypt.NTSTATUS.STATUS_NO_MEMORY) - { - throw new OutOfMemoryException(); - } - else - { - throw new InvalidOperationException(); - } - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs deleted file mode 100644 index 1e6452f8fa9..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.BCryptGenRandom.cs +++ /dev/null @@ -1,17 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class BCrypt - { - internal const int BCRYPT_USE_SYSTEM_PREFERRED_RNG = 0x00000002; - - [DllImport(Libraries.BCrypt, CharSet = CharSet.Unicode)] - internal static extern unsafe NTSTATUS BCryptGenRandom(IntPtr hAlgorithm, byte* pbBuffer, int cbBuffer, int dwFlags); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.NTSTATUS.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.NTSTATUS.cs deleted file mode 100644 index af646aea985..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/BCrypt/Interop.NTSTATUS.cs +++ /dev/null @@ -1,18 +0,0 @@ -// 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. - -internal static partial class Interop -{ - internal static partial class BCrypt - { - internal enum NTSTATUS : uint - { - STATUS_SUCCESS = 0x0, - STATUS_NOT_FOUND = 0xc0000225, - STATUS_INVALID_PARAMETER = 0xc000000d, - STATUS_NO_MEMORY = 0xc0000017, - STATUS_AUTH_TAG_MISMATCH = 0xc000a002, - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs deleted file mode 100644 index cce01906ff6..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs +++ /dev/null @@ -1,21 +0,0 @@ -// 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.Runtime.InteropServices; -using System.Security; - -internal static partial class Interop -{ - internal static partial class Crypt32 - { - internal const uint CRYPTPROTECTMEMORY_BLOCK_SIZE = 16; - internal const uint CRYPTPROTECTMEMORY_SAME_PROCESS = 0; - - [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern bool CryptProtectMemory(SafeBuffer pData, uint cbData, uint dwFlags); - - [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern bool CryptUnprotectMemory(SafeBuffer pData, uint cbData, uint dwFlags); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Interop.BOOL.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Interop.BOOL.cs deleted file mode 100644 index b79d90fbe9f..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Interop.BOOL.cs +++ /dev/null @@ -1,21 +0,0 @@ -// 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. - -internal static partial class Interop -{ - /// <summary> - /// Blittable version of Windows BOOL type. It is convenient in situations where - /// manual marshalling is required, or to avoid overhead of regular bool marshalling. - /// </summary> - /// <remarks> - /// Some Windows APIs return arbitrary integer values although the return type is defined - /// as BOOL. It is best to never compare BOOL to TRUE. Always use bResult != BOOL.FALSE - /// or bResult == BOOL.FALSE . - /// </remarks> - internal enum BOOL : int - { - FALSE = 0, - TRUE = 1, - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Interop.BOOLEAN.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Interop.BOOLEAN.cs deleted file mode 100644 index 8158ffabde5..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Interop.BOOLEAN.cs +++ /dev/null @@ -1,21 +0,0 @@ -// 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. - -internal static partial class Interop -{ - /// <summary> - /// Blittable version of Windows BOOLEAN type. It is convenient in situations where - /// manual marshalling is required, or to avoid overhead of regular bool marshalling. - /// </summary> - /// <remarks> - /// Some Windows APIs return arbitrary integer values although the return type is defined - /// as BOOLEAN. It is best to never compare BOOLEAN to TRUE. Always use bResult != BOOLEAN.FALSE - /// or bResult == BOOLEAN.FALSE . - /// </remarks> - internal enum BOOLEAN : byte - { - FALSE = 0, - TRUE = 1, - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Interop.Errors.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Interop.Errors.cs deleted file mode 100644 index cb6125de765..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Interop.Errors.cs +++ /dev/null @@ -1,46 +0,0 @@ -// 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. - -internal static partial class Interop -{ - // As defined in winerror.h and https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382.aspx - internal static partial class Errors - { - internal const int ERROR_SUCCESS = 0x0; - internal const int ERROR_FILE_NOT_FOUND = 0x2; - internal const int ERROR_PATH_NOT_FOUND = 0x3; - internal const int ERROR_ACCESS_DENIED = 0x5; - internal const int ERROR_INVALID_HANDLE = 0x6; - internal const int ERROR_NOT_ENOUGH_MEMORY = 0x8; - internal const int ERROR_INVALID_DRIVE = 0xF; - internal const int ERROR_NO_MORE_FILES = 0x12; - internal const int ERROR_NOT_READY = 0x15; - internal const int ERROR_SHARING_VIOLATION = 0x20; - internal const int ERROR_HANDLE_EOF = 0x26; - internal const int ERROR_NOT_SUPPORTED = 0x32; - internal const int ERROR_FILE_EXISTS = 0x50; - internal const int ERROR_INVALID_PARAMETER = 0x57; - internal const int ERROR_BROKEN_PIPE = 0x6D; - internal const int ERROR_INSUFFICIENT_BUFFER = 0x7A; - internal const int ERROR_INVALID_NAME = 0x7B; - internal const int ERROR_BAD_PATHNAME = 0xA1; - internal const int ERROR_ALREADY_EXISTS = 0xB7; - internal const int ERROR_ENVVAR_NOT_FOUND = 0xCB; - internal const int ERROR_FILENAME_EXCED_RANGE = 0xCE; - internal const int ERROR_NO_DATA = 0xE8; - internal const int ERROR_MORE_DATA = 0xEA; - internal const int ERROR_NO_MORE_ITEMS = 0x103; - internal const int ERROR_NOT_OWNER = 0x120; - internal const int ERROR_TOO_MANY_POSTS = 0x12A; - internal const int ERROR_ARITHMETIC_OVERFLOW = 0x216; - internal const int ERROR_MUTANT_LIMIT_EXCEEDED = 0x24B; - internal const int ERROR_OPERATION_ABORTED = 0x3E3; - internal const int ERROR_IO_PENDING = 0x3E5; - internal const int ERROR_NO_UNICODE_TRANSLATION = 0x459; - internal const int ERROR_NOT_FOUND = 0x490; - internal const int ERROR_BAD_IMPERSONATION_LEVEL = 0x542; - internal const int ERROR_NO_SYSTEM_RESOURCES = 0x5AA; - internal const int ERROR_TIMEOUT = 0x000005B4; - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Interop.Libraries.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Interop.Libraries.cs deleted file mode 100644 index 8cbc8bfb266..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Interop.Libraries.cs +++ /dev/null @@ -1,20 +0,0 @@ -// 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. - -internal static partial class Interop -{ - internal static partial class Libraries - { - internal const string Advapi32 = "advapi32.dll"; - internal const string BCrypt = "BCrypt.dll"; - internal const string Crypt32 = "crypt32.dll"; - internal const string Kernel32 = "kernel32.dll"; - internal const string Ole32 = "ole32.dll"; - internal const string OleAut32 = "oleaut32.dll"; - internal const string User32 = "user32.dll"; - internal const string NtDll = "ntdll.dll"; - internal const string Secur32 = "secur32.dll"; - internal const string Shell32 = "shell32.dll"; - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CancelIoEx.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CancelIoEx.cs deleted file mode 100644 index 057ebb924f4..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CancelIoEx.cs +++ /dev/null @@ -1,19 +0,0 @@ -// 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.Runtime.InteropServices; -using System.Threading; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe bool CancelIoEx(SafeHandle handle, NativeOverlapped* lpOverlapped); - - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe bool CancelIoEx(IntPtr handle, NativeOverlapped* lpOverlapped); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CloseHandle.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CloseHandle.cs deleted file mode 100644 index c4385997185..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CloseHandle.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool CloseHandle(IntPtr handle); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CompletionPort.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CompletionPort.cs deleted file mode 100644 index 326f0e9df00..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CompletionPort.cs +++ /dev/null @@ -1,23 +0,0 @@ -// 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.Runtime.InteropServices; - -internal partial class Interop -{ - internal partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern IntPtr CreateIoCompletionPort(IntPtr FileHandle, IntPtr ExistingCompletionPort, UIntPtr CompletionKey, int NumberOfConcurrentThreads); - - [DllImport(Libraries.Kernel32, SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool PostQueuedCompletionStatus(IntPtr CompletionPort, int dwNumberOfBytesTransferred, UIntPtr CompletionKey, IntPtr lpOverlapped); - - [DllImport(Libraries.Kernel32, SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool GetQueuedCompletionStatus(IntPtr CompletionPort, out int lpNumberOfBytes, out UIntPtr CompletionKey, out IntPtr lpOverlapped, int dwMilliseconds); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Constants.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Constants.cs deleted file mode 100644 index b13cdfd03fe..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Constants.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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. - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal const int MAXIMUM_ALLOWED = 0x02000000; - internal const int SYNCHRONIZE = 0x00100000; - internal const int MUTEX_MODIFY_STATE = 0x00000001; - internal const int SEMAPHORE_MODIFY_STATE = 0x00000002; - internal const int EVENT_MODIFY_STATE = 0x00000002; - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile.cs deleted file mode 100644 index 9ebac4f6640..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile.cs +++ /dev/null @@ -1,40 +0,0 @@ -// 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 Microsoft.Win32.SafeHandles; -using System; -using System.IO; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - /// <summary> - /// WARNING: This method does not implicitly handle long paths. Use CreateFile. - /// </summary> - [DllImport(Libraries.Kernel32, EntryPoint = "CreateFileW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)] - private static extern SafeFileHandle CreateFilePrivate( - string lpFileName, - int dwDesiredAccess, - System.IO.FileShare dwShareMode, - ref SECURITY_ATTRIBUTES securityAttrs, - System.IO.FileMode dwCreationDisposition, - int dwFlagsAndAttributes, - IntPtr hTemplateFile); - - internal static SafeFileHandle CreateFile( - string lpFileName, - int dwDesiredAccess, - System.IO.FileShare dwShareMode, - ref SECURITY_ATTRIBUTES securityAttrs, - System.IO.FileMode dwCreationDisposition, - int dwFlagsAndAttributes, - IntPtr hTemplateFile) - { - lpFileName = PathInternal.EnsureExtendedPrefixIfNeeded(lpFileName); - return CreateFilePrivate(lpFileName, dwDesiredAccess, dwShareMode, ref securityAttrs, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.EventWaitHandle.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.EventWaitHandle.cs deleted file mode 100644 index c3adfadb53d..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.EventWaitHandle.cs +++ /dev/null @@ -1,29 +0,0 @@ -// 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. - -#nullable enable -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal const uint CREATE_EVENT_INITIAL_SET = 0x2; - internal const uint CREATE_EVENT_MANUAL_RESET = 0x1; - - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool SetEvent(SafeWaitHandle handle); - - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool ResetEvent(SafeWaitHandle handle); - - [DllImport(Libraries.Kernel32, EntryPoint = "CreateEventExW", SetLastError = true, CharSet = CharSet.Unicode)] - internal static extern SafeWaitHandle CreateEventEx(IntPtr lpSecurityAttributes, string? name, uint flags, uint desiredAccess); - - [DllImport(Libraries.Kernel32, EntryPoint = "OpenEventW", SetLastError = true, CharSet = CharSet.Unicode)] - internal static extern SafeWaitHandle OpenEvent(uint desiredAccess, bool inheritHandle, string name); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ExpandEnvironmentStrings.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ExpandEnvironmentStrings.cs deleted file mode 100644 index fbd5da84b8e..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ExpandEnvironmentStrings.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, EntryPoint = "ExpandEnvironmentStringsW", CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern uint ExpandEnvironmentStrings(string lpSrc, ref char lpDst, uint nSize); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FILE_INFO_BY_HANDLE_CLASS.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FILE_INFO_BY_HANDLE_CLASS.cs deleted file mode 100644 index 5ea23ea96ad..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FILE_INFO_BY_HANDLE_CLASS.cs +++ /dev/null @@ -1,35 +0,0 @@ -// 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. - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal enum FILE_INFO_BY_HANDLE_CLASS : uint - { - FileBasicInfo = 0x0u, - FileStandardInfo = 0x1u, - FileNameInfo = 0x2u, - FileRenameInfo = 0x3u, - FileDispositionInfo = 0x4u, - FileAllocationInfo = 0x5u, - FileEndOfFileInfo = 0x6u, - FileStreamInfo = 0x7u, - FileCompressionInfo = 0x8u, - FileAttributeTagInfo = 0x9u, - FileIdBothDirectoryInfo = 0xAu, - FileIdBothDirectoryRestartInfo = 0xBu, - FileIoPriorityHintInfo = 0xCu, - FileRemoteProtocolInfo = 0xDu, - FileFullDirectoryInfo = 0xEu, - FileFullDirectoryRestartInfo = 0xFu, - FileStorageInfo = 0x10u, - FileAlignmentInfo = 0x11u, - FileIdInfo = 0x12u, - FileIdExtdDirectoryInfo = 0x13u, - FileIdExtdDirectoryRestartInfo = 0x14u, - MaximumFileInfoByHandleClass = 0x15u, - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FILE_TIME.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FILE_TIME.cs deleted file mode 100644 index 6a6464c4c8e..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FILE_TIME.cs +++ /dev/null @@ -1,27 +0,0 @@ -// 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; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal struct FILE_TIME - { - internal uint dwLowDateTime; - internal uint dwHighDateTime; - - internal FILE_TIME(long fileTime) - { - dwLowDateTime = (uint)fileTime; - dwHighDateTime = (uint)(fileTime >> 32); - } - - internal long ToTicks() => ((long)dwHighDateTime << 32) + dwLowDateTime; - internal DateTime ToDateTimeUtc() => DateTime.FromFileTimeUtc(ToTicks()); - internal DateTimeOffset ToDateTimeOffset() => DateTimeOffset.FromFileTime(ToTicks()); - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileAttributes.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileAttributes.cs deleted file mode 100644 index 2cf4e287d3c..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileAttributes.cs +++ /dev/null @@ -1,17 +0,0 @@ -// 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. - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal partial class FileAttributes - { - internal const int FILE_ATTRIBUTE_NORMAL = 0x00000080; - internal const int FILE_ATTRIBUTE_READONLY = 0x00000001; - internal const int FILE_ATTRIBUTE_DIRECTORY = 0x00000010; - internal const int FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400; - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileTimeToSystemTime.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileTimeToSystemTime.cs deleted file mode 100644 index 676e344a51d..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileTimeToSystemTime.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32)] - internal static extern unsafe Interop.BOOL FileTimeToSystemTime(long* lpFileTime, Interop.Kernel32.SYSTEMTIME* lpSystemTime); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileTypes.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileTypes.cs deleted file mode 100644 index a23ba1a3a0b..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FileTypes.cs +++ /dev/null @@ -1,17 +0,0 @@ -// 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. - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal partial class FileTypes - { - internal const int FILE_TYPE_UNKNOWN = 0x0000; - internal const int FILE_TYPE_DISK = 0x0001; - internal const int FILE_TYPE_CHAR = 0x0002; - internal const int FILE_TYPE_PIPE = 0x0003; - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindClose.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindClose.cs deleted file mode 100644 index 4bd534933d6..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindClose.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool FindClose(IntPtr hFindFile); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindFirstFileEx.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindFirstFileEx.cs deleted file mode 100644 index 6ab52b4d0e9..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindFirstFileEx.cs +++ /dev/null @@ -1,44 +0,0 @@ -// 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. - -#nullable enable -using Microsoft.Win32.SafeHandles; -using System; -using System.IO; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - /// <summary> - /// WARNING: This method does not implicitly handle long paths. Use FindFirstFile. - /// </summary> - [DllImport(Libraries.Kernel32, EntryPoint = "FindFirstFileExW", SetLastError = true, CharSet = CharSet.Unicode)] - private static extern SafeFindHandle FindFirstFileExPrivate(string lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, ref WIN32_FIND_DATA lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, IntPtr lpSearchFilter, int dwAdditionalFlags); - - internal static SafeFindHandle FindFirstFile(string fileName, ref WIN32_FIND_DATA data) - { - fileName = PathInternal.EnsureExtendedPrefixIfNeeded(fileName); - - // use FindExInfoBasic since we don't care about short name and it has better perf - return FindFirstFileExPrivate(fileName, FINDEX_INFO_LEVELS.FindExInfoBasic, ref data, FINDEX_SEARCH_OPS.FindExSearchNameMatch, IntPtr.Zero, 0); - } - - internal enum FINDEX_INFO_LEVELS : uint - { - FindExInfoStandard = 0x0u, - FindExInfoBasic = 0x1u, - FindExInfoMaxInfoLevel = 0x2u, - } - - internal enum FINDEX_SEARCH_OPS : uint - { - FindExSearchNameMatch = 0x0u, - FindExSearchLimitToDirectories = 0x1u, - FindExSearchLimitToDevices = 0x2u, - FindExSearchMaxSearchOp = 0x3u, - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FlushFileBuffers.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FlushFileBuffers.cs deleted file mode 100644 index 2b145d3d7dd..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FlushFileBuffers.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool FlushFileBuffers(SafeHandle hHandle); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FormatMessage.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FormatMessage.cs deleted file mode 100644 index 2eda58f2504..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FormatMessage.cs +++ /dev/null @@ -1,88 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - private const int FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200; - private const int FORMAT_MESSAGE_FROM_HMODULE = 0x00000800; - private const int FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000; - private const int FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000; - private const int FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100; - private const int ERROR_INSUFFICIENT_BUFFER = 0x7A; - - [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, EntryPoint = "FormatMessageW", SetLastError = true, BestFitMapping = true)] - private static extern unsafe int FormatMessage( - int dwFlags, - IntPtr lpSource, - uint dwMessageId, - int dwLanguageId, - void* lpBuffer, - int nSize, - IntPtr arguments); - - /// <summary> - /// Returns a string message for the specified Win32 error code. - /// </summary> - internal static string GetMessage(int errorCode) => - GetMessage(errorCode, IntPtr.Zero); - - internal static unsafe string GetMessage(int errorCode, IntPtr moduleHandle) - { - int flags = FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY; - if (moduleHandle != IntPtr.Zero) - { - flags |= FORMAT_MESSAGE_FROM_HMODULE; - } - - // First try to format the message into the stack based buffer. Most error messages willl fit. - Span<char> stackBuffer = stackalloc char[256]; // arbitrary stack limit - fixed (char* bufferPtr = stackBuffer) - { - int length = FormatMessage(flags, moduleHandle, unchecked((uint)errorCode), 0, bufferPtr, stackBuffer.Length, IntPtr.Zero); - if (length > 0) - { - return GetAndTrimString(stackBuffer.Slice(0, length)); - } - } - - // We got back an error. If the error indicated that there wasn't enough room to store - // the error message, then call FormatMessage again, but this time rather than passing in - // a buffer, have the method allocate one, which we then need to free. - if (Marshal.GetLastWin32Error() == ERROR_INSUFFICIENT_BUFFER) - { - IntPtr nativeMsgPtr = default; - try - { - int length = FormatMessage(flags | FORMAT_MESSAGE_ALLOCATE_BUFFER, moduleHandle, unchecked((uint)errorCode), 0, &nativeMsgPtr, 0, IntPtr.Zero); - if (length > 0) - { - return GetAndTrimString(new Span<char>((char*)nativeMsgPtr, length)); - } - } - finally - { - Marshal.FreeHGlobal(nativeMsgPtr); - } - } - - // Couldn't get a message, so manufacture one. - return string.Format("Unknown error (0x{0:x})", errorCode); - } - - private static string GetAndTrimString(Span<char> buffer) - { - int length = buffer.Length; - while (length > 0 && buffer[length - 1] <= 32) - { - length--; // trim off spaces and non-printable ASCII chars at the end of the resource - } - return buffer.Slice(0, length).ToString(); - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FreeEnvironmentStrings.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FreeEnvironmentStrings.cs deleted file mode 100644 index c222db8ef91..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FreeEnvironmentStrings.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, EntryPoint = "FreeEnvironmentStringsW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)] - internal static extern unsafe bool FreeEnvironmentStrings(char* lpszEnvironmentBlock); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FreeLibrary.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FreeLibrary.cs deleted file mode 100644 index 56d52fefbb0..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FreeLibrary.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)] - internal static extern bool FreeLibrary(IntPtr hModule); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GET_FILEEX_INFO_LEVELS.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GET_FILEEX_INFO_LEVELS.cs deleted file mode 100644 index 4ee86420322..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GET_FILEEX_INFO_LEVELS.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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. - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal enum GET_FILEEX_INFO_LEVELS : uint - { - GetFileExInfoStandard = 0x0u, - GetFileExMaxInfoLevel = 0x1u, - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCPInfo.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCPInfo.cs deleted file mode 100644 index b22a149b123..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCPInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct CPINFO - { - internal int MaxCharSize; - - internal fixed byte DefaultChar[2 /* MAX_DEFAULTCHAR */]; - internal fixed byte LeadByte[12 /* MAX_LEADBYTES */]; - } - - [DllImport(Libraries.Kernel32)] - internal static extern unsafe Interop.BOOL GetCPInfo(uint codePage, CPINFO* lpCpInfo); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetComputerName.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetComputerName.cs deleted file mode 100644 index 011430da5c7..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetComputerName.cs +++ /dev/null @@ -1,29 +0,0 @@ -// 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. - -#nullable enable -using System; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, EntryPoint = "GetComputerNameW")] - private static extern unsafe int GetComputerName(ref char lpBuffer, ref uint nSize); - - // maximum length of the NETBIOS name (not including NULL) - private const int MAX_COMPUTERNAME_LENGTH = 15; - - internal static unsafe string? GetComputerName() - { - Span<char> buffer = stackalloc char[MAX_COMPUTERNAME_LENGTH + 1]; - uint length = (uint)buffer.Length; - - return GetComputerName(ref MemoryMarshal.GetReference(buffer), ref length) != 0 ? - buffer.Slice(0, (int)length).ToString() : - null; - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentDirectory.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentDirectory.cs deleted file mode 100644 index 4e30a8be432..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentDirectory.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, EntryPoint = "GetCurrentDirectoryW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)] - internal static extern uint GetCurrentDirectory(uint nBufferLength, ref char lpBuffer); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentProcessId.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentProcessId.cs deleted file mode 100644 index 5369a8049df..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentProcessId.cs +++ /dev/null @@ -1,17 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32)] - [SuppressGCTransition] - internal static extern uint GetCurrentProcessId(); - } - - internal static uint GetCurrentProcessId() => Kernel32.GetCurrentProcessId(); -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentProcess_IntPtr.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentProcess_IntPtr.cs deleted file mode 100644 index a763735651a..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentProcess_IntPtr.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32)] - internal static extern IntPtr GetCurrentProcess(); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentThreadId.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentThreadId.cs deleted file mode 100644 index 775ddabfb6a..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCurrentThreadId.cs +++ /dev/null @@ -1,16 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, ExactSpelling = true)] - [SuppressGCTransition] - public static extern int GetCurrentThreadId(); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetEnvironmentStrings.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetEnvironmentStrings.cs deleted file mode 100644 index 5594fe7a4cb..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetEnvironmentStrings.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, EntryPoint = "GetEnvironmentStringsW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)] - internal static extern unsafe char* GetEnvironmentStrings(); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetEnvironmentVariable.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetEnvironmentVariable.cs deleted file mode 100644 index 43463e52304..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetEnvironmentVariable.cs +++ /dev/null @@ -1,23 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal static unsafe int GetEnvironmentVariable(string lpName, Span<char> buffer) - { - fixed (char* bufferPtr = &MemoryMarshal.GetReference(buffer)) - { - return GetEnvironmentVariable(lpName, bufferPtr, buffer.Length); - } - } - - [DllImport(Libraries.Kernel32, EntryPoint = "GetEnvironmentVariableW", SetLastError = true, CharSet = CharSet.Unicode)] - private static extern unsafe int GetEnvironmentVariable(string lpName, char* lpBuffer, int nSize); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileAttributesEx.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileAttributesEx.cs deleted file mode 100644 index 8d2e754edba..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileAttributesEx.cs +++ /dev/null @@ -1,25 +0,0 @@ -// 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. - -#nullable enable -using System.IO; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - /// <summary> - /// WARNING: This method does not implicitly handle long paths. Use GetFileAttributesEx. - /// </summary> - [DllImport(Libraries.Kernel32, EntryPoint = "GetFileAttributesExW", SetLastError = true, CharSet = CharSet.Unicode)] - private static extern bool GetFileAttributesExPrivate(string name, GET_FILEEX_INFO_LEVELS fileInfoLevel, ref WIN32_FILE_ATTRIBUTE_DATA lpFileInformation); - - internal static bool GetFileAttributesEx(string name, GET_FILEEX_INFO_LEVELS fileInfoLevel, ref WIN32_FILE_ATTRIBUTE_DATA lpFileInformation) - { - name = PathInternal.EnsureExtendedPrefixIfNeeded(name); - return GetFileAttributesExPrivate(name, fileInfoLevel, ref lpFileInformation); - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileInformationByHandleEx.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileInformationByHandleEx.cs deleted file mode 100644 index 92bee35cf42..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileInformationByHandleEx.cs +++ /dev/null @@ -1,24 +0,0 @@ -// 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 Microsoft.Win32.SafeHandles; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool GetFileInformationByHandleEx(SafeFileHandle hFile, FILE_INFO_BY_HANDLE_CLASS FileInformationClass, out FILE_STANDARD_INFO lpFileInformation, uint dwBufferSize); - - internal struct FILE_STANDARD_INFO - { - internal long AllocationSize; - internal long EndOfFile; - internal uint NumberOfLinks; - internal BOOL DeletePending; - internal BOOL Directory; - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileType_SafeHandle.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileType_SafeHandle.cs deleted file mode 100644 index cdde2f0e4d9..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileType_SafeHandle.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern int GetFileType(SafeHandle hFile); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFullPathNameW.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFullPathNameW.cs deleted file mode 100644 index 1bb63e7ed1d..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFullPathNameW.cs +++ /dev/null @@ -1,18 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - /// <summary> - /// WARNING: This method does not implicitly handle long paths. Use GetFullPathName or PathHelper. - /// </summary> - [DllImport(Libraries.Kernel32, SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)] - internal static extern uint GetFullPathNameW(ref char lpFileName, uint nBufferLength, ref char lpBuffer, IntPtr lpFilePart); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetLogicalDrives.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetLogicalDrives.cs deleted file mode 100644 index 2400eb3aac4..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetLogicalDrives.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern int GetLogicalDrives(); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetLongPathNameW.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetLongPathNameW.cs deleted file mode 100644 index 189c8e8cfe3..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetLongPathNameW.cs +++ /dev/null @@ -1,17 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - /// <summary> - /// WARNING: This method does not implicitly handle long paths. Use GetFullPath/PathHelper. - /// </summary> - [DllImport(Libraries.Kernel32, SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)] - internal static extern uint GetLongPathNameW(ref char lpszShortPath, ref char lpszLongPath, uint cchBuffer); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetProcessMemoryInfo.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetProcessMemoryInfo.cs deleted file mode 100644 index 1d004bb8e91..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetProcessMemoryInfo.cs +++ /dev/null @@ -1,30 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [StructLayout(LayoutKind.Sequential)] - internal struct PROCESS_MEMORY_COUNTERS - { - public uint cb; - public uint PageFaultCount; - public UIntPtr PeakWorkingSetSize; - public UIntPtr WorkingSetSize; - public UIntPtr QuotaPeakPagedPoolUsage; - public UIntPtr QuotaPagedPoolUsage; - public UIntPtr QuotaPeakNonPagedPoolUsage; - public UIntPtr QuotaNonPagedPoolUsage; - public UIntPtr PagefileUsage; - public UIntPtr PeakPagefileUsage; - } - - [DllImport(Libraries.Kernel32, EntryPoint="K32GetProcessMemoryInfo")] - internal static extern bool GetProcessMemoryInfo(IntPtr Process, ref PROCESS_MEMORY_COUNTERS ppsmemCounters, uint cb); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetProcessTimes.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetProcessTimes.cs deleted file mode 100644 index 451394539c6..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetProcessTimes.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool GetProcessTimes(IntPtr handleProcess, out long creation, out long exit, out long kernel, out long user); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetStdHandle.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetStdHandle.cs deleted file mode 100644 index c73c86e935e..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetStdHandle.cs +++ /dev/null @@ -1,16 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32)] - [SuppressGCTransition] - internal static extern IntPtr GetStdHandle(int nStdHandle); // param is NOT a handle, but it returns one! - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemDirectoryW.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemDirectoryW.cs deleted file mode 100644 index 197f6f5eadc..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemDirectoryW.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern uint GetSystemDirectoryW(ref char lpBuffer, uint uSize); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemInfo.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemInfo.cs deleted file mode 100644 index 9e5b21c6b7f..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemInfo.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32)] - internal static extern void GetSystemInfo(out SYSTEM_INFO lpSystemInfo); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTime.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTime.cs deleted file mode 100644 index ed0aa147454..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTime.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32)] - internal static extern unsafe void GetSystemTime(Interop.Kernel32.SYSTEMTIME* lpSystemTime); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimeAsFileTime.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimeAsFileTime.cs deleted file mode 100644 index fc8b030a4c1..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimeAsFileTime.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32)] - internal static extern unsafe void GetSystemTimeAsFileTime(long* lpSystemTimeAsFileTime); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimePreciseAsFileTime.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimePreciseAsFileTime.cs deleted file mode 100644 index 0067d90a808..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimePreciseAsFileTime.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32)] - internal static extern unsafe void GetSystemTimePreciseAsFileTime(long* lpSystemTimeAsFileTime); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimes.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimes.cs deleted file mode 100644 index 34f8ad7b6df..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetSystemTimes.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool GetSystemTimes(out long idle, out long kernel, out long user); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetTempFileNameW.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetTempFileNameW.cs deleted file mode 100644 index d7f9b828c0c..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetTempFileNameW.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)] - internal static extern uint GetTempFileNameW(ref char lpPathName, string lpPrefixString, uint uUnique, ref char lpTempFileName); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetTempPathW.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetTempPathW.cs deleted file mode 100644 index 8d2b0b199ed..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetTempPathW.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, BestFitMapping = false)] - internal static extern uint GetTempPathW(int bufferLen, ref char buffer); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetVersionExW.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetVersionExW.cs deleted file mode 100644 index 5899bdb5259..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetVersionExW.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern bool GetVersionExW(ref OSVERSIONINFOEX osvi); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GlobalMemoryStatusEx.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GlobalMemoryStatusEx.cs deleted file mode 100644 index e25c8ef4f59..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GlobalMemoryStatusEx.cs +++ /dev/null @@ -1,20 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal static unsafe bool GlobalMemoryStatusEx(ref MEMORYSTATUSEX buffer) - { - buffer.length = sizeof(MEMORYSTATUSEX); - return GlobalMemoryStatusExNative(ref buffer); - } - - [DllImport(Libraries.Kernel32, SetLastError = true, EntryPoint = "GlobalMemoryStatusEx")] - private static extern bool GlobalMemoryStatusExNative(ref MEMORYSTATUSEX lpBuffer); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Globalization.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Globalization.cs deleted file mode 100644 index 192e555bba8..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Globalization.cs +++ /dev/null @@ -1,145 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static unsafe partial class Kernel32 - { - internal const uint LOCALE_ALLOW_NEUTRAL_NAMES = 0x08000000; // Flag to allow returning neutral names/lcids for name conversion - internal const uint LOCALE_ILANGUAGE = 0x00000001; - internal const uint LOCALE_SUPPLEMENTAL = 0x00000002; - internal const uint LOCALE_REPLACEMENT = 0x00000008; - internal const uint LOCALE_NEUTRALDATA = 0x00000010; - internal const uint LOCALE_SPECIFICDATA = 0x00000020; - internal const uint LOCALE_SISO3166CTRYNAME = 0x0000005A; - internal const uint LOCALE_SNAME = 0x0000005C; - internal const uint LOCALE_INEUTRAL = 0x00000071; - internal const uint LOCALE_SSHORTTIME = 0x00000079; - internal const uint LOCALE_STIMEFORMAT = 0x00001003; - internal const uint LOCALE_IFIRSTDAYOFWEEK = 0x0000100C; - internal const uint LOCALE_RETURN_NUMBER = 0x20000000; - internal const uint LOCALE_NOUSEROVERRIDE = 0x80000000; - - internal const uint LCMAP_SORTHANDLE = 0x20000000; - internal const uint LCMAP_HASH = 0x00040000; - - internal const int COMPARE_STRING = 0x0001; - - internal const uint TIME_NOSECONDS = 0x00000002; - - internal const string LOCALE_NAME_USER_DEFAULT = null; - internal const string LOCALE_NAME_SYSTEM_DEFAULT = "!x-sys-default-locale"; - - [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - internal static extern int LCIDToLocaleName(int locale, char* pLocaleName, int cchName, uint dwFlags); - - [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - internal static extern int LocaleNameToLCID(string lpName, uint dwFlags); - - [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - internal static extern int LCMapStringEx( - string? lpLocaleName, - uint dwMapFlags, - char* lpSrcStr, - int cchSrc, - void* lpDestStr, - int cchDest, - void* lpVersionInformation, - void* lpReserved, - IntPtr sortHandle); - - [DllImport("kernel32.dll", EntryPoint = "FindNLSStringEx")] - internal static extern int FindNLSStringEx( - char* lpLocaleName, - uint dwFindNLSStringFlags, - char* lpStringSource, - int cchSource, - char* lpStringValue, - int cchValue, - int* pcchFound, - void* lpVersionInformation, - void* lpReserved, - IntPtr sortHandle); - - [DllImport("kernel32.dll", EntryPoint = "CompareStringEx")] - internal static extern int CompareStringEx( - char* lpLocaleName, - uint dwCmpFlags, - char* lpString1, - int cchCount1, - char* lpString2, - int cchCount2, - void* lpVersionInformation, - void* lpReserved, - IntPtr lParam); - - [DllImport("kernel32.dll", EntryPoint = "CompareStringOrdinal")] - internal static extern int CompareStringOrdinal( - char* lpString1, - int cchCount1, - char* lpString2, - int cchCount2, - bool bIgnoreCase); - - [DllImport("kernel32.dll", EntryPoint = "FindStringOrdinal")] - internal static extern int FindStringOrdinal( - uint dwFindStringOrdinalFlags, - char* lpStringSource, - int cchSource, - char* lpStringValue, - int cchValue, - int bIgnoreCase); - - [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - internal static extern bool IsNLSDefinedString( - int Function, - uint dwFlags, - IntPtr lpVersionInformation, - char* lpString, - int cchStr); - - [DllImport("kernel32.dll", CharSet = CharSet.Auto)] - internal static extern Interop.BOOL GetUserPreferredUILanguages(uint dwFlags, uint* pulNumLanguages, char* pwszLanguagesBuffer, uint* pcchLanguagesBuffer); - - [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - internal static extern int GetLocaleInfoEx(string lpLocaleName, uint LCType, void* lpLCData, int cchData); - - [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - internal static extern bool EnumSystemLocalesEx(EnumLocalesProcEx lpLocaleEnumProcEx, uint dwFlags, void* lParam, IntPtr reserved); - - internal delegate BOOL EnumLocalesProcEx(char* lpLocaleString, uint dwFlags, void* lParam); - - [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - internal static extern bool EnumTimeFormatsEx(EnumTimeFormatsProcEx lpTimeFmtEnumProcEx, string lpLocaleName, uint dwFlags, void* lParam); - - internal delegate BOOL EnumTimeFormatsProcEx(char* lpTimeFormatString, void* lParam); - - [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - internal static extern int GetCalendarInfoEx(string? lpLocaleName, uint Calendar, IntPtr lpReserved, uint CalType, IntPtr lpCalData, int cchData, out int lpValue); - - [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - internal static extern int GetCalendarInfoEx(string? lpLocaleName, uint Calendar, IntPtr lpReserved, uint CalType, IntPtr lpCalData, int cchData, IntPtr lpValue); - - [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - internal static extern bool EnumCalendarInfoExEx(EnumCalendarInfoProcExEx pCalInfoEnumProcExEx, string lpLocaleName, uint Calendar, string? lpReserved, uint CalType, void* lParam); - - internal delegate BOOL EnumCalendarInfoProcExEx(char* lpCalendarInfoString, uint Calendar, IntPtr lpReserved, void* lParam); - - [StructLayout(LayoutKind.Sequential)] - internal struct NlsVersionInfoEx - { - internal int dwNLSVersionInfoSize; - internal int dwNLSVersion; - internal int dwDefinedVersion; - internal int dwEffectiveId; - internal Guid guidCustomVersion; - } - - [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - internal static extern bool GetNLSVersionEx(int function, string localeName, NlsVersionInfoEx* lpVersionInformation); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.HandleTypes.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.HandleTypes.cs deleted file mode 100644 index a5a42af560e..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.HandleTypes.cs +++ /dev/null @@ -1,16 +0,0 @@ -// 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. - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal partial class HandleTypes - { - internal const int STD_INPUT_HANDLE = -10; - internal const int STD_OUTPUT_HANDLE = -11; - internal const int STD_ERROR_HANDLE = -12; - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.IsWow64Process_IntPtr.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.IsWow64Process_IntPtr.cs deleted file mode 100644 index 43936ab3fae..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.IsWow64Process_IntPtr.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool IsWow64Process(IntPtr hProcess, out bool Wow64Process); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LoadLibraryEx.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LoadLibraryEx.cs deleted file mode 100644 index 7693f628075..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LoadLibraryEx.cs +++ /dev/null @@ -1,19 +0,0 @@ -// 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 Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal const int LOAD_LIBRARY_AS_DATAFILE = 0x00000002; - internal const int LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800; - - [DllImport(Libraries.Kernel32, EntryPoint = "LoadLibraryExW", CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern SafeLibraryHandle LoadLibraryEx(string libFilename, IntPtr reserved, int flags); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LocalAlloc.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LocalAlloc.cs deleted file mode 100644 index 14486c2b533..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LocalAlloc.cs +++ /dev/null @@ -1,24 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal const uint LMEM_FIXED = 0x0000; - internal const uint LMEM_MOVEABLE = 0x0002; - - [DllImport(Libraries.Kernel32)] - internal static extern IntPtr LocalAlloc(uint uFlags, UIntPtr uBytes); - - [DllImport(Libraries.Kernel32)] - internal static extern IntPtr LocalReAlloc(IntPtr hMem, IntPtr uBytes, uint uFlags); - - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern IntPtr LocalFree(IntPtr hMem); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LockFile.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LockFile.cs deleted file mode 100644 index 82c7e4998b8..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.LockFile.cs +++ /dev/null @@ -1,18 +0,0 @@ -// 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 Microsoft.Win32.SafeHandles; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool LockFile(SafeFileHandle handle, int offsetLow, int offsetHigh, int countLow, int countHigh); - - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool UnlockFile(SafeFileHandle handle, int offsetLow, int offsetHigh, int countLow, int countHigh); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MAX_PATH.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MAX_PATH.cs deleted file mode 100644 index 9de12c94041..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MAX_PATH.cs +++ /dev/null @@ -1,11 +0,0 @@ -// 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. - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal const int MAX_PATH = 260; - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MEMORYSTATUSEX.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MEMORYSTATUSEX.cs deleted file mode 100644 index 83d1d860d1b..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MEMORYSTATUSEX.cs +++ /dev/null @@ -1,26 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [StructLayout(LayoutKind.Sequential)] - internal struct MEMORYSTATUSEX - { - // The length field must be set to the size of this data structure. - internal int length; - internal int memoryLoad; - internal ulong totalPhys; - internal ulong availPhys; - internal ulong totalPageFile; - internal ulong availPageFile; - internal ulong totalVirtual; - internal ulong availVirtual; - internal ulong availExtendedVirtual; - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MEMORY_BASIC_INFORMATION.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MEMORY_BASIC_INFORMATION.cs deleted file mode 100644 index ce49fb58179..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MEMORY_BASIC_INFORMATION.cs +++ /dev/null @@ -1,24 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct MEMORY_BASIC_INFORMATION - { - internal void* BaseAddress; - internal void* AllocationBase; - internal uint AllocationProtect; - internal UIntPtr RegionSize; - internal uint State; - internal uint Protect; - internal uint Type; - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MUI.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MUI.cs deleted file mode 100644 index 12867a8527b..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MUI.cs +++ /dev/null @@ -1,16 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal const uint MUI_PREFERRED_UI_LANGUAGES = 0x10; - - [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)] - internal static extern unsafe bool GetFileMUIPath(uint dwFlags, string pcwszFilePath, char* pwszLanguage, ref int pcchLanguage, char* pwszFileMUIPath, ref int pcchFileMUIPath, ref long pululEnumerator); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MultiByteToWideChar.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MultiByteToWideChar.cs deleted file mode 100644 index d369cb49c7c..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.MultiByteToWideChar.cs +++ /dev/null @@ -1,19 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32)] - internal static extern unsafe int MultiByteToWideChar( - uint CodePage, uint dwFlags, - byte* lpMultiByteStr, int cbMultiByte, - char* lpWideCharStr, int cchWideChar); - - internal const uint MB_PRECOMPOSED = 0x00000001; - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Mutex.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Mutex.cs deleted file mode 100644 index 6adaf987370..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Mutex.cs +++ /dev/null @@ -1,25 +0,0 @@ -// 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. - -#nullable enable -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal const uint CREATE_MUTEX_INITIAL_OWNER = 0x1; - - [DllImport(Libraries.Kernel32, EntryPoint = "OpenMutexW", SetLastError = true, CharSet = CharSet.Unicode)] - internal static extern SafeWaitHandle OpenMutex(uint desiredAccess, bool inheritHandle, string name); - - [DllImport(Libraries.Kernel32, EntryPoint = "CreateMutexExW", SetLastError = true, CharSet = CharSet.Unicode)] - internal static extern SafeWaitHandle CreateMutexEx(IntPtr lpMutexAttributes, string? name, uint flags, uint desiredAccess); - - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool ReleaseMutex(SafeWaitHandle handle); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.OSVERSIONINFOEX.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.OSVERSIONINFOEX.cs deleted file mode 100644 index 0f6e2e6b333..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.OSVERSIONINFOEX.cs +++ /dev/null @@ -1,27 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - internal unsafe struct OSVERSIONINFOEX - { - public int dwOSVersionInfoSize; - public int dwMajorVersion; - public int dwMinorVersion; - public int dwBuildNumber; - public int dwPlatformId; - public fixed char szCSDVersion[128]; - public ushort wServicePackMajor; - public ushort wServicePackMinor; - public ushort wSuiteMask; - public byte wProductType; - public byte wReserved; - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.OutputDebugString.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.OutputDebugString.cs deleted file mode 100644 index 3ad3edde73d..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.OutputDebugString.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Interop.Libraries.Kernel32, CharSet = CharSet.Unicode, EntryPoint = "OutputDebugStringW", ExactSpelling = true)] - internal static extern void OutputDebugString(string message); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceCounter.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceCounter.cs deleted file mode 100644 index 63f68473234..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceCounter.cs +++ /dev/null @@ -1,23 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - // The actual native signature is: - // BOOL WINAPI QueryPerformanceCounter( - // _Out_ LARGE_INTEGER* lpPerformanceCount - // ); - // - // We take a long* (rather than a out long) to avoid the pinning overhead. - // We don't set last error since we don't need the extended error info. - - [DllImport(Libraries.Kernel32, ExactSpelling = true)] - [SuppressGCTransition] - internal static extern unsafe BOOL QueryPerformanceCounter(long* lpPerformanceCount); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceFrequency.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceFrequency.cs deleted file mode 100644 index 641451b671f..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceFrequency.cs +++ /dev/null @@ -1,22 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - // The actual native signature is: - // BOOL WINAPI QueryPerformanceFrequency( - // _Out_ LARGE_INTEGER* lpFrequency - // ); - // - // We take a long* (rather than a out long) to avoid the pinning overhead. - // We don't set last error since we don't need the extended error info. - - [DllImport(Libraries.Kernel32, ExactSpelling = true)] - internal static extern unsafe BOOL QueryPerformanceFrequency(long* lpFrequency); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryUnbiasedInterruptTime.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryUnbiasedInterruptTime.cs deleted file mode 100644 index f7264d4dc8c..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryUnbiasedInterruptTime.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32)] - internal static extern bool QueryUnbiasedInterruptTime(out ulong UnbiasedTime); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs deleted file mode 100644 index b9f1c9584d8..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_IntPtr.cs +++ /dev/null @@ -1,20 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe int ReadFile( - SafeHandle handle, - byte* bytes, - int numBytesToRead, - out int numBytesRead, - IntPtr mustBeZero); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs deleted file mode 100644 index a3c72547f96..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ReadFile_SafeHandle_NativeOverlapped.cs +++ /dev/null @@ -1,21 +0,0 @@ -// 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.Runtime.InteropServices; -using System.Threading; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe int ReadFile( - SafeHandle handle, - byte* bytes, - int numBytesToRead, - IntPtr numBytesRead_mustBeZero, - NativeOverlapped* overlapped); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ResolveLocaleName.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ResolveLocaleName.cs deleted file mode 100644 index c349129d515..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.ResolveLocaleName.cs +++ /dev/null @@ -1,16 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static unsafe partial class Kernel32 - { - internal const int LOCALE_NAME_MAX_LENGTH = 85; - - [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - internal static extern int ResolveLocaleName(string lpNameToResolve, char* lpLocaleName, int cchLocaleName); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SECURITY_ATTRIBUTES.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SECURITY_ATTRIBUTES.cs deleted file mode 100644 index f2f32fd2775..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SECURITY_ATTRIBUTES.cs +++ /dev/null @@ -1,20 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [StructLayout(LayoutKind.Sequential)] - internal struct SECURITY_ATTRIBUTES - { - internal uint nLength; - internal IntPtr lpSecurityDescriptor; - internal BOOL bInheritHandle; - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SYSTEM_INFO.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SYSTEM_INFO.cs deleted file mode 100644 index 0ebeeff1933..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SYSTEM_INFO.cs +++ /dev/null @@ -1,38 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [StructLayout(LayoutKind.Sequential)] - internal struct SYSTEM_INFO - { - internal ushort wProcessorArchitecture; - internal ushort wReserved; - internal int dwPageSize; - internal IntPtr lpMinimumApplicationAddress; - internal IntPtr lpMaximumApplicationAddress; - internal IntPtr dwActiveProcessorMask; - internal int dwNumberOfProcessors; - internal int dwProcessorType; - internal int dwAllocationGranularity; - internal short wProcessorLevel; - internal short wProcessorRevision; - } - - internal enum ProcessorArchitecture : ushort - { - Processor_Architecture_INTEL = 0, - Processor_Architecture_ARM = 5, - Processor_Architecture_IA64 = 6, - Processor_Architecture_AMD64 = 9, - Processor_Architecture_ARM64 = 12, - Processor_Architecture_UNKNOWN = 0xFFFF - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SecurityOptions.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SecurityOptions.cs deleted file mode 100644 index bc9f5806771..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SecurityOptions.cs +++ /dev/null @@ -1,18 +0,0 @@ -// 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. - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal static partial class SecurityOptions - { - internal const int SECURITY_SQOS_PRESENT = 0x00100000; - internal const int SECURITY_ANONYMOUS = 0 << 16; - internal const int SECURITY_IDENTIFICATION = 1 << 16; - internal const int SECURITY_IMPERSONATION = 2 << 16; - internal const int SECURITY_DELEGATION = 3 << 16; - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Semaphore.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Semaphore.cs deleted file mode 100644 index 4f6d8de8768..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.Semaphore.cs +++ /dev/null @@ -1,23 +0,0 @@ -// 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. - -#nullable enable -using Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, EntryPoint = "OpenSemaphoreW", SetLastError = true, CharSet = CharSet.Unicode)] - internal static extern SafeWaitHandle OpenSemaphore(uint desiredAccess, bool inheritHandle, string name); - - [DllImport(Libraries.Kernel32, EntryPoint = "CreateSemaphoreExW", SetLastError = true, CharSet = CharSet.Unicode)] - internal static extern SafeWaitHandle CreateSemaphoreEx(IntPtr lpSecurityAttributes, int initialCount, int maximumCount, string? name, uint flags, uint desiredAccess); - - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool ReleaseSemaphore(SafeWaitHandle handle, int releaseCount, out int previousCount); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetCurrentDirectory.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetCurrentDirectory.cs deleted file mode 100644 index d268d4daa6f..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetCurrentDirectory.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, EntryPoint = "SetCurrentDirectoryW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)] - internal static extern bool SetCurrentDirectory(string path); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetEndOfFile.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetEndOfFile.cs deleted file mode 100644 index 6d93e151cf6..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetEndOfFile.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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 Microsoft.Win32.SafeHandles; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool SetEndOfFile(SafeFileHandle hFile); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetEnvironmentVariable.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetEnvironmentVariable.cs deleted file mode 100644 index 243bd6562e0..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetEnvironmentVariable.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, EntryPoint = "SetEnvironmentVariableW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)] - internal static extern bool SetEnvironmentVariable(string lpName, string? lpValue); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetFilePointerEx.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetFilePointerEx.cs deleted file mode 100644 index e83806697f1..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetFilePointerEx.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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 Microsoft.Win32.SafeHandles; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern bool SetFilePointerEx(SafeFileHandle hFile, long liDistanceToMove, out long lpNewFilePointer, uint dwMoveMethod); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetThreadErrorMode.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetThreadErrorMode.cs deleted file mode 100644 index f582c20c58e..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SetThreadErrorMode.cs +++ /dev/null @@ -1,17 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true, ExactSpelling = true)] - [SuppressGCTransition] - internal static extern bool SetThreadErrorMode(uint dwNewMode, out uint lpOldMode); - - internal const uint SEM_FAILCRITICALERRORS = 1; - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SystemTimeToFileTime.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SystemTimeToFileTime.cs deleted file mode 100644 index c347eeae7f8..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.SystemTimeToFileTime.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32)] - internal static extern unsafe Interop.BOOL SystemTimeToFileTime(Interop.Kernel32.SYSTEMTIME* lpSystemTime, long* lpFileTime); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TimeZone.Registry.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TimeZone.Registry.cs deleted file mode 100644 index 14993bcca62..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TimeZone.Registry.cs +++ /dev/null @@ -1,30 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [StructLayout(LayoutKind.Sequential)] - internal struct REG_TZI_FORMAT - { - internal int Bias; - internal int StandardBias; - internal int DaylightBias; - internal SYSTEMTIME StandardDate; - internal SYSTEMTIME DaylightDate; - - internal REG_TZI_FORMAT(in TIME_ZONE_INFORMATION tzi) - { - Bias = tzi.Bias; - StandardDate = tzi.StandardDate; - StandardBias = tzi.StandardBias; - DaylightDate = tzi.DaylightDate; - DaylightBias = tzi.DaylightBias; - } - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TimeZone.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TimeZone.cs deleted file mode 100644 index 7be40ca8f4c..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TimeZone.cs +++ /dev/null @@ -1,93 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal struct SYSTEMTIME - { - internal ushort Year; - internal ushort Month; - internal ushort DayOfWeek; - internal ushort Day; - internal ushort Hour; - internal ushort Minute; - internal ushort Second; - internal ushort Milliseconds; - - internal bool Equals(in SYSTEMTIME other) => - Year == other.Year && - Month == other.Month && - DayOfWeek == other.DayOfWeek && - Day == other.Day && - Hour == other.Hour && - Minute == other.Minute && - Second == other.Second && - Milliseconds == other.Milliseconds; - } - - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - internal unsafe struct TIME_DYNAMIC_ZONE_INFORMATION - { - internal int Bias; - internal fixed char StandardName[32]; - internal SYSTEMTIME StandardDate; - internal int StandardBias; - internal fixed char DaylightName[32]; - internal SYSTEMTIME DaylightDate; - internal int DaylightBias; - internal fixed char TimeZoneKeyName[128]; - internal byte DynamicDaylightTimeDisabled; - - internal string GetTimeZoneKeyName() - { - fixed (char* p = TimeZoneKeyName) - return new string(p); - } - } - - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - internal unsafe struct TIME_ZONE_INFORMATION - { - internal int Bias; - internal fixed char StandardName[32]; - internal SYSTEMTIME StandardDate; - internal int StandardBias; - internal fixed char DaylightName[32]; - internal SYSTEMTIME DaylightDate; - internal int DaylightBias; - - internal TIME_ZONE_INFORMATION(in TIME_DYNAMIC_ZONE_INFORMATION dtzi) - { - // The start of TIME_DYNAMIC_ZONE_INFORMATION has identical layout as TIME_ZONE_INFORMATION - fixed (TIME_ZONE_INFORMATION* pTo = &this) - fixed (TIME_DYNAMIC_ZONE_INFORMATION* pFrom = &dtzi) - *pTo = *(TIME_ZONE_INFORMATION*)pFrom; - } - - internal string GetStandardName() - { - fixed (char* p = StandardName) - return new string(p); - } - - internal string GetDaylightName() - { - fixed (char* p = DaylightName) - return new string(p); - } - } - - internal const uint TIME_ZONE_ID_INVALID = unchecked((uint)-1); - - [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)] - internal static extern uint GetDynamicTimeZoneInformation(out TIME_DYNAMIC_ZONE_INFORMATION pTimeZoneInformation); - - [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)] - internal static extern uint GetTimeZoneInformation(out TIME_ZONE_INFORMATION lpTimeZoneInformation); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TzSpecificLocalTimeToSystemTime.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TzSpecificLocalTimeToSystemTime.cs deleted file mode 100644 index 5cea7e071cf..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.TzSpecificLocalTimeToSystemTime.cs +++ /dev/null @@ -1,18 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32)] - internal static extern unsafe Interop.BOOL TzSpecificLocalTimeToSystemTime( - IntPtr lpTimeZoneInformation, - Interop.Kernel32.SYSTEMTIME* lpLocalTime, - Interop.Kernel32.SYSTEMTIME* lpUniversalTime); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VerSetConditionMask.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VerSetConditionMask.cs deleted file mode 100644 index 96e6172bc63..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VerSetConditionMask.cs +++ /dev/null @@ -1,14 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32)] - internal static extern ulong VerSetConditionMask(ulong ConditionMask, uint TypeMask, byte Condition); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VerifyVersionExW.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VerifyVersionExW.cs deleted file mode 100644 index f8bd85a2a71..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VerifyVersionExW.cs +++ /dev/null @@ -1,20 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal const byte VER_GREATER_EQUAL = 0x3; - internal const uint VER_MAJORVERSION = 0x0000002; - internal const uint VER_MINORVERSION = 0x0000001; - internal const uint VER_SERVICEPACKMAJOR = 0x0000020; - internal const uint VER_SERVICEPACKMINOR = 0x0000010; - - [DllImport(Libraries.Kernel32)] - internal static extern bool VerifyVersionInfoW(ref OSVERSIONINFOEX lpVersionInfo, uint dwTypeMask, ulong dwlConditionMask); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualAlloc.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualAlloc.cs deleted file mode 100644 index 6fa12851417..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualAlloc.cs +++ /dev/null @@ -1,21 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal const int MEM_COMMIT = 0x1000; - internal const int MEM_RESERVE = 0x2000; - internal const int MEM_RELEASE = 0x8000; - internal const int MEM_FREE = 0x10000; - internal const int PAGE_READWRITE = 0x04; - - [DllImport(Libraries.Kernel32)] - internal static extern unsafe void* VirtualAlloc(void* lpAddress, UIntPtr dwSize, int flAllocationType, int flProtect); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualFree.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualFree.cs deleted file mode 100644 index 75dbdf04777..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualFree.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32)] - internal static extern unsafe bool VirtualFree(void* lpAddress, UIntPtr dwSize, int dwFreeType); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualQuery.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualQuery.cs deleted file mode 100644 index 1c9655693d9..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.VirtualQuery.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe UIntPtr VirtualQuery(void* lpAddress, ref MEMORY_BASIC_INFORMATION lpBuffer, UIntPtr dwLength); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WIN32_FILE_ATTRIBUTE_DATA.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WIN32_FILE_ATTRIBUTE_DATA.cs deleted file mode 100644 index 05607443da4..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WIN32_FILE_ATTRIBUTE_DATA.cs +++ /dev/null @@ -1,29 +0,0 @@ -// 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. - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - internal struct WIN32_FILE_ATTRIBUTE_DATA - { - internal int dwFileAttributes; - internal FILE_TIME ftCreationTime; - internal FILE_TIME ftLastAccessTime; - internal FILE_TIME ftLastWriteTime; - internal uint nFileSizeHigh; - internal uint nFileSizeLow; - - internal void PopulateFrom(ref WIN32_FIND_DATA findData) - { - dwFileAttributes = (int)findData.dwFileAttributes; - ftCreationTime = findData.ftCreationTime; - ftLastAccessTime = findData.ftLastAccessTime; - ftLastWriteTime = findData.ftLastWriteTime; - nFileSizeHigh = findData.nFileSizeHigh; - nFileSizeLow = findData.nFileSizeLow; - } - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WIN32_FIND_DATA.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WIN32_FIND_DATA.cs deleted file mode 100644 index f1ed25f83b4..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WIN32_FIND_DATA.cs +++ /dev/null @@ -1,32 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - internal unsafe struct WIN32_FIND_DATA - { - internal uint dwFileAttributes; - internal FILE_TIME ftCreationTime; - internal FILE_TIME ftLastAccessTime; - internal FILE_TIME ftLastWriteTime; - internal uint nFileSizeHigh; - internal uint nFileSizeLow; - internal uint dwReserved0; - internal uint dwReserved1; - private fixed char _cFileName[MAX_PATH]; - private fixed char _cAlternateFileName[14]; - - internal ReadOnlySpan<char> cFileName - { - get { fixed (char* c = _cFileName) return new ReadOnlySpan<char>(c, MAX_PATH); } - } - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WideCharToMultiByte.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WideCharToMultiByte.cs deleted file mode 100644 index 1925a8c5785..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WideCharToMultiByte.cs +++ /dev/null @@ -1,22 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - [DllImport(Libraries.Kernel32)] - internal static extern unsafe int WideCharToMultiByte( - uint CodePage, uint dwFlags, - char* lpWideCharStr, int cchWideChar, - byte* lpMultiByteStr, int cbMultiByte, - IntPtr lpDefaultChar, IntPtr lpUsedDefaultChar); - - internal const uint CP_ACP = 0; - internal const uint WC_NO_BEST_FIT_CHARS = 0x00000400; - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs deleted file mode 100644 index e25d205259d..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_IntPtr.cs +++ /dev/null @@ -1,22 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - // Note there are two different WriteFile prototypes - this is to use - // the type system to force you to not trip across a "feature" in - // Win32's async IO support. You can't do the following three things - // simultaneously: overlapped IO, free the memory for the overlapped - // struct in a callback (or an EndWrite method called by that callback), - // and pass in an address for the numBytesRead parameter. - - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe int WriteFile(SafeHandle handle, byte* bytes, int numBytesToWrite, out int numBytesWritten, IntPtr mustBeZero); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs deleted file mode 100644 index 9c01f0a5fb7..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.WriteFile_SafeHandle_NativeOverlapped.cs +++ /dev/null @@ -1,22 +0,0 @@ -// 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.Runtime.InteropServices; -using System.Threading; - -internal static partial class Interop -{ - internal static partial class Kernel32 - { - // Note there are two different WriteFile prototypes - this is to use - // the type system to force you to not trip across a "feature" in - // Win32's async IO support. You can't do the following three things - // simultaneously: overlapped IO, free the memory for the overlapped - // struct in a callback (or an EndWrite method called by that callback), - // and pass in an address for the numBytesRead parameter. - [DllImport(Libraries.Kernel32, SetLastError = true)] - internal static extern unsafe int WriteFile(SafeHandle handle, byte* bytes, int numBytesToWrite, IntPtr numBytesWritten_mustBeZero, NativeOverlapped* lpOverlapped); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Normaliz/Interop.Idna.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Normaliz/Interop.Idna.cs deleted file mode 100644 index 039e34b5157..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Normaliz/Interop.Idna.cs +++ /dev/null @@ -1,34 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Normaliz - { - // - // Idn APIs - // - - [DllImport("Normaliz.dll", CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern unsafe int IdnToAscii( - uint dwFlags, - char* lpUnicodeCharStr, - int cchUnicodeChar, - char* lpASCIICharStr, - int cchASCIIChar); - - [DllImport("Normaliz.dll", CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern unsafe int IdnToUnicode( - uint dwFlags, - char* lpASCIICharStr, - int cchASCIIChar, - char* lpUnicodeCharStr, - int cchUnicodeChar); - - internal const int IDN_ALLOW_UNASSIGNED = 0x1; - internal const int IDN_USE_STD3_ASCII_RULES = 0x2; - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Normaliz/Interop.Normalization.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Normaliz/Interop.Normalization.cs deleted file mode 100644 index 3e954483d18..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Normaliz/Interop.Normalization.cs +++ /dev/null @@ -1,23 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Normaliz - { - [DllImport("Normaliz.dll", CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern bool IsNormalizedString(int normForm, string source, int length); - - [DllImport("Normaliz.dll", CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern int NormalizeString( - int normForm, - string source, - int sourceLength, - [System.Runtime.InteropServices.OutAttribute] - char[]? destination, - int destinationLength); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/NtDll/Interop.NtQueryInformationFile.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/NtDll/Interop.NtQueryInformationFile.cs deleted file mode 100644 index ed36e7898b3..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/NtDll/Interop.NtQueryInformationFile.cs +++ /dev/null @@ -1,46 +0,0 @@ -// 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 Microsoft.Win32.SafeHandles; -using System; -using System.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class NtDll - { - [DllImport(Libraries.NtDll, ExactSpelling = true)] - internal static extern unsafe int NtQueryInformationFile( - SafeFileHandle FileHandle, - out IO_STATUS_BLOCK IoStatusBlock, - void* FileInformation, - uint Length, - uint FileInformationClass); - - [StructLayout(LayoutKind.Sequential)] - internal struct IO_STATUS_BLOCK - { - private IO_STATUS Status; - private IntPtr Information; - } - - // This isn't an actual Windows type, we have to separate it out as the size of IntPtr varies by architecture - // and we can't specify the size at compile time to offset the Information pointer in the status block. - [StructLayout(LayoutKind.Explicit)] - internal struct IO_STATUS - { - [FieldOffset(0)] - private int Status; - - [FieldOffset(0)] - private IntPtr Pointer; - } - - internal const uint FileModeInformation = 16; - internal const uint FILE_SYNCHRONOUS_IO_ALERT = 0x00000010; - internal const uint FILE_SYNCHRONOUS_IO_NONALERT = 0x00000020; - - internal const int STATUS_INVALID_HANDLE = unchecked((int)0xC0000008); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/NtDll/Interop.NtQuerySystemInformation.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/NtDll/Interop.NtQuerySystemInformation.cs deleted file mode 100644 index dc8be886d6c..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/NtDll/Interop.NtQuerySystemInformation.cs +++ /dev/null @@ -1,23 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class NtDll - { - [DllImport(Libraries.NtDll)] - internal static extern unsafe int NtQuerySystemInformation(int SystemInformationClass, void* SystemInformation, int SystemInformationLength, uint* ReturnLength); - - [StructLayout(LayoutKind.Sequential)] - internal struct SYSTEM_LEAP_SECOND_INFORMATION - { - public bool Enabled; - public uint Flags; - } - - internal const int SystemLeapSecondInformation = 206; - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Ole32/Interop.CoCreateGuid.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Ole32/Interop.CoCreateGuid.cs deleted file mode 100644 index 57accbe7c00..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Ole32/Interop.CoCreateGuid.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Ole32 - { - [DllImport(Interop.Libraries.Ole32)] - internal static extern int CoCreateGuid(out Guid guid); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Ole32/Interop.CoTaskMemAlloc.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Ole32/Interop.CoTaskMemAlloc.cs deleted file mode 100644 index e51dc99550c..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Ole32/Interop.CoTaskMemAlloc.cs +++ /dev/null @@ -1,21 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Ole32 - { - [DllImport(Libraries.Ole32)] - internal static extern IntPtr CoTaskMemAlloc(UIntPtr cb); - - [DllImport(Libraries.Ole32)] - internal static extern IntPtr CoTaskMemRealloc(IntPtr pv, UIntPtr cb); - - [DllImport(Libraries.Ole32)] - internal static extern void CoTaskMemFree(IntPtr ptr); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringByteLen.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringByteLen.cs deleted file mode 100644 index 7c97ecdca7a..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringByteLen.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class OleAut32 - { - [DllImport(Libraries.OleAut32)] - internal static extern IntPtr SysAllocStringByteLen(byte[]? str, uint len); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringLen.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringLen.cs deleted file mode 100644 index ac9459907bf..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringLen.cs +++ /dev/null @@ -1,16 +0,0 @@ -// 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.Runtime.InteropServices; -using System.Security; - -internal static partial class Interop -{ - internal static partial class OleAut32 - { - [DllImport(Libraries.OleAut32, CharSet = CharSet.Unicode)] - internal static extern IntPtr SysAllocStringLen(string? src, int len); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysFreeString.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysFreeString.cs deleted file mode 100644 index fea22df406a..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/OleAut32/Interop.SysFreeString.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class OleAut32 - { - [DllImport(Libraries.OleAut32)] - internal static extern void SysFreeString(IntPtr bstr); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Secur32/Interop.GetUserNameExW.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Secur32/Interop.GetUserNameExW.cs deleted file mode 100644 index e88864cd9e7..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Secur32/Interop.GetUserNameExW.cs +++ /dev/null @@ -1,16 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Secur32 - { - [DllImport(Libraries.Secur32, CharSet = CharSet.Unicode, SetLastError = true)] - internal static extern BOOLEAN GetUserNameExW(int NameFormat, ref char lpNameBuffer, ref uint lpnSize); - - internal const int NameSamCompatible = 2; - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/Shell32/Interop.SHGetKnownFolderPath.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/Shell32/Interop.SHGetKnownFolderPath.cs deleted file mode 100644 index 3e72b01e1f6..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/Shell32/Interop.SHGetKnownFolderPath.cs +++ /dev/null @@ -1,320 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class Shell32 - { - internal const int COR_E_PLATFORMNOTSUPPORTED = unchecked((int)0x80131539); - - // https://msdn.microsoft.com/en-us/library/windows/desktop/bb762188.aspx - [DllImport(Libraries.Shell32, CharSet = CharSet.Unicode, SetLastError = false, BestFitMapping = false, ExactSpelling = true)] - internal static extern int SHGetKnownFolderPath( - [MarshalAs(UnmanagedType.LPStruct)] Guid rfid, - uint dwFlags, - IntPtr hToken, - out string ppszPath); - - // https://msdn.microsoft.com/en-us/library/windows/desktop/dd378457.aspx - internal static class KnownFolders - { - /// <summary> - /// (CSIDL_ADMINTOOLS) Per user Administrative Tools - /// "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Administrative Tools" - /// </summary> - internal const string AdminTools = "{724EF170-A42D-4FEF-9F26-B60E846FBA4F}"; - - /// <summary> - /// (CSIDL_CDBURN_AREA) Temporary Burn folder - /// "%LOCALAPPDATA%\Microsoft\Windows\Burn\Burn" - /// </summary> - internal const string CDBurning = "{9E52AB10-F80D-49DF-ACB8-4330F5687855}"; - - /// <summary> - /// (CSIDL_COMMON_ADMINTOOLS) Common Administrative Tools - /// "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\Administrative Tools" - /// </summary> - internal const string CommonAdminTools = "{D0384E7D-BAC3-4797-8F14-CBA229B392B5}"; - - /// <summary> - /// (CSIDL_COMMON_OEM_LINKS) OEM Links folder - /// "%ALLUSERSPROFILE%\OEM Links" - /// </summary> - internal const string CommonOEMLinks = "{C1BAE2D0-10DF-4334-BEDD-7AA20B227A9D}"; - - /// <summary> - /// (CSIDL_COMMON_PROGRAMS) Common Programs folder - /// "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs" - /// </summary> - internal const string CommonPrograms = "{0139D44E-6AFE-49F2-8690-3DAFCAE6FFB8}"; - - /// <summary> - /// (CSIDL_COMMON_STARTMENU) Common Start Menu folder - /// "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu" - /// </summary> - internal const string CommonStartMenu = "{A4115719-D62E-491D-AA7C-E74B8BE3B067}"; - - /// <summary> - /// (CSIDL_COMMON_STARTUP, CSIDL_COMMON_ALTSTARTUP) Common Startup folder - /// "%ALLUSERSPROFILE%\Microsoft\Windows\Start Menu\Programs\StartUp" - /// </summary> - internal const string CommonStartup = "{82A5EA35-D9CD-47C5-9629-E15D2F714E6E}"; - - /// <summary> - /// (CSIDL_COMMON_TEMPLATES) Common Templates folder - /// "%ALLUSERSPROFILE%\Microsoft\Windows\Templates" - /// </summary> - internal const string CommonTemplates = "{B94237E7-57AC-4347-9151-B08C6C32D1F7}"; - - /// <summary> - /// (CSIDL_DRIVES) Computer virtual folder - /// </summary> - internal const string ComputerFolder = "{0AC0837C-BBF8-452A-850D-79D08E667CA7}"; - - /// <summary> - /// (CSIDL_CONNECTIONS) Network Connections virtual folder - /// </summary> - internal const string ConnectionsFolder = "{6F0CD92B-2E97-45D1-88FF-B0D186B8DEDD}"; - - /// <summary> - /// (CSIDL_CONTROLS) Control Panel virtual folder - /// </summary> - internal const string ControlPanelFolder = "{82A74AEB-AEB4-465C-A014-D097EE346D63}"; - - /// <summary> - /// (CSIDL_COOKIES) Cookies folder - /// "%APPDATA%\Microsoft\Windows\Cookies" - /// </summary> - internal const string Cookies = "{2B0F765D-C0E9-4171-908E-08A611B84FF6}"; - - /// <summary> - /// (CSIDL_DESKTOP, CSIDL_DESKTOPDIRECTORY) Desktop folder - /// "%USERPROFILE%\Desktop" - /// </summary> - internal const string Desktop = "{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}"; - - /// <summary> - /// (CSIDL_MYDOCUMENTS, CSIDL_PERSONAL) Documents (My Documents) folder - /// "%USERPROFILE%\Documents" - /// </summary> - internal const string Documents = "{FDD39AD0-238F-46AF-ADB4-6C85480369C7}"; - - /// <summary> - /// (CSIDL_FAVORITES, CSIDL_COMMON_FAVORITES) Favorites folder - /// "%USERPROFILE%\Favorites" - /// </summary> - internal const string Favorites = "{1777F761-68AD-4D8A-87BD-30B759FA33DD}"; - - /// <summary> - /// (CSIDL_FONTS) Fonts folder - /// "%windir%\Fonts" - /// </summary> - internal const string Fonts = "{FD228CB7-AE11-4AE3-864C-16F3910AB8FE}"; - - /// <summary> - /// (CSIDL_HISTORY) History folder - /// "%LOCALAPPDATA%\Microsoft\Windows\History" - /// </summary> - internal const string History = "{D9DC8A3B-B784-432E-A781-5A1130A75963}"; - - /// <summary> - /// (CSIDL_INTERNET_CACHE) Temporary Internet Files folder - /// "%LOCALAPPDATA%\Microsoft\Windows\Temporary Internet Files" - /// </summary> - internal const string InternetCache = "{352481E8-33BE-4251-BA85-6007CAEDCF9D}"; - - /// <summary> - /// (CSIDL_INTERNET) The Internet virtual folder - /// </summary> - internal const string InternetFolder = "{4D9F7874-4E0C-4904-967B-40B0D20C3E4B}"; - - /// <summary> - /// (CSIDL_LOCAL_APPDATA) Local folder - /// "%LOCALAPPDATA%" ("%USERPROFILE%\AppData\Local") - /// </summary> - internal const string LocalAppData = "{F1B32785-6FBA-4FCF-9D55-7B8E7F157091}"; - - /// <summary> - /// (CSIDL_RESOURCES_LOCALIZED) Fixed localized resources folder - /// "%windir%\resources\0409" (per active codepage) - /// </summary> - internal const string LocalizedResourcesDir = "{2A00375E-224C-49DE-B8D1-440DF7EF3DDC}"; - - /// <summary> - /// (CSIDL_MYMUSIC) Music folder - /// "%USERPROFILE%\Music" - /// </summary> - internal const string Music = "{4BD8D571-6D19-48D3-BE97-422220080E43}"; - - /// <summary> - /// (CSIDL_NETHOOD) Network shortcuts folder "%APPDATA%\Microsoft\Windows\Network Shortcuts" - /// </summary> - internal const string NetHood = "{C5ABBF53-E17F-4121-8900-86626FC2C973}"; - - /// <summary> - /// (CSIDL_NETWORK, CSIDL_COMPUTERSNEARME) Network virtual folder - /// </summary> - internal const string NetworkFolder = "{D20BEEC4-5CA8-4905-AE3B-BF251EA09B53}"; - - /// <summary> - /// (CSIDL_MYPICTURES) Pictures folder "%USERPROFILE%\Pictures" - /// </summary> - internal const string Pictures = "{33E28130-4E1E-4676-835A-98395C3BC3BB}"; - - /// <summary> - /// (CSIDL_PRINTERS) Printers virtual folder - /// </summary> - internal const string PrintersFolder = "{76FC4E2D-D6AD-4519-A663-37BD56068185}"; - - /// <summary> - /// (CSIDL_PRINTHOOD) Printer Shortcuts folder - /// "%APPDATA%\Microsoft\Windows\Printer Shortcuts" - /// </summary> - internal const string PrintHood = "{9274BD8D-CFD1-41C3-B35E-B13F55A758F4}"; - - /// <summary> - /// (CSIDL_PROFILE) The root users profile folder "%USERPROFILE%" - /// ("%SystemDrive%\Users\%USERNAME%") - /// </summary> - internal const string Profile = "{5E6C858F-0E22-4760-9AFE-EA3317B67173}"; - - /// <summary> - /// (CSIDL_COMMON_APPDATA) ProgramData folder - /// "%ALLUSERSPROFILE%" ("%ProgramData%", "%SystemDrive%\ProgramData") - /// </summary> - internal const string ProgramData = "{62AB5D82-FDC1-4DC3-A9DD-070D1D495D97}"; - - /// <summary> - /// (CSIDL_PROGRAM_FILES) Program Files folder for the current process architecture - /// "%ProgramFiles%" ("%SystemDrive%\Program Files") - /// </summary> - internal const string ProgramFiles = "{905e63b6-c1bf-494e-b29c-65b732d3d21a}"; - - /// <summary> - /// (CSIDL_PROGRAM_FILESX86) 32 bit Program Files folder (available to both 32/64 bit processes) - /// </summary> - internal const string ProgramFilesX86 = "{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}"; - - /// <summary> - /// (CSIDL_PROGRAM_FILES_COMMON) Common Program Files folder for the current process architecture - /// "%ProgramFiles%\Common Files" - /// </summary> - internal const string ProgramFilesCommon = "{F7F1ED05-9F6D-47A2-AAAE-29D317C6F066}"; - - /// <summary> - /// (CSIDL_PROGRAM_FILES_COMMONX86) Common 32 bit Program Files folder (available to both 32/64 bit processes) - /// </summary> - internal const string ProgramFilesCommonX86 = "{DE974D24-D9C6-4D3E-BF91-F4455120B917}"; - - /// <summary> - /// (CSIDL_PROGRAMS) Start menu Programs folder - /// "%APPDATA%\Microsoft\Windows\Start Menu\Programs" - /// </summary> - internal const string Programs = "{A77F5D77-2E2B-44C3-A6A2-ABA601054A51}"; - - /// <summary> - /// (CSIDL_COMMON_DESKTOPDIRECTORY) Public Desktop folder - /// "%PUBLIC%\Desktop" - /// </summary> - internal const string PublicDesktop = "{C4AA340D-F20F-4863-AFEF-F87EF2E6BA25}"; - - /// <summary> - /// (CSIDL_COMMON_DOCUMENTS) Public Documents folder - /// "%PUBLIC%\Documents" - /// </summary> - internal const string PublicDocuments = "{ED4824AF-DCE4-45A8-81E2-FC7965083634}"; - - /// <summary> - /// (CSIDL_COMMON_MUSIC) Public Music folder - /// "%PUBLIC%\Music" - /// </summary> - internal const string PublicMusic = "{3214FAB5-9757-4298-BB61-92A9DEAA44FF}"; - - /// <summary> - /// (CSIDL_COMMON_PICTURES) Public Pictures folder - /// "%PUBLIC%\Pictures" - /// </summary> - internal const string PublicPictures = "{B6EBFB86-6907-413C-9AF7-4FC2ABF07CC5}"; - - /// <summary> - /// (CSIDL_COMMON_VIDEO) Public Videos folder - /// "%PUBLIC%\Videos" - /// </summary> - internal const string PublicVideos = "{2400183A-6185-49FB-A2D8-4A392A602BA3}"; - - /// <summary> - /// (CSIDL_RECENT) Recent Items folder - /// "%APPDATA%\Microsoft\Windows\Recent" - /// </summary> - internal const string Recent = "{AE50C081-EBD2-438A-8655-8A092E34987A}"; - - /// <summary> - /// (CSIDL_BITBUCKET) Recycle Bin virtual folder - /// </summary> - internal const string RecycleBinFolder = "{B7534046-3ECB-4C18-BE4E-64CD4CB7D6AC}"; - - /// <summary> - /// (CSIDL_RESOURCES) Resources fixed folder - /// "%windir%\Resources" - /// </summary> - internal const string ResourceDir = "{8AD10C31-2ADB-4296-A8F7-E4701232C972}"; - - /// <summary> - /// (CSIDL_APPDATA) Roaming user application data folder - /// "%APPDATA%" ("%USERPROFILE%\AppData\Roaming") - /// </summary> - internal const string RoamingAppData = "{3EB685DB-65F9-4CF6-A03A-E3EF65729F3D}"; - - /// <summary> - /// (CSIDL_SENDTO) SendTo folder - /// "%APPDATA%\Microsoft\Windows\SendTo" - /// </summary> - internal const string SendTo = "{8983036C-27C0-404B-8F08-102D10DCFD74}"; - - /// <summary> - /// (CSIDL_STARTMENU) Start Menu folder - /// "%APPDATA%\Microsoft\Windows\Start Menu" - /// </summary> - internal const string StartMenu = "{625B53C3-AB48-4EC1-BA1F-A1EF4146FC19}"; - - /// <summary> - /// (CSIDL_STARTUP, CSIDL_ALTSTARTUP) Startup folder - /// "%APPDATA%\Microsoft\Windows\Start Menu\Programs\StartUp" - /// </summary> - internal const string Startup = "{B97D20BB-F46A-4C97-BA10-5E3608430854}"; - - /// <summary> - /// (CSIDL_SYSTEM) System32 folder - /// "%windir%\system32" - /// </summary> - internal const string System = "{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}"; - - /// <summary> - /// (CSIDL_SYSTEMX86) X86 System32 folder - /// "%windir%\system32" or "%windir%\syswow64" - /// </summary> - internal const string SystemX86 = "{D65231B0-B2F1-4857-A4CE-A8E7C6EA7D27}"; - - /// <summary> - /// (CSIDL_TEMPLATES) Templates folder - /// "%APPDATA%\Microsoft\Windows\Templates" - /// </summary> - internal const string Templates = "{A63293E8-664E-48DB-A079-DF759E0509F7}"; - - /// <summary> - /// (CSIDL_MYVIDEO) Videos folder - /// "%USERPROFILE%\Videos" - /// </summary> - internal const string Videos = "{18989B1D-99B5-455B-841C-AB7C74E4DDFC}"; - - /// <summary> - /// (CSIDL_WINDOWS) Windows folder "%windir%" - /// </summary> - internal const string Windows = "{F38BF404-1D43-42F2-9305-67DE0B28FC23}"; - } - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.Constants.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.Constants.cs deleted file mode 100644 index a48329fb6b1..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.Constants.cs +++ /dev/null @@ -1,12 +0,0 @@ -// 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. - -internal static partial class Interop -{ - internal static partial class User32 - { - internal const int HWND_BROADCAST = 0xffff; - internal const int WM_SETTINGCHANGE = 0x001A; - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.LoadString.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.LoadString.cs deleted file mode 100644 index e328e9b0c1e..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.LoadString.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; -using Microsoft.Win32.SafeHandles; - -internal static partial class Interop -{ - internal static partial class User32 - { - [DllImport(Libraries.User32, SetLastError = true, EntryPoint = "LoadStringW", CharSet = CharSet.Unicode)] - internal static extern unsafe int LoadString(SafeLibraryHandle hInstance, uint uID, char* lpBuffer, int cchBufferMax); - } -} diff --git a/netcore/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.SendMessageTimeout.cs b/netcore/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.SendMessageTimeout.cs deleted file mode 100644 index f73c0aceaa8..00000000000 --- a/netcore/System.Private.CoreLib/shared/Interop/Windows/User32/Interop.SendMessageTimeout.cs +++ /dev/null @@ -1,15 +0,0 @@ -// 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.Runtime.InteropServices; - -internal static partial class Interop -{ - internal static partial class User32 - { - [DllImport(Libraries.User32, EntryPoint = "SendMessageTimeoutW", CharSet = CharSet.Unicode)] - public static extern IntPtr SendMessageTimeout(IntPtr hWnd, int msg, IntPtr wParam, string lParam, int flags, int timeout, IntPtr pdwResult); - } -} |