You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.167
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
parent
e49d6f06c0
commit
536cd135cc
@@ -0,0 +1,33 @@
|
||||
// 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 GlobalizationInterop
|
||||
{
|
||||
internal delegate void EnumCalendarInfoCallback(
|
||||
[MarshalAs(UnmanagedType.LPWStr)] string calendarString,
|
||||
IntPtr context);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetCalendars")]
|
||||
internal static extern int GetCalendars(string localeName, CalendarId[] calendars, int calendarsCapacity);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetCalendarInfo")]
|
||||
internal static extern ResultCode GetCalendarInfo(string localeName, CalendarId calendarId, CalendarDataType calendarDataType, [Out] StringBuilder result, int resultCapacity);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_EnumCalendarInfo")]
|
||||
internal static extern bool EnumCalendarInfo(EnumCalendarInfoCallback callback, string localeName, CalendarId calendarId, CalendarDataType calendarDataType, IntPtr context);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, EntryPoint = "GlobalizationNative_GetLatestJapaneseEra")]
|
||||
internal static extern int GetLatestJapaneseEra();
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, EntryPoint = "GlobalizationNative_GetJapaneseEraStartDate")]
|
||||
internal static extern bool GetJapaneseEraStartDate(int era, out int startYear, out int startMonth, out int startDay);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// 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 GlobalizationInterop
|
||||
{
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ChangeCase")]
|
||||
internal unsafe static extern void ChangeCase(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ChangeCaseInvariant")]
|
||||
internal unsafe static extern void ChangeCaseInvariant(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ChangeCaseTurkish")]
|
||||
internal unsafe static extern void ChangeCaseTurkish(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// 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 GlobalizationInterop
|
||||
{
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetSortHandle")]
|
||||
internal unsafe static extern ResultCode GetSortHandle(byte[] localeName, out SafeSortHandle sortHandle);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_CloseSortHandle")]
|
||||
internal unsafe static extern void CloseSortHandle(IntPtr handle);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_CompareString")]
|
||||
internal unsafe static extern int CompareString(SafeSortHandle sortHandle, char* lpStr1, int cwStr1Len, char* lpStr2, int cwStr2Len, CompareOptions options);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IndexOf")]
|
||||
internal unsafe static extern int IndexOf(SafeSortHandle sortHandle, string target, int cwTargetLength, char* pSource, int cwSourceLength, CompareOptions options, int* matchLengthPtr);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_LastIndexOf")]
|
||||
internal unsafe static extern int LastIndexOf(SafeSortHandle sortHandle, string target, int cwTargetLength, char* pSource, int cwSourceLength, CompareOptions options);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IndexOfOrdinalIgnoreCase")]
|
||||
internal unsafe static extern int IndexOfOrdinalIgnoreCase(string target, int cwTargetLength, char* pSource, int cwSourceLength, bool findLast);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_StartsWith")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
internal unsafe static extern bool StartsWith(SafeSortHandle sortHandle, string target, int cwTargetLength, string source, int cwSourceLength, CompareOptions options);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_EndsWith")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
internal unsafe static extern bool EndsWith(SafeSortHandle sortHandle, string target, int cwTargetLength, string source, int cwSourceLength, CompareOptions options);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetSortKey")]
|
||||
internal unsafe static extern int GetSortKey(SafeSortHandle sortHandle, string str, int strLength, byte* sortKey, int sortKeyLength, CompareOptions options);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_CompareStringOrdinalIgnoreCase")]
|
||||
internal unsafe static extern int CompareStringOrdinalIgnoreCase(char* lpStr1, int cwStr1Len, char* lpStr2, int cwStr2Len);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, EntryPoint = "GlobalizationNative_GetSortVersion")]
|
||||
internal static extern int GetSortVersion();
|
||||
|
||||
internal class SafeSortHandle : SafeHandle
|
||||
{
|
||||
private SafeSortHandle() :
|
||||
base(IntPtr.Zero, true)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool IsInvalid
|
||||
{
|
||||
get { return handle == IntPtr.Zero; }
|
||||
}
|
||||
|
||||
protected override bool ReleaseHandle()
|
||||
{
|
||||
CloseSortHandle(handle);
|
||||
SetHandle(IntPtr.Zero);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// 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 GlobalizationInterop
|
||||
{
|
||||
internal const int AllowUnassigned = 0x1;
|
||||
internal const int UseStd3AsciiRules = 0x2;
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ToAscii")]
|
||||
internal static unsafe extern int ToAscii(uint flags, char* src, int srcLen, char* dstBuffer, int dstBufferCapacity);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_ToUnicode")]
|
||||
internal static unsafe extern int ToUnicode(uint flags, char* src, int srcLen, char* dstBuffer, int dstBufferCapacity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// 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 GlobalizationInterop
|
||||
{
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleName")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
internal unsafe static extern bool GetLocaleName(string localeName, [Out] StringBuilder value, int valueLength);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleInfoString")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
internal unsafe static extern bool GetLocaleInfoString(string localeName, uint localeStringData, [Out] StringBuilder value, int valueLength);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetDefaultLocaleName")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
internal unsafe static extern bool GetDefaultLocaleName([Out] StringBuilder value, int valueLength);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleTimeFormat")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
internal unsafe static extern bool GetLocaleTimeFormat(string localeName, bool shortFormat, [Out] StringBuilder value, int valueLength);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleInfoInt")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
internal unsafe static extern bool GetLocaleInfoInt(string localeName, uint localeNumberData, ref int value);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleInfoGroupingSizes")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
internal unsafe static extern bool GetLocaleInfoGroupingSizes(string localeName, uint localeGroupingData, ref int primaryGroupSize, ref int secondaryGroupSize);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocales")]
|
||||
internal unsafe static extern int GetLocales([Out] Char[] value, int valueLength);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// 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 GlobalizationInterop
|
||||
{
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IsNormalized")]
|
||||
internal static extern int IsNormalized(NormalizationForm normalizationForm, string src, int srcLen);
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_NormalizeString")]
|
||||
internal static extern int NormalizeString(NormalizationForm normalizationForm, string src, int srcLen, [Out] char[] dstBuffer, int dstBufferCapacity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// 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 GlobalizationInterop
|
||||
{
|
||||
// needs to be kept in sync with ResultCode in System.Globalization.Native
|
||||
internal enum ResultCode
|
||||
{
|
||||
Success = 0,
|
||||
UnknownError = 1,
|
||||
InsufficentBuffer = 2,
|
||||
OutOfMemory = 3
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// 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 GlobalizationInterop
|
||||
{
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Ansi, EntryPoint = "GlobalizationNative_ReadLink")] // readlink requires char*
|
||||
internal static extern bool ReadLink(string filePath, [Out] StringBuilder result, uint resultCapacity);
|
||||
|
||||
// needs to be kept in sync with TimeZoneDisplayNameType in System.Globalization.Native
|
||||
internal enum TimeZoneDisplayNameType
|
||||
{
|
||||
Generic = 0,
|
||||
Standard = 1,
|
||||
DaylightSavings = 2,
|
||||
}
|
||||
|
||||
[DllImport(Libraries.GlobalizationInterop, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetTimeZoneDisplayName")]
|
||||
internal static extern ResultCode GetTimeZoneDisplayName(
|
||||
string localeName,
|
||||
string timeZoneId,
|
||||
TimeZoneDisplayNameType type,
|
||||
[Out] StringBuilder result,
|
||||
int resultLength);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
// 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.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>(
|
||||
Func<TArg1, TArg2, TArg3, StringBuilder, GlobalizationInterop.ResultCode> interopCall,
|
||||
TArg1 arg1,
|
||||
TArg2 arg2,
|
||||
TArg3 arg3,
|
||||
out string result)
|
||||
{
|
||||
const int initialStringSize = 80;
|
||||
const int maxDoubleAttempts = 5;
|
||||
|
||||
StringBuilder stringBuilder = StringBuilderCache.Acquire(initialStringSize);
|
||||
|
||||
for (int i = 0; i < maxDoubleAttempts; i++)
|
||||
{
|
||||
GlobalizationInterop.ResultCode resultCode = interopCall(arg1, arg2, arg3, stringBuilder);
|
||||
|
||||
if (resultCode == GlobalizationInterop.ResultCode.Success)
|
||||
{
|
||||
result = StringBuilderCache.GetStringAndRelease(stringBuilder);
|
||||
return true;
|
||||
}
|
||||
else if (resultCode == GlobalizationInterop.ResultCode.InsufficentBuffer)
|
||||
{
|
||||
// increase the string size and loop
|
||||
stringBuilder.EnsureCapacity(stringBuilder.Capacity * 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
// if there is an unknown error, don't proceed
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilderCache.Release(stringBuilder);
|
||||
result = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// 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 partial class Interop
|
||||
{
|
||||
internal unsafe partial class Sys
|
||||
{
|
||||
[DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetNonCryptographicallySecureRandomBytes")]
|
||||
internal static unsafe extern void GetNonCryptographicallySecureRandomBytes(byte* buffer, int length);
|
||||
}
|
||||
|
||||
internal static unsafe void GetRandomBytes(byte* buffer, int length)
|
||||
{
|
||||
Sys.GetNonCryptographicallySecureRandomBytes(buffer, length);
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,8 @@ internal static partial class Interop
|
||||
internal long MTime;
|
||||
internal long CTime;
|
||||
internal long BirthTime;
|
||||
internal long Dev;
|
||||
internal long Ino;
|
||||
}
|
||||
|
||||
internal static class FileTypes
|
||||
|
||||
58
external/corert/src/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.SysLog.cs
vendored
Normal file
58
external/corert/src/System.Private.CoreLib/shared/Interop/Unix/System.Native/Interop.SysLog.cs
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// 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 partial class Interop
|
||||
{
|
||||
internal 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(SafeBSTRHandle pData, uint cbData, uint dwFlags);
|
||||
|
||||
[DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
internal static extern bool CryptUnprotectMemory(SafeBSTRHandle pData, uint cbData, uint dwFlags);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
internal partial class Interop
|
||||
{
|
||||
// As defined in winerror.h and https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382.aspx
|
||||
internal partial class Errors
|
||||
{
|
||||
internal const int ERROR_SUCCESS = 0x0;
|
||||
|
||||
@@ -9,7 +9,6 @@ internal static partial class Interop
|
||||
internal const string BCrypt = "BCrypt.dll";
|
||||
internal const string Crypt32 = "crypt32.dll";
|
||||
internal const string Kernel32 = "kernel32.dll";
|
||||
internal const string NtDll = "ntdll.dll";
|
||||
internal const string OleAut32 = "oleaut32.dll";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
internal partial class Interop
|
||||
{
|
||||
internal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
16
external/corert/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindClose.cs
vendored
Normal file
16
external/corert/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindClose.cs
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// 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 partial class Interop
|
||||
{
|
||||
internal partial class Kernel32
|
||||
{
|
||||
[DllImport(Libraries.Kernel32, SetLastError = true)]
|
||||
internal extern static bool FindClose(IntPtr hFindFile);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// 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 partial class Interop
|
||||
{
|
||||
internal 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.EnsureExtendedPrefixOverMaxPath(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,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// 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 partial class Interop
|
||||
{
|
||||
internal partial class Kernel32
|
||||
{
|
||||
[DllImport(Libraries.Kernel32, EntryPoint = "FreeEnvironmentStringsW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
|
||||
internal static extern unsafe bool FreeEnvironmentStrings(char* lpszEnvironmentBlock);
|
||||
}
|
||||
}
|
||||
24
external/corert/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCPInfo.cs
vendored
Normal file
24
external/corert/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetCPInfo.cs
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
// 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.IO;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
internal partial class Interop
|
||||
{
|
||||
internal partial class Kernel32
|
||||
{
|
||||
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 int GetCPInfo(uint codePage, CPINFO* lpCpInfo);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user