17 [DllImport(
"oleaut32.dll")]
20 [DllImport(
"oleaut32.dll")]
26 [DllImport(
"oleaut32.dll")]
40 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_GetCalendars")]
43 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_GetCalendarInfo")]
46 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_EnumCalendarInfo")]
49 [DllImport(
"System.Globalization.Native", EntryPoint =
"GlobalizationNative_GetLatestJapaneseEra")]
52 [DllImport(
"System.Globalization.Native", EntryPoint =
"GlobalizationNative_GetJapaneseEraStartDate")]
55 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_ChangeCase")]
56 internal unsafe
static extern void ChangeCase(
char* src,
int srcLen,
char* dstBuffer,
int dstBufferCapacity,
bool bToUpper);
58 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_ChangeCaseInvariant")]
59 internal unsafe
static extern void ChangeCaseInvariant(
char* src,
int srcLen,
char* dstBuffer,
int dstBufferCapacity,
bool bToUpper);
61 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_ChangeCaseTurkish")]
62 internal unsafe
static extern void ChangeCaseTurkish(
char* src,
int srcLen,
char* dstBuffer,
int dstBufferCapacity,
bool bToUpper);
64 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_InitOrdinalCasingPage")]
67 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Ansi, EntryPoint =
"GlobalizationNative_GetSortHandle")]
70 [DllImport(
"System.Globalization.Native", EntryPoint =
"GlobalizationNative_CloseSortHandle")]
73 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_CompareString")]
76 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_IndexOf")]
79 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_LastIndexOf")]
82 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_StartsWith")]
86 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_EndsWith")]
90 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_GetSortKey")]
93 [DllImport(
"System.Globalization.Native", EntryPoint =
"GlobalizationNative_GetSortVersion")]
96 [DllImport(
"System.Globalization.Native", EntryPoint =
"GlobalizationNative_LoadICU")]
104 [DllImport(
"System.Globalization.Native", EntryPoint =
"GlobalizationNative_InitICUFunctions")]
107 [DllImport(
"System.Globalization.Native", EntryPoint =
"GlobalizationNative_GetICUVersion")]
110 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_ToAscii")]
111 internal unsafe
static extern int ToAscii(uint flags,
char* src,
int srcLen,
char* dstBuffer,
int dstBufferCapacity);
113 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_ToUnicode")]
114 internal unsafe
static extern int ToUnicode(uint flags,
char* src,
int srcLen,
char* dstBuffer,
int dstBufferCapacity);
116 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_GetLocaleName")]
120 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_GetLocaleInfoString")]
122 internal unsafe
static extern bool GetLocaleInfoString(
string localeName, uint localeStringData,
char*
value,
int valueLength,
string uiLocaleName =
null);
124 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_IsPredefinedLocale")]
128 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_GetLocaleTimeFormat")]
132 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_GetLocaleInfoInt")]
136 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_GetLocaleInfoGroupingSizes")]
138 internal static extern bool GetLocaleInfoGroupingSizes(
string localeName, uint localeGroupingData, ref
int primaryGroupSize, ref
int secondaryGroupSize);
140 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_GetLocales")]
143 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_IsNormalized")]
146 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_NormalizeString")]
149 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_WindowsIdToIanaId")]
152 [DllImport(
"System.Globalization.Native",
CharSet =
CharSet.Unicode, EntryPoint =
"GlobalizationNative_IanaIdToWindowsId")]
153 internal unsafe
static extern int IanaIdToWindowsId(
string ianaId,
char* windowsId,
int windowsIdLength);
162 internal static class Kernel32
320 internal struct MEMORYSTATUSEX
412 internal struct SYSTEM_INFO
562 internal struct WIN32_FILE_ATTRIBUTE_DATA
588 internal struct WIN32_FIND_DATA
623 internal unsafe
static extern int LCIDToLocaleName(
int locale,
char* pLocaleName,
int cchName, uint dwFlags);
629 internal unsafe
static extern int LCMapStringEx(
string lpLocaleName, uint dwMapFlags,
char* lpSrcStr,
int cchSrc,
void* lpDestStr,
int cchDest,
void* lpVersionInformation,
void* lpReserved,
IntPtr sortHandle);
631 [DllImport(
"kernel32.dll")]
632 internal unsafe
static extern int FindNLSStringEx(
char* lpLocaleName, uint dwFindNLSStringFlags,
char* lpStringSource,
int cchSource,
char* lpStringValue,
int cchValue,
int* pcchFound,
void* lpVersionInformation,
void* lpReserved,
IntPtr sortHandle);
634 [DllImport(
"kernel32.dll")]
635 internal unsafe
static extern int CompareStringEx(
char* lpLocaleName, uint dwCmpFlags,
char* lpString1,
int cchCount1,
char* lpString2,
int cchCount2,
void* lpVersionInformation,
void* lpReserved,
IntPtr lParam);
637 [DllImport(
"kernel32.dll")]
638 internal unsafe
static extern int CompareStringOrdinal(
char* lpString1,
int cchCount1,
char* lpString2,
int cchCount2,
bool bIgnoreCase);
640 [DllImport(
"kernel32.dll")]
641 internal unsafe
static extern int FindStringOrdinal(uint dwFindStringOrdinalFlags,
char* lpStringSource,
int cchSource,
char* lpStringValue,
int cchValue,
BOOL bIgnoreCase);
644 internal unsafe
static extern bool IsNLSDefinedString(
int Function, uint dwFlags,
IntPtr lpVersionInformation,
char* lpString,
int cchStr);
650 internal unsafe
static extern int GetLocaleInfoEx(
string lpLocaleName, uint LCType,
void* lpLCData,
int cchData);
653 internal unsafe
static extern bool EnumSystemLocalesEx(delegate* unmanaged<char*, uint, void*, BOOL> lpLocaleEnumProcEx, uint dwFlags,
void* lParam,
IntPtr reserved);
656 internal unsafe
static extern bool EnumTimeFormatsEx(delegate* unmanaged<char*, void*, BOOL> lpTimeFmtEnumProcEx,
string lpLocaleName, uint dwFlags,
void* lParam);
664 [DllImport(
"kernel32.dll")]
668 internal unsafe
static extern int GetGeoInfo(
int location,
int geoType,
char* lpGeoData,
int cchData,
int LangId);
671 internal unsafe
static extern bool EnumCalendarInfoExEx(delegate* unmanaged<char*, uint, IntPtr, void*, BOOL> pCalInfoEnumProcExEx,
string lpLocaleName, uint
Calendar,
string lpReserved, uint CalType,
void* lParam);
677 internal unsafe
static extern int ResolveLocaleName(
string lpNameToResolve,
char* lpLocaleName,
int cchLocaleName);
693 [DllImport(
"kernel32.dll", ExactSpelling =
true)]
696 [DllImport(
"kernel32.dll", ExactSpelling =
true)]
699 [DllImport(
"kernel32.dll", ExactSpelling =
true)]
702 internal static int CopyFile(
string src,
string dst,
bool failIfExists)
704 int flags = (failIfExists ? 1 : 0);
713 [DllImport(
"kernel32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"CopyFileExW",
SetLastError =
true)]
716 internal static bool CopyFileEx(
string src,
string dst,
IntPtr progressRoutine,
IntPtr progressData, ref
int cancel,
int flags)
720 return CopyFileExPrivate(src, dst, progressRoutine, progressData, ref cancel, flags);
723 [DllImport(
"kernel32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"CreateDirectoryW",
SetLastError =
true)]
732 [DllImport(
"kernel32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"CreateFileW", ExactSpelling =
true,
SetLastError =
true)]
738 return CreateFilePrivate(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
744 return CreateFilePrivate(lpFileName, dwDesiredAccess, dwShareMode,
null, dwCreationDisposition, dwFlagsAndAttributes,
IntPtr.
Zero);
747 [DllImport(
"kernel32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"DeleteFileW",
SetLastError =
true)]
756 [DllImport(
"kernel32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"DeleteVolumeMountPointW",
SetLastError =
true)]
765 [DllImport(
"kernel32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"CreateFileW", ExactSpelling =
true,
SetLastError =
true)]
774 [DllImport(
"kernel32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"CreateSymbolicLinkW", ExactSpelling =
true,
SetLastError =
true)]
777 internal static void CreateSymbolicLink(
string symlinkFileName,
string targetFileName,
bool isDirectory)
779 string path = symlinkFileName;
783 bool flag = (Environment.OSVersion.Version.Major == 10 && Environment.OSVersion.Version.Build >= 14972) ||
Environment.
OSVersion.Version.Major >= 11;
803 [DllImport(
"kernel32.dll", ExactSpelling =
true)]
806 [DllImport(
"kernel32.dll", ExactSpelling =
true)]
809 [DllImport(
"kernel32.dll", ExactSpelling =
true)]
812 [DllImport(
"kernel32.dll", ExactSpelling =
true)]
816 internal static extern bool DeviceIoControl(
SafeHandle hDevice, uint dwIoControlCode,
IntPtr lpInBuffer, uint nInBufferSize,
byte[] lpOutBuffer, uint nOutBufferSize, out uint lpBytesReturned,
IntPtr lpOverlapped);
818 [DllImport(
"kernel32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"ExpandEnvironmentStringsW", ExactSpelling =
true,
SetLastError =
true)]
821 [DllImport(
"kernel32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"FindNextFileW",
SetLastError =
true)]
824 [DllImport(
"kernel32.dll")]
825 [SuppressGCTransition]
831 [DllImport(
"kernel32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"FindFirstFileExW", ExactSpelling =
true,
SetLastError =
true)]
844 [DllImport(
"kernel32.dll", ExactSpelling =
true,
SetLastError =
true)]
847 [DllImport(
"kernel32.dll")]
848 [SuppressGCTransition]
851 [DllImport(
"kernel32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"GetComputerNameW", ExactSpelling =
true)]
857 uint nSize = (uint)span.
Length;
862 return span.
Slice(0, (
int)nSize).ToString();
865 [DllImport(
"kernel32.dll")]
868 [DllImport(
"kernel32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"GetCurrentDirectoryW", ExactSpelling =
true,
SetLastError =
true)]
871 [DllImport(
"kernel32.dll")]
874 [DllImport(
"kernel32.dll")]
877 [DllImport(
"kernel32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"GetFileAttributesExW", ExactSpelling =
true,
SetLastError =
true)]
886 [DllImport(
"kernel32.dll", ExactSpelling =
true,
SetLastError =
true)]
892 [DllImport(
"kernel32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"GetFinalPathNameByHandleW", ExactSpelling =
true,
SetLastError =
true)]
896 internal static extern uint
GetFullPathNameW(ref
char lpFileName, uint nBufferLength, ref
char lpBuffer,
IntPtr lpFilePart);
902 internal static extern uint
GetLongPathNameW(ref
char lpszShortPath, ref
char lpszLongPath, uint cchBuffer);
904 [DllImport(
"kernel32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"GetModuleFileNameW", ExactSpelling =
true,
SetLastError =
true)]
910 [DllImport(
"kernel32.dll", EntryPoint =
"K32GetProcessMemoryInfo")]
914 internal static extern bool GetProcessTimes(
IntPtr handleProcess, out
long creation, out
long exit, out
long kernel, out
long user);
916 [DllImport(
"kernel32.dll")]
917 [SuppressGCTransition]
923 [DllImport(
"kernel32.dll")]
926 [DllImport(
"kernel32.dll")]
927 [SuppressGCTransition]
931 internal static extern bool GetSystemTimes(out
long idle, out
long kernel, out
long user);
934 internal static extern uint
GetTempFileNameW(ref
char lpPathName,
string lpPrefixString, uint uUnique, ref
char lpTempFileName);
936 [DllImport(
"kernel32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, ExactSpelling =
true)]
939 [DllImport(
"kernel32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"GetVolumeInformationW",
SetLastError =
true)]
940 internal unsafe
static extern bool GetVolumeInformation(
string drive,
char* volumeName,
int volumeNameBufLen,
int* volSerialNumber,
int* maxFileNameLen, out
int fileSystemFlags,
char* fileSystemName,
int fileSystemNameBufLen);
942 [DllImport(
"kernel32.dll")]
945 [DllImport(
"kernel32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"LoadLibraryExW", ExactSpelling =
true,
SetLastError =
true)]
948 [DllImport(
"kernel32.dll")]
951 [DllImport(
"kernel32.dll")]
954 [DllImport(
"kernel32.dll")]
963 [DllImport(
"kernel32.dll")]
964 internal unsafe
static extern int MultiByteToWideChar(uint CodePage, uint dwFlags,
byte* lpMultiByteStr,
int cbMultiByte,
char* lpWideCharStr,
int cchWideChar);
966 [DllImport(
"kernel32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"MoveFileExW",
SetLastError =
true)]
969 internal static bool MoveFile(
string src,
string dst,
bool overwrite)
981 [DllImport(
"kernel32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"OutputDebugStringW", ExactSpelling =
true)]
984 [DllImport(
"kernel32.dll", ExactSpelling =
true)]
985 [SuppressGCTransition]
988 [DllImport(
"kernel32.dll", ExactSpelling =
true)]
991 [DllImport(
"kernel32.dll")]
1006 [DllImport(
"kernel32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"RemoveDirectoryW",
SetLastError =
true)]
1015 [DllImport(
"kernel32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"ReplaceFileW",
SetLastError =
true)]
1016 private static extern bool ReplaceFilePrivate(
string replacedFileName,
string replacementFileName,
string backupFileName,
int dwReplaceFlags,
IntPtr lpExclude,
IntPtr lpReserved);
1018 internal static bool ReplaceFile(
string replacedFileName,
string replacementFileName,
string backupFileName,
int dwReplaceFlags,
IntPtr lpExclude,
IntPtr lpReserved)
1023 return ReplaceFilePrivate(replacedFileName, replacementFileName, backupFileName, dwReplaceFlags, lpExclude, lpReserved);
1029 [DllImport(
"kernel32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"SetCurrentDirectoryW", ExactSpelling =
true,
SetLastError =
true)]
1032 [DllImport(
"kernel32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"SetFileAttributesW",
SetLastError =
true)]
1041 [DllImport(
"kernel32.dll", ExactSpelling =
true,
SetLastError =
true)]
1047 [DllImport(
"kernel32.dll")]
1048 [SuppressGCTransition]
1051 [DllImport(
"kernel32.dll", ExactSpelling =
true,
SetLastError =
true)]
1052 [SuppressGCTransition]
1055 [DllImport(
"kernel32.dll")]
1056 [SuppressGCTransition]
1065 [DllImport(
"kernel32.dll")]
1068 [DllImport(
"kernel32.dll")]
1071 [DllImport(
"kernel32.dll")]
1074 [DllImport(
"kernel32.dll", ExactSpelling =
true)]
1075 internal unsafe
static extern void*
VirtualAlloc(
void* lpAddress,
UIntPtr dwSize,
int flAllocationType,
int flProtect);
1077 [DllImport(
"kernel32.dll", ExactSpelling =
true)]
1080 [DllImport(
"kernel32.dll", ExactSpelling =
true,
SetLastError =
true)]
1083 [DllImport(
"kernel32.dll")]
1084 internal unsafe
static extern int WideCharToMultiByte(uint CodePage, uint dwFlags,
char* lpWideCharStr,
int cchWideChar,
byte* lpMultiByteStr,
int cbMultiByte,
IntPtr lpDefaultChar,
IntPtr lpUsedDefaultChar);
1101 [DllImport(
"kernel32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"CreateEventExW", ExactSpelling =
true,
SetLastError =
true)]
1107 [DllImport(
"kernel32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"GetEnvironmentVariableW", ExactSpelling =
true,
SetLastError =
true)]
1110 [DllImport(
"kernel32.dll", ExactSpelling =
true)]
1113 [DllImport(
"kernel32.dll", ExactSpelling =
true)]
1116 [DllImport(
"kernel32.dll", BestFitMapping =
true,
CharSet =
CharSet.Unicode, EntryPoint =
"FormatMessageW", ExactSpelling =
true,
SetLastError =
true)]
1117 private unsafe
static extern int FormatMessage(
int dwFlags,
IntPtr lpSource, uint dwMessageId,
int dwLanguageId,
void* lpBuffer,
int nSize,
IntPtr arguments);
1132 fixed (
char* lpBuffer = span)
1156 return $
"Unknown error (0x{errorCode:x})";
1162 while (num > 0 &&
buffer[num - 1] <=
' ')
1166 return buffer.Slice(0, num).ToString();
1172 [DllImport(
"kernel32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"CreateMutexExW", ExactSpelling =
true,
SetLastError =
true)]
1178 [DllImport(
"kernel32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"OpenSemaphoreW", ExactSpelling =
true,
SetLastError =
true)]
1181 [DllImport(
"kernel32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"CreateSemaphoreExW", ExactSpelling =
true,
SetLastError =
true)]
1187 [DllImport(
"kernel32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"SetEnvironmentVariableW", ExactSpelling =
true,
SetLastError =
true)]
1196 [DllImport(
"Normaliz.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
1197 internal unsafe
static extern int IdnToAscii(uint dwFlags,
char* lpUnicodeCharStr,
int cchUnicodeChar,
char* lpASCIICharStr,
int cchASCIIChar);
1199 [DllImport(
"Normaliz.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
1200 internal unsafe
static extern int IdnToUnicode(uint dwFlags,
char* lpASCIICharStr,
int cchASCIIChar,
char* lpUnicodeCharStr,
int cchUnicodeChar);
1202 [DllImport(
"Normaliz.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
1205 [DllImport(
"Normaliz.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
1299 [DllImport(
"advapi32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"EncryptFileW", SetLastError =
true)]
1308 [DllImport(
"advapi32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"DecryptFileW", SetLastError =
true)]
1317 [DllImport(
"advapi32.dll", ExactSpelling =
true)]
1320 [DllImport(
"advapi32.dll", ExactSpelling =
true)]
1323 [DllImport(
"advapi32.dll", ExactSpelling =
true)]
1326 [DllImport(
"advapi32.dll", ExactSpelling =
true)]
1329 [DllImport(
"advapi32.dll", ExactSpelling =
true)]
1334 int num =
EventWriteTransfer_PInvoke(registrationHandle, in eventDescriptor, activityId, relatedActivityId, userDataCount, userData);
1335 if (num == 87 && relatedActivityId ==
null)
1343 [DllImport(
"advapi32.dll", EntryPoint =
"EventWriteTransfer", ExactSpelling =
true)]
1346 [DllImport(
"advapi32.dll",
CharSet =
CharSet.Unicode, ExactSpelling =
true, SetLastError =
true)]
1347 internal static extern bool LookupAccountNameW(
string lpSystemName, ref
char lpAccountName, ref
byte Sid, ref uint cbSid, ref
char ReferencedDomainName, ref uint cchReferencedDomainName, out uint peUse);
1349 [DllImport(
"advapi32.dll")]
1352 [DllImport(
"advapi32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"RegDeleteValueW", ExactSpelling =
true)]
1355 [DllImport(
"advapi32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"RegEnumKeyExW", ExactSpelling =
true)]
1356 internal static extern int RegEnumKeyEx(
SafeRegistryHandle hKey,
int dwIndex,
char[] lpName, ref
int lpcbName,
int[] lpReserved, [Out]
char[] lpClass,
int[] lpcbClass,
long[] lpftLastWriteTime);
1358 [DllImport(
"advapi32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"RegEnumValueW", ExactSpelling =
true)]
1359 internal static extern int RegEnumValue(
SafeRegistryHandle hKey,
int dwIndex,
char[] lpValueName, ref
int lpcbValueName,
IntPtr lpReserved_MustBeZero,
int[] lpType,
byte[] lpData,
int[] lpcbData);
1361 [DllImport(
"advapi32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"RegOpenKeyExW", ExactSpelling =
true)]
1364 [DllImport(
"advapi32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"RegQueryValueExW", ExactSpelling =
true)]
1367 [DllImport(
"advapi32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"RegQueryValueExW", ExactSpelling =
true)]
1370 [DllImport(
"advapi32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"RegQueryValueExW", ExactSpelling =
true)]
1373 [DllImport(
"advapi32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"RegQueryValueExW", ExactSpelling =
true)]
1376 [DllImport(
"advapi32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, EntryPoint =
"RegSetValueExW", ExactSpelling =
true)]
1397 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
1400 [DllImport(
"crypt32.dll",
CharSet =
CharSet.Unicode, SetLastError =
true)]
1410 internal static class NtDll
1539 uint nextEntryOffset =
info->NextEntryOffset;
1540 if (nextEntryOffset == 0)
1643 [DllImport(
"ntdll.dll",
CharSet =
CharSet.Unicode, ExactSpelling =
true)]
1644 private unsafe static extern uint
NtCreateFile(
IntPtr* FileHandle,
DesiredAccess DesiredAccess,
OBJECT_ATTRIBUTES*
ObjectAttributes,
IO_STATUS_BLOCK* IoStatusBlock,
long* AllocationSize,
FileAttributes FileAttributes,
FileShare ShareAccess,
CreateDisposition CreateDisposition,
CreateOptions CreateOptions,
void* EaBuffer, uint EaLength);
1646 internal unsafe static (uint status,
IntPtr handle) CreateFile(
ReadOnlySpan<char> path,
IntPtr rootDirectory,
CreateDisposition createDisposition,
DesiredAccess desiredAccess =
DesiredAccess.SYNCHRONIZE |
DesiredAccess.FILE_GENERIC_READ,
FileShare shareAccess =
FileShare.ReadWrite |
FileShare.Delete,
FileAttributes fileAttributes = (
FileAttributes)0,
CreateOptions createOptions =
CreateOptions.FILE_SYNCHRONOUS_IO_NONALERT,
ObjectAttributes objectAttributes =
ObjectAttributes.OBJ_CASE_INSENSITIVE,
void*
eaBuffer =
null, uint
eaLength = 0u,
long*
preallocationSize =
null,
SECURITY_QUALITY_OF_SERVICE*
securityQualityOfService =
null)
1653 uNICODE_STRING.Length = (ushort)(path.
Length * 2);
1654 uNICODE_STRING.MaximumLength = (ushort)(path.
Length * 2);
1655 uNICODE_STRING.Buffer = (
IntPtr)ptr;
1660 uint item2 =
NtCreateFile(&
item,
desiredAccess, &oBJECT_ATTRIBUTES, &iO_STATUS_BLOCK,
preallocationSize,
fileAttributes,
shareAccess,
createDisposition,
createOptions,
eaBuffer,
eaLength);
1666 [DllImport(
"ntdll.dll", ExactSpelling =
true)]
1667 public static extern uint RtlNtStatusToDosError(
int Status);
1669 [DllImport(
"ntdll.dll",
CharSet =
CharSet.Unicode, ExactSpelling =
true)]
1670 public unsafe static extern int NtQueryDirectoryFile(
IntPtr FileHandle,
IntPtr Event,
IntPtr ApcRoutine,
IntPtr ApcContext,
IO_STATUS_BLOCK* IoStatusBlock,
IntPtr FileInformation, uint Length,
FILE_INFORMATION_CLASS FileInformationClass,
BOOLEAN ReturnSingleEntry,
UNICODE_STRING*
FileName,
BOOLEAN RestartScan);
1672 [DllImport(
"ntdll.dll", ExactSpelling =
true)]
1675 [DllImport(
"ntdll.dll", ExactSpelling =
true)]
1678 [DllImport(
"ntdll.dll", ExactSpelling =
true)]
1689 internal struct UNICODE_STRING
1764 [DllImport(
"ole32.dll")]
1767 [DllImport(
"ole32.dll")]
1770 [DllImport(
"ole32.dll")]
1773 [DllImport(
"ole32.dll")]
1776 [DllImport(
"ole32.dll")]
1782 [DllImport(
"secur32.dll",
CharSet =
CharSet.Unicode, ExactSpelling =
true, SetLastError =
true)]
1788 [DllImport(
"shell32.dll", BestFitMapping =
false,
CharSet =
CharSet.Unicode, ExactSpelling =
true)]
1804 internal unsafe
static extern void*
calloc(nuint num, nuint size);
1807 internal unsafe
static extern void free(
void* ptr);
1810 internal unsafe
static extern void*
malloc(nuint size);
1813 internal unsafe
static extern void*
realloc(
void* ptr, nuint new_size);
1816 internal static class User32
1827 [DllImport(
"user32.dll",
CharSet =
CharSet.Unicode, EntryPoint =
"LoadStringW", ExactSpelling =
true, SetLastError =
true)]
1828 internal unsafe
static extern int LoadString(
IntPtr hInstance, uint uID,
char* lpBuffer,
int cchBufferMax);
1830 [DllImport(
"user32.dll", EntryPoint =
"SendMessageTimeoutW")]
1833 [DllImport(
"user32.dll", ExactSpelling =
true)]
1836 [DllImport(
"user32.dll",
CharSet =
CharSet.Unicode, ExactSpelling =
true, SetLastError =
true)]
1850 internal static bool CallStringMethod<TArg1, TArg2, TArg3>(SpanFunc<char, TArg1, TArg2, TArg3, Globalization.ResultCode> interopCall, TArg1 arg1, TArg2 arg2, TArg3 arg3, out
string result)
1853 switch (interopCall(span, arg1, arg2, arg3))
1856 result = span.
Slice(0, span.IndexOf(
'\0')).ToString();
1859 span =
new char[1280];
1862 result = span.
Slice(0, span.IndexOf(
'\0')).ToString();
static int EventActivityIdControl(ActivityControl ControlCode, ref Guid ActivityId)
static int RegSetValueEx(SafeRegistryHandle hKey, string lpValueName, int Reserved, int dwType, string lpData, int cbData)
static int RegQueryValueEx(SafeRegistryHandle hKey, string lpValueName, int[] lpReserved, ref int lpType, [Out] byte[] lpData, ref int lpcbData)
static int RegEnumValue(SafeRegistryHandle hKey, int dwIndex, char[] lpValueName, ref int lpcbValueName, IntPtr lpReserved_MustBeZero, int[] lpType, byte[] lpData, int[] lpcbData)
static bool EncryptFile(string path)
static uint EventUnregister(long registrationHandle)
static int RegQueryValueEx(SafeRegistryHandle hKey, string lpValueName, int[] lpReserved, ref int lpType, ref int lpData, ref int lpcbData)
static bool DecryptFileFilePrivate(string lpFileName, int dwReserved)
static int RegEnumKeyEx(SafeRegistryHandle hKey, int dwIndex, char[] lpName, ref int lpcbName, int[] lpReserved, [Out] char[] lpClass, int[] lpcbClass, long[] lpftLastWriteTime)
static unsafe int EventWriteTransfer_PInvoke(long registrationHandle, in EventDescriptor eventDescriptor, Guid *activityId, Guid *relatedActivityId, int userDataCount, EventProvider.EventData *userData)
static unsafe int EnumerateTraceGuidsEx(TRACE_QUERY_INFO_CLASS TraceQueryInfoClass, void *InBuffer, int InBufferSize, void *OutBuffer, int OutBufferSize, out int ReturnLength)
static bool LookupAccountNameW(string lpSystemName, ref char lpAccountName, ref byte Sid, ref uint cbSid, ref char ReferencedDomainName, ref uint cchReferencedDomainName, out uint peUse)
@ EVENT_ACTIVITY_CTRL_GET_ID
@ EVENT_ACTIVITY_CTRL_GET_SET_ID
@ EVENT_ACTIVITY_CTRL_CREATE_SET_ID
@ EVENT_ACTIVITY_CTRL_CREATE_ID
@ EVENT_ACTIVITY_CTRL_SET_ID
static int RegQueryValueEx(SafeRegistryHandle hKey, string lpValueName, int[] lpReserved, ref int lpType, [Out] char[] lpData, ref int lpcbData)
static bool EncryptFilePrivate(string lpFileName)
static unsafe uint EventRegister(in Guid providerId, EtwEnableCallback enableCallback, void *callbackContext, ref long registrationHandle)
static unsafe int EventWriteTransfer(long registrationHandle, in EventDescriptor eventDescriptor, Guid *activityId, Guid *relatedActivityId, int userDataCount, EventProvider.EventData *userData)
static int RegOpenKeyEx(SafeRegistryHandle hKey, string lpSubKey, int ulOptions, int samDesired, out SafeRegistryHandle hkResult)
unsafe delegate void EtwEnableCallback(in Guid sourceId, int isEnabled, byte level, long matchAnyKeywords, long matchAllKeywords, EVENT_FILTER_DESCRIPTOR *filterData, void *callbackContext)
static int RegDeleteValue(SafeRegistryHandle hKey, string lpValueName)
static bool DecryptFile(string path)
static unsafe int EventSetInformation(long registrationHandle, EVENT_INFO_CLASS informationClass, void *eventInformation, uint informationLength)
static int RegQueryValueEx(SafeRegistryHandle hKey, string lpValueName, int[] lpReserved, ref int lpType, ref long lpData, ref int lpcbData)
static int RegCloseKey(IntPtr hKey)
@ STATUS_AUTH_TAG_MISMATCH
@ STATUS_INVALID_PARAMETER
static unsafe NTSTATUS BCryptGenRandom(IntPtr hAlgorithm, byte *pbBuffer, int cbBuffer, int dwFlags)
static bool CryptUnprotectMemory(SafeBuffer pData, uint cbData, uint dwFlags)
static bool CryptProtectMemory(SafeBuffer pData, uint cbData, uint dwFlags)
static bool IsPredefinedLocale(string localeName)
static int GetICUVersion()
static unsafe void ChangeCaseInvariant(char *src, int srcLen, char *dstBuffer, int dstBufferCapacity, bool bToUpper)
static unsafe int GetSortKey(IntPtr sortHandle, char *str, int strLength, byte *sortKey, int sortKeyLength, CompareOptions options)
static unsafe void ChangeCaseTurkish(char *src, int srcLen, char *dstBuffer, int dstBufferCapacity, bool bToUpper)
static unsafe bool GetLocaleName(string localeName, char *value, int valueLength)
static unsafe int IndexOf(IntPtr sortHandle, char *target, int cwTargetLength, char *pSource, int cwSourceLength, CompareOptions options, int *matchLengthPtr)
static unsafe bool GetLocaleTimeFormat(string localeName, bool shortFormat, char *value, int valueLength)
static void InitICUFunctions(IntPtr icuuc, IntPtr icuin, string version, string suffix)
static unsafe void ChangeCase(char *src, int srcLen, char *dstBuffer, int dstBufferCapacity, bool bToUpper)
static void CloseSortHandle(IntPtr handle)
static unsafe ResultCode GetCalendarInfo(string localeName, CalendarId calendarId, CalendarDataType calendarDataType, char *result, int resultCapacity)
static int GetCalendars(string localeName, CalendarId[] calendars, int calendarsCapacity)
static ResultCode GetSortHandle(string localeName, out IntPtr sortHandle)
static int GetSortVersion(IntPtr sortHandle)
static int GetLatestJapaneseEra()
static unsafe bool StartsWith(IntPtr sortHandle, char *target, int cwTargetLength, char *source, int cwSourceLength, CompareOptions options, int *matchedLength)
static unsafe int IsNormalized(NormalizationForm normalizationForm, char *src, int srcLen)
static unsafe int ToUnicode(uint flags, char *src, int srcLen, char *dstBuffer, int dstBufferCapacity)
static unsafe void InitOrdinalCasingPage(int pageNumber, char *pTarget)
static unsafe int CompareString(IntPtr sortHandle, char *lpStr1, int cwStr1Len, char *lpStr2, int cwStr2Len, CompareOptions options)
static void InitICUFunctions(IntPtr icuuc, IntPtr icuin, ReadOnlySpan< char > version, ReadOnlySpan< char > suffix)
static unsafe bool GetLocaleInfoString(string localeName, uint localeStringData, char *value, int valueLength, string uiLocaleName=null)
static unsafe bool EnumCalendarInfo(delegate *unmanaged< char *, IntPtr, void > callback, string localeName, CalendarId calendarId, CalendarDataType calendarDataType, IntPtr context)
static bool GetLocaleInfoInt(string localeName, uint localeNumberData, ref int value)
static unsafe int NormalizeString(NormalizationForm normalizationForm, char *src, int srcLen, char *dstBuffer, int dstBufferCapacity)
static unsafe int IanaIdToWindowsId(string ianaId, char *windowsId, int windowsIdLength)
static int GetLocales([Out] char[] value, int valueLength)
static unsafe int LastIndexOf(IntPtr sortHandle, char *target, int cwTargetLength, char *pSource, int cwSourceLength, CompareOptions options, int *matchLengthPtr)
static unsafe int ToAscii(uint flags, char *src, int srcLen, char *dstBuffer, int dstBufferCapacity)
static unsafe int WindowsIdToIanaId(string windowsId, IntPtr region, char *ianaId, int ianaIdLength)
static unsafe bool EndsWith(IntPtr sortHandle, char *target, int cwTargetLength, char *source, int cwSourceLength, CompareOptions options, int *matchedLength)
static bool GetLocaleInfoGroupingSizes(string localeName, uint localeGroupingData, ref int primaryGroupSize, ref int secondaryGroupSize)
static bool GetJapaneseEraStartDate(int era, out int startYear, out int startMonth, out int startDay)
static int corehost_resolve_component_dependencies(string componentMainAssemblyPath, corehost_resolve_component_dependencies_result_fn result)
delegate void corehost_resolve_component_dependencies_result_fn(string assemblyPaths, string nativeSearchPaths, string resourceSearchPaths)
static IntPtr corehost_set_error_writer(IntPtr errorWriter)
delegate void corehost_error_writer_fn(string message)
static unsafe int ResolveLocaleName(string lpNameToResolve, char *lpLocaleName, int cchLocaleName)
static int GetCalendarInfoEx(string lpLocaleName, uint Calendar, IntPtr lpReserved, uint CalType, IntPtr lpCalData, int cchData, out int lpValue)
static unsafe void InitializeCriticalSection(CRITICAL_SECTION *lpCriticalSection)
static bool ReplaceFile(string replacedFileName, string replacementFileName, string backupFileName, int dwReplaceFlags, IntPtr lpExclude, IntPtr lpReserved)
static bool FindClose(IntPtr hFindFile)
static bool RemoveDirectoryPrivate(string path)
static unsafe bool GetVolumeInformation(string drive, char *volumeName, int volumeNameBufLen, int *volSerialNumber, int *maxFileNameLen, out int fileSystemFlags, char *fileSystemName, int fileSystemNameBufLen)
static bool SetEnvironmentVariable(string lpName, string lpValue)
static ulong VerSetConditionMask(ulong ConditionMask, uint TypeMask, byte Condition)
static IntPtr GetStdHandle(int nStdHandle)
static unsafe BOOL GetCPInfo(uint codePage, CPINFO *lpCpInfo)
static bool ReleaseMutex(SafeWaitHandle handle)
static unsafe int WriteFileGather(SafeHandle hFile, long *aSegmentArray, int nNumberOfBytesToWrite, IntPtr lpReserved, NativeOverlapped *lpOverlapped)
static bool SetCurrentDirectory(string path)
static unsafe bool EnumSystemLocalesEx(delegate *unmanaged< char *, uint, void *, BOOL > lpLocaleEnumProcEx, uint dwFlags, void *lParam, IntPtr reserved)
static unsafe int LCMapStringEx(string lpLocaleName, uint dwMapFlags, char *lpSrcStr, int cchSrc, void *lpDestStr, int cchDest, void *lpVersionInformation, void *lpReserved, IntPtr sortHandle)
static int GetLogicalDrives()
static uint GetEnvironmentVariable(string lpName, ref char lpBuffer, uint nSize)
static Microsoft.Win32.SafeHandles.SafeFindHandle FindFirstFileExPrivate(string lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, ref WIN32_FIND_DATA lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, IntPtr lpSearchFilter, int dwAdditionalFlags)
static bool ResetEvent(SafeWaitHandle handle)
static uint GetFullPathNameW(ref char lpFileName, uint nBufferLength, ref char lpBuffer, IntPtr lpFilePart)
static unsafe int WriteFile(IntPtr handle, byte *bytes, int numBytesToWrite, out int numBytesWritten, IntPtr mustBeZero)
static unsafe BOOL QueryPerformanceFrequency(long *lpFrequency)
static bool GetProcessMemoryInfo(IntPtr Process, ref PROCESS_MEMORY_COUNTERS ppsmemCounters, uint cb)
static unsafe UIntPtr VirtualQuery(void *lpAddress, ref MEMORY_BASIC_INFORMATION lpBuffer, UIntPtr dwLength)
static unsafe void LeaveCriticalSection(CRITICAL_SECTION *lpCriticalSection)
static bool DeleteFilePrivate(string path)
static bool RemoveDirectory(string path)
static SafeFindHandle FindFirstFile(string fileName, ref WIN32_FIND_DATA data)
static unsafe int WriteFile(SafeHandle handle, byte *bytes, int numBytesToWrite, IntPtr numBytesWritten_mustBeZero, NativeOverlapped *lpOverlapped)
static void OutputDebugString(string message)
static bool DeleteVolumeMountPointPrivate(string mountPoint)
static SafeWaitHandle CreateSemaphoreEx(IntPtr lpSecurityAttributes, int initialCount, int maximumCount, string name, uint flags, uint desiredAccess)
static bool PostQueuedCompletionStatus(IntPtr CompletionPort, int dwNumberOfBytesTransferred, UIntPtr CompletionKey, IntPtr lpOverlapped)
static unsafe string GetMessage(int errorCode, IntPtr moduleHandle)
static bool FreeLibrary(IntPtr hModule)
static unsafe BOOL GetUserPreferredUILanguages(uint dwFlags, uint *pulNumLanguages, char *pwszLanguagesBuffer, uint *pcchLanguagesBuffer)
static unsafe BOOL TzSpecificLocalTimeToSystemTime(IntPtr lpTimeZoneInformation, SYSTEMTIME *lpLocalTime, SYSTEMTIME *lpUniversalTime)
static void SetLastError(int errorCode)
static IntPtr LocalFree(IntPtr hMem)
static SafeWaitHandle OpenEvent(uint desiredAccess, bool inheritHandle, string name)
static unsafe bool GetNLSVersionEx(int function, string localeName, NlsVersionInfoEx *lpVersionInformation)
static uint GetTempPathW(int bufferLen, ref char buffer)
static unsafe bool CancelIoEx(SafeHandle handle, NativeOverlapped *lpOverlapped)
static unsafe SafeFileHandle CreateFile(string lpFileName, int dwDesiredAccess, FileShare dwShareMode, FileMode dwCreationDisposition, int dwFlagsAndAttributes)
static unsafe IntPtr CreateFilePrivate_IntPtr(string lpFileName, int dwDesiredAccess, FileShare dwShareMode, SECURITY_ATTRIBUTES *lpSecurityAttributes, FileMode dwCreationDisposition, int dwFlagsAndAttributes, IntPtr hTemplateFile)
static uint GetSystemDirectoryW(ref char lpBuffer, uint uSize)
static unsafe SafeFileHandle CreateFile(string lpFileName, int dwDesiredAccess, FileShare dwShareMode, SECURITY_ATTRIBUTES *lpSecurityAttributes, FileMode dwCreationDisposition, int dwFlagsAndAttributes, IntPtr hTemplateFile)
static int CopyFile(string src, string dst, bool failIfExists)
static bool ReleaseSemaphore(SafeWaitHandle handle, int releaseCount, out int previousCount)
static unsafe void * VirtualAlloc(void *lpAddress, UIntPtr dwSize, int flAllocationType, int flProtect)
static void GetSystemInfo(out SYSTEM_INFO lpSystemInfo)
static unsafe bool VirtualFree(void *lpAddress, UIntPtr dwSize, int dwFreeType)
static unsafe bool SleepConditionVariableCS(CONDITION_VARIABLE *ConditionVariable, CRITICAL_SECTION *CriticalSection, int dwMilliseconds)
static uint GetCurrentProcessId()
static unsafe BOOL GlobalMemoryStatusEx(MEMORYSTATUSEX *lpBuffer)
static int LocaleNameToLCID(string lpName, uint dwFlags)
static unsafe int ReadFileScatter(SafeHandle hFile, long *aSegmentArray, int nNumberOfBytesToRead, IntPtr lpReserved, NativeOverlapped *lpOverlapped)
static bool MoveFile(string src, string dst, bool overwrite)
static bool CloseHandle(IntPtr handle)
static bool CopyFileEx(string src, string dst, IntPtr progressRoutine, IntPtr progressData, ref int cancel, int flags)
static bool GetProcessTimes(IntPtr handleProcess, out long creation, out long exit, out long kernel, out long user)
static unsafe int WideCharToMultiByte(uint CodePage, uint dwFlags, char *lpWideCharStr, int cchWideChar, byte *lpMultiByteStr, int cbMultiByte, IntPtr lpDefaultChar, IntPtr lpUsedDefaultChar)
static bool DeleteFile(string path)
static unsafe void InitializeConditionVariable(CONDITION_VARIABLE *ConditionVariable)
static unsafe BOOL FileTimeToSystemTime(ulong *lpFileTime, SYSTEMTIME *lpSystemTime)
static IntPtr LoadLibraryEx(string libFilename, IntPtr reserved, int flags)
static unsafe BOOL QueryPerformanceCounter(long *lpPerformanceCount)
static int GetComputerName(ref char lpBuffer, ref uint nSize)
static unsafe int MultiByteToWideChar(uint CodePage, uint dwFlags, byte *lpMultiByteStr, int cbMultiByte, char *lpWideCharStr, int cchWideChar)
static unsafe int GetGeoInfo(int location, int geoType, char *lpGeoData, int cchData, int LangId)
static bool SetThreadErrorMode(uint dwNewMode, out uint lpOldMode)
static uint ExpandEnvironmentStrings(string lpSrc, ref char lpDst, uint nSize)
static uint GetLongPathNameW(ref char lpszShortPath, ref char lpszLongPath, uint cchBuffer)
static bool UnlockFile(SafeFileHandle handle, int offsetLow, int offsetHigh, int countLow, int countHigh)
static uint GetTempFileNameW(ref char lpPathName, string lpPrefixString, uint uUnique, ref char lpTempFileName)
static unsafe bool EnumCalendarInfoExEx(delegate *unmanaged< char *, uint, IntPtr, void *, BOOL > pCalInfoEnumProcExEx, string lpLocaleName, uint Calendar, string lpReserved, uint CalType, void *lParam)
static bool SetFilePointerEx(SafeFileHandle hFile, long liDistanceToMove, out long lpNewFilePointer, uint dwMoveMethod)
static SafeWaitHandle CreateMutexEx(IntPtr lpMutexAttributes, string name, uint flags, uint desiredAccess)
static unsafe void DeleteCriticalSection(CRITICAL_SECTION *lpCriticalSection)
static bool CreateSymbolicLinkPrivate(string lpSymlinkFileName, string lpTargetFileName, int dwFlags)
static unsafe bool SetConsoleCtrlHandler(delegate *unmanaged< int, BOOL > HandlerRoutine, bool Add)
static unsafe int WriteFile(SafeHandle handle, byte *bytes, int numBytesToWrite, out int numBytesWritten, NativeOverlapped *lpOverlapped)
static unsafe bool SetFileInformationByHandle(SafeFileHandle hFile, int FileInformationClass, void *lpFileInformation, uint dwBufferSize)
static string GetMessage(int errorCode)
static bool ReplaceFilePrivate(string replacedFileName, string replacementFileName, string backupFileName, int dwReplaceFlags, IntPtr lpExclude, IntPtr lpReserved)
static unsafe IntPtr CreateFile_IntPtr(string lpFileName, int dwDesiredAccess, FileShare dwShareMode, FileMode dwCreationDisposition, int dwFlagsAndAttributes)
static unsafe int ReadFile(SafeHandle handle, byte *bytes, int numBytesToRead, IntPtr numBytesRead_mustBeZero, NativeOverlapped *overlapped)
static unsafe int CompareStringOrdinal(char *lpString1, int cchCount1, char *lpString2, int cchCount2, bool bIgnoreCase)
static unsafe char * GetEnvironmentStringsW()
static IntPtr LocalReAlloc(IntPtr hMem, nuint uBytes, uint uFlags)
static bool QueryUnbiasedInterruptTime(out ulong UnbiasedTime)
static bool CopyFileExPrivate(string src, string dst, IntPtr progressRoutine, IntPtr progressData, ref int cancel, int flags)
static uint GetModuleFileName(IntPtr hModule, ref char lpFilename, uint nSize)
static bool GetQueuedCompletionStatus(IntPtr CompletionPort, out int lpNumberOfBytes, out UIntPtr CompletionKey, out IntPtr lpOverlapped, int dwMilliseconds)
static unsafe int FindNLSStringEx(char *lpLocaleName, uint dwFindNLSStringFlags, char *lpStringSource, int cchSource, char *lpStringValue, int cchValue, int *pcchFound, void *lpVersionInformation, void *lpReserved, IntPtr sortHandle)
static unsafe BOOL FreeEnvironmentStringsW(char *lpszEnvironmentBlock)
static bool GetFileAttributesEx(string name, GET_FILEEX_INFO_LEVELS fileInfoLevel, ref WIN32_FILE_ATTRIBUTE_DATA lpFileInformation)
static bool MoveFileExPrivate(string src, string dst, uint flags)
static bool VerifyVersionInfoW(ref OSVERSIONINFOEX lpVersionInfo, uint dwTypeMask, ulong dwlConditionMask)
static bool CreateDirectory(string path, ref SECURITY_ATTRIBUTES lpSecurityAttributes)
static uint GetCurrentDirectory(uint nBufferLength, ref char lpBuffer)
static bool DeleteVolumeMountPoint(string mountPoint)
static bool CreateDirectoryPrivate(string path, ref SECURITY_ATTRIBUTES lpSecurityAttributes)
static SafeWaitHandle OpenMutex(uint desiredAccess, bool inheritHandle, string name)
static unsafe void GetSystemTime(SYSTEMTIME *lpSystemTime)
static unsafe bool GetFileInformationByHandleEx(SafeFileHandle hFile, int FileInformationClass, void *lpFileInformation, uint dwBufferSize)
static IntPtr GetCurrentProcess()
static unsafe SafeFileHandle CreateFilePrivate(string lpFileName, int dwDesiredAccess, FileShare dwShareMode, SECURITY_ATTRIBUTES *lpSecurityAttributes, FileMode dwCreationDisposition, int dwFlagsAndAttributes, IntPtr hTemplateFile)
static unsafe int ReadFile(SafeHandle handle, byte *bytes, int numBytesToRead, out int numBytesRead, NativeOverlapped *overlapped)
static IntPtr CreateIoCompletionPort(IntPtr FileHandle, IntPtr ExistingCompletionPort, UIntPtr CompletionKey, int NumberOfConcurrentThreads)
static bool SetFileAttributesPrivate(string name, int attr)
static bool SetFileAttributes(string name, int attr)
static bool FindNextFile(SafeFindHandle hndFindFile, ref WIN32_FIND_DATA lpFindFileData)
static unsafe void WakeConditionVariable(CONDITION_VARIABLE *ConditionVariable)
static bool LockFile(SafeFileHandle handle, int offsetLow, int offsetHigh, int countLow, int countHigh)
static unsafe int FindStringOrdinal(uint dwFindStringOrdinalFlags, char *lpStringSource, int cchSource, char *lpStringValue, int cchValue, BOOL bIgnoreCase)
static bool DeviceIoControl(SafeHandle hDevice, uint dwIoControlCode, IntPtr lpInBuffer, uint nInBufferSize, byte[] lpOutBuffer, uint nOutBufferSize, out uint lpBytesReturned, IntPtr lpOverlapped)
static uint GetTimeZoneInformation(out TIME_ZONE_INFORMATION lpTimeZoneInformation)
static void CreateSymbolicLink(string symlinkFileName, string targetFileName, bool isDirectory)
static unsafe int LCIDToLocaleName(int locale, char *pLocaleName, int cchName, uint dwFlags)
static bool GetSystemTimes(out long idle, out long kernel, out long user)
static uint GetDynamicTimeZoneInformation(out TIME_DYNAMIC_ZONE_INFORMATION pTimeZoneInformation)
static bool GetFileAttributesExPrivate(string name, GET_FILEEX_INFO_LEVELS fileInfoLevel, ref WIN32_FILE_ATTRIBUTE_DATA lpFileInformation)
static unsafe int FormatMessage(int dwFlags, IntPtr lpSource, uint dwMessageId, int dwLanguageId, void *lpBuffer, int nSize, IntPtr arguments)
static int GetLastError()
static int GetFileType(SafeHandle hFile)
static unsafe int CompareStringEx(char *lpLocaleName, uint dwCmpFlags, char *lpString1, int cchCount1, char *lpString2, int cchCount2, void *lpVersionInformation, void *lpReserved, IntPtr lParam)
static bool SetEvent(SafeWaitHandle handle)
static unsafe BOOL SystemTimeToFileTime(SYSTEMTIME *lpSystemTime, ulong *lpFileTime)
static IntPtr LocalAlloc(uint uFlags, nuint uBytes)
static string GetComputerName()
static int GetUserGeoID(int geoClass)
static unsafe bool IsNLSDefinedString(int Function, uint dwFlags, IntPtr lpVersionInformation, char *lpString, int cchStr)
static SafeWaitHandle OpenSemaphore(uint desiredAccess, bool inheritHandle, string name)
static SafeWaitHandle CreateEventEx(IntPtr lpSecurityAttributes, string name, uint flags, uint desiredAccess)
static unsafe bool GetOverlappedResult(SafeFileHandle hFile, NativeOverlapped *lpOverlapped, ref int lpNumberOfBytesTransferred, bool bWait)
static unsafe void EnterCriticalSection(CRITICAL_SECTION *lpCriticalSection)
static unsafe int GetLocaleInfoEx(string lpLocaleName, uint LCType, void *lpLCData, int cchData)
static SafeFindHandle FindFirstFileExPrivate(string lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, ref WIN32_FIND_DATA lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, IntPtr lpSearchFilter, int dwAdditionalFlags)
static bool FlushFileBuffers(SafeHandle hHandle)
static int GetCalendarInfoEx(string lpLocaleName, uint Calendar, IntPtr lpReserved, uint CalType, IntPtr lpCalData, int cchData, IntPtr lpValue)
static unsafe uint GetFinalPathNameByHandle(SafeFileHandle hFile, char *lpszFilePath, uint cchFilePath, uint dwFlags)
@ FindExSearchLimitToDevices
@ FindExSearchLimitToDirectories
@ FindExSearchMaxSearchOp
static string GetAndTrimString(Span< char > buffer)
static unsafe bool EnumTimeFormatsEx(delegate *unmanaged< char *, void *, BOOL > lpTimeFmtEnumProcEx, string lpLocaleName, uint dwFlags, void *lParam)
static unsafe int NormalizeString(NormalizationForm normForm, char *source, int sourceLength, char *destination, int destinationLength)
static unsafe int IdnToAscii(uint dwFlags, char *lpUnicodeCharStr, int cchUnicodeChar, char *lpASCIICharStr, int cchASCIIChar)
static unsafe BOOL IsNormalizedString(NormalizationForm normForm, char *source, int length)
static unsafe int IdnToUnicode(uint dwFlags, char *lpASCIICharStr, int cchASCIIChar, char *lpUnicodeCharStr, int cchUnicodeChar)
static IntPtr CreateDisposition createDisposition
static IntPtr CreateDisposition DesiredAccess FileShare FileAttributes CreateOptions ObjectAttributes void * eaBuffer
static unsafe(uint status, IntPtr handle) CreateFile(ReadOnlySpan< char > path
static IntPtr CreateDisposition DesiredAccess FileShare FileAttributes CreateOptions ObjectAttributes void uint long * preallocationSize
static IntPtr CreateDisposition DesiredAccess FileShare shareAccess
static unsafe int RtlGetVersionEx(out RTL_OSVERSIONINFOEX osvi)
static IntPtr CreateDisposition DesiredAccess desiredAccess
static IntPtr CreateDisposition DesiredAccess FileShare FileAttributes CreateOptions ObjectAttributes void uint eaLength
@ FileRenameInformationExBypassAccessCheck
@ FileNumaNodeInformation
@ FileRenameInformationEx
@ FileValidDataLengthInformation
@ FileFullDirectoryInformation
@ FilePipeRemoteInformation
@ FileHardLinkFullIdInformation
@ FileCompletionInformation
@ FileDirectoryInformation
@ FileStandardLinkInformation
@ FileSfioVolumeInformation
@ FileNetworkPhysicalNameInformation
@ FilePositionInformation
@ FileAllocationInformation
@ FileIoPriorityHintInformation
@ FileRenameInformationBypassAccessCheck
@ FileBothDirectoryInformation
@ FileDesiredStorageClassInformation
@ FileMoveClusterInformation
@ FileIsRemoteDeviceInformation
@ FileObjectIdInformation
@ FileMailslotQueryInformation
@ FileProcessIdsUsingFileInformation
@ FileReplaceCompletionInformation
@ FileCompressionInformation
@ FileTrackingInformation
@ FileLinkInformationBypassAccessCheck
@ FileEndOfFileInformation
@ FileAlternateNameInformation
@ FileInternalInformation
@ FilePipeLocalInformation
@ FileAlignmentInformation
@ FileIdGlobalTxDirectoryInformation
@ FileShortNameInformation
@ FileIoCompletionNotificationInformation
@ FileNormalizedNameInformation
@ FileHardLinkInformation
@ FileNetworkOpenInformation
@ FileAttributeTagInformation
@ FileIdFullDirectoryInformation
@ FileMailslotSetInformation
@ FileReparsePointInformation
@ FileVolumeNameInformation
@ FileSfioReserveInformation
@ FileIdBothDirectoryInformation
@ FileRemoteProtocolInformation
@ FileIdExtdBothDirectoryInformation
@ FileIdExtdDirectoryInformation
@ FileDispositionInformation
@ FileStandardInformation
@ FileDispositionInformationEx
@ FileIoStatusBlockRangeInformation
static IntPtr CreateDisposition DesiredAccess FileShare FileAttributes CreateOptions ObjectAttributes void uint long SECURITY_QUALITY_OF_SERVICE * securityQualityOfService
@ FILE_DISALLOW_EXCLUSIVE
@ FILE_COMPLETE_IF_OPLOCKED
@ FILE_CREATE_TREE_CONNECTION
@ FILE_OPEN_REPARSE_POINT
@ FILE_NON_DIRECTORY_FILE
@ FILE_SYNCHRONOUS_IO_ALERT
@ FILE_OPEN_FOR_BACKUP_INTENT
@ FILE_SYNCHRONOUS_IO_NONALERT
@ FILE_NO_INTERMEDIATE_BUFFERING
@ FILE_OPEN_REQUIRING_OPLOCK
@ STANDARD_RIGHTS_EXECUTE
@ FILE_CREATE_PIPE_INSTANCE
static IntPtr rootDirectory
static unsafe int NtQueryDirectoryFile(IntPtr FileHandle, IntPtr Event, IntPtr ApcRoutine, IntPtr ApcContext, IO_STATUS_BLOCK *IoStatusBlock, IntPtr FileInformation, uint Length, FILE_INFORMATION_CLASS FileInformationClass, BOOLEAN ReturnSingleEntry, UNICODE_STRING *FileName, BOOLEAN RestartScan)
static IntPtr CreateDisposition DesiredAccess FileShare FileAttributes fileAttributes
static IntPtr CreateDisposition DesiredAccess FileShare FileAttributes CreateOptions ObjectAttributes objectAttributes
static unsafe uint NtQuerySystemInformation(int SystemInformationClass, void *SystemInformation, uint SystemInformationLength, uint *ReturnLength)
static unsafe int NtQueryInformationFile(SafeFileHandle FileHandle, out IO_STATUS_BLOCK IoStatusBlock, void *FileInformation, uint Length, uint FileInformationClass)
static int RtlGetVersion(ref RTL_OSVERSIONINFOEX lpVersionInformation)
static IntPtr CreateDisposition DesiredAccess FileShare FileAttributes CreateOptions createOptions
static unsafe uint NtCreateFile(IntPtr *FileHandle, DesiredAccess DesiredAccess, OBJECT_ATTRIBUTES *ObjectAttributes, IO_STATUS_BLOCK *IoStatusBlock, long *AllocationSize, FileAttributes FileAttributes, FileShare ShareAccess, CreateDisposition CreateDisposition, CreateOptions CreateOptions, void *EaBuffer, uint EaLength)
static int CoGetStandardMarshal(ref Guid riid, IntPtr pv, int dwDestContext, IntPtr pvDestContext, int mshlflags, out IntPtr ppMarshal)
static IntPtr CoTaskMemRealloc(IntPtr pv, nuint cb)
static void CoTaskMemFree(IntPtr ptr)
static IntPtr CoTaskMemAlloc(nuint cb)
static int CoCreateGuid(out Guid guid)
static int CLSIDFromProgID(string lpszProgID, out Guid lpclsid)
static IntPtr SysAllocStringLen(IntPtr src, uint len)
static void SysFreeString(IntPtr bstr)
static IntPtr SysAllocStringByteLen(byte[] str, uint len)
static void VariantClear(IntPtr variant)
static BOOLEAN GetUserNameExW(int NameFormat, ref char lpNameBuffer, ref uint lpnSize)
static int SHGetKnownFolderPath([MarshalAs(UnmanagedType.LPStruct)] Guid rfid, uint dwFlags, IntPtr hToken, out string ppszPath)
static unsafe void * _aligned_malloc(nuint size, nuint alignment)
static unsafe void * realloc(void *ptr, nuint new_size)
static unsafe void _aligned_free(void *ptr)
static unsafe void free(void *ptr)
static unsafe void * _aligned_realloc(void *ptr, nuint size, nuint alignment)
static unsafe void * malloc(nuint size)
static unsafe void * calloc(nuint num, nuint size)
static IntPtr SendMessageTimeout(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam, int flags, int timeout, out IntPtr pdwResult)
static IntPtr GetProcessWindowStation()
static unsafe bool GetUserObjectInformationW(IntPtr hObj, int nIndex, void *pvBuffer, uint nLength, ref uint lpnLengthNeeded)
static unsafe int LoadString(IntPtr hInstance, uint uID, char *lpBuffer, int cchBufferMax)
static unsafe void GetRandomBytes(byte *buffer, int length)
static bool CallStringMethod< TArg1, TArg2, TArg3 >(SpanFunc< char, TArg1, TArg2, TArg3, Globalization.ResultCode > interopCall, TArg1 arg1, TArg2 arg2, TArg3 arg3, out string result)
static OperatingSystem OSVersion
static string EnsureExtendedPrefix(string path)
static string EnsureExtendedPrefixIfNeeded(string path)
static Exception GetExceptionForLastWin32Error(string path="")
static Exception GetExceptionForWin32Error(int errorCode, string path="")
static void FreeHGlobal(IntPtr hglobal)
static int GetLastWin32Error()
unsafe fixed byte LeadByte[12]
unsafe fixed byte DefaultChar[2]
DateTimeOffset ToDateTimeOffset()
ulong ullAvailExtendedVirtual
ushort SubstituteNameLength
ushort SubstituteNameOffset
unsafe fixed char szCSDVersion[128]
UIntPtr PeakWorkingSetSize
UIntPtr PeakPagefileUsage
UIntPtr QuotaNonPagedPoolUsage
UIntPtr QuotaPagedPoolUsage
UIntPtr QuotaPeakPagedPoolUsage
UIntPtr QuotaPeakNonPagedPoolUsage
IntPtr lpSecurityDescriptor
bool Equals(in SYSTEMTIME other)
IntPtr lpMinimumApplicationAddress
IntPtr dwActiveProcessorMask
int dwAllocationGranularity
ushort wProcessorArchitecture
IntPtr lpMaximumApplicationAddress
ushort SubstituteNameOffset
ushort SubstituteNameLength
FILE_TIME ftLastAccessTime
void PopulateFrom(ref WIN32_FIND_DATA findData)
FILE_TIME ftLastWriteTime
unsafe fixed char _cAlternateFileName[14]
unsafe ReadOnlySpan< char > cFileName
FILE_TIME ftLastWriteTime
FILE_TIME ftLastAccessTime
unsafe fixed char _cFileName[260]
DateTimeOffset ToDateTimeOffset()
unsafe fixed char szCSDVersion[128]
unsafe void * SecurityDescriptor
unsafe SECURITY_QUALITY_OF_SERVICE * SecurityQualityOfService
unsafe OBJECT_ATTRIBUTES(UNICODE_STRING *objectName, ObjectAttributes attributes, IntPtr rootDirectory, SECURITY_QUALITY_OF_SERVICE *securityQualityOfService=null)
unsafe UNICODE_STRING * ObjectName
ObjectAttributes Attributes
ImpersonationLevel ImpersonationLevel
ContextTrackingMode ContextTrackingMode
static DateTimeOffset FromFileTime(long fileTime)
static DateTime FromFileTimeUtc(long fileTime)
static readonly Guid Empty
static readonly IntPtr Zero
override string ToString()
Span< T > Slice(int start)