* Update SPCL to use GeneratedDllImport where possible.
{
internal static partial class Globalization
{
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetCalendars")]
- internal static extern int GetCalendars(string localeName, CalendarId[] calendars, int calendarsCapacity);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetCalendars", CharSet = CharSet.Unicode)]
+ internal static partial 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);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetCalendarInfo", CharSet = CharSet.Unicode)]
+ internal static unsafe partial ResultCode GetCalendarInfo(string localeName, CalendarId calendarId, CalendarDataType calendarDataType, char* result, int resultCapacity);
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_EnumCalendarInfo")]
- internal static extern unsafe bool EnumCalendarInfo(delegate* unmanaged<char*, IntPtr, void> callback, string localeName, CalendarId calendarId, CalendarDataType calendarDataType, IntPtr context);
+ internal static unsafe bool EnumCalendarInfo(delegate* unmanaged<char*, IntPtr, void> callback, string localeName, CalendarId calendarId, CalendarDataType calendarDataType, IntPtr context)
+ {
+ return EnumCalendarInfo((IntPtr)callback, localeName, calendarId, calendarDataType, context);
+ }
- [DllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetLatestJapaneseEra")]
- internal static extern int GetLatestJapaneseEra();
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_EnumCalendarInfo", CharSet = CharSet.Unicode)]
+ // We skip the following DllImport because of 'Parsing function pointer types in signatures is not supported.' for some targeted
+ // platforms (for example, WASM build).
+ private static unsafe partial bool EnumCalendarInfo(IntPtr callback, string localeName, CalendarId calendarId, CalendarDataType calendarDataType, IntPtr context);
- [DllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetJapaneseEraStartDate")]
- internal static extern bool GetJapaneseEraStartDate(int era, out int startYear, out int startMonth, out int startDay);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetLatestJapaneseEra")]
+ internal static partial int GetLatestJapaneseEra();
+
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetJapaneseEraStartDate")]
+ internal static partial bool GetJapaneseEraStartDate(int era, out int startYear, out int startMonth, out int startDay);
}
}
{
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);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_ChangeCase", CharSet = CharSet.Unicode)]
+ internal static unsafe partial 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);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_ChangeCaseInvariant", CharSet = CharSet.Unicode)]
+ internal static unsafe partial 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);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_ChangeCaseTurkish", CharSet = CharSet.Unicode)]
+ internal static unsafe partial void ChangeCaseTurkish(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper);
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_InitOrdinalCasingPage")]
- internal static extern unsafe void InitOrdinalCasingPage(int pageNumber, char* pTarget);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_InitOrdinalCasingPage", CharSet = CharSet.Unicode)]
+ internal static unsafe partial void InitOrdinalCasingPage(int pageNumber, char* pTarget);
}
}
{
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);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetSortHandle", CharSet = CharSet.Ansi)]
+ internal static unsafe partial ResultCode GetSortHandle(string localeName, out IntPtr sortHandle);
- [DllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_CloseSortHandle")]
- internal static extern void CloseSortHandle(IntPtr handle);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_CloseSortHandle")]
+ internal static partial 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);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_CompareString", CharSet = CharSet.Unicode)]
+ internal static unsafe partial 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);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_IndexOf", CharSet = CharSet.Unicode)]
+ internal static unsafe partial 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, int* matchLengthPtr);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_LastIndexOf", CharSet = CharSet.Unicode)]
+ internal static unsafe partial int LastIndexOf(IntPtr sortHandle, char* target, int cwTargetLength, char* pSource, int cwSourceLength, CompareOptions options, int* matchLengthPtr);
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_StartsWith")]
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_StartsWith", CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern unsafe bool StartsWith(IntPtr sortHandle, char* target, int cwTargetLength, char* source, int cwSourceLength, CompareOptions options, int* matchedLength);
+ internal static unsafe partial bool StartsWith(IntPtr sortHandle, char* target, int cwTargetLength, char* source, int cwSourceLength, CompareOptions options, int* matchedLength);
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_EndsWith")]
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_EndsWith", CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern unsafe bool EndsWith(IntPtr sortHandle, char* target, int cwTargetLength, char* source, int cwSourceLength, CompareOptions options, int* matchedLength);
+ internal static unsafe partial bool EndsWith(IntPtr sortHandle, char* target, int cwTargetLength, char* source, int cwSourceLength, CompareOptions options, int* matchedLength);
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_StartsWith")]
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_StartsWith", CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool StartsWith(IntPtr sortHandle, string target, int cwTargetLength, string source, int cwSourceLength, CompareOptions options);
+ internal static partial bool StartsWith(IntPtr sortHandle, string target, int cwTargetLength, string source, int cwSourceLength, CompareOptions options);
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_EndsWith")]
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_EndsWith", CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool EndsWith(IntPtr sortHandle, string target, int cwTargetLength, string source, int cwSourceLength, CompareOptions options);
+ internal static partial 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);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetSortKey", CharSet = CharSet.Unicode)]
+ internal static unsafe partial int GetSortKey(IntPtr sortHandle, char* str, int strLength, byte* sortKey, int sortKeyLength, CompareOptions options);
- [DllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetSortVersion")]
- internal static extern int GetSortVersion(IntPtr sortHandle);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetSortVersion")]
+ internal static partial int GetSortVersion(IntPtr sortHandle);
}
}
internal static partial class Interop
{
- internal static class HostPolicy
+ internal static partial class HostPolicy
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Auto)]
internal delegate void corehost_resolve_component_dependencies_result_fn(string assemblyPaths,
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Auto)]
internal delegate void corehost_error_writer_fn(string message);
- [DllImport(Libraries.HostPolicy, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
- internal static extern int corehost_resolve_component_dependencies(string componentMainAssemblyPath,
+#pragma warning disable CS3016 // Arrays as attribute arguments is not CLS-compliant
+ [GeneratedDllImport(Libraries.HostPolicy, CharSet = CharSet.Auto)]
+ [UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
+ internal static partial int corehost_resolve_component_dependencies(string componentMainAssemblyPath,
corehost_resolve_component_dependencies_result_fn result);
- [DllImport(Libraries.HostPolicy, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Auto)]
- internal static extern IntPtr corehost_set_error_writer(IntPtr errorWriter);
+ [GeneratedDllImport(Libraries.HostPolicy, CharSet = CharSet.Auto)]
+ [UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
+ internal static partial IntPtr corehost_set_error_writer(IntPtr errorWriter);
+#pragma warning restore CS3016 // Arrays as attribute arguments is not CLS-compliant
}
}
{
internal static partial class Globalization
{
- [DllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_LoadICU")]
- internal static extern int LoadICU();
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_LoadICU")]
+ internal static partial int LoadICU();
internal static void InitICUFunctions(IntPtr icuuc, IntPtr icuin, ReadOnlySpan<char> version, ReadOnlySpan<char> suffix)
{
InitICUFunctions(icuuc, icuin, version.ToString(), suffix.Length > 0 ? suffix.ToString() : null);
}
- [DllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_InitICUFunctions")]
- internal static extern void InitICUFunctions(IntPtr icuuc, IntPtr icuin, string version, string? suffix);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_InitICUFunctions", CharSet = CharSet.Ansi)]
+ internal static partial void InitICUFunctions(IntPtr icuuc, IntPtr icuin, string version, string? suffix);
- [DllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetICUVersion")]
- internal static extern int GetICUVersion();
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetICUVersion")]
+ internal static partial int GetICUVersion();
}
}
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);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_ToAscii", CharSet = CharSet.Unicode)]
+ internal static unsafe partial 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);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_ToUnicode", CharSet = CharSet.Unicode)]
+ internal static unsafe partial int ToUnicode(uint flags, char* src, int srcLen, char* dstBuffer, int dstBufferCapacity);
}
}
{
internal static partial class Globalization
{
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleName")]
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetLocaleName", CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern unsafe bool GetLocaleName(string localeName, char* value, int valueLength);
+ internal static unsafe partial bool GetLocaleName(string localeName, char* value, int valueLength);
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleInfoString")]
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetLocaleInfoString", CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern unsafe bool GetLocaleInfoString(string localeName, uint localeStringData, char* value, int valueLength, string? uiLocaleName = null);
+ internal static unsafe partial bool GetLocaleInfoString(string localeName, uint localeStringData, char* value, int valueLength, string? uiLocaleName = null);
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetDefaultLocaleName")]
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetDefaultLocaleName", CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern unsafe bool GetDefaultLocaleName(char* value, int valueLength);
+ internal static unsafe partial bool GetDefaultLocaleName(char* value, int valueLength);
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IsPredefinedLocale")]
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_IsPredefinedLocale", CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool IsPredefinedLocale(string localeName);
+ internal static partial bool IsPredefinedLocale(string localeName);
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleTimeFormat")]
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetLocaleTimeFormat", CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern unsafe bool GetLocaleTimeFormat(string localeName, bool shortFormat, char* value, int valueLength);
+ internal static unsafe partial bool GetLocaleTimeFormat(string localeName, bool shortFormat, char* value, int valueLength);
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleInfoInt")]
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetLocaleInfoInt", CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool GetLocaleInfoInt(string localeName, uint localeNumberData, ref int value);
+ internal static partial bool GetLocaleInfoInt(string localeName, uint localeNumberData, ref int value);
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetLocaleInfoGroupingSizes")]
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetLocaleInfoGroupingSizes", CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool GetLocaleInfoGroupingSizes(string localeName, uint localeGroupingData, ref int primaryGroupSize, ref int secondaryGroupSize);
+ internal static partial 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);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetLocales", CharSet = CharSet.Unicode)]
+ internal static partial int GetLocales([Out] char[]? value, int valueLength);
}
}
{
internal static partial class Globalization
{
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IsNormalized")]
- internal static extern unsafe int IsNormalized(NormalizationForm normalizationForm, char* src, int srcLen);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_IsNormalized", CharSet = CharSet.Unicode)]
+ internal static unsafe partial int IsNormalized(NormalizationForm normalizationForm, char* src, int srcLen);
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_NormalizeString")]
- internal static extern unsafe int NormalizeString(NormalizationForm normalizationForm, char* src, int srcLen, char* dstBuffer, int dstBufferCapacity);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_NormalizeString", CharSet = CharSet.Unicode)]
+ internal static unsafe partial int NormalizeString(NormalizationForm normalizationForm, char* src, int srcLen, char* dstBuffer, int dstBufferCapacity);
}
}
{
internal static partial class Globalization
{
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_GetTimeZoneDisplayName")]
- internal static extern unsafe ResultCode GetTimeZoneDisplayName(
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_GetTimeZoneDisplayName", CharSet = CharSet.Unicode)]
+ internal static unsafe partial ResultCode GetTimeZoneDisplayName(
string localeName,
string timeZoneId,
TimeZoneDisplayNameType type,
char* result,
int resultLength);
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_WindowsIdToIanaId")]
- internal static extern unsafe int WindowsIdToIanaId(string windowsId, IntPtr region, char* ianaId, int ianaIdLength);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_WindowsIdToIanaId", CharSet = CharSet.Unicode)]
+ internal static unsafe partial int WindowsIdToIanaId(string windowsId, IntPtr region, char* ianaId, int ianaIdLength);
- [DllImport(Libraries.GlobalizationNative, CharSet = CharSet.Unicode, EntryPoint = "GlobalizationNative_IanaIdToWindowsId")]
- internal static extern unsafe int IanaIdToWindowsId(string ianaId, char* windowsId, int windowsIdLength);
+ [GeneratedDllImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_IanaIdToWindowsId", CharSet = CharSet.Unicode)]
+ internal static unsafe partial int IanaIdToWindowsId(string ianaId, char* windowsId, int windowsIdLength);
}
}
}
[DllImport(Libraries.libc, EntryPoint = "setattrlist", SetLastError = true)]
+ // TODO: [DllImportGenerator] Switch to use GeneratedDllImport once we annotate blittable types used in interop in CoreLib (like Guid)
internal static unsafe extern int setattrlist(string path, AttrList* attrList, void* attrBuf, nint attrBufSize, CULong options);
internal const uint FSOPT_NOFOLLOW = 0x00000001;
public nint patchVersion;
}
- [DllImport(Libraries.libobjc)]
- private static extern IntPtr objc_getClass(string className);
- [DllImport(Libraries.libobjc)]
- private static extern IntPtr sel_getUid(string selector);
- [DllImport(Libraries.libobjc, EntryPoint = "objc_msgSend")]
- private static extern IntPtr intptr_objc_msgSend(IntPtr basePtr, IntPtr selector);
+ [GeneratedDllImport(Libraries.libobjc, CharSet = CharSet.Ansi)]
+ private static partial IntPtr objc_getClass(string className);
+ [GeneratedDllImport(Libraries.libobjc, CharSet = CharSet.Ansi)]
+ private static partial IntPtr sel_getUid(string selector);
+ [GeneratedDllImport(Libraries.libobjc, EntryPoint = "objc_msgSend")]
+ private static partial IntPtr intptr_objc_msgSend(IntPtr basePtr, IntPtr selector);
internal static Version GetOperatingSystemVersion()
{
return new Version(major, minor, patch);
}
- [DllImport(Libraries.libobjc, EntryPoint = "objc_msgSend")]
- private static extern NSOperatingSystemVersion NSOperatingSystemVersion_objc_msgSend(IntPtr basePtr, IntPtr selector);
+ [GeneratedDllImport(Libraries.libobjc, EntryPoint = "objc_msgSend")]
+ private static partial NSOperatingSystemVersion NSOperatingSystemVersion_objc_msgSend(IntPtr basePtr, IntPtr selector);
- [DllImport(Libraries.libobjc, EntryPoint = "objc_msgSend_stret")]
- private static extern void NSOperatingSystemVersion_objc_msgSend_stret(out NSOperatingSystemVersion osVersion, IntPtr basePtr, IntPtr selector);
+ [GeneratedDllImport(Libraries.libobjc, EntryPoint = "objc_msgSend_stret")]
+ private static partial void NSOperatingSystemVersion_objc_msgSend_stret(out NSOperatingSystemVersion osVersion, IntPtr basePtr, IntPtr selector);
}
}
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_CreateAutoreleasePool")]
- internal static extern IntPtr CreateAutoreleasePool();
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_CreateAutoreleasePool")]
+ internal static partial IntPtr CreateAutoreleasePool();
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_DrainAutoreleasePool")]
- internal static extern void DrainAutoreleasePool(IntPtr ptr);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_DrainAutoreleasePool")]
+ internal static partial void DrainAutoreleasePool(IntPtr ptr);
}
}
/// <returns>
/// true if the process status was read; otherwise, false.
/// </returns>
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ReadProcessStatusInfo", SetLastError = true)]
- private static extern unsafe bool TryReadProcessStatusInfo(int pid, ProcessStatusInfo* processStatus);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ReadProcessStatusInfo", SetLastError = true)]
+ private static unsafe partial bool TryReadProcessStatusInfo(int pid, ProcessStatusInfo* processStatus);
internal struct ProcessStatusInfo
{
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ChDir", SetLastError = true)]
- internal static extern int ChDir(string path);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ChDir", CharSet = CharSet.Ansi, SetLastError = true)]
+ internal static partial int ChDir(string path);
}
}
{
internal unsafe partial class Sys
{
- [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetErrNo")]
+ [GeneratedDllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetErrNo")]
[SuppressGCTransition]
- internal static extern int GetErrNo();
+ internal static partial int GetErrNo();
- [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_SetErrNo")]
+ [GeneratedDllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_SetErrNo")]
[SuppressGCTransition]
- internal static extern void SetErrNo(int errorCode);
+ internal static partial void SetErrNo(int errorCode);
}
}
/// <summary>
/// Returns -1 on error, 0 on success.
/// </summary>
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FAllocate", SetLastError = true)]
- internal static extern int FAllocate(SafeFileHandle fd, long offset, long length);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FAllocate", SetLastError = true)]
+ internal static partial int FAllocate(SafeFileHandle fd, long offset, long length);
}
}
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FSync", SetLastError = true)]
- internal static extern int FSync(SafeFileHandle fd);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_FSync", SetLastError = true)]
+ internal static partial int FSync(SafeFileHandle fd);
}
}
internal ulong lastRecordedUserTime;
}
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetCpuUtilization")]
- internal static extern int GetCpuUtilization(ref ProcessCpuInformation previousCpuInfo);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetCpuUtilization")]
+ internal static partial int GetCpuUtilization(ref ProcessCpuInformation previousCpuInfo);
}
}
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetCwd", SetLastError = true)]
- private static extern unsafe byte* GetCwd(byte* buffer, int bufferLength);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetCwd", SetLastError = true)]
+ private static unsafe partial byte* GetCwd(byte* buffer, int bufferLength);
internal static unsafe string GetCwd()
{
{
internal unsafe partial class Sys
{
- [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetEnv")]
- internal static extern unsafe IntPtr GetEnv(string name);
+ [GeneratedDllImport(Interop.Libraries.SystemNative, CharSet = CharSet.Ansi, EntryPoint = "SystemNative_GetEnv")]
+ internal static unsafe partial IntPtr GetEnv(string name);
}
}
\ No newline at end of file
{
internal unsafe partial class Sys
{
- [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetEnviron")]
- internal static extern unsafe IntPtr GetEnviron();
+ [GeneratedDllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetEnviron")]
+ internal static unsafe partial IntPtr GetEnviron();
- [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_FreeEnviron")]
- internal static extern unsafe void FreeEnviron(IntPtr environ);
+ [GeneratedDllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_FreeEnviron")]
+ internal static unsafe partial void FreeEnviron(IntPtr environ);
}
}
\ No newline at end of file
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPid")]
- internal static extern int GetPid();
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPid")]
+ internal static partial int GetPid();
}
}
/// <summary>
/// Returns the full path to the executable for the current process, resolving symbolic links.
/// </summary>
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetProcessPath", SetLastError = true)]
- internal static extern string? GetProcessPath();
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetProcessPath", CharSet = CharSet.Ansi, SetLastError = true)]
+ internal static partial string? GetProcessPath();
}
}
{
internal static partial class Sys
{
- [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetNonCryptographicallySecureRandomBytes")]
- internal static extern unsafe void GetNonCryptographicallySecureRandomBytes(byte* buffer, int length);
+ [GeneratedDllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetNonCryptographicallySecureRandomBytes")]
+ internal static unsafe partial void GetNonCryptographicallySecureRandomBytes(byte* buffer, int length);
- [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetCryptographicallySecureRandomBytes")]
- internal static extern unsafe int GetCryptographicallySecureRandomBytes(byte* buffer, int length);
+ [GeneratedDllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetCryptographicallySecureRandomBytes")]
+ internal static unsafe partial int GetCryptographicallySecureRandomBytes(byte* buffer, int length);
}
internal static unsafe void GetRandomBytes(byte* buffer, int length)
{
internal static partial class Sys
{
- [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetSystemTimeAsTicks")]
+ [GeneratedDllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetSystemTimeAsTicks")]
[SuppressGCTransition]
- internal static extern long GetSystemTimeAsTicks();
+ internal static partial long GetSystemTimeAsTicks();
}
}
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetTimestamp", ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetTimestamp", ExactSpelling = true)]
[SuppressGCTransition]
- internal static extern ulong GetTimestamp();
+ internal static partial ulong GetTimestamp();
}
}
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetUnixName")]
- private static extern IntPtr GetUnixNamePrivate();
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetUnixName")]
+ private static partial IntPtr GetUnixNamePrivate();
internal static string GetUnixName()
{
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetUnixRelease", CharSet = CharSet.Ansi, SetLastError = true)]
- public static extern string GetUnixRelease();
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetUnixRelease", CharSet = CharSet.Ansi, SetLastError = true)]
+ public static partial string GetUnixRelease();
}
}
internal static readonly bool CanSetHiddenFlag = (LChflagsCanSetHiddenFlag() != 0);
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LChflagsCanSetHiddenFlag")]
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LChflagsCanSetHiddenFlag")]
[SuppressGCTransition]
- private static extern int LChflagsCanSetHiddenFlag();
+ private static partial int LChflagsCanSetHiddenFlag();
}
}
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);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LockFileRegion", SetLastError =true)]
+ internal static partial int LockFileRegion(SafeHandle fd, long offset, long length, LockType lockType);
}
}
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Log")]
- internal static extern unsafe void Log(byte* buffer, int count);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_Log")]
+ internal static unsafe partial void Log(byte* buffer, int count);
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LogError")]
- internal static extern unsafe void LogError(byte* buffer, int count);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LogError")]
+ internal static unsafe partial void LogError(byte* buffer, int count);
}
}
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LowLevelMonitor_Create")]
- internal static extern IntPtr LowLevelMonitor_Create();
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LowLevelMonitor_Create")]
+ internal static partial IntPtr LowLevelMonitor_Create();
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LowLevelMonitor_Destroy")]
- internal static extern void LowLevelMonitor_Destroy(IntPtr monitor);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LowLevelMonitor_Destroy")]
+ internal static partial void LowLevelMonitor_Destroy(IntPtr monitor);
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LowLevelMonitor_Acquire")]
- internal static extern void LowLevelMonitor_Acquire(IntPtr monitor);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LowLevelMonitor_Acquire")]
+ internal static partial void LowLevelMonitor_Acquire(IntPtr monitor);
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LowLevelMonitor_Release")]
- internal static extern void LowLevelMonitor_Release(IntPtr monitor);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LowLevelMonitor_Release")]
+ internal static partial void LowLevelMonitor_Release(IntPtr monitor);
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LowLevelMonitor_Wait")]
- internal static extern void LowLevelMonitor_Wait(IntPtr monitor);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LowLevelMonitor_Wait")]
+ internal static partial void LowLevelMonitor_Wait(IntPtr monitor);
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LowLevelMonitor_TimedWait")]
- internal static extern bool LowLevelMonitor_TimedWait(IntPtr monitor, int timeoutMilliseconds);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LowLevelMonitor_TimedWait")]
+ internal static partial bool LowLevelMonitor_TimedWait(IntPtr monitor, int timeoutMilliseconds);
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LowLevelMonitor_Signal_Release")]
- internal static extern void LowLevelMonitor_Signal_Release(IntPtr monitor);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LowLevelMonitor_Signal_Release")]
+ internal static partial void LowLevelMonitor_Signal_Release(IntPtr monitor);
}
}
{
internal static unsafe partial class Sys
{
- [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_AlignedAlloc")]
- internal static extern void* AlignedAlloc(nuint alignment, nuint size);
+ [GeneratedDllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_AlignedAlloc")]
+ internal static partial void* AlignedAlloc(nuint alignment, nuint size);
- [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_AlignedFree")]
- internal static extern void AlignedFree(void* ptr);
+ [GeneratedDllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_AlignedFree")]
+ internal static partial void AlignedFree(void* ptr);
- [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_AlignedRealloc")]
- internal static extern void* AlignedRealloc(void* ptr, nuint alignment, nuint new_size);
+ [GeneratedDllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_AlignedRealloc")]
+ internal static partial void* AlignedRealloc(void* ptr, nuint alignment, nuint new_size);
- [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_Calloc")]
- internal static extern void* Calloc(nuint num, nuint size);
+ [GeneratedDllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_Calloc")]
+ internal static partial void* Calloc(nuint num, nuint size);
- [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_Free")]
- internal static extern void Free(void* ptr);
+ [GeneratedDllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_Free")]
+ internal static partial void Free(void* ptr);
- [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_Malloc")]
- internal static extern void* Malloc(nuint size);
+ [GeneratedDllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_Malloc")]
+ internal static partial void* Malloc(nuint size);
- [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_Realloc")]
- internal static extern void* Realloc(void* ptr, nuint new_size);
+ [GeneratedDllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_Realloc")]
+ internal static partial void* Realloc(void* ptr, nuint new_size);
}
}
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_MksTemps", SetLastError = true)]
- internal static extern IntPtr MksTemps(
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_MksTemps", SetLastError = true)]
+ internal static partial IntPtr MksTemps(
byte[] template,
int suffixlen);
}
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PRead", SetLastError = true)]
- internal static extern unsafe int PRead(SafeHandle fd, byte* buffer, int bufferSize, long fileOffset);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PRead", SetLastError = true)]
+ internal static unsafe partial int PRead(SafeHandle fd, byte* buffer, int bufferSize, long fileOffset);
}
}
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PReadV", SetLastError = true)]
- internal static extern unsafe long PReadV(SafeHandle fd, IOVector* vectors, int vectorCount, long fileOffset);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PReadV", SetLastError = true)]
+ internal static unsafe partial long PReadV(SafeHandle fd, IOVector* vectors, int vectorCount, long fileOffset);
}
}
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PWrite", SetLastError = true)]
- internal static extern unsafe int PWrite(SafeHandle fd, byte* buffer, int bufferSize, long fileOffset);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PWrite", SetLastError = true)]
+ internal static unsafe partial int PWrite(SafeHandle fd, byte* buffer, int bufferSize, long fileOffset);
}
}
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PWriteV", SetLastError = true)]
- internal static extern unsafe long PWriteV(SafeHandle fd, IOVector* vectors, int vectorCount, long fileOffset);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PWriteV", SetLastError = true)]
+ internal static unsafe partial long PWriteV(SafeHandle fd, IOVector* vectors, int vectorCount, long fileOffset);
}
}
/// <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);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_PosixFAdvise", SetLastError = false /* this is explicitly called out in the man page */)]
+ internal static partial int PosixFAdvise(SafeFileHandle fd, long offset, long length, FileAdvice advice);
}
}
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SetPosixSignalHandler")]
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SetPosixSignalHandler")]
[SuppressGCTransition]
- internal static extern unsafe void SetPosixSignalHandler(delegate* unmanaged<int, PosixSignal, int> handler);
+ internal static unsafe partial void SetPosixSignalHandler(delegate* unmanaged<int, PosixSignal, int> handler);
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_EnablePosixSignalHandling", SetLastError = true)]
- internal static extern bool EnablePosixSignalHandling(int signal);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_EnablePosixSignalHandling", SetLastError = true)]
+ internal static partial bool EnablePosixSignalHandling(int signal);
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_DisablePosixSignalHandling")]
- internal static extern void DisablePosixSignalHandling(int signal);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_DisablePosixSignalHandling")]
+ internal static partial void DisablePosixSignalHandling(int signal);
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_HandleNonCanceledPosixSignal")]
- internal static extern void HandleNonCanceledPosixSignal(int signal);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_HandleNonCanceledPosixSignal")]
+ internal static partial void HandleNonCanceledPosixSignal(int signal);
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPlatformSignalNumber")]
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetPlatformSignalNumber")]
[SuppressGCTransition]
- internal static extern int GetPlatformSignalNumber(PosixSignal signal);
+ internal static partial int GetPlatformSignalNumber(PosixSignal signal);
}
}
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_OpenDir", CharSet = CharSet.Ansi, SetLastError = true)]
internal static partial IntPtr OpenDir(string path);
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetReadDirRBufferSize", SetLastError = false)]
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetReadDirRBufferSize", SetLastError = false)]
[SuppressGCTransition]
- internal static extern int GetReadDirRBufferSize();
+ internal static partial int GetReadDirRBufferSize();
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ReadDirR")]
- internal static unsafe extern int ReadDirR(IntPtr dir, byte* buffer, int bufferSize, DirectoryEntry* outputEntry);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_ReadDirR")]
+ internal static unsafe partial int ReadDirR(IntPtr dir, byte* buffer, int bufferSize, DirectoryEntry* outputEntry);
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_CloseDir", SetLastError = true)]
internal static partial int CloseDir(IntPtr dir);
{
internal static partial class Sys
{
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SymLink", SetLastError = true)]
- internal static extern int SymLink(string target, string linkPath);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SymLink", CharSet = CharSet.Ansi, SetLastError = true)]
+ internal static partial int SymLink(string target, string linkPath);
}
}
/// </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);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SysLog", CharSet = CharSet.Ansi)]
+ internal static partial void SysLog(SysLogPriority priority, string message, string arg1);
}
}
zfs = 0x2FC12FC1,
}
- [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetFileSystemType")]
- private static extern long GetFileSystemType(SafeFileHandle fd);
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetFileSystemType")]
+ private static partial long GetFileSystemType(SafeFileHandle fd);
internal static bool TryGetFileSystemType(SafeFileHandle fd, out UnixFileSystemTypes fileSystemType)
{
internal static partial class Advapi32
{
[DllImport(Libraries.Advapi32, ExactSpelling = true)]
+ // TODO: [DllImportGenerator] Switch to use GeneratedDllImport once we annotate blittable types used in interop in CoreLib (like Guid)
internal static extern int EventActivityIdControl(ActivityControl ControlCode, ref Guid ActivityId);
}
}
internal static partial class Advapi32
{
[DllImport(Libraries.Advapi32, ExactSpelling = true)]
- internal static extern unsafe uint EventRegister(
+ // TODO: [DllImportGenerator] Switch to use GeneratedDllImport once we annotate blittable types used in interop in CoreLib (like Guid)
+ internal static unsafe extern uint EventRegister(
in Guid providerId,
EtwEnableCallback enableCallback,
void* callbackContext,
{
internal static partial class Advapi32
{
- [DllImport(Libraries.Advapi32, ExactSpelling = true)]
- internal static extern unsafe int EventSetInformation(
+ [GeneratedDllImport(Libraries.Advapi32, ExactSpelling = true)]
+ internal static unsafe partial int EventSetInformation(
long registrationHandle,
EVENT_INFO_CLASS informationClass,
void* eventInformation,
public long MatchAllKeyword;
}
- [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true)]
- internal static extern unsafe int EnumerateTraceGuidsEx(
+ [GeneratedDllImport(Interop.Libraries.Advapi32, ExactSpelling = true)]
+ internal static unsafe partial int EnumerateTraceGuidsEx(
TRACE_QUERY_INFO_CLASS TraceQueryInfoClass,
void* InBuffer,
int InBufferSize,
{
internal static partial class Advapi32
{
- [DllImport(Libraries.Advapi32, ExactSpelling = true)]
- internal static extern uint EventUnregister(long registrationHandle);
+ [GeneratedDllImport(Libraries.Advapi32, ExactSpelling = true)]
+ internal static partial uint EventUnregister(long registrationHandle);
}
}
{
internal static partial class Advapi32
{
- [DllImport(Libraries.Advapi32, ExactSpelling = true)]
- internal static extern int EventWriteString(
+ [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Ansi, ExactSpelling = true)]
+ internal static partial int EventWriteString(
long registrationHandle,
byte level,
long keyword,
return HResult;
}
- [DllImport(Interop.Libraries.Advapi32, ExactSpelling = true, EntryPoint = "EventWriteTransfer")]
- private static extern unsafe int EventWriteTransfer_PInvoke(
+ [GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "EventWriteTransfer", ExactSpelling = true)]
+ private static unsafe partial int EventWriteTransfer_PInvoke(
long registrationHandle,
in EventDescriptor eventDescriptor,
Guid* activityId,
{
internal static partial class Advapi32
{
- [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
- internal static extern bool LookupAccountNameW(
+ [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial bool LookupAccountNameW(
string? lpSystemName,
ref char lpAccountName,
ref byte Sid,
{
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);
+ [GeneratedDllImport(Libraries.BCrypt, CharSet = CharSet.Unicode)]
+ internal static unsafe partial NTSTATUS BCryptGenRandom(IntPtr hAlgorithm, byte* pbBuffer, int cbBuffer, int dwFlags);
}
}
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);
+ [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static partial 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);
+ [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static partial bool CryptUnprotectMemory(SafeBuffer pData, uint cbData, uint dwFlags);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern IntPtr CreateIoCompletionPort(IntPtr FileHandle, IntPtr ExistingCompletionPort, UIntPtr CompletionKey, int NumberOfConcurrentThreads);
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static partial IntPtr CreateIoCompletionPort(IntPtr FileHandle, IntPtr ExistingCompletionPort, UIntPtr CompletionKey, int NumberOfConcurrentThreads);
- [DllImport(Libraries.Kernel32, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool PostQueuedCompletionStatus(IntPtr CompletionPort, int dwNumberOfBytesTransferred, UIntPtr CompletionKey, IntPtr lpOverlapped);
+ internal static partial bool PostQueuedCompletionStatus(IntPtr CompletionPort, int dwNumberOfBytesTransferred, UIntPtr CompletionKey, IntPtr lpOverlapped);
- [DllImport(Libraries.Kernel32, SetLastError = true)]
+ [GeneratedDllImport(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);
+ internal static partial bool GetQueuedCompletionStatus(IntPtr CompletionPort, out int lpNumberOfBytes, out UIntPtr CompletionKey, out IntPtr lpOverlapped, int dwMilliseconds);
}
}
private IntPtr Ptr;
}
- [DllImport(Libraries.Kernel32, ExactSpelling = true)]
- internal static extern unsafe void InitializeConditionVariable(CONDITION_VARIABLE* ConditionVariable);
+ [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ internal static unsafe partial void InitializeConditionVariable(CONDITION_VARIABLE* ConditionVariable);
- [DllImport(Libraries.Kernel32, ExactSpelling = true)]
- internal static extern unsafe void WakeConditionVariable(CONDITION_VARIABLE* ConditionVariable);
+ [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ internal static unsafe partial void WakeConditionVariable(CONDITION_VARIABLE* ConditionVariable);
- [DllImport(Libraries.Kernel32, ExactSpelling = true)]
- internal static extern unsafe bool SleepConditionVariableCS(CONDITION_VARIABLE* ConditionVariable, CRITICAL_SECTION* CriticalSection, int dwMilliseconds);
+ [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ internal static unsafe partial bool SleepConditionVariableCS(CONDITION_VARIABLE* ConditionVariable, CRITICAL_SECTION* CriticalSection, int dwMilliseconds);
}
}
/// </summary>
internal const int SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE = 0x2;
- [DllImport(Libraries.Kernel32, EntryPoint = "CreateSymbolicLinkW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)]
- private static extern bool CreateSymbolicLinkPrivate(string lpSymlinkFileName, string lpTargetFileName, int dwFlags);
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateSymbolicLinkW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ private static partial bool CreateSymbolicLinkPrivate(string lpSymlinkFileName, string lpTargetFileName, int dwFlags);
/// <summary>
/// Creates a symbolic link.
private UIntPtr SpinCount;
}
- [DllImport(Libraries.Kernel32, ExactSpelling = true)]
- internal static extern unsafe void InitializeCriticalSection(CRITICAL_SECTION* lpCriticalSection);
+ [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ internal static unsafe partial void InitializeCriticalSection(CRITICAL_SECTION* lpCriticalSection);
- [DllImport(Libraries.Kernel32, ExactSpelling = true)]
- internal static extern unsafe void EnterCriticalSection(CRITICAL_SECTION* lpCriticalSection);
+ [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ internal static unsafe partial void EnterCriticalSection(CRITICAL_SECTION* lpCriticalSection);
- [DllImport(Libraries.Kernel32, ExactSpelling = true)]
- internal static extern unsafe void LeaveCriticalSection(CRITICAL_SECTION* lpCriticalSection);
+ [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ internal static unsafe partial void LeaveCriticalSection(CRITICAL_SECTION* lpCriticalSection);
- [DllImport(Libraries.Kernel32, ExactSpelling = true)]
- internal static extern unsafe void DeleteCriticalSection(CRITICAL_SECTION* lpCriticalSection);
+ [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ internal static unsafe partial void DeleteCriticalSection(CRITICAL_SECTION* lpCriticalSection);
}
}
// https://docs.microsoft.com/windows/win32/api/winioctl/ni-winioctl-fsctl_get_reparse_point
internal const int FSCTL_GET_REPARSE_POINT = 0x000900a8;
- [DllImport(Libraries.Kernel32, EntryPoint = "DeviceIoControl", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)]
- internal static extern bool DeviceIoControl(
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "DeviceIoControl", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial bool DeviceIoControl(
SafeHandle hDevice,
uint dwIoControlCode,
IntPtr lpInBuffer,
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);
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static partial bool SetEvent(SafeWaitHandle handle);
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern bool ResetEvent(SafeWaitHandle handle);
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static partial bool ResetEvent(SafeWaitHandle handle);
- [DllImport(Libraries.Kernel32, EntryPoint = "CreateEventExW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)]
- internal static extern SafeWaitHandle CreateEventEx(IntPtr lpSecurityAttributes, string? name, uint flags, uint desiredAccess);
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateEventExW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial SafeWaitHandle CreateEventEx(IntPtr lpSecurityAttributes, string? name, uint flags, uint desiredAccess);
- [DllImport(Libraries.Kernel32, EntryPoint = "OpenEventW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)]
- internal static extern SafeWaitHandle OpenEvent(uint desiredAccess, bool inheritHandle, string name);
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "OpenEventW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial SafeWaitHandle OpenEvent(uint desiredAccess, bool inheritHandle, string name);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, EntryPoint = "ExpandEnvironmentStringsW", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
- internal static extern uint ExpandEnvironmentStrings(string lpSrc, ref char lpDst, uint nSize);
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "ExpandEnvironmentStringsW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial uint ExpandEnvironmentStrings(string lpSrc, ref char lpDst, uint nSize);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe int ReadFileScatter(
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static unsafe partial int ReadFileScatter(
SafeHandle hFile,
long* aSegmentArray,
int nNumberOfBytesToRead,
IntPtr lpReserved,
NativeOverlapped* lpOverlapped);
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe int WriteFileGather(
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static unsafe partial int WriteFileGather(
SafeHandle hFile,
long* aSegmentArray,
int nNumberOfBytesToWrite,
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32)]
+ [GeneratedDllImport(Libraries.Kernel32)]
[SuppressGCTransition]
- internal static extern unsafe Interop.BOOL FileTimeToSystemTime(ulong* lpFileTime, Interop.Kernel32.SYSTEMTIME* lpSystemTime);
+ internal static unsafe partial Interop.BOOL FileTimeToSystemTime(ulong* lpFileTime, Interop.Kernel32.SYSTEMTIME* lpSystemTime);
}
}
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use FindFirstFile.
/// </summary>
- [DllImport(Libraries.Kernel32, EntryPoint = "FindFirstFileExW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)]
- private static extern SafeFindHandle FindFirstFileExPrivate(string lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, ref WIN32_FIND_DATA lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, IntPtr lpSearchFilter, int dwAdditionalFlags);
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "FindFirstFileExW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ private static partial 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)
{
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, EntryPoint = "FindNextFileW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
- internal static extern bool FindNextFile(SafeFindHandle hndFindFile, ref WIN32_FIND_DATA lpFindFileData);
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "FindNextFileW", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static partial bool FindNextFile(SafeFindHandle hndFindFile, ref WIN32_FIND_DATA lpFindFileData);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, ExactSpelling = true)]
- internal static extern unsafe BOOL FreeEnvironmentStringsW(char* lpszEnvironmentBlock);
+ [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ internal static unsafe partial BOOL FreeEnvironmentStringsW(char* lpszEnvironmentBlock);
}
}
internal fixed byte LeadByte[12 /* MAX_LEADBYTES */];
}
- [DllImport(Libraries.Kernel32)]
- internal static extern unsafe Interop.BOOL GetCPInfo(uint codePage, CPINFO* lpCpInfo);
+ [GeneratedDllImport(Libraries.Kernel32)]
+ internal static unsafe partial Interop.BOOL GetCPInfo(uint codePage, CPINFO* lpCpInfo);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, EntryPoint = "GetCurrentDirectoryW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)]
- internal static extern uint GetCurrentDirectory(uint nBufferLength, ref char lpBuffer);
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetCurrentDirectoryW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial uint GetCurrentDirectory(uint nBufferLength, ref char lpBuffer);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, ExactSpelling = true)]
- internal static extern unsafe char* GetEnvironmentStringsW();
+ [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ internal static unsafe partial char* GetEnvironmentStringsW();
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, EntryPoint = "GetEnvironmentVariableW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)]
- internal static extern uint GetEnvironmentVariable(string lpName, ref char lpBuffer, uint nSize);
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetEnvironmentVariableW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial uint GetEnvironmentVariable(string lpName, ref char lpBuffer, uint nSize);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, SetLastError = true, ExactSpelling = true)]
- internal static extern unsafe bool GetFileInformationByHandleEx(SafeFileHandle hFile, int FileInformationClass, void* lpFileInformation, uint dwBufferSize);
+ [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true, SetLastError = true)]
+ internal static unsafe partial bool GetFileInformationByHandleEx(SafeFileHandle hFile, int FileInformationClass, void* lpFileInformation, uint dwBufferSize);
}
}
internal const uint FILE_NAME_NORMALIZED = 0x0;
// https://docs.microsoft.com/windows/desktop/api/fileapi/nf-fileapi-getfinalpathnamebyhandlew (kernel32)
- [DllImport(Libraries.Kernel32, EntryPoint = "GetFinalPathNameByHandleW", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
- internal static unsafe extern uint GetFinalPathNameByHandle(
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetFinalPathNameByHandleW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static unsafe partial uint GetFinalPathNameByHandle(
SafeFileHandle hFile,
char* lpszFilePath,
uint cchFilePath,
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32)]
+ [GeneratedDllImport(Libraries.Kernel32)]
[SuppressGCTransition]
- internal static extern int GetLastError();
+ internal static partial int GetLastError();
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, EntryPoint = "GetModuleFileNameW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)]
- internal static extern uint GetModuleFileName(IntPtr hModule, ref char lpFilename, uint nSize);
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetModuleFileNameW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial uint GetModuleFileName(IntPtr hModule, ref char lpFilename, uint nSize);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, SetLastError = true, CharSet = CharSet.Auto)]
- internal static extern unsafe bool GetOverlappedResult(
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Auto, SetLastError = true)]
+ internal static unsafe partial bool GetOverlappedResult(
SafeFileHandle hFile,
NativeOverlapped* lpOverlapped,
ref int lpNumberOfBytesTransferred,
public UIntPtr PeakPagefileUsage;
}
- [DllImport(Libraries.Kernel32, EntryPoint="K32GetProcessMemoryInfo")]
- internal static extern bool GetProcessMemoryInfo(IntPtr Process, ref PROCESS_MEMORY_COUNTERS ppsmemCounters, uint cb);
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint ="K32GetProcessMemoryInfo")]
+ internal static partial bool GetProcessMemoryInfo(IntPtr Process, ref PROCESS_MEMORY_COUNTERS ppsmemCounters, uint cb);
}
}
{
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);
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static partial bool GetProcessTimes(IntPtr handleProcess, out long creation, out long exit, out long kernel, out long user);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
- internal static extern uint GetSystemDirectoryW(ref char lpBuffer, uint uSize);
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial uint GetSystemDirectoryW(ref char lpBuffer, uint uSize);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32)]
+ [GeneratedDllImport(Libraries.Kernel32)]
[SuppressGCTransition]
- internal static extern unsafe void GetSystemTime(Interop.Kernel32.SYSTEMTIME* lpSystemTime);
+ internal static unsafe partial void GetSystemTime(Interop.Kernel32.SYSTEMTIME* lpSystemTime);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern bool GetSystemTimes(out long idle, out long kernel, out long user);
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static partial bool GetSystemTimes(out long idle, out long kernel, out long user);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false, ExactSpelling = true)]
- internal static extern uint GetTempFileNameW(ref char lpPathName, string lpPrefixString, uint uUnique, ref char lpTempFileName);
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial uint GetTempFileNameW(ref char lpPathName, string lpPrefixString, uint uUnique, ref char lpTempFileName);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)]
- internal static extern uint GetTempPathW(int bufferLen, ref char buffer);
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ internal static partial uint GetTempPathW(int bufferLen, ref char buffer);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32)]
- internal static unsafe extern BOOL GlobalMemoryStatusEx(MEMORYSTATUSEX* lpBuffer);
+ [GeneratedDllImport(Libraries.Kernel32)]
+ internal static unsafe partial BOOL GlobalMemoryStatusEx(MEMORYSTATUSEX* lpBuffer);
}
}
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 unsafe int LCIDToLocaleName(int locale, char* pLocaleName, int cchName, uint dwFlags);
+ [GeneratedDllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ internal static unsafe partial 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);
+ [GeneratedDllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ internal static partial int LocaleNameToLCID(string lpName, uint dwFlags);
- [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern unsafe int LCMapStringEx(
+ [GeneratedDllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static unsafe partial int LCMapStringEx(
string? lpLocaleName,
uint dwMapFlags,
char* lpSrcStr,
void* lpReserved,
IntPtr sortHandle);
- [DllImport("kernel32.dll", EntryPoint = "FindNLSStringEx", SetLastError = SetLastErrorForDebug)]
- internal static extern unsafe int FindNLSStringEx(
+ [GeneratedDllImport("kernel32.dll", EntryPoint = "FindNLSStringEx", SetLastError = SetLastErrorForDebug)]
+ internal static unsafe partial int FindNLSStringEx(
char* lpLocaleName,
uint dwFindNLSStringFlags,
char* lpStringSource,
void* lpReserved,
IntPtr sortHandle);
- [DllImport("kernel32.dll", EntryPoint = "CompareStringEx")]
- internal static extern unsafe int CompareStringEx(
+ [GeneratedDllImport("kernel32.dll", EntryPoint = "CompareStringEx")]
+ internal static unsafe partial int CompareStringEx(
char* lpLocaleName,
uint dwCmpFlags,
char* lpString1,
void* lpReserved,
IntPtr lParam);
- [DllImport("kernel32.dll", EntryPoint = "CompareStringOrdinal")]
- internal static extern unsafe int CompareStringOrdinal(
+ [GeneratedDllImport("kernel32.dll", EntryPoint = "CompareStringOrdinal")]
+ internal static unsafe partial int CompareStringOrdinal(
char* lpString1,
int cchCount1,
char* lpString2,
int cchCount2,
bool bIgnoreCase);
- [DllImport("kernel32.dll", EntryPoint = "FindStringOrdinal", SetLastError = SetLastErrorForDebug)]
- internal static extern unsafe int FindStringOrdinal(
+ [GeneratedDllImport("kernel32.dll", EntryPoint = "FindStringOrdinal", SetLastError = SetLastErrorForDebug)]
+ internal static unsafe partial int FindStringOrdinal(
uint dwFindStringOrdinalFlags,
char* lpStringSource,
int cchSource,
int cchValue,
BOOL bIgnoreCase);
- [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
- internal static extern unsafe bool IsNLSDefinedString(
+ [GeneratedDllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ internal static unsafe partial bool IsNLSDefinedString(
int Function,
uint dwFlags,
IntPtr lpVersionInformation,
char* lpString,
int cchStr);
- [DllImport("kernel32.dll", CharSet = CharSet.Auto)]
- internal static extern unsafe Interop.BOOL GetUserPreferredUILanguages(uint dwFlags, uint* pulNumLanguages, char* pwszLanguagesBuffer, uint* pcchLanguagesBuffer);
+ [GeneratedDllImport("kernel32.dll", CharSet = CharSet.Auto)]
+ internal static unsafe partial Interop.BOOL GetUserPreferredUILanguages(uint dwFlags, uint* pulNumLanguages, char* pwszLanguagesBuffer, uint* pcchLanguagesBuffer);
- [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
- internal static extern unsafe int GetLocaleInfoEx(string lpLocaleName, uint LCType, void* lpLCData, int cchData);
+ [GeneratedDllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ internal static unsafe partial int GetLocaleInfoEx(string lpLocaleName, uint LCType, void* lpLCData, int cchData);
- [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
- internal static extern unsafe bool EnumSystemLocalesEx(delegate* unmanaged<char*, uint, void*, BOOL> lpLocaleEnumProcEx, uint dwFlags, void* lParam, IntPtr reserved);
+ [GeneratedDllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ internal static unsafe partial bool EnumSystemLocalesEx(delegate* unmanaged<char*, uint, void*, BOOL> lpLocaleEnumProcEx, uint dwFlags, void* lParam, IntPtr reserved);
- [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
- internal static extern unsafe bool EnumTimeFormatsEx(delegate* unmanaged<char*, void*, BOOL> lpTimeFmtEnumProcEx, string lpLocaleName, uint dwFlags, void* lParam);
+ [GeneratedDllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ internal static unsafe partial bool EnumTimeFormatsEx(delegate* unmanaged<char*, void*, BOOL> lpTimeFmtEnumProcEx, string lpLocaleName, uint dwFlags, 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);
+ [GeneratedDllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ internal static partial 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);
+ [GeneratedDllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ internal static partial int GetCalendarInfoEx(string? lpLocaleName, uint Calendar, IntPtr lpReserved, uint CalType, IntPtr lpCalData, int cchData, IntPtr lpValue);
- [DllImport("kernel32.dll")]
- internal static extern int GetUserGeoID(int geoClass);
+ [GeneratedDllImport("kernel32.dll")]
+ internal static partial int GetUserGeoID(int geoClass);
- [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
- internal static extern unsafe int GetGeoInfo(int location, int geoType, char* lpGeoData, int cchData, int LangId);
+ [GeneratedDllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ internal static unsafe partial int GetGeoInfo(int location, int geoType, char* lpGeoData, int cchData, int LangId);
- [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
- internal static extern unsafe bool EnumCalendarInfoExEx(delegate* unmanaged<char*, uint, IntPtr, void*, BOOL> pCalInfoEnumProcExEx, string lpLocaleName, uint Calendar, string? lpReserved, uint CalType, void* lParam);
+ [GeneratedDllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ internal static unsafe partial bool EnumCalendarInfoExEx(delegate* unmanaged<char*, uint, IntPtr, void*, BOOL> pCalInfoEnumProcExEx, string lpLocaleName, uint Calendar, string? lpReserved, uint CalType, void* lParam);
[StructLayout(LayoutKind.Sequential)]
internal struct NlsVersionInfoEx
internal Guid guidCustomVersion;
}
- [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
- internal static extern unsafe bool GetNLSVersionEx(int function, string localeName, NlsVersionInfoEx* lpVersionInformation);
+ [GeneratedDllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ internal static unsafe partial bool GetNLSVersionEx(int function, string localeName, NlsVersionInfoEx* lpVersionInformation);
}
}
internal const uint LMEM_MOVEABLE = 0x0002;
internal const uint LMEM_ZEROINIT = 0x0040;
- [DllImport(Libraries.Kernel32)]
- internal static extern IntPtr LocalAlloc(uint uFlags, nuint uBytes);
+ [GeneratedDllImport(Libraries.Kernel32)]
+ internal static partial IntPtr LocalAlloc(uint uFlags, nuint uBytes);
- [DllImport(Libraries.Kernel32)]
- internal static extern IntPtr LocalReAlloc(IntPtr hMem, nuint uBytes, uint uFlags);
+ [GeneratedDllImport(Libraries.Kernel32)]
+ internal static partial IntPtr LocalReAlloc(IntPtr hMem, nuint uBytes, uint uFlags);
- [DllImport(Libraries.Kernel32)]
- internal static extern IntPtr LocalFree(IntPtr hMem);
+ [GeneratedDllImport(Libraries.Kernel32)]
+ internal static partial IntPtr LocalFree(IntPtr hMem);
}
}
{
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);
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static partial 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);
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static partial bool UnlockFile(SafeFileHandle handle, int offsetLow, int offsetHigh, int countLow, int countHigh);
}
}
{
internal const uint CREATE_MUTEX_INITIAL_OWNER = 0x1;
- [DllImport(Libraries.Kernel32, EntryPoint = "OpenMutexW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)]
- internal static extern SafeWaitHandle OpenMutex(uint desiredAccess, bool inheritHandle, string name);
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "OpenMutexW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial SafeWaitHandle OpenMutex(uint desiredAccess, bool inheritHandle, string name);
- [DllImport(Libraries.Kernel32, EntryPoint = "CreateMutexExW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)]
- internal static extern SafeWaitHandle CreateMutexEx(IntPtr lpMutexAttributes, string? name, uint flags, uint desiredAccess);
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateMutexExW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial SafeWaitHandle CreateMutexEx(IntPtr lpMutexAttributes, string? name, uint flags, uint desiredAccess);
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern bool ReleaseMutex(SafeWaitHandle handle);
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static partial bool ReleaseMutex(SafeWaitHandle handle);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Interop.Libraries.Kernel32, CharSet = CharSet.Unicode, EntryPoint = "OutputDebugStringW", ExactSpelling = true)]
- internal static extern void OutputDebugString(string message);
+ [GeneratedDllImport(Interop.Libraries.Kernel32, EntryPoint = "OutputDebugStringW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ internal static partial void OutputDebugString(string message);
}
}
// 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)]
+ [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
[SuppressGCTransition]
- internal static extern unsafe BOOL QueryPerformanceCounter(long* lpPerformanceCount);
+ internal static unsafe partial BOOL QueryPerformanceCounter(long* 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)]
- internal static extern unsafe BOOL QueryPerformanceFrequency(long* lpFrequency);
+ [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ internal static unsafe partial BOOL QueryPerformanceFrequency(long* lpFrequency);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32)]
- internal static extern bool QueryUnbiasedInterruptTime(out ulong UnbiasedTime);
+ [GeneratedDllImport(Libraries.Kernel32)]
+ internal static partial bool QueryUnbiasedInterruptTime(out ulong UnbiasedTime);
}
}
{
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);
+ [GeneratedDllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ internal static partial int ResolveLocaleName(string lpNameToResolve, char* lpLocaleName, int cchLocaleName);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, EntryPoint = "OpenSemaphoreW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)]
- internal static extern SafeWaitHandle OpenSemaphore(uint desiredAccess, bool inheritHandle, string name);
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "OpenSemaphoreW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial SafeWaitHandle OpenSemaphore(uint desiredAccess, bool inheritHandle, string name);
- [DllImport(Libraries.Kernel32, EntryPoint = "CreateSemaphoreExW", SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)]
- internal static extern SafeWaitHandle CreateSemaphoreEx(IntPtr lpSecurityAttributes, int initialCount, int maximumCount, string? name, uint flags, uint desiredAccess);
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateSemaphoreExW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial 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);
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static partial bool ReleaseSemaphore(SafeWaitHandle handle, int releaseCount, out int previousCount);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, EntryPoint = "SetCurrentDirectoryW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)]
- internal static extern bool SetCurrentDirectory(string path);
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "SetCurrentDirectoryW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial bool SetCurrentDirectory(string path);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, EntryPoint = "SetEnvironmentVariableW", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false, ExactSpelling = true)]
- internal static extern bool SetEnvironmentVariable(string lpName, string? lpValue);
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "SetEnvironmentVariableW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial bool SetEnvironmentVariable(string lpName, string? lpValue);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern bool SetFilePointerEx(SafeFileHandle hFile, long liDistanceToMove, out long lpNewFilePointer, uint dwMoveMethod);
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
+ internal static partial bool SetFilePointerEx(SafeFileHandle hFile, long liDistanceToMove, out long lpNewFilePointer, uint dwMoveMethod);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32)]
+ [GeneratedDllImport(Libraries.Kernel32)]
[SuppressGCTransition]
- internal static extern void SetLastError(int errorCode);
+ internal static partial void SetLastError(int errorCode);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32)]
+ [GeneratedDllImport(Libraries.Kernel32)]
[SuppressGCTransition]
- internal static extern unsafe Interop.BOOL SystemTimeToFileTime(Interop.Kernel32.SYSTEMTIME* lpSystemTime, ulong* lpFileTime);
+ internal static unsafe partial Interop.BOOL SystemTimeToFileTime(Interop.Kernel32.SYSTEMTIME* lpSystemTime, ulong* lpFileTime);
}
}
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);
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial 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);
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial uint GetTimeZoneInformation(out TIME_ZONE_INFORMATION lpTimeZoneInformation);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32)]
- internal static extern unsafe Interop.BOOL TzSpecificLocalTimeToSystemTime(
+ [GeneratedDllImport(Libraries.Kernel32)]
+ internal static unsafe partial Interop.BOOL TzSpecificLocalTimeToSystemTime(
IntPtr lpTimeZoneInformation,
Interop.Kernel32.SYSTEMTIME* lpLocalTime,
Interop.Kernel32.SYSTEMTIME* lpUniversalTime);
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32)]
- internal static extern ulong VerSetConditionMask(ulong ConditionMask, uint TypeMask, byte Condition);
+ [GeneratedDllImport(Libraries.Kernel32)]
+ internal static partial ulong VerSetConditionMask(ulong ConditionMask, uint TypeMask, byte Condition);
}
}
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);
+ [GeneratedDllImport(Libraries.Kernel32)]
+ internal static partial bool VerifyVersionInfoW(ref OSVERSIONINFOEX lpVersionInfo, uint dwTypeMask, ulong dwlConditionMask);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, ExactSpelling = true)]
- internal static extern unsafe void* VirtualAlloc(void* lpAddress, UIntPtr dwSize, int flAllocationType, int flProtect);
+ [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ internal static unsafe partial void* VirtualAlloc(void* lpAddress, UIntPtr dwSize, int flAllocationType, int flProtect);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, ExactSpelling = true)]
- internal static extern unsafe bool VirtualFree(void* lpAddress, UIntPtr dwSize, int dwFreeType);
+ [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ internal static unsafe partial bool VirtualFree(void* lpAddress, UIntPtr dwSize, int dwFreeType);
}
}
{
internal static partial class Kernel32
{
- [DllImport(Libraries.Kernel32, SetLastError = true, ExactSpelling = true)]
- internal static extern unsafe UIntPtr VirtualQuery(void* lpAddress, ref MEMORY_BASIC_INFORMATION lpBuffer, UIntPtr dwLength);
+ [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true, SetLastError = true)]
+ internal static unsafe partial UIntPtr VirtualQuery(void* lpAddress, ref MEMORY_BASIC_INFORMATION lpBuffer, UIntPtr dwLength);
}
}
// Idn APIs
//
- [DllImport("Normaliz.dll", CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern unsafe int IdnToAscii(
+ [GeneratedDllImport("Normaliz.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static unsafe partial 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(
+ [GeneratedDllImport("Normaliz.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static unsafe partial int IdnToUnicode(
uint dwFlags,
char* lpASCIICharStr,
int cchASCIIChar,
{
internal static partial class Normaliz
{
- [DllImport("Normaliz.dll", CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern unsafe BOOL IsNormalizedString(NormalizationForm normForm, char* source, int length);
+ [GeneratedDllImport("Normaliz.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static unsafe partial BOOL IsNormalizedString(NormalizationForm normForm, char* source, int length);
- [DllImport("Normaliz.dll", CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern unsafe int NormalizeString(
+ [GeneratedDllImport("Normaliz.dll", CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static unsafe partial int NormalizeString(
NormalizationForm normForm,
char* source,
int sourceLength,
{
// https://msdn.microsoft.com/en-us/library/bb432380.aspx
// https://msdn.microsoft.com/en-us/library/windows/hardware/ff566424.aspx
- [DllImport(Libraries.NtDll, CharSet = CharSet.Unicode, ExactSpelling = true)]
- private static extern unsafe uint NtCreateFile(
+ [GeneratedDllImport(Libraries.NtDll, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ private static unsafe partial uint NtCreateFile(
IntPtr* FileHandle,
DesiredAccess DesiredAccess,
OBJECT_ATTRIBUTES* ObjectAttributes,
{
// https://msdn.microsoft.com/en-us/library/windows/hardware/ff556633.aspx
// https://msdn.microsoft.com/en-us/library/windows/hardware/ff567047.aspx
- [DllImport(Libraries.NtDll, CharSet = CharSet.Unicode, ExactSpelling = true)]
- public static unsafe extern int NtQueryDirectoryFile(
+ [GeneratedDllImport(Libraries.NtDll, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ public static unsafe partial int NtQueryDirectoryFile(
IntPtr FileHandle,
IntPtr Event,
IntPtr ApcRoutine,
{
internal static partial class NtDll
{
- [DllImport(Libraries.NtDll, ExactSpelling = true)]
- internal static extern unsafe int NtQueryInformationFile(
+ [GeneratedDllImport(Libraries.NtDll, ExactSpelling = true)]
+ internal static unsafe partial int NtQueryInformationFile(
SafeFileHandle FileHandle,
out IO_STATUS_BLOCK IoStatusBlock,
void* FileInformation,
{
internal static partial class NtDll
{
- [DllImport(Libraries.NtDll, ExactSpelling = true)]
- private static extern int RtlGetVersion(ref RTL_OSVERSIONINFOEX lpVersionInformation);
+ [GeneratedDllImport(Libraries.NtDll, ExactSpelling = true)]
+ private static partial int RtlGetVersion(ref RTL_OSVERSIONINFOEX lpVersionInformation);
internal static unsafe int RtlGetVersionEx(out RTL_OSVERSIONINFOEX osvi)
{
internal static partial class NtDll
{
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680600(v=vs.85).aspx
- [DllImport(Libraries.NtDll, ExactSpelling = true)]
- public static extern uint RtlNtStatusToDosError(int Status);
+ [GeneratedDllImport(Libraries.NtDll, ExactSpelling = true)]
+ public static partial uint RtlNtStatusToDosError(int Status);
}
}
internal static partial class Ole32
{
[DllImport(Interop.Libraries.Ole32, CharSet = CharSet.Unicode)]
+ // TODO: [DllImportGenerator] Switch to use GeneratedDllImport once we annotate blittable types used in interop in CoreLib (like Guid)
internal static extern int CLSIDFromProgID(string lpszProgID, out Guid lpclsid);
}
}
internal static partial class Ole32
{
[DllImport(Interop.Libraries.Ole32)]
+ // TODO: [DllImportGenerator] Switch to use GeneratedDllImport once we annotate blittable types used in interop in CoreLib (like Guid)
internal static extern int CoCreateGuid(out Guid guid);
}
}
internal static partial class Ole32
{
[DllImport(Interop.Libraries.Ole32)]
+ // TODO: [DllImportGenerator] Switch to use GeneratedDllImport once we annotate blittable types used in interop in CoreLib (like Guid)
internal static extern int CoGetStandardMarshal(ref Guid riid, IntPtr pv, int dwDestContext, IntPtr pvDestContext, int mshlflags, out IntPtr ppMarshal);
}
}
{
internal static partial class Ole32
{
- [DllImport(Libraries.Ole32)]
- internal static extern IntPtr CoTaskMemAlloc(nuint cb);
+ [GeneratedDllImport(Libraries.Ole32)]
+ internal static partial IntPtr CoTaskMemAlloc(nuint cb);
- [DllImport(Libraries.Ole32)]
- internal static extern IntPtr CoTaskMemRealloc(IntPtr pv, nuint cb);
+ [GeneratedDllImport(Libraries.Ole32)]
+ internal static partial IntPtr CoTaskMemRealloc(IntPtr pv, nuint cb);
- [DllImport(Libraries.Ole32)]
- internal static extern void CoTaskMemFree(IntPtr ptr);
+ [GeneratedDllImport(Libraries.Ole32)]
+ internal static partial void CoTaskMemFree(IntPtr ptr);
}
}
{
internal static partial class OleAut32
{
- [DllImport(Libraries.OleAut32)]
- internal static extern IntPtr SysAllocStringByteLen(byte[]? str, uint len);
+ [GeneratedDllImport(Libraries.OleAut32)]
+ internal static partial IntPtr SysAllocStringByteLen(byte[]? str, uint len);
}
}
{
internal static partial class OleAut32
{
- [DllImport(Libraries.OleAut32)]
- internal static extern void SysFreeString(IntPtr bstr);
+ [GeneratedDllImport(Libraries.OleAut32)]
+ internal static partial void SysFreeString(IntPtr bstr);
}
}
{
internal static partial class OleAut32
{
- [DllImport(Libraries.OleAut32)]
- internal static extern void VariantClear(IntPtr variant);
+ [GeneratedDllImport(Libraries.OleAut32)]
+ internal static partial void VariantClear(IntPtr variant);
}
}
{
internal static partial class Secur32
{
- [DllImport(Libraries.Secur32, CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]
- internal static extern BOOLEAN GetUserNameExW(int NameFormat, ref char lpNameBuffer, ref uint lpnSize);
+ [GeneratedDllImport(Libraries.Secur32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static partial BOOLEAN GetUserNameExW(int NameFormat, ref char lpNameBuffer, ref uint lpnSize);
internal const int NameSamCompatible = 2;
}
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)]
+ [DllImport(Libraries.Shell32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = false)]
+ // TODO: [DllImportGenerator] Switch to use GeneratedDllImport once we annotate blittable types used in interop in CoreLib (like Guid)
internal static extern int SHGetKnownFolderPath(
[MarshalAs(UnmanagedType.LPStruct)] Guid rfid,
uint dwFlags,
{
internal static unsafe partial class Ucrtbase
{
- [DllImport(Libraries.Ucrtbase, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- internal static extern void* _aligned_malloc(nuint size, nuint alignment);
-
- [DllImport(Libraries.Ucrtbase, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- internal static extern void _aligned_free(void* ptr);
-
- [DllImport(Libraries.Ucrtbase, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- internal static extern void* _aligned_realloc(void* ptr, nuint size, nuint alignment);
-
- [DllImport(Libraries.Ucrtbase, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- internal static extern void* calloc(nuint num, nuint size);
-
- [DllImport(Libraries.Ucrtbase, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- internal static extern void free(void* ptr);
-
- [DllImport(Libraries.Ucrtbase, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- internal static extern void* malloc(nuint size);
-
- [DllImport(Libraries.Ucrtbase, CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
- internal static extern void* realloc(void* ptr, nuint new_size);
+#pragma warning disable CS3016 // Arrays as attribute arguments is not CLS-compliant
+ [GeneratedDllImport(Libraries.Ucrtbase, ExactSpelling = true)]
+ [UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
+ internal static partial void* _aligned_malloc(nuint size, nuint alignment);
+
+ [GeneratedDllImport(Libraries.Ucrtbase, ExactSpelling = true)]
+ [UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
+ internal static partial void _aligned_free(void* ptr);
+
+ [GeneratedDllImport(Libraries.Ucrtbase, ExactSpelling = true)]
+ [UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
+ internal static partial void* _aligned_realloc(void* ptr, nuint size, nuint alignment);
+
+ [GeneratedDllImport(Libraries.Ucrtbase, ExactSpelling = true)]
+ [UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
+ internal static partial void* calloc(nuint num, nuint size);
+
+ [GeneratedDllImport(Libraries.Ucrtbase, ExactSpelling = true)]
+ [UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
+ internal static partial void free(void* ptr);
+
+ [GeneratedDllImport(Libraries.Ucrtbase, ExactSpelling = true)]
+ [UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
+ internal static partial void* malloc(nuint size);
+
+ [GeneratedDllImport(Libraries.Ucrtbase, ExactSpelling = true)]
+ [UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
+ internal static partial void* realloc(void* ptr, nuint new_size);
+#pragma warning restore CS3016 // Arrays as attribute arguments is not CLS-compliant
}
}
{
internal static partial class User32
{
- [DllImport(Libraries.User32, SetLastError = true, EntryPoint = "LoadStringW", CharSet = CharSet.Unicode, ExactSpelling = true)]
- internal static extern unsafe int LoadString(IntPtr hInstance, uint uID, char* lpBuffer, int cchBufferMax);
+ [GeneratedDllImport(Libraries.User32, EntryPoint = "LoadStringW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ internal static unsafe partial int LoadString(IntPtr hInstance, uint uID, char* lpBuffer, int cchBufferMax);
}
}
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum);netstandard2.0-windows;netstandard2.0</TargetFrameworks>
<IsPackable>true</IsPackable>
+ <Nullable>Annotations</Nullable>
<AddNETFrameworkPlaceholderFileToPackage>true</AddNETFrameworkPlaceholderFileToPackage>
<AddXamarinPlaceholderFilesToPackage>true</AddXamarinPlaceholderFilesToPackage>
<AddNETFrameworkAssemblyReferenceToPackage>true</AddNETFrameworkAssemblyReferenceToPackage>
<Reference Include="System.Diagnostics.Tracing" />
<Reference Include="System.IO.FileSystem" />
<Reference Include="System.IO.FileSystem.Watcher" />
+ <Reference Include="System.Memory" />
<Reference Include="System.ObjectModel" />
<Reference Include="System.Resources.ResourceManager" />
<Reference Include="System.Runtime" />
+ <Reference Include="System.Runtime.CompilerServices.Unsafe" />
<Reference Include="System.Runtime.Extensions" />
<Reference Include="System.Runtime.InteropServices" />
<Reference Include="System.Runtime.InteropServices.RuntimeInformation" />
<Compile Include="System\Threading\ThreadingAclExtensions.net46.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
+ <Reference Include="System.Memory" />
<Reference Include="System.Runtime" />
+ <Reference Include="System.Runtime.CompilerServices.Unsafe" />
<Reference Include="System.Runtime.InteropServices" />
<Reference Include="System.Security.AccessControl" />
<Reference Include="System.Security.Principal.Windows" />