* Update conversion code fix to offer multiple fixes for appending each previously probed entry-point suffix when ExactSpelling is false.
* Remove ExactSpelling property and move properties that were relying on ExactSpelling = false to use explicit entrypoint names.
* Emit ExactSpelling = true for all of our emitted target DllImports.
* Fix a few entry points
* Add a comment around CharSet.Auto
* Update compatibility doc.
* Update docs/design/libraries/DllImportGenerator/Compatibility.md
Co-authored-by: Elinor Fung <elfung@microsoft.com>
Co-authored-by: Elinor Fung <elfung@microsoft.com>
[`CallingConvention`](https://docs.microsoft.com/dotnet/api/system.runtime.interopservices.dllimportattribute.callingconvention) will not be supported for `GeneratedDllImportAttribute`. Users will be required to use the new `UnmanagedCallConvAttribute` attribute instead. This attribute provides support for extensible calling conventions and provides parity with the `UnmanagedCallersOnlyAttribute` attribute and C# function pointer syntax. We will enable our conversion code-fix to automatically convert explicit and known calling convention usage to use the `UnmanagedCallConvAttribute`.
+[`ExactSpelling`](https://docs.microsoft.com/dotnet/api/system.runtime.interopservices.dllimportattribute.exactspelling) will not be supported for `GeneratedDllImportAttribute`. If `ExactSpelling` is used on an existing `DllImport`, the offered code-fix will provide users with additional options for using `A` or `W` suffixed variants depending on the provided `CharSet` so they can explicitly choose which spelling is correct for their scenario.
+
### Required references
The following framework references are required:
{
private const string RuntimeLibrary = "*";
- [GeneratedDllImport(RuntimeLibrary, ExactSpelling = true)]
+ [GeneratedDllImport(RuntimeLibrary)]
[SuppressGCTransition]
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
internal static partial ulong RhpGetTickCount64();
- [GeneratedDllImport(RuntimeLibrary, ExactSpelling = true)]
+ [GeneratedDllImport(RuntimeLibrary)]
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
internal static partial IntPtr RhpGetCurrentThread();
private static extern bool _RhReRegisterForFinalize(object obj);
// Wait for all pending finalizers. This must be a p/invoke to avoid starving the GC.
- [GeneratedDllImport(RuntimeLibrary, ExactSpelling = true)]
+ [GeneratedDllImport(RuntimeLibrary)]
private static partial void RhWaitForPendingFinalizers(int allowReentrantWait);
// Temporary workaround to unblock shareable assembly bring-up - without shared interop,
RhWaitForPendingFinalizers(allowReentrantWait ? 1 : 0);
}
- [GeneratedDllImport(RuntimeLibrary, ExactSpelling = true)]
+ [GeneratedDllImport(RuntimeLibrary)]
internal static partial void RhInitializeFinalizerThread();
// Get maximum GC generation number.
[RuntimeImport(RuntimeLibrary, "RhGetTotalAllocatedBytes")]
internal static extern long RhGetTotalAllocatedBytes();
- [GeneratedDllImport(RuntimeLibrary, ExactSpelling = true)]
+ [GeneratedDllImport(RuntimeLibrary)]
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
internal static partial long RhGetTotalAllocatedBytesPrecise();
[RuntimeImport(RuntimeLibrary, "RhGetMemoryInfo")]
internal static extern void RhGetMemoryInfo(ref byte info, GCKind kind);
- [GeneratedDllImport(RuntimeLibrary, ExactSpelling = true)]
+ [GeneratedDllImport(RuntimeLibrary)]
internal static unsafe partial void RhAllocateNewArray(IntPtr pArrayEEType, uint numElements, uint flags, void* pResult);
- [GeneratedDllImport(RuntimeLibrary, ExactSpelling = true)]
+ [GeneratedDllImport(RuntimeLibrary)]
internal static unsafe partial void RhAllocateNewObject(IntPtr pEEType, uint flags, void* pResult);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern object RhMemberwiseClone(object obj);
// Busy spin for the given number of iterations.
- [GeneratedDllImport(RuntimeLibrary, EntryPoint = "RhSpinWait", ExactSpelling = true)]
+ [GeneratedDllImport(RuntimeLibrary, EntryPoint = "RhSpinWait")]
[SuppressGCTransition]
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
internal static partial void RhSpinWait(int iterations);
// Yield the cpu to another thread ready to process, if one is available.
- [GeneratedDllImport(RuntimeLibrary, EntryPoint = "RhYield", ExactSpelling = true)]
+ [GeneratedDllImport(RuntimeLibrary, EntryPoint = "RhYield")]
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
private static partial int _RhYield();
internal static bool RhYield() { return (_RhYield() != 0); }
- [GeneratedDllImport(RuntimeLibrary, EntryPoint = "RhFlushProcessWriteBuffers", ExactSpelling = true)]
+ [GeneratedDllImport(RuntimeLibrary, EntryPoint = "RhFlushProcessWriteBuffers")]
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
internal static partial void RhFlushProcessWriteBuffers();
#if !TARGET_UNIX
// Wait for any object to be signalled, in a way that's compatible with the CLR's behavior in an STA.
// ExactSpelling = 'true' to force MCG to resolve it to default
- [GeneratedDllImport(RuntimeLibrary, ExactSpelling = true)]
+ [GeneratedDllImport(RuntimeLibrary)]
private static unsafe partial int RhCompatibleReentrantWaitAny(int alertable, int timeout, int count, IntPtr* handles);
// Temporary workaround to unblock shareable assembly bring-up - without shared interop,
internal static extern void RhCallDescrWorker(IntPtr callDescr);
// For Managed to Native calls
- [GeneratedDllImport(RuntimeLibrary, EntryPoint = "RhCallDescrWorker", ExactSpelling = true)]
+ [GeneratedDllImport(RuntimeLibrary, EntryPoint = "RhCallDescrWorker")]
internal static partial void RhCallDescrWorkerNative(IntPtr callDescr);
// Moves memory from smem to dmem. Size must be a positive value.
[RuntimeImport(RuntimeLibrary, "modff")]
internal static extern unsafe float modff(float x, float* intptr);
- [GeneratedDllImport(RuntimeImports.RuntimeLibrary, ExactSpelling = true)]
+ [GeneratedDllImport(RuntimeImports.RuntimeLibrary)]
internal static unsafe partial void* memmove(byte* dmem, byte* smem, nuint size);
- [GeneratedDllImport(RuntimeImports.RuntimeLibrary, ExactSpelling = true)]
+ [GeneratedDllImport(RuntimeImports.RuntimeLibrary)]
internal static unsafe partial void* memset(byte* mem, int value, nuint size);
#if TARGET_X86 || TARGET_AMD64
- [GeneratedDllImport(RuntimeLibrary, ExactSpelling = true)]
+ [GeneratedDllImport(RuntimeLibrary)]
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
internal static unsafe partial void RhCpuIdEx(int* cpuInfo, int functionId, int subFunctionId);
#endif
internal static unsafe Array RhNewArray(EETypePtr pEEType, int length)
=> RhNewArray(pEEType.ToPointer(), length);
- [GeneratedDllImport(RuntimeLibrary, ExactSpelling = true)]
+ [GeneratedDllImport(RuntimeLibrary)]
internal static unsafe partial void RhAllocateNewObject(IntPtr pEEType, uint flags, void* pResult);
[MethodImpl(MethodImplOptions.InternalCall)]
{
internal static partial class Sys
{
- [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetTimestamp", ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetTimestamp")]
[SuppressGCTransition]
internal static partial ulong GetTimestamp();
}
{
internal static partial class Activeds
{
- [GeneratedDllImport(Interop.Libraries.Activeds, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Interop.Libraries.Activeds, CharSet = CharSet.Unicode)]
internal static partial int ADsOpenObject(string path, string? userName, string? password, int flags, ref Guid iid, out IntPtr ppObject);
}
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "ChangeServiceConfig2W", ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "ChangeServiceConfig2W", SetLastError = true)]
public static partial bool ChangeServiceConfig2(SafeServiceHandle serviceHandle, uint infoLevel, ref SERVICE_DESCRIPTION serviceDesc);
#pragma warning disable DLLIMPORTGENANALYZER015 // Use 'GeneratedDllImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "ClearEventLogW", CharSet = CharSet.Unicode, SetLastError = true)]
public static partial bool ClearEventLog(SafeEventLogReadHandle hEventLog, string lpBackupFileName);
}
}
internal static partial class Advapi32
{
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "ConvertSecurityDescriptorToStringSecurityDescriptorW",
- CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool ConvertSdToStringSd(
byte[] securityDescriptor,
/* DWORD */ uint requestedRevision,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "ConvertSidToStringSidW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "ConvertSidToStringSidW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial BOOL ConvertSidToStringSid(IntPtr sid, out string stringSid);
}
}
internal static partial class Advapi32
{
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "ConvertStringSecurityDescriptorToSecurityDescriptorW",
- CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool ConvertStringSdToSd(
string stringSd,
/* DWORD */ uint stringSdRevision,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Interop.Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "ConvertStringSecurityDescriptorToSecurityDescriptorW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool ConvertStringSecurityDescriptorToSecurityDescriptor(
string StringSecurityDescriptor,
int StringSDRevision,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "ConvertStringSidToSidW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "ConvertStringSidToSidW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial BOOL ConvertStringSidToSid(
string stringSid,
out IntPtr ByteArray);
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "CreateProcessWithLogonW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "CreateProcessWithLogonW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial bool CreateProcessWithLogonW(
string userName,
string domain,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "CreateServiceW", CharSet = CharSet.Unicode, SetLastError = true)]
public static partial IntPtr CreateService(SafeServiceHandle databaseHandle, string serviceName, string displayName, int access, int serviceType,
int startType, int errorControl, string binaryPath, string loadOrderGroup, IntPtr pTagId, string dependencies,
string servicesStartName, string password);
None = 0,
}
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
internal static partial bool CryptCreateHash(
SafeProvHandle hProv,
int Algid,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
internal static partial bool CryptDeriveKey(
SafeProvHandle hProv,
int Algid,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
public static partial bool CryptDestroyHash(IntPtr hHash);
}
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
public static partial bool CryptDestroyKey(IntPtr hKey);
}
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
public static partial bool CryptEncrypt(
SafeCapiKeyHandle hKey,
SafeHashHandle hHash,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
public static partial bool CryptExportKey(
SafeCapiKeyHandle hKey,
SafeCapiKeyHandle hExpKey,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
internal static partial bool CryptGenKey(SafeProvHandle hProv, int Algid, int dwFlags, out SafeCapiKeyHandle phKey);
}
}
HP_TLS1PRF_SEED = 0x0007, // seed for TLS1 PRF
}
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
public static partial bool CryptGetHashParam(
SafeHashHandle hHash,
CryptHashProperty dwParam,
ref int pdwDataLen,
int dwFlags);
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
public static partial bool CryptSetHashParam(SafeHashHandle hHash, CryptHashProperty dwParam, byte[] buffer, int dwFlags);
}
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
public static partial bool CryptHashData(SafeHashHandle hHash, byte[] pbData, int dwDataLen, int dwFlags);
}
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
internal static unsafe partial bool CryptImportKey(
SafeProvHandle hProv,
byte* pbData,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "EnumDependentServicesW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "EnumDependentServicesW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool EnumDependentServices(
SafeServiceHandle serviceHandle,
int serviceState,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "EnumServicesStatusExW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "EnumServicesStatusExW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool EnumServicesStatusEx(
SafeServiceHandle databaseHandle,
int infolevel,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32)]
internal static partial int EventActivityIdControl(ActivityControl ControlCode, ref Guid ActivityId);
}
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32)]
internal static unsafe partial uint EventRegister(
in Guid providerId,
EtwEnableCallback enableCallback,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32)]
internal static unsafe partial int EventSetInformation(
long registrationHandle,
EVENT_INFO_CLASS informationClass,
public long MatchAllKeyword;
}
- [GeneratedDllImport(Interop.Libraries.Advapi32, ExactSpelling = true)]
+ [GeneratedDllImport(Interop.Libraries.Advapi32)]
internal static unsafe partial int EnumerateTraceGuidsEx(
TRACE_QUERY_INFO_CLASS TraceQueryInfoClass,
void* InBuffer,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32)]
internal static partial uint EventUnregister(long registrationHandle);
}
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Ansi, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Ansi)]
internal static partial int EventWriteString(
long registrationHandle,
byte level,
return HResult;
}
- [GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "EventWriteTransfer", ExactSpelling = true)]
+ [GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "EventWriteTransfer")]
private static unsafe partial int EventWriteTransfer_PInvoke(
long registrationHandle,
in EventDescriptor eventDescriptor,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
public static partial bool GetNumberOfEventLogRecords(SafeEventLogReadHandle hEventLog, out int NumberOfRecords);
}
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool GetOldestEventLogRecord(SafeEventLogReadHandle hEventLog, out int OldestRecord);
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "GetSecurityDescriptorLength", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "GetSecurityDescriptorLength", CharSet = CharSet.Unicode)]
internal static partial uint GetSecurityDescriptorLength(IntPtr byteArray);
}
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "GetSecurityInfo", ExactSpelling = true)]
+ [GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "GetSecurityInfo")]
internal static unsafe partial uint GetSecurityInfoByHandle(
SafeHandle handle,
/*DWORD*/ uint objectType,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "GetNamedSecurityInfoW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "GetNamedSecurityInfoW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial uint GetSecurityInfoByName(
string name,
/*DWORD*/ uint objectType,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "GetServiceDisplayNameW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "GetServiceDisplayNameW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial bool GetServiceDisplayName(SafeServiceHandle? SCMHandle, string serviceName, char* displayName, ref int displayNameLength);
}
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "GetServiceKeyNameW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "GetServiceKeyNameW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial bool GetServiceKeyName(SafeServiceHandle? SCMHandle, string displayName, char* KeyName, ref int KeyNameLength);
}
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "LogonUserW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "LogonUserW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial int LogonUser(
string username,
string? domain,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool LookupAccountNameW(
string? lpSystemName,
ref char lpAccountName,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool NotifyChangeEventLog(SafeEventLogReadHandle hEventLog, SafeWaitHandle hEvent);
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "OpenEventLogW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial SafeEventLogReadHandle OpenEventLog(string lpUNCServerName, string lpSourceName);
}
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "OpenSCManagerW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "OpenSCManagerW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial IntPtr OpenSCManager(string? machineName, string? databaseName, int access);
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "OpenServiceW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "OpenServiceW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial IntPtr OpenService(SafeServiceHandle? databaseHandle, string serviceName, int access);
}
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "QueryServiceConfigW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "QueryServiceConfigW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool QueryServiceConfig(SafeServiceHandle serviceHandle, IntPtr queryServiceConfigPtr, int bufferSize, out int bytesNeeded);
}
internal const int FORWARDS_READ = 0x4;
internal const int BACKWARDS_READ = 0x8;
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "ReadEventLogW", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool ReadEventLog(
SafeEventLogReadHandle hEventLog,
{
// Note: RegCreateKeyEx won't set the last error on failure - it returns
// an error code if it fails.
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegCreateKeyExW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegCreateKeyExW", CharSet = CharSet.Unicode)]
internal static partial int RegCreateKeyEx(
SafeRegistryHandle hKey,
string lpSubKey,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegDeleteKeyExW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegDeleteKeyExW", CharSet = CharSet.Unicode)]
internal static partial int RegDeleteKeyEx(
SafeRegistryHandle hKey,
string lpSubKey,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegDeleteValueW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegDeleteValueW", CharSet = CharSet.Unicode)]
internal static partial int RegDeleteValue(
SafeRegistryHandle hKey,
string? lpValueName);
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegEnumKeyExW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegEnumKeyExW", CharSet = CharSet.Unicode)]
internal static partial int RegEnumKeyEx(
SafeRegistryHandle hKey,
int dwIndex,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegEnumValueW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegEnumValueW", CharSet = CharSet.Unicode)]
internal static partial int RegEnumValue(
SafeRegistryHandle hKey,
int dwIndex,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegOpenKeyExW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegOpenKeyExW", CharSet = CharSet.Unicode)]
internal static partial int RegOpenKeyEx(
SafeRegistryHandle hKey,
string? lpSubKey,
int samDesired,
out SafeRegistryHandle hkResult);
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegOpenKeyExW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegOpenKeyExW", CharSet = CharSet.Unicode)]
internal static partial int RegOpenKeyEx(
IntPtr hKey,
string? lpSubKey,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegQueryInfoKeyW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegQueryInfoKeyW", CharSet = CharSet.Unicode)]
internal static partial int RegQueryInfoKey(
SafeRegistryHandle hKey,
[Out] char[]? lpClass,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegQueryValueExW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegQueryValueExW", CharSet = CharSet.Unicode)]
internal static partial int RegQueryValueEx(
SafeRegistryHandle hKey,
string? lpValueName,
byte[]? lpData,
ref int lpcbData);
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegQueryValueExW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegQueryValueExW", CharSet = CharSet.Unicode)]
internal static partial int RegQueryValueEx(
SafeRegistryHandle hKey,
string? lpValueName,
ref int lpData,
ref int lpcbData);
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegQueryValueExW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegQueryValueExW", CharSet = CharSet.Unicode)]
internal static partial int RegQueryValueEx(
SafeRegistryHandle hKey,
string? lpValueName,
ref long lpData,
ref int lpcbData);
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegQueryValueExW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegQueryValueExW", CharSet = CharSet.Unicode)]
internal static partial int RegQueryValueEx(
SafeRegistryHandle hKey,
string? lpValueName,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegSetValueExW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegSetValueExW", CharSet = CharSet.Unicode)]
internal static partial int RegSetValueEx(
SafeRegistryHandle hKey,
string? lpValueName,
byte[]? lpData,
int cbData);
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegSetValueExW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegSetValueExW", CharSet = CharSet.Unicode)]
internal static partial int RegSetValueEx(
SafeRegistryHandle hKey,
string? lpValueName,
char[]? lpData,
int cbData);
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegSetValueExW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegSetValueExW", CharSet = CharSet.Unicode)]
internal static partial int RegSetValueEx(
SafeRegistryHandle hKey,
string? lpValueName,
ref int lpData,
int cbData);
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegSetValueExW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegSetValueExW", CharSet = CharSet.Unicode)]
internal static partial int RegSetValueEx(
SafeRegistryHandle hKey,
string? lpValueName,
ref long lpData,
int cbData);
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegSetValueExW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegSetValueExW", CharSet = CharSet.Unicode)]
internal static partial int RegSetValueEx(
SafeRegistryHandle hKey,
string? lpValueName,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegisterEventSourceW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial SafeEventLogWriteHandle RegisterEventSource(string lpUNCServerName, string lpSourceName);
}
}
{
public delegate int ServiceControlCallbackEx(int control, int eventType, IntPtr eventData, IntPtr eventContext);
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegisterServiceCtrlHandlerExW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegisterServiceCtrlHandlerExW", CharSet = CharSet.Unicode, SetLastError = true)]
public static partial IntPtr RegisterServiceCtrlHandlerEx(string? serviceName, ServiceControlCallbackEx? callback, IntPtr userData);
}
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "ReportEventW", SetLastError = true)]
public static partial bool ReportEvent(
SafeEventLogWriteHandle hEventLog,
short wType,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Interop.Libraries.Advapi32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Advapi32, SetLastError = true)]
internal static partial bool RevertToSelf();
}
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "SetSecurityInfo", ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "SetSecurityInfo", SetLastError = true)]
internal static partial uint SetSecurityInfoByHandle(
SafeHandle handle,
/*DWORD*/ uint objectType,
internal static partial class Advapi32
{
[GeneratedDllImport(Interop.Libraries.Advapi32, EntryPoint = "SetNamedSecurityInfoW",
- CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial uint SetSecurityInfoByName(
string name,
/*DWORD*/ uint objectType,
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "StartServiceW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "StartServiceW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool StartService(SafeServiceHandle serviceHandle, int argNum, IntPtr argPtrs);
}
}
{
internal static partial class Advapi32
{
- [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "StartServiceCtrlDispatcherW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Advapi32, EntryPoint = "StartServiceCtrlDispatcherW", CharSet = CharSet.Unicode, SetLastError = true)]
public static partial bool StartServiceCtrlDispatcher(IntPtr entry);
}
}
{
internal static partial class Authz
{
- [GeneratedDllImport(Libraries.Authz, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Authz, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool AuthzInitializeResourceManager(
int flags,
IntPtr pfnAccessCheck,
{
internal static partial class BCrypt
{
- [GeneratedDllImport(Libraries.BCrypt, CharSet = CharSet.Unicode)]
+ [GeneratedDllImport(Libraries.BCrypt)]
internal static partial NTSTATUS BCryptDestroyKey(IntPtr hKey);
}
}
return newHash;
}
- [GeneratedDllImport(Libraries.BCrypt, CharSet = CharSet.Unicode)]
+ [GeneratedDllImport(Libraries.BCrypt)]
private static partial NTSTATUS BCryptDuplicateHash(
SafeBCryptHashHandle hHash,
out SafeBCryptHashHandle phNewHash,
}
}
- [GeneratedDllImport(Libraries.BCrypt, CharSet = CharSet.Unicode)]
+ [GeneratedDllImport(Libraries.BCrypt)]
public static unsafe partial NTSTATUS BCryptEncrypt(SafeKeyHandle hKey, byte* pbInput, int cbInput, IntPtr paddingInfo, byte[]? pbIV, int cbIV, byte* pbOutput, int cbOutput, out int cbResult, int dwFlags);
- [GeneratedDllImport(Libraries.BCrypt, CharSet = CharSet.Unicode)]
+ [GeneratedDllImport(Libraries.BCrypt)]
public static unsafe partial NTSTATUS BCryptDecrypt(SafeKeyHandle hKey, byte* pbInput, int cbInput, IntPtr paddingInfo, byte[]? pbIV, int cbIV, byte* pbOutput, int cbOutput, out int cbResult, int dwFlags);
}
}
internal static NTSTATUS BCryptFinishHash(SafeBCryptHashHandle hHash, Span<byte> pbOutput, int cbOutput, int dwFlags) =>
BCryptFinishHash(hHash, ref MemoryMarshal.GetReference(pbOutput), cbOutput, dwFlags);
- [GeneratedDllImport(Libraries.BCrypt, CharSet = CharSet.Unicode)]
+ [GeneratedDllImport(Libraries.BCrypt)]
private static partial NTSTATUS BCryptFinishHash(SafeBCryptHashHandle hHash, ref byte pbOutput, int cbOutput, int dwFlags);
}
}
{
internal static partial class BCrypt
{
- [GeneratedDllImport(Libraries.BCrypt, CharSet = CharSet.Unicode)]
+ [GeneratedDllImport(Libraries.BCrypt)]
internal static unsafe partial NTSTATUS BCryptGenerateSymmetricKey(
SafeBCryptAlgorithmHandle hAlgorithm,
out SafeBCryptKeyHandle phKey,
int cbSecret,
uint dwFlags);
- [GeneratedDllImport(Libraries.BCrypt, CharSet = CharSet.Unicode)]
+ [GeneratedDllImport(Libraries.BCrypt)]
internal static unsafe partial NTSTATUS BCryptGenerateSymmetricKey(
nuint hAlgorithm,
out SafeBCryptKeyHandle phKey,
{
internal static partial class BCrypt
{
- [GeneratedDllImport(Libraries.BCrypt, CharSet = CharSet.Unicode)]
+ [GeneratedDllImport(Libraries.BCrypt)]
internal static unsafe partial NTSTATUS BCryptKeyDerivation(
SafeBCryptKeyHandle hKey,
BCryptBufferDesc* pParameterList,
internal const int CRED_MAX_USERNAME_LENGTH = 514;
internal const int CRED_MAX_DOMAIN_TARGET_LENGTH = 338;
- [GeneratedDllImport(Libraries.Credui, EntryPoint = "CredUIParseUserNameW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Credui, EntryPoint = "CredUIParseUserNameW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial int CredUIParseUserName(
string pszUserName,
char* pszUser,
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CertAddCertificateContextToStore(SafeCertStoreHandle hCertStore, SafeCertContextHandle pCertContext, CertStoreAddDisposition dwAddDisposition, IntPtr ppStoreContext);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CertAddCertificateLinkToStore(SafeCertStoreHandle hCertStore, SafeCertContextHandle pCertContext, CertStoreAddDisposition dwAddDisposition, IntPtr ppStoreContext);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Interop.Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Crypt32, SetLastError = true)]
internal static partial bool CertCloseStore(IntPtr hCertStore, uint dwFlags);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CertControlStore(SafeCertStoreHandle hCertStore, CertControlStoreFlags dwFlags, CertControlStoreType dwControlType, IntPtr pvCtrlPara);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CertCreateCertificateChainEngine(ref CERT_CHAIN_ENGINE_CONFIG pConfig, out SafeChainEngineHandle hChainEngineHandle);
}
}
internal static partial class Crypt32
{
// Note: CertDeleteCertificateFromStore always calls CertFreeCertificateContext on pCertContext, even if an error is encountered.
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial bool CertDeleteCertificateFromStore(CERT_CONTEXT* pCertContext);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial SafeCertContextHandle CertDuplicateCertificateContext(IntPtr pCertContext);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
public static unsafe partial CERT_CONTEXT* CertEnumCertificatesInStore(
IntPtr hCertStore,
CERT_CONTEXT* pPrevCertContext);
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial CERT_CONTEXT* CertEnumCertificatesInStore(SafeCertStoreHandle hCertStore, CERT_CONTEXT* pPrevCertContext);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial SafeCertContextHandle CertFindCertificateInStore(
SafeCertStoreHandle hCertStore,
CertEncodingType dwCertEncodingType,
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial CERT_EXTENSION* CertFindExtension([MarshalAs(UnmanagedType.LPStr)] string pszObjId, int cExtensions, IntPtr rgExtensions);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial void CertFreeCertificateChain(IntPtr pChainContext);
}
}
internal static partial class Crypt32
{
// Note: This api always return TRUE, regardless of success.
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CertFreeCertificateContext(IntPtr pCertContext);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CertGetCertificateContextProperty(
SafeCertContextHandle pCertContext,
CertContextPropId dwPropId,
byte[]? pvData,
ref int pcbData);
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CertGetCertificateContextProperty(
SafeCertContextHandle pCertContext,
CertContextPropId dwPropId,
out IntPtr pvData,
ref int pcbData);
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CertGetCertificateContextProperty(
SafeCertContextHandle pCertContext,
CertContextPropId dwPropId,
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CertGetCertificateContextProperty(
SafeCertContextHandle pCertContext,
CertContextPropId dwPropId,
{
// Note: It's somewhat unusual to use an API enum as a parameter type to a P/Invoke but in this case, X509KeyUsageFlags was intentionally designed as bit-wise
// identical to the wincrypt CERT_*_USAGE values.
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial bool CertGetIntendedKeyUsage(
CertEncodingType dwCertEncodingType,
CERT_INFO* pCertInfo,
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial int CertGetPublicKeyLength(MsgEncodingType dwCertEncodingType, ref CERT_PUBLIC_KEY_INFO pPublicKey);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial bool CertGetValidUsages(int cCerts, ref SafeCertContextHandle rghCerts, out int cNumOIDs, void* rghOIDs, ref int pcbOIDs);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial SafeCertStoreHandle CertOpenStore(IntPtr lpszStoreProvider, CertEncodingType dwMsgAndCertEncodingType, IntPtr hCryptProv, CertStoreFlags dwFlags, [MarshalAs(UnmanagedType.LPWStr)] string? pvPara);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
public static partial bool CertSaveStore(
SafeCertStoreHandle hCertStore,
CertEncodingType dwMsgAndCertEncodingType,
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CertSerializeCertificateStoreElement(SafeCertContextHandle pCertContext, int dwFlags, byte[]? pbElement, ref int pcbElement);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial bool CertSetCertificateContextProperty(SafeCertContextHandle pCertContext, CertContextPropId dwPropId, CertSetPropertyFlags dwFlags, CRYPT_KEY_PROV_INFO* pvData);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial bool CertSetCertificateContextProperty(SafeCertContextHandle pCertContext, CertContextPropId dwPropId, CertSetPropertyFlags dwFlags, DATA_BLOB* pvData);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial bool CertSetCertificateContextProperty(SafeCertContextHandle pCertContext, CertContextPropId dwPropId, CertSetPropertyFlags dwFlags, SafeNCryptKeyHandle keyHandle);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial int CertVerifyTimeValidity(ref FILETIME pTimeToVerify, CERT_INFO* pCertInfo);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CryptAcquireCertificatePrivateKey(
SafeCertContextHandle pCert,
CryptAcquireCertificatePrivateKeyFlags dwFlags,
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
public static partial bool CryptAcquireCertificatePrivateKey(
SafeCertContextHandle pCert,
CryptAcquireCertificatePrivateKeyFlags dwFlags,
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CryptDecodeObject(CertEncodingType dwCertEncodingType, IntPtr lpszStructType, byte[] pbEncoded, int cbEncoded, CryptDecodeObjectFlags dwFlags, byte[]? pvStructInfo, ref int pcbStructInfo);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial bool CryptEncodeObject(CertEncodingType dwCertEncodingType, IntPtr lpszStructType, void* pvStructInfo, byte[]? pbEncoded, ref int pcbEncoded);
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial bool CryptEncodeObject(CertEncodingType dwCertEncodingType, [MarshalAs(UnmanagedType.LPStr)] string lpszStructType, void* pvStructInfo, byte[]? pbEncoded, ref int pcbEncoded);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CryptHashPublicKeyInfo(
IntPtr hCryptProv,
int algId,
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial bool CryptImportPublicKeyInfoEx2(
CertEncodingType dwCertEncodingType,
CERT_PUBLIC_KEY_INFO* pInfo,
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CryptMsgClose(IntPtr hCryptMsg);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CryptMsgControl(
SafeCryptMsgHandle hCryptMsg,
int dwFlags,
MsgControlType dwCtrlType,
ref CMSG_CTRL_DECRYPT_PARA pvCtrlPara);
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CryptMsgControl(
SafeCryptMsgHandle hCryptMsg,
int dwFlags,
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial SafeCryptMsgHandle CryptMsgOpenToEncode(
MsgEncodingType dwMsgEncodingType,
int dwFlags,
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static partial bool CryptProtectData(
in DATA_BLOB pDataIn,
internal const uint CRYPTPROTECTMEMORY_BLOCK_SIZE = 16;
internal const uint CRYPTPROTECTMEMORY_SAME_PROCESS = 0;
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CryptProtectMemory(SafeBuffer pData, uint cbData, uint dwFlags);
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CryptUnprotectMemory(SafeBuffer pData, uint cbData, uint dwFlags);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial bool CryptQueryObject(
CertQueryObjectType dwObjectType,
void* pvObject,
out SafeCertContextHandle ppvContext
);
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial bool CryptQueryObject(
CertQueryObjectType dwObjectType,
void* pvObject,
IntPtr ppvContext
);
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial bool CryptQueryObject(
CertQueryObjectType dwObjectType,
void* pvObject,
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial bool CryptQueryObject(
CertQueryObjectType dwObjectType,
void* pvObject,
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool PFXExportCertStore(SafeCertStoreHandle hStore, ref DATA_BLOB pPFX, SafePasswordHandle szPassword, PFXExportFlags dwFlags);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial SafeCertStoreHandle PFXImportCertStore(ref DATA_BLOB pPFX, SafePasswordHandle password, PfxCertStoreFlags dwFlags);
}
}
{
internal static partial class Crypt32
{
- [GeneratedDllImport(Interop.Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Crypt32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static partial bool CertFreeCertificateContext(IntPtr pCertContext);
- [GeneratedDllImport(Interop.Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Crypt32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static partial bool CertVerifyCertificateChainPolicy(
IntPtr pszPolicyOID,
#endif
}
- [GeneratedDllImport(Interop.Libraries.CryptUI, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.CryptUI, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool CryptUIDlgViewCertificateW(
in CRYPTUI_VIEWCERTIFICATE_STRUCTW ViewInfo, IntPtr pfPropertiesChanged);
- [GeneratedDllImport(Interop.Libraries.CryptUI, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.CryptUI, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial SafeCertContextHandle CryptUIDlgSelectCertificateW(ref CRYPTUI_SELECTCERTIFICATE_STRUCTW csc);
}
}
DsRolePrimaryDomainInfoBasicEx = 4
}
- [GeneratedDllImport(Libraries.Dsrole, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Dsrole, CharSet = CharSet.Unicode)]
internal static partial int DsRoleGetPrimaryDomainInformation(
[MarshalAs(UnmanagedType.LPTStr)] string lpServer,
DSROLE_PRIMARY_DOMAIN_INFO_LEVEL InfoLevel,
{
internal static partial class Gdi32
{
- [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Unicode)]
public static partial IntPtr CreateDCW(string pwszDriver, string pwszDevice, string? pszPort, IntPtr pdm);
}
}
{
internal static partial class Gdi32
{
- [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Unicode)]
public static partial IntPtr CreateFontIndirectW(ref User32.LOGFONT lplf);
}
}
{
internal static partial class Gdi32
{
- [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Unicode)]
public static partial IntPtr CreateICW(string pszDriver, string pszDevice, string? pszPort, IntPtr pdm);
}
}
{
internal static partial class IpHlpApi
{
- [GeneratedDllImport(Interop.Libraries.IpHlpApi, ExactSpelling = true)]
+ [GeneratedDllImport(Interop.Libraries.IpHlpApi)]
internal static unsafe partial uint GetNetworkParams(IntPtr pFixedInfo, uint* pOutBufLen);
}
}
private IntPtr Ptr;
}
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Kernel32)]
internal static unsafe partial void InitializeConditionVariable(CONDITION_VARIABLE* ConditionVariable);
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Kernel32)]
internal static unsafe partial void WakeConditionVariable(CONDITION_VARIABLE* ConditionVariable);
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Kernel32)]
internal static unsafe partial bool SleepConditionVariableCS(CONDITION_VARIABLE* ConditionVariable, CRITICAL_SECTION* CriticalSection, int dwMilliseconds);
}
}
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use CopyFileEx.
/// </summary>
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CopyFileExW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CopyFileExW", CharSet = CharSet.Unicode, SetLastError = true)]
private static partial bool CopyFileExPrivate(
string src,
string dst,
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use CreateDirectory.
/// </summary>
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateDirectoryW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateDirectoryW", CharSet = CharSet.Unicode, SetLastError = true)]
private static partial bool CreateDirectoryPrivate(
string path,
ref SECURITY_ATTRIBUTES lpSecurityAttributes);
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use CreateFile.
/// </summary>
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateFileW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateFileW", CharSet = CharSet.Unicode, SetLastError = true)]
private static unsafe partial SafeFileHandle CreateFilePrivate(
string lpFileName,
int dwDesiredAccess,
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateFileMappingW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateFileMappingW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial SafeMemoryMappedFileHandle CreateFileMapping(
SafeFileHandle hFile,
ref SECURITY_ATTRIBUTES lpFileMappingAttributes,
int dwMaximumSizeLow,
string? lpName);
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateFileMappingW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateFileMappingW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial SafeMemoryMappedFileHandle CreateFileMapping(
IntPtr hFile,
ref SECURITY_ATTRIBUTES lpFileMappingAttributes,
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use CreateFile.
/// </summary>
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateFileW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateFileW", CharSet = CharSet.Unicode, SetLastError = true)]
private static unsafe partial IntPtr CreateFilePrivate_IntPtr(
string lpFileName,
int dwDesiredAccess,
/// </summary>
internal const int SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE = 0x2;
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateSymbolicLinkW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateSymbolicLinkW", CharSet = CharSet.Unicode, SetLastError = true)]
private static partial bool CreateSymbolicLinkPrivate(string lpSymlinkFileName, string lpTargetFileName, int dwFlags);
/// <summary>
private UIntPtr SpinCount;
}
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Kernel32)]
internal static unsafe partial void InitializeCriticalSection(CRITICAL_SECTION* lpCriticalSection);
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Kernel32)]
internal static unsafe partial void EnterCriticalSection(CRITICAL_SECTION* lpCriticalSection);
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Kernel32)]
internal static unsafe partial void LeaveCriticalSection(CRITICAL_SECTION* lpCriticalSection);
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Kernel32)]
internal static unsafe partial void DeleteCriticalSection(CRITICAL_SECTION* lpCriticalSection);
}
}
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use DeleteFile.
/// </summary>
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "DeleteFileW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "DeleteFileW", CharSet = CharSet.Unicode, SetLastError = true)]
private static partial bool DeleteFilePrivate(string path);
internal static bool DeleteFile(string path)
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use DeleteVolumeMountPoint.
/// </summary>
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "DeleteVolumeMountPointW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "DeleteVolumeMountPointW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool DeleteVolumeMountPointPrivate(string mountPoint);
internal static bool DeleteVolumeMountPoint(string mountPoint)
// https://docs.microsoft.com/windows/win32/api/winioctl/ni-winioctl-fsctl_get_reparse_point
internal const int FSCTL_GET_REPARSE_POINT = 0x000900a8;
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "DeviceIoControl", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "DeviceIoControl", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool DeviceIoControl(
SafeHandle hDevice,
uint dwIoControlCode,
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial bool ResetEvent(SafeWaitHandle handle);
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateEventExW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateEventExW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial SafeWaitHandle CreateEventEx(IntPtr lpSecurityAttributes, string? name, uint flags, uint desiredAccess);
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "OpenEventW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "OpenEventW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial SafeWaitHandle OpenEvent(uint desiredAccess, bool inheritHandle, string name);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "ExpandEnvironmentStringsW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "ExpandEnvironmentStringsW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial uint ExpandEnvironmentStrings(string lpSrc, ref char lpDst, uint nSize);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial bool FillConsoleOutputAttribute(IntPtr hConsoleOutput, short wColorAttribute, int numCells, COORD startCoord, out int pNumBytesWritten);
}
}
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use FindFirstFile.
/// </summary>
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "FindFirstFileExW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "FindFirstFileExW", CharSet = CharSet.Unicode, 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)
private const int FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100;
private const int ERROR_INSUFFICIENT_BUFFER = 0x7A;
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "FormatMessageW", ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "FormatMessageW", SetLastError = true)]
private static unsafe partial int FormatMessage(
int dwFlags,
IntPtr lpSource,
public const int FORMAT_MESSAGE_FROM_HMODULE = 0x00000800;
public const int FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000;
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "FormatMessageW", CharSet = CharSet.Unicode, SetLastError = true)]
public static partial int FormatMessage(
int dwFlags,
SafeLibraryHandle lpSource,
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Kernel32)]
internal static unsafe partial BOOL FreeEnvironmentStringsW(char* lpszEnvironmentBlock);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial bool FreeLibrary(IntPtr hModule);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetComputerNameW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetComputerNameW", CharSet = CharSet.Unicode)]
private static unsafe partial int GetComputerName(char* lpBuffer, uint* nSize);
// maximum length of the NETBIOS name (not including NULL)
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial uint GetConsoleTitleW(char* title, uint nSize);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetCurrentDirectoryW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetCurrentDirectoryW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial uint GetCurrentDirectory(uint nBufferLength, ref char lpBuffer);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Kernel32)]
[SuppressGCTransition]
public static partial int GetCurrentThreadId();
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Kernel32)]
internal static unsafe partial char* GetEnvironmentStringsW();
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetEnvironmentVariableW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetEnvironmentVariableW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial uint GetEnvironmentVariable(string lpName, ref char lpBuffer, uint nSize);
}
}
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use GetFileAttributesEx.
/// </summary>
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetFileAttributesExW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetFileAttributesExW", CharSet = CharSet.Unicode, SetLastError = true)]
private static partial bool GetFileAttributesExPrivate(
string? name,
GET_FILEEX_INFO_LEVELS fileInfoLevel,
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, 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)
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetFinalPathNameByHandleW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetFinalPathNameByHandleW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial uint GetFinalPathNameByHandle(
SafeFileHandle hFile,
char* lpszFilePath,
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use GetFullPathName or PathHelper.
/// </summary>
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial uint GetFullPathNameW(
ref char lpFileName,
uint nBufferLength,
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use GetFullPath/PathHelper.
/// </summary>
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial uint GetLongPathNameW(
ref char lpszShortPath,
ref char lpszLongPath,
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetModuleFileNameW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetModuleFileNameW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial uint GetModuleFileName(IntPtr hModule, ref char lpFilename, uint nSize);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial bool GetNamedPipeHandleStateW(
SafePipeHandle hNamedPipe,
uint* lpState,
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Auto, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static unsafe partial bool GetOverlappedResult(
SafeFileHandle hFile,
NativeOverlapped* lpOverlapped,
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial int GetPriorityClass(SafeProcessHandle handle);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial bool GetProcessAffinityMask(SafeProcessHandle handle, out IntPtr processMask, out IntPtr systemMask);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, EntryPoint = "QueryFullProcessImageNameW", ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "QueryFullProcessImageNameW", CharSet = CharSet.Unicode, SetLastError = true)]
private static unsafe partial bool QueryFullProcessImageName(
SafeHandle hProcess,
uint dwFlags,
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial bool GetProcessWorkingSetSizeEx(SafeProcessHandle handle, out IntPtr min, out IntPtr max, out int flags);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial uint GetSystemDirectoryW(ref char lpBuffer, uint uSize);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial uint GetTempFileNameW(ref char lpPathName, string lpPrefixString, uint uUnique, ref char lpTempFileName);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode)]
internal static partial uint GetTempPathW(int bufferLen, ref char buffer);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial int GetThreadPriority(SafeThreadHandle handle);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial bool GetThreadPriorityBoost(SafeThreadHandle handle, out bool disabled);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial bool GetThreadTimes(SafeThreadHandle handle, out long creation, out long exit, out long kernel, out long user);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Interop.Libraries.Kernel32, CharSet = CharSet.Unicode)]
+ [GeneratedDllImport(Interop.Libraries.Kernel32)]
internal static partial int GetUserDefaultLCID();
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetVolumeInformationW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "GetVolumeInformationW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial bool GetVolumeInformation(
string drive,
char* volumeName,
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
public static partial IntPtr GlobalLock(IntPtr hMem);
public static IntPtr GlobalLock(HandleRef hMem)
return result;
}
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Kernel32)]
public static partial IntPtr GlobalUnlock(IntPtr hMem);
public static IntPtr GlobalUnlock(HandleRef hMem)
[GeneratedDllImport("kernel32.dll")]
internal static partial int GetUserGeoID(int geoClass);
- [GeneratedDllImport("kernel32.dll", CharSet = CharSet.Unicode)]
+ [GeneratedDllImport("kernel32.dll", EntryPoint = "GetGeoInfoW", CharSet = CharSet.Unicode)]
internal static unsafe partial int GetGeoInfo(int location, int geoType, char* lpGeoData, int cchData, int LangId);
[GeneratedDllImport("kernel32.dll", CharSet = CharSet.Unicode)]
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "LoadLibraryW", CharSet = CharSet.Unicode, SetLastError = true)]
public static partial IntPtr LoadLibrary(string libFilename);
}
}
public const int LOAD_LIBRARY_AS_DATAFILE = 0x00000002;
public const int LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800;
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
public static partial SafeLibraryHandle LoadLibraryExW(string lpwLibFileName, IntPtr hFile, uint dwFlags);
}
}
internal const int LOAD_LIBRARY_AS_DATAFILE = 0x00000002;
internal const int LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800;
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "LoadLibraryExW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "LoadLibraryExW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial IntPtr LoadLibraryEx(string libFilename, IntPtr reserved, int flags);
}
}
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use MoveFile.
/// </summary>
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "MoveFileExW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "MoveFileExW", CharSet = CharSet.Unicode, SetLastError = true)]
private static partial bool MoveFileExPrivate(
string src, string dst, uint flags);
{
internal const uint CREATE_MUTEX_INITIAL_OWNER = 0x1;
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "OpenMutexW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "OpenMutexW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial SafeWaitHandle OpenMutex(uint desiredAccess, bool inheritHandle, string name);
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateMutexExW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateMutexExW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial SafeWaitHandle CreateMutexEx(IntPtr lpMutexAttributes, string? name, uint flags, uint desiredAccess);
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "OpenFileMappingW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "OpenFileMappingW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial SafeMemoryMappedFileHandle OpenFileMapping(
int dwDesiredAccess,
[MarshalAs(UnmanagedType.Bool)] bool bInheritHandle,
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial SafeProcessHandle OpenProcess(
int access, bool inherit, int processId);
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial SafeThreadHandle OpenThread(int access, bool inherit, int threadId);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Interop.Libraries.Kernel32, EntryPoint = "OutputDebugStringW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Interop.Libraries.Kernel32, EntryPoint = "OutputDebugStringW", CharSet = CharSet.Unicode)]
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.
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Kernel32)]
[SuppressGCTransition]
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.
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Kernel32)]
internal static unsafe partial BOOL QueryPerformanceFrequency(long* lpFrequency);
}
}
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use RemoveDirectory.
/// </summary>
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "RemoveDirectoryW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "RemoveDirectoryW", CharSet = CharSet.Unicode, SetLastError = true)]
private static partial bool RemoveDirectoryPrivate(string path);
internal static bool RemoveDirectory(string path)
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "ReplaceFileW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "ReplaceFileW", CharSet = CharSet.Unicode, SetLastError = true)]
private static partial bool ReplaceFilePrivate(
string replacedFileName, string replacementFileName, string? backupFileName,
int dwReplaceFlags, IntPtr lpExclude, IntPtr lpReserved);
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "OpenSemaphoreW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "OpenSemaphoreW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial SafeWaitHandle OpenSemaphore(uint desiredAccess, bool inheritHandle, string name);
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateSemaphoreExW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateSemaphoreExW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial SafeWaitHandle CreateSemaphoreEx(IntPtr lpSecurityAttributes, int initialCount, int maximumCount, string? name, uint flags, uint desiredAccess);
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "SetCurrentDirectoryW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "SetCurrentDirectoryW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool SetCurrentDirectory(string path);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "SetEnvironmentVariableW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "SetEnvironmentVariableW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool SetEnvironmentVariable(string lpName, string? lpValue);
}
}
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use SetFileAttributes.
/// </summary>
- [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "SetFileAttributesW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "SetFileAttributesW", CharSet = CharSet.Unicode, SetLastError = true)]
private static partial bool SetFileAttributesPrivate(
string name,
int attr);
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static unsafe partial bool SetFileInformationByHandle(
SafeFileHandle hFile,
int FileInformationClass,
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial bool SetPriorityClass(SafeProcessHandle handle, int priorityClass);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial bool SetProcessAffinityMask(SafeProcessHandle handle, IntPtr mask);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial bool SetProcessPriorityBoost(SafeProcessHandle handle, bool disabled);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial bool SetProcessWorkingSetSizeEx(SafeProcessHandle handle, IntPtr min, IntPtr max, int flags);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial IntPtr SetThreadAffinityMask(SafeThreadHandle handle, IntPtr mask);
}
}
internal static partial class Kernel32
{
[SuppressGCTransition]
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial bool SetThreadErrorMode(
uint dwNewMode,
out uint lpOldMode);
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial int SetThreadIdealProcessor(SafeThreadHandle handle, int processor);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial bool SetThreadPriority(SafeThreadHandle handle, int priority);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial bool SetThreadPriorityBoost(SafeThreadHandle handle, bool disabled);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial bool TerminateProcess(SafeProcessHandle processHandle, int exitCode);
}
}
internal const uint TIME_ZONE_ID_INVALID = unchecked((uint)-1);
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial uint GetDynamicTimeZoneInformation(out TIME_DYNAMIC_ZONE_INFORMATION pTimeZoneInformation);
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial uint GetTimeZoneInformation(out TIME_ZONE_INFORMATION lpTimeZoneInformation);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, EntryPoint = "VerLanguageNameW")]
+ [GeneratedDllImport(Libraries.Kernel32, EntryPoint = "VerLanguageNameW")]
internal static unsafe partial int VerLanguageName(uint wLang, char* szLang, uint cchLang);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial IntPtr VirtualAlloc(SafeHandle lpAddress, UIntPtr dwSize, int flAllocationType, int flProtect);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Kernel32)]
internal static unsafe partial void* VirtualAlloc(void* lpAddress, UIntPtr dwSize, int flAllocationType, int flProtect);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Kernel32)]
internal static unsafe partial bool VirtualFree(void* lpAddress, UIntPtr dwSize, int dwFreeType);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial UIntPtr VirtualQuery(
SafeHandle lpAddress,
ref MEMORY_BASIC_INFORMATION lpBuffer,
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static unsafe partial UIntPtr VirtualQuery(void* lpAddress, ref MEMORY_BASIC_INFORMATION lpBuffer, UIntPtr dwLength);
}
}
{
internal static partial class Kernel32
{
- [GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial int WaitForSingleObject(SafeWaitHandle handle, int timeout);
}
}
{
internal static partial class Logoncli
{
- [GeneratedDllImport(Libraries.Logoncli, EntryPoint = "DsGetDcNameW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Logoncli, EntryPoint = "DsGetDcNameW", CharSet = CharSet.Unicode)]
internal static partial int DsGetDcName(
string computerName,
string domainName,
internal static unsafe ErrorCode NCryptEncrypt(SafeNCryptKeyHandle hKey, ReadOnlySpan<byte> pbInput, int cbInput, void* pPaddingInfo, Span<byte> pbOutput, int cbOutput, out int pcbResult, AsymmetricPaddingMode dwFlags) =>
NCryptEncrypt(hKey, ref MemoryMarshal.GetReference(pbInput), cbInput, pPaddingInfo, ref MemoryMarshal.GetReference(pbOutput), cbOutput, out pcbResult, dwFlags);
- [GeneratedDllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)]
+ [GeneratedDllImport(Interop.Libraries.NCrypt)]
private static unsafe partial ErrorCode NCryptEncrypt(SafeNCryptKeyHandle hKey, ref byte pbInput, int cbInput, void* pPaddingInfo, ref byte pbOutput, int cbOutput, out int pcbResult, AsymmetricPaddingMode dwFlags);
internal static unsafe ErrorCode NCryptDecrypt(SafeNCryptKeyHandle hKey, ReadOnlySpan<byte> pbInput, int cbInput, void* pPaddingInfo, Span<byte> pbOutput, int cbOutput, out int pcbResult, AsymmetricPaddingMode dwFlags) =>
NCryptDecrypt(hKey, ref MemoryMarshal.GetReference(pbInput), cbInput, pPaddingInfo, ref MemoryMarshal.GetReference(pbOutput), cbOutput, out pcbResult, dwFlags);
- [GeneratedDllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)]
+ [GeneratedDllImport(Interop.Libraries.NCrypt)]
private static unsafe partial ErrorCode NCryptDecrypt(SafeNCryptKeyHandle hKey, ref byte pbInput, int cbInput, void* pPaddingInfo, ref byte pbOutput, int cbOutput, out int pcbResult, AsymmetricPaddingMode dwFlags);
}
}
{
// https://msdn.microsoft.com/en-us/library/bb432380.aspx
// https://msdn.microsoft.com/en-us/library/windows/hardware/ff566424.aspx
- [GeneratedDllImport(Libraries.NtDll, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.NtDll, CharSet = CharSet.Unicode)]
private static unsafe partial uint NtCreateFile(
IntPtr* FileHandle,
DesiredAccess DesiredAccess,
{
// https://msdn.microsoft.com/en-us/library/windows/hardware/ff556633.aspx
// https://msdn.microsoft.com/en-us/library/windows/hardware/ff567047.aspx
- [GeneratedDllImport(Libraries.NtDll, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.NtDll, CharSet = CharSet.Unicode)]
public static unsafe partial int NtQueryDirectoryFile(
IntPtr FileHandle,
IntPtr Event,
{
internal static partial class NtDll
{
- [GeneratedDllImport(Libraries.NtDll, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.NtDll)]
internal static unsafe partial int NtQueryInformationFile(
SafeFileHandle FileHandle,
out IO_STATUS_BLOCK IoStatusBlock,
{
internal static partial class NtDll
{
- [GeneratedDllImport(Libraries.NtDll, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.NtDll)]
internal static unsafe partial uint NtQueryInformationProcess(SafeProcessHandle ProcessHandle, int ProcessInformationClass, void* ProcessInformation, uint ProcessInformationLength, out uint ReturnLength);
}
}
{
internal static partial class NtDll
{
- [GeneratedDllImport(Libraries.NtDll, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.NtDll)]
internal static unsafe partial uint NtQuerySystemInformation(int SystemInformationClass, void* SystemInformation, uint SystemInformationLength, uint* ReturnLength);
internal const uint STATUS_INFO_LENGTH_MISMATCH = 0xC0000004;
{
internal static partial class NtDll
{
- [GeneratedDllImport(Libraries.NtDll, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.NtDll)]
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
- [GeneratedDllImport(Libraries.NtDll, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.NtDll)]
public static partial uint RtlNtStatusToDosError(int Status);
}
}
internal static partial class Ole32
{
- [GeneratedDllImport(Interop.Libraries.Ole32, ExactSpelling = true)]
+ [GeneratedDllImport(Interop.Libraries.Ole32)]
internal static partial int CoGetApartmentType(out APTTYPE pAptType, out APTTYPEQUALIFIER pAptQualifier);
}
}
internal const uint COINIT_APARTMENTTHREADED = 2;
internal const uint COINIT_MULTITHREADED = 0;
- [GeneratedDllImport(Interop.Libraries.Ole32, ExactSpelling = true)]
+ [GeneratedDllImport(Interop.Libraries.Ole32)]
internal static partial int CoInitializeEx(IntPtr reserved, uint dwCoInit);
}
}
{
internal static partial class Ole32
{
- [GeneratedDllImport(Interop.Libraries.Ole32, ExactSpelling = true)]
+ [GeneratedDllImport(Interop.Libraries.Ole32)]
internal static partial int CoUninitialize();
}
}
{
internal static partial class Pdh
{
- [GeneratedDllImport(Libraries.Pdh, CharSet = CharSet.Unicode)]
+ [GeneratedDllImport(Libraries.Pdh)]
public static partial int PdhFormatFromRawValue(
uint dwCounterType,
uint dwFormat,
{
internal static partial class PerfCounter
{
- [GeneratedDllImport(Libraries.Advapi32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32)]
internal static partial uint PerfStopProvider(
IntPtr hProvider
);
internal uint InstanceNameSize;
}
- [GeneratedDllImport(Libraries.Advapi32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32)]
internal static partial uint PerfStartProvider(
ref Guid ProviderGuid,
PERFLIBREQUEST ControlCallback,
out SafePerfProviderHandle phProvider
);
- [GeneratedDllImport(Libraries.Advapi32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
+ [GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial PerfCounterSetInstanceStruct* PerfCreateInstance(
SafePerfProviderHandle hProvider,
ref Guid CounterSetGuid,
uint dwInstance
);
- [GeneratedDllImport(Libraries.Advapi32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32)]
internal static unsafe partial uint PerfSetCounterSetInfo(
SafePerfProviderHandle hProvider,
PerfCounterSetInfoStruct* pTemplate,
uint dwTemplateSize
);
- [GeneratedDllImport(Libraries.Advapi32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32)]
internal static unsafe partial uint PerfDeleteInstance(
SafePerfProviderHandle hProvider,
PerfCounterSetInstanceStruct* InstanceBlock
);
- [GeneratedDllImport(Libraries.Advapi32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Advapi32)]
internal static unsafe partial uint PerfSetCounterRefValue(
SafePerfProviderHandle hProvider,
PerfCounterSetInstanceStruct* pInstance,
{
internal static partial class Secur32
{
- [GeneratedDllImport(Libraries.Secur32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Secur32, CharSet = CharSet.Unicode, 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
- [GeneratedDllImport(Libraries.Shell32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = false)]
+ [GeneratedDllImport(Libraries.Shell32, CharSet = CharSet.Unicode, SetLastError = false)]
internal static partial int SHGetKnownFolderPath(
in Guid rfid,
uint dwFlags,
internal const uint SEE_MASK_NOCLOSEPROCESS = 0x00000040;
internal const uint SEE_MASK_FLAG_NO_UI = 0x00000400;
- [GeneratedDllImport(Libraries.Shell32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Shell32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial bool ShellExecuteExW(
SHELLEXECUTEINFO* pExecInfo);
}
public char* pwszSslCtlIdentifier;
}
- [GeneratedDllImport(Interop.Libraries.SspiCli, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, SetLastError = true)]
internal static partial int EncryptMessage(
ref CredHandle contextHandle,
uint qualityOfProtection,
ref SecBufferDesc inputOutput,
uint sequenceNumber);
- [GeneratedDllImport(Interop.Libraries.SspiCli, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, SetLastError = true)]
internal static unsafe partial int DecryptMessage(
ref CredHandle contextHandle,
ref SecBufferDesc inputOutput,
uint sequenceNumber,
uint* qualityOfProtection);
- [GeneratedDllImport(Interop.Libraries.SspiCli, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, SetLastError = true)]
internal static partial int QuerySecurityContextToken(
ref CredHandle phContext,
out SecurityContextTokenHandle handle);
- [GeneratedDllImport(Interop.Libraries.SspiCli, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, SetLastError = true)]
internal static partial int FreeContextBuffer(
IntPtr contextBuffer);
- [GeneratedDllImport(Interop.Libraries.SspiCli, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, SetLastError = true)]
internal static partial int FreeCredentialsHandle(
ref CredHandle handlePtr);
- [GeneratedDllImport(Interop.Libraries.SspiCli, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, SetLastError = true)]
internal static partial int DeleteSecurityContext(
ref CredHandle handlePtr);
- [GeneratedDllImport(Interop.Libraries.SspiCli, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, SetLastError = true)]
internal static unsafe partial int AcceptSecurityContext(
ref CredHandle credentialHandle,
void* inContextPtr,
ref ContextFlags attributes,
out long timeStamp);
- [GeneratedDllImport(Interop.Libraries.SspiCli, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, SetLastError = true)]
internal static unsafe partial int QueryContextAttributesW(
ref CredHandle contextHandle,
ContextAttribute attribute,
void* buffer);
- [GeneratedDllImport(Interop.Libraries.SspiCli, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, SetLastError = true)]
internal static partial int SetContextAttributesW(
ref CredHandle contextHandle,
ContextAttribute attribute,
byte[] buffer,
int bufferSize);
- [GeneratedDllImport(Interop.Libraries.SspiCli, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, SetLastError = true)]
internal static partial int EnumerateSecurityPackagesW(
out int pkgnum,
out SafeFreeContextBuffer_SECURITY handle);
- [GeneratedDllImport(Interop.Libraries.SspiCli, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial int AcquireCredentialsHandleW(
string? principal,
string moduleName,
ref CredHandle handlePtr,
out long timeStamp);
- [GeneratedDllImport(Interop.Libraries.SspiCli, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial int AcquireCredentialsHandleW(
string? principal,
string moduleName,
ref CredHandle handlePtr,
out long timeStamp);
- [GeneratedDllImport(Interop.Libraries.SspiCli, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial int AcquireCredentialsHandleW(
string? principal,
string moduleName,
ref CredHandle handlePtr,
out long timeStamp);
- [GeneratedDllImport(Interop.Libraries.SspiCli, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial int AcquireCredentialsHandleW(
string? principal,
string moduleName,
ref CredHandle handlePtr,
out long timeStamp);
- [GeneratedDllImport(Interop.Libraries.SspiCli, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, SetLastError = true)]
internal static unsafe partial int InitializeSecurityContextW(
ref CredHandle credentialHandle,
void* inContextPtr,
ref ContextFlags attributes,
out long timeStamp);
- [GeneratedDllImport(Interop.Libraries.SspiCli, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, SetLastError = true)]
internal static unsafe partial int CompleteAuthToken(
void* inContextPtr,
ref SecBufferDesc inputBuffers);
- [GeneratedDllImport(Interop.Libraries.SspiCli, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, SetLastError = true)]
internal static unsafe partial int ApplyControlToken(
void* inContextPtr,
ref SecBufferDesc inputBuffers);
- [GeneratedDllImport(Interop.Libraries.SspiCli, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, SetLastError = true)]
internal static partial SECURITY_STATUS SspiFreeAuthIdentity(
IntPtr authData);
- [GeneratedDllImport(Interop.Libraries.SspiCli, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial SECURITY_STATUS SspiEncodeStringsAsAuthIdentity(
string userName,
string domainName,
string password,
out SafeSspiAuthDataHandle authData);
- [GeneratedDllImport(Interop.Libraries.SspiCli, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.SspiCli, SetLastError = true)]
internal static partial SECURITY_STATUS SetCredentialsAttributesW(
in CredHandle handlePtr,
long ulAttribute,
internal static unsafe partial class Ucrtbase
{
#pragma warning disable CS3016 // Arrays as attribute arguments is not CLS-compliant
- [GeneratedDllImport(Libraries.Ucrtbase, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Ucrtbase)]
[UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
internal static partial void* _aligned_malloc(nuint size, nuint alignment);
- [GeneratedDllImport(Libraries.Ucrtbase, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Ucrtbase)]
[UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
internal static partial void _aligned_free(void* ptr);
- [GeneratedDllImport(Libraries.Ucrtbase, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Ucrtbase)]
[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)]
+ [GeneratedDllImport(Libraries.Ucrtbase)]
[UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
internal static partial void* calloc(nuint num, nuint size);
- [GeneratedDllImport(Libraries.Ucrtbase, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Ucrtbase)]
[UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
internal static partial void free(void* ptr);
- [GeneratedDllImport(Libraries.Ucrtbase, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Ucrtbase)]
[UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
internal static partial void* malloc(nuint size);
- [GeneratedDllImport(Libraries.Ucrtbase, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Ucrtbase)]
[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
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, SetLastError = true)]
public static partial IntPtr CreateWindowExW(
int exStyle,
string lpszClassName,
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode)]
public static partial IntPtr DefWindowProcW(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32)]
public static partial bool DestroyWindow(IntPtr hWnd);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode)]
public static partial int DispatchMessageW(ref MSG msg);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode)]
public static partial IntPtr FindWindowW(string lpClassName, string lpWindowName);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode)]
public static partial bool GetClassInfoW(IntPtr hInst, string lpszClass, ref WNDCLASS wc);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode)]
public static partial int GetMessageW(ref MSG msg, IntPtr hwnd, int msgMin, int msgMax);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32)]
internal static partial IntPtr GetProcessWindowStation();
}
}
// index that doesn't exist.
[SuppressGCTransition]
- [GeneratedDllImport(Libraries.User32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32)]
internal static partial uint GetSysColor(int nIndex);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, SetLastError = true)]
public static unsafe partial bool GetUserObjectInformationW(IntPtr hObj, int nIndex, void* pvBuffer, uint nLength, ref uint lpnLengthNeeded);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.User32, SetLastError = true)]
public static partial int GetWindowTextLengthW(IntPtr hWnd);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, SetLastError = true)]
public static unsafe partial int GetWindowTextW(IntPtr hWnd, char* lpString, int nMaxCount);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32)]
public static unsafe partial int GetWindowThreadProcessId(IntPtr handle, int* processId);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32)]
public static partial bool IsWindow(IntPtr hWnd);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32)]
public static partial bool KillTimer(IntPtr hwnd, IntPtr idEvent);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, EntryPoint = "LoadStringW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.User32, EntryPoint = "LoadStringW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial int LoadString(IntPtr hInstance, uint uID, char* lpBuffer, int cchBufferMax);
}
}
internal const int MB_ICONEXCLAMATION = 0x30;
internal const int MB_ICONASTERISK = 0x40;
- [GeneratedDllImport(Libraries.User32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32)]
internal static partial bool MessageBeep(int type);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32)]
public static partial int MsgWaitForMultipleObjectsEx(int nCount, IntPtr pHandles, int dwMilliseconds, int dwWakeMask, int dwFlags);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode)]
public static partial int PostMessageW(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode)]
public static partial void PostQuitMessage(int exitCode);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, SetLastError = true)]
public static partial short RegisterClassW(ref WNDCLASS wc);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode)]
public static partial int RegisterWindowMessageW(string msg);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode)]
public static partial IntPtr SendMessageW(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode)]
public static partial IntPtr SetClassLongW(IntPtr hwnd, int nIndex, IntPtr dwNewLong);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode)]
public static partial IntPtr SetClassLongPtrW(IntPtr hwnd, int nIndex, IntPtr dwNewLong);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32)]
public static partial IntPtr SetTimer(IntPtr hWnd, IntPtr nIDEvent, int uElapse, IntPtr lpTimerProc);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode)]
public static partial IntPtr SetWindowLongW(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode)]
public static partial IntPtr SetWindowLongPtrW(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.User32)]
public static partial bool TranslateMessage(ref MSG msg);
}
}
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, SetLastError = true)]
public static partial short UnregisterClassW(string lpClassName, IntPtr hInstance);
}
}
{
internal static partial class WebSocket
{
- [GeneratedDllImport(Libraries.WebSocket, EntryPoint = "WebSocketSend", ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.WebSocket, EntryPoint = "WebSocketSend")]
internal static partial int WebSocketSend_Raw(
SafeHandle webSocketHandle,
BufferType bufferType,
ref Buffer buffer,
IntPtr applicationContext);
- [GeneratedDllImport(Libraries.WebSocket, EntryPoint = "WebSocketSend", ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.WebSocket, EntryPoint = "WebSocketSend")]
internal static partial int WebSocketSendWithoutBody_Raw(
SafeHandle webSocketHandle,
BufferType bufferType,
internal const int SND_FILENAME = 0x20000;
internal const int SND_NOSTOP = 0x10;
- [GeneratedDllImport(Libraries.WinMM, EntryPoint = "PlaySoundW", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.WinMM, EntryPoint = "PlaySoundW", CharSet = CharSet.Unicode)]
internal static partial bool PlaySound(string soundName, IntPtr hmod, int soundFlags);
- [GeneratedDllImport(Libraries.WinMM, EntryPoint = "PlaySoundW", ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.WinMM, EntryPoint = "PlaySoundW")]
internal static partial bool PlaySound(byte[]? soundName, IntPtr hmod, int soundFlags);
}
}
internal const int MMIO_READ = 0x00000000;
internal const int MMIO_ALLOCBUF = 0x00010000;
- [GeneratedDllImport(Libraries.WinMM, CharSet = CharSet.Auto)]
+ [GeneratedDllImport(Libraries.WinMM, EntryPoint = "mmioOpenW", CharSet = CharSet.Unicode)]
internal static partial IntPtr mmioOpen(string fileName, IntPtr not_used, int flags);
}
}
internal const int NS_ALL = 0;
- [GeneratedDllImport(Libraries.Ws2_32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Ws2_32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial int GetAddrInfoExW(
string pName,
string? pServiceName,
delegate* unmanaged<int, int, NativeOverlapped*, void> lpCompletionRoutine,
IntPtr* lpNameHandle);
- [GeneratedDllImport(Libraries.Ws2_32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Ws2_32)]
internal static unsafe partial int GetAddrInfoExCancel(IntPtr* lpHandle);
- [GeneratedDllImport(Libraries.Ws2_32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Ws2_32)]
internal static unsafe partial void FreeAddrInfoExW(AddressInfoEx* pAddrInfo);
[StructLayout(LayoutKind.Sequential)]
{
internal static partial class Winsock
{
- [GeneratedDllImport(Interop.Libraries.Ws2_32, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Ws2_32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial int GetAddrInfoW(
string pNameName,
string? pServiceName,
AddressInfo* pHints,
AddressInfo** ppResult);
- [GeneratedDllImport(Interop.Libraries.Ws2_32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Ws2_32, SetLastError = true)]
internal static unsafe partial void FreeAddrInfoW(AddressInfo* info);
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
{
internal static partial class Winsock
{
- [GeneratedDllImport(Interop.Libraries.Ws2_32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Ws2_32, EntryPoint = "WSADuplicateSocketW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial int WSADuplicateSocket(
SafeSocketHandle s,
uint dwProcessId,
{
internal static partial class Winsock
{
- [GeneratedDllImport(Interop.Libraries.Ws2_32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Ws2_32, SetLastError = true)]
internal static partial IntPtr accept(
SafeSocketHandle socketHandle,
byte[] socketAddress,
{
internal static partial class Winsock
{
- [GeneratedDllImport(Interop.Libraries.Ws2_32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Ws2_32, SetLastError = true)]
internal static partial SocketError closesocket(IntPtr socketHandle);
}
}
{
internal static partial class Winsock
{
- [GeneratedDllImport(Interop.Libraries.Ws2_32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Ws2_32, SetLastError = true)]
internal static partial SocketError ioctlsocket(
IntPtr handle,
int cmd,
{
internal static partial class Winsock
{
- [GeneratedDllImport(Interop.Libraries.Ws2_32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Ws2_32, SetLastError = true)]
internal static partial SocketError setsockopt(
IntPtr handle,
SocketOptionLevel optionLevel,
{
internal static partial class Wkscli
{
- [GeneratedDllImport(Libraries.Wkscli, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Wkscli, CharSet = CharSet.Unicode)]
internal static partial int NetWkstaGetInfo(string server, int level, ref IntPtr buffer);
}
}
[UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
public static partial IntPtr ldap_init(string hostName, int portNumber);
- [GeneratedDllImport(Libraries.Wldap32, EntryPoint = "ldap_connect", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Wldap32, EntryPoint = "ldap_connect", CharSet = CharSet.Unicode)]
[UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
public static partial int ldap_connect(ConnectionHandle ldapHandle, in LDAP_TIMEVAL timeout);
- [GeneratedDllImport(Libraries.Wldap32, EntryPoint = "ldap_unbind", CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Wldap32, EntryPoint = "ldap_unbind", CharSet = CharSet.Unicode)]
[UnmanagedCallConv(CallConvs = new Type[] { typeof(System.Runtime.CompilerServices.CallConvCdecl) })]
public static partial int ldap_unbind(IntPtr ldapHandle);
{
internal static partial class Wtsapi32
{
- [GeneratedDllImport(Libraries.Wtsapi32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Wtsapi32)]
public static partial bool WTSRegisterSessionNotification(IntPtr hWnd, int dwFlags);
}
}
{
internal static partial class Wtsapi32
{
- [GeneratedDllImport(Libraries.Wtsapi32, ExactSpelling = true)]
+ [GeneratedDllImport(Libraries.Wtsapi32)]
public static partial bool WTSUnRegisterSessionNotification(IntPtr hWnd);
}
}
{
public CharSet CharSet { get; set; }
public string? EntryPoint { get; set; }
- public bool ExactSpelling { get; set; }
public bool SetLastError { get; set; }
public GeneratedDllImportAttribute(string dllName)
out int pdwReturnedProductType
);
- [GeneratedDllImport("kernel32.dll", ExactSpelling = true)]
+ [GeneratedDllImport("kernel32.dll")]
private static partial int GetCurrentApplicationUserModelId(ref uint applicationUserModelIdLength, byte[] applicationUserModelId);
private static volatile Version s_windowsVersionObject;
return RegQueryValueEx(key.Handle, null, null, IntPtr.Zero, b, ref size) != ERROR_FILE_NOT_FOUND;
}
- [GeneratedDllImport(Interop.Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Kernel32, EntryPoint = "SetEnvironmentVariableW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool SetEnvironmentVariable(string lpName, string lpValue);
}
}
EventLogHandle session,
int flags);
- [GeneratedDllImport(Interop.Libraries.Wevtapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Wevtapi, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool EvtNextChannelPath(
EventLogHandle channelEnum,
int channelPathBufferSize,
EventLogHandle session,
int flags);
- [GeneratedDllImport(Interop.Libraries.Wevtapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Wevtapi, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool EvtNextPublisherId(
EventLogHandle publisherEnum,
int publisherIdBufferSize,
string[] valuePaths,
EvtRenderContextFlags flags);
- [GeneratedDllImport(Interop.Libraries.Wevtapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Wevtapi, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool EvtRender(
EventLogHandle context,
EventLogHandle eventHandle,
#endif
};
- [GeneratedDllImport(Interop.Libraries.Wevtapi, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Interop.Libraries.Wevtapi, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool EvtFormatMessage(
EventLogHandle publisherMetadataHandle,
EventLogHandle eventHandle,
PDNS_RECORD pRecordList,
DNS_FREE_TYPE FreeType
);*/
- [GeneratedDllImport(global::Interop.Libraries.Dnsapi, CharSet = CharSet.Unicode)]
+ [GeneratedDllImport(global::Interop.Libraries.Dnsapi)]
internal static partial void DnsRecordListFree(
IntPtr dnsResultList,
bool dnsFreeType);
{
internal static partial class Comdlg32
{
- [GeneratedDllImport(Libraries.Comdlg32, CharSet = CharSet.Auto, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Comdlg32, EntryPoint="PrintDlgW", SetLastError = true)]
internal static partial bool PrintDlg(ref PRINTDLG lppd);
- [GeneratedDllImport(Libraries.Comdlg32, CharSet = CharSet.Auto, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Comdlg32, EntryPoint="PrintDlgW", SetLastError = true)]
internal static partial bool PrintDlg(ref PRINTDLGX86 lppd);
[StructLayout(LayoutKind.Sequential)]
internal const int CHECKJPEGFORMAT = 4119;
internal const int CHECKPNGFORMAT = 4120;
- [GeneratedDllImport(Libraries.Gdi32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Gdi32, SetLastError = true)]
internal static partial IntPtr CreateCompatibleBitmap(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
#endif
HandleRef hpal, int iStartIndex, int nEntries, byte[] lppe);
- [GeneratedDllImport(Libraries.Gdi32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Gdi32, SetLastError = true)]
internal static partial IntPtr CreateDIBSection(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
#endif
HandleRef hdc, ref BITMAPINFO_FLAT bmi, int iUsage, ref IntPtr ppvBits, IntPtr hSection, int dwOffset);
- [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Gdi32, EntryPoint = "StartDocW", SetLastError = true)]
internal static partial int StartDoc(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
#endif
HandleRef hDC, DOCINFO lpDocInfo);
- [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, SetLastError = true)]
internal static partial int StartPage(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
#endif
HandleRef hDC);
- [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, SetLastError = true)]
internal static partial int EndPage(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
#endif
HandleRef hDC);
- [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, SetLastError = true)]
internal static partial int AbortDoc(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
#endif
HandleRef hDC);
- [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, SetLastError = true)]
internal static partial int EndDoc(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
#endif
HandleRef hDC);
- [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Gdi32, EntryPoint = "ResetDCW", SetLastError = true)]
internal static partial IntPtr /*HDC*/ ResetDC(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
#endif
HandleRef /*DEVMODE*/ lpDevMode);
- [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Gdi32, EntryPoint = "AddFontResourceExW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial int AddFontResourceEx(string lpszFilename, int fl, IntPtr pdv);
internal static int AddFontFile(string fileName)
return AddFontResourceEx(fileName, /*FR_PRIVATE*/ 0x10, IntPtr.Zero);
}
- [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, SetLastError = true)]
internal static partial int ExtEscape(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
#endif
HandleRef hDC, int nEscape, int cbInput, ref int inData, int cbOutput, out int outData);
- [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, SetLastError = true)]
internal static partial int ExtEscape(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
#endif
HandleRef hDC, int nEscape, int cbInput, byte[] inData, int cbOutput, out int outData);
- [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, SetLastError = true)]
internal static partial int IntersectClipRect(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
#endif
HandleRef hDC, int x1, int y1, int x2, int y2);
- [GeneratedDllImport(Libraries.Gdi32, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Gdi32, EntryPoint = "GetObjectW", SetLastError = true)]
internal static partial int GetObject(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
#endif
HandleRef hObject, int nSize, ref BITMAP bm);
- [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Gdi32, EntryPoint = "GetObjectW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial int GetObject(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
return IntGlobalAlloc(uFlags, new UIntPtr(dwBytes));
}
- [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Gdi32, CharSet = CharSet.Auto, SetLastError = true)]
internal static partial IntPtr SelectObject(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
{
internal static partial class Shell32
{
- [GeneratedDllImport(Libraries.Shell32, CharSet = CharSet.Unicode)]
+ [GeneratedDllImport(Libraries.Shell32, EntryPoint = "ExtractAssociatedIconW", CharSet = CharSet.Unicode)]
internal static unsafe partial IntPtr ExtractAssociatedIcon(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
{
internal static partial class User32
{
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Unicode, SetLastError = true)]
+ [GeneratedDllImport(Libraries.User32, EntryPoint = "LoadIconW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial IntPtr LoadIcon(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
#endif
HandleRef hInst, IntPtr iconId);
- [GeneratedDllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.User32, SetLastError = true)]
internal static partial bool DestroyIcon(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
#endif
HandleRef hIcon);
- [GeneratedDllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.User32, SetLastError = true)]
internal static partial IntPtr CopyImage(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
#endif
HandleRef hImage, int uType, int cxDesired, int cyDesired, int fuFlags);
- [GeneratedDllImport(Libraries.User32, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.User32, SetLastError = true)]
internal static partial bool GetIconInfo(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
[GeneratedDllImport(Libraries.User32, SetLastError = true)]
public static partial int GetSystemMetrics(int nIndex);
- [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(Libraries.User32, CharSet = CharSet.Auto, SetLastError = true)]
internal static partial bool DrawIconEx(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
{
internal static partial class Winspool
{
- [GeneratedDllImport(Libraries.Winspool, CharSet = CharSet.Auto, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Winspool, EntryPoint = "DeviceCapabilitiesW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial int DeviceCapabilities(string pDevice, string pPort, short fwCapabilities, IntPtr pOutput, IntPtr /*DEVMODE*/ pDevMode);
- [GeneratedDllImport(Libraries.Winspool, CharSet = CharSet.Auto, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Winspool, EntryPoint = "DocumentPropertiesW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial int DocumentProperties(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
#endif
HandleRef /*DEVMODE*/ pDevModeInput, int fMode);
- [GeneratedDllImport(Libraries.Winspool, CharSet = CharSet.Auto, SetLastError = true)]
+ [GeneratedDllImport(Libraries.Winspool, EntryPoint = "DocumentPropertiesW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial int DocumentProperties(
#if NET7_0_OR_GREATER
[MarshalUsing(typeof(HandleRefMarshaller))]
[GeneratedDllImport(LibraryName)]
internal static partial int GdipGetNearestColor(IntPtr graphics, out int argb);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipAddPathString(IntPtr path, string s, int lenght, IntPtr family, int style, float emSize, ref RectangleF layoutRect, IntPtr format);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipAddPathStringI(IntPtr path, string s, int lenght, IntPtr family, int style, float emSize, ref Rectangle layoutRect, IntPtr format);
[GeneratedDllImport(LibraryName)]
[GeneratedDllImport(LibraryName)]
internal static partial int GdipGetImageThumbnail(IntPtr image, uint width, uint height, out IntPtr thumbImage, IntPtr callback, IntPtr callBackData);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipSaveImageToFile(IntPtr image, string filename, ref Guid encoderClsID, IntPtr encoderParameters);
[GeneratedDllImport(LibraryName)]
[GeneratedDllImport(LibraryName)]
internal static partial int GdipCreateFontFromHfont(IntPtr hdc, out IntPtr font, ref Interop.User32.LOGFONT lf);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipGetMetafileHeaderFromFile(string filename, IntPtr header);
[GeneratedDllImport(LibraryName)]
StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek,
StreamCloseDelegate close, StreamSizeDelegate size, IntPtr header);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipRecordMetafileFromDelegate_linux(StreamGetHeaderDelegate getHeader,
StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek,
StreamCloseDelegate close, StreamSizeDelegate size, IntPtr hdc, EmfType type, ref RectangleF frameRect,
MetafileFrameUnit frameUnit, string? description, out IntPtr metafile);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipRecordMetafileFromDelegateI_linux(StreamGetHeaderDelegate getHeader,
StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek,
StreamCloseDelegate close, StreamSizeDelegate size, IntPtr hdc, EmfType type, ref Rectangle frameRect,
[GeneratedDllImport(LibraryName)]
internal static partial int GdipGetMetafileHeaderFromEmf(IntPtr hEnhMetafile, MetafileHeaderEmf metafileHeaderEmf);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipGetMetafileHeaderFromFile(string filename, IntPtr header);
[GeneratedDllImport(LibraryName)]
[GeneratedDllImport(LibraryName)]
internal static partial int GdipCreateMetafileFromStream(IntPtr stream, IntPtr* metafile);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipRecordMetafileStream(IntPtr stream, IntPtr referenceHdc, EmfType emfType, RectangleF* frameRect, MetafileFrameUnit frameUnit, string? description, IntPtr* metafile);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipRecordMetafileStream(IntPtr stream, IntPtr referenceHdc, EmfType emfType, IntPtr pframeRect, MetafileFrameUnit frameUnit, string? description, IntPtr* metafile);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipRecordMetafileStreamI(IntPtr stream, IntPtr referenceHdc, EmfType emfType, Rectangle* frameRect, MetafileFrameUnit frameUnit, string? description, IntPtr* metafile);
[GeneratedDllImport(LibraryName)]
#endif
HandleRef graphics, int sizeData, byte[] data);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipCreateFontFromLogfontW(IntPtr hdc, ref Interop.User32.LOGFONT lf, out IntPtr font);
[GeneratedDllImport(LibraryName)]
[GeneratedDllImport(LibraryName)]
internal static partial int GdipDisposeImage(IntPtr image);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipCreateBitmapFromFile(string filename, out IntPtr bitmap);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipCreateBitmapFromFileICM(string filename, out IntPtr bitmap);
[GeneratedDllImport(LibraryName)]
#endif
WmfPlaceableFileHeader wmfplacealbeHeader, out IntPtr metafile);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipCreateMetafileFromFile(string file, out IntPtr metafile);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipRecordMetafile(IntPtr referenceHdc, EmfType emfType, IntPtr pframeRect, MetafileFrameUnit frameUnit, string? description, out IntPtr metafile);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipRecordMetafile(IntPtr referenceHdc, EmfType emfType, ref RectangleF frameRect, MetafileFrameUnit frameUnit, string? description, out IntPtr metafile);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipRecordMetafileI(IntPtr referenceHdc, EmfType emfType, ref Rectangle frameRect, MetafileFrameUnit frameUnit, string? description, out IntPtr metafile);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipRecordMetafileFileName(string fileName, IntPtr referenceHdc, EmfType emfType, ref RectangleF frameRect, MetafileFrameUnit frameUnit, string? description, out IntPtr metafile);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipRecordMetafileFileName(string fileName, IntPtr referenceHdc, EmfType emfType, IntPtr pframeRect, MetafileFrameUnit frameUnit, string? description, out IntPtr metafile);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipRecordMetafileFileNameI(string fileName, IntPtr referenceHdc, EmfType emfType, ref Rectangle frameRect, MetafileFrameUnit frameUnit, string? description, out IntPtr metafile);
[GeneratedDllImport(LibraryName)]
#endif
HandleRef graphics, int destSpace, int srcSpace, Point* points, int count);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipLoadImageFromFileICM(string filename, out IntPtr image);
- [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ [GeneratedDllImport(LibraryName, CharSet = CharSet.Unicode)]
internal static partial int GdipLoadImageFromFile(string filename, out IntPtr image);
[GeneratedDllImport(LibraryName)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34583", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
public partial class Directory_NotifyFilter_Tests : FileSystemWatcherTest
{
- [GeneratedDllImport("advapi32.dll", EntryPoint = "SetNamedSecurityInfoW", SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
+ [GeneratedDllImport("advapi32.dll", EntryPoint = "SetNamedSecurityInfoW", SetLastError = true, CharSet = CharSet.Unicode)]
private static partial uint SetSecurityInfoByHandle( string name, uint objectType, uint securityInformation,
IntPtr owner, IntPtr group, IntPtr dacl, IntPtr sacl);
[ActiveIssue("https://github.com/dotnet/runtime/issues/34583", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
public partial class File_NotifyFilter_Tests : FileSystemWatcherTest
{
- [GeneratedDllImport("advapi32.dll", EntryPoint = "SetNamedSecurityInfoW", SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)]
+ [GeneratedDllImport("advapi32.dll", EntryPoint = "SetNamedSecurityInfoW", SetLastError = true, CharSet = CharSet.Unicode)]
private static partial uint SetSecurityInfoByHandle(string name, uint objectType, uint securityInformation,
IntPtr owner, IntPtr group, IntPtr dacl, IntPtr sacl);
methodSymbol,
dllImportAttr!,
generatedDllImportAttrType,
+ entryPointSuffix: null,
cancelToken),
equivalenceKey: ConvertToGeneratedDllImportKey),
context.Diagnostics);
+
+ DllImportData dllImportData = methodSymbol.GetDllImportData()!;
+ if (!dllImportData.ExactSpelling)
+ {
+ // CharSet.Auto traditionally maps to either an A or W suffix
+ // depending on the default CharSet of the platform.
+ // We will offer both suffix options when CharSet.Auto is provided
+ // to enable developers to pick which variant they mean (since they could explicitly decide they want one or the other)
+ if (dllImportData.CharacterSet is CharSet.None or CharSet.Ansi or CharSet.Auto)
+ {
+ context.RegisterCodeFix(
+ CodeAction.Create(
+ string.Format(Resources.ConvertToGeneratedDllImportWithSuffix, "A"),
+ cancelToken => ConvertToGeneratedDllImport(
+ context.Document,
+ methodSyntax,
+ methodSymbol,
+ dllImportAttr!,
+ generatedDllImportAttrType,
+ entryPointSuffix: 'A',
+ cancelToken),
+ equivalenceKey: ConvertToGeneratedDllImportKey + "A"),
+ context.Diagnostics);
+ }
+ if (dllImportData.CharacterSet is CharSet.Unicode or CharSet.Auto)
+ {
+ context.RegisterCodeFix(
+ CodeAction.Create(
+ string.Format(Resources.ConvertToGeneratedDllImportWithSuffix, "W"),
+ cancelToken => ConvertToGeneratedDllImport(
+ context.Document,
+ methodSyntax,
+ methodSymbol,
+ dllImportAttr!,
+ generatedDllImportAttrType,
+ entryPointSuffix: 'W',
+ cancelToken),
+ equivalenceKey: ConvertToGeneratedDllImportKey + "W"),
+ context.Diagnostics);
+ }
+ }
}
private async Task<Document> ConvertToGeneratedDllImport(
IMethodSymbol methodSymbol,
AttributeData dllImportAttr,
INamedTypeSymbol generatedDllImportAttrType,
+ char? entryPointSuffix,
CancellationToken cancellationToken)
{
DocumentEditor editor = await DocumentEditor.CreateAsync(doc, cancellationToken).ConfigureAwait(false);
dllImportSyntax,
methodSymbol.GetDllImportData()!,
generatedDllImportAttrType,
+ methodSymbol.Name,
+ entryPointSuffix,
out SyntaxNode? unmanagedCallConvAttributeMaybe);
// Add annotation about potential behavioural and compatibility changes
AttributeSyntax dllImportSyntax,
DllImportData dllImportData,
INamedTypeSymbol generatedDllImportAttrType,
+ string methodName,
+ char? entryPointSuffix,
out SyntaxNode? unmanagedCallConvAttributeMaybe)
{
unmanagedCallConvAttributeMaybe = null;
// Update attribute arguments for GeneratedDllImport
List<SyntaxNode> argumentsToRemove = new List<SyntaxNode>();
+ AttributeArgumentSyntax? entryPointAttributeArgument = null;
foreach (SyntaxNode argument in generator.GetAttributeArguments(generatedDllImportSyntax))
{
if (argument is not AttributeArgumentSyntax attrArg)
argumentsToRemove.Add(argument);
}
}
+ else if (IsMatchingNamedArg(attrArg, nameof(DllImportAttribute.ExactSpelling)))
+ {
+ argumentsToRemove.Add(argument);
+ }
+ else if (IsMatchingNamedArg(attrArg, nameof(DllImportAttribute.EntryPoint)))
+ {
+ entryPointAttributeArgument = attrArg;
+ if (!dllImportData.ExactSpelling && entryPointSuffix.HasValue)
+ {
+ if (entryPointAttributeArgument.Expression.IsKind(SyntaxKind.StringLiteralExpression))
+ {
+ string? entryPoint = (string?)((LiteralExpressionSyntax)entryPointAttributeArgument.Expression).Token.Value;
+ if (entryPoint is not null)
+ {
+ entryPointAttributeArgument = entryPointAttributeArgument.WithExpression(
+ SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression,
+ SyntaxFactory.Literal(entryPoint + entryPointSuffix)));
+ }
+ }
+ else
+ {
+ entryPointAttributeArgument = entryPointAttributeArgument.WithExpression(
+ SyntaxFactory.BinaryExpression(SyntaxKind.AddExpression,
+ entryPointAttributeArgument.Expression,
+ SyntaxFactory.LiteralExpression(SyntaxKind.StringLiteralExpression,
+ SyntaxFactory.Literal(entryPointSuffix.ToString()))));
+ }
+ }
+ argumentsToRemove.Add(attrArg);
+ }
else if (IsMatchingNamedArg(attrArg, nameof(DllImportAttribute.PreserveSig)))
{
// We transform the signature for PreserveSig, so we can remove the argument
}
}
+ if (entryPointSuffix.HasValue && entryPointAttributeArgument is null)
+ {
+ entryPointAttributeArgument = (AttributeArgumentSyntax)generator.AttributeArgument("EntryPoint",
+ generator.LiteralExpression(methodName + entryPointSuffix.Value));
+ }
+
generatedDllImportSyntax = generator.RemoveNodes(generatedDllImportSyntax, argumentsToRemove);
+ if (entryPointAttributeArgument is not null)
+ {
+ generatedDllImportSyntax = generator.AddAttributeArguments(generatedDllImportSyntax, new[] { entryPointAttributeArgument });
+ }
return SortDllImportAttributeArguments((AttributeSyntax)generatedDllImportSyntax, generator);
}
DllImportMember userDefinedValues = DllImportMember.None;
CharSet charSet = CharSet.Ansi;
string? entryPoint = null;
- bool exactSpelling = false; // VB has different and unusual default behavior here.
bool setLastError = false;
// All other data on attribute is defined as NamedArguments.
}
entryPoint = (string)namedArg.Value.Value!;
break;
- case nameof(GeneratedDllImportData.ExactSpelling):
- userDefinedValues |= DllImportMember.ExactSpelling;
- if (namedArg.Value.Value is not bool)
- {
- return null;
- }
- exactSpelling = (bool)namedArg.Value.Value!;
- break;
case nameof(GeneratedDllImportData.SetLastError):
userDefinedValues |= DllImportMember.SetLastError;
if (namedArg.Value.Value is not bool)
IsUserDefined = userDefinedValues,
CharSet = charSet,
EntryPoint = entryPoint,
- ExactSpelling = exactSpelling,
SetLastError = setLastError,
};
}
AttributeArgument(
NameEquals(nameof(DllImportAttribute.EntryPoint)),
null,
- CreateStringExpressionSyntax(targetDllImportData.EntryPoint!))
+ CreateStringExpressionSyntax(targetDllImportData.EntryPoint!)),
+ AttributeArgument(
+ NameEquals(nameof(DllImportAttribute.ExactSpelling)),
+ null,
+ CreateBoolExpressionSyntax(true))
};
if (targetDllImportData.IsUserDefined.HasFlag(DllImportMember.CharSet))
ExpressionSyntax value = CreateEnumExpressionSyntax(targetDllImportData.CharSet);
newAttributeArgs.Add(AttributeArgument(name, null, value));
}
- if (targetDllImportData.IsUserDefined.HasFlag(DllImportMember.ExactSpelling))
- {
- NameEqualsSyntax name = NameEquals(nameof(DllImportAttribute.ExactSpelling));
- ExpressionSyntax value = CreateBoolExpressionSyntax(targetDllImportData.ExactSpelling);
- newAttributeArgs.Add(AttributeArgument(name, null, value));
- }
if (targetDllImportData.IsUserDefined.HasFlag(DllImportMember.SetLastError))
{
NameEqualsSyntax name = NameEquals(nameof(DllImportAttribute.SetLastError));
{
CharSet = dllImportData.CharSet,
EntryPoint = dllImportData.EntryPoint,
- ExactSpelling = dllImportData.ExactSpelling,
SetLastError = dllImportData.SetLastError,
IsUserDefined = dllImportData.IsUserDefined & membersToForward
};
None = 0,
CharSet = 1 << 0,
EntryPoint = 1 << 1,
- ExactSpelling = 1 << 2,
- SetLastError = 1 << 3,
+ SetLastError = 1 << 2,
All = ~None
}
public DllImportMember IsUserDefined { get; init; }
public CharSet CharSet { get; init; }
public string? EntryPoint { get; init; }
- public bool ExactSpelling { get; init; }
public bool SetLastError { get; init; }
}
}
}
/// <summary>
+ /// Looks up a localized string similar to Convert to 'GeneratedDllImport' with '{0}' suffix.
+ /// </summary>
+ internal static string ConvertToGeneratedDllImportWithSuffix {
+ get {
+ return ResourceManager.GetString("ConvertToGeneratedDllImportWithSuffix", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to The specified parameter needs to be marshalled from managed to native, but the native type '{0}' does not support it..
/// </summary>
internal static string CustomTypeMarshallingManagedToNativeUnsupported {
<value>Conversion to 'GeneratedDllImport' may change behavior and compatibility. See {0} for more information.</value>
<comment>{0} is a documentation link</comment>
</data>
+ <data name="ConvertToGeneratedDllImportWithSuffix" xml:space="preserve">
+ <value>Convert to 'GeneratedDllImport' with '{0}' suffix</value>
+ </data>
<data name="CustomTypeMarshallingManagedToNativeUnsupported" xml:space="preserve">
<value>The specified parameter needs to be marshalled from managed to native, but the native type '{0}' does not support it.</value>
</data>
[GeneratedDllImport(""DoesNotExist"",
CharSet = CharSet.Unicode,
EntryPoint = ""UserDefinedEntryPoint"",
- ExactSpelling = true,
SetLastError = true)]
public static partial void Method();
}
[GeneratedDllImport(nameof(Test),
CharSet = (CharSet)2,
EntryPoint = EntryPointName,
- ExactSpelling = 0 != 1,
SetLastError = IsFalse)]
public static partial void Method1();
[GeneratedDllImport(nameof(Test),
CharSet = (CharSet)Two,
EntryPoint = EntryPointName,
- ExactSpelling = One != Two,
SetLastError = !IsTrue)]
public static partial void Method2();
+
+ [GeneratedDllImport(nameof(Test),
+ CharSet = (CharSet)2,
+ EntryPoint = EntryPointName,
+ SetLastError = 0 != 1)]
+ public static partial void Method3();
}
";
using System.Runtime.InteropServices;
partial class Test
{{
+ [DllImport(""DoesNotExist"", EntryPoint = ""Entry"", ExactSpelling = true)]
+ public static extern int [|Method|](out int ret);
+
[DllImport(""DoesNotExist"", BestFitMapping = false, EntryPoint = ""Entry"")]
public static extern int [|Method1|](out int ret);
partial class Test
{{
[GeneratedDllImport(""DoesNotExist"", EntryPoint = ""Entry"")]
+ public static partial int {{|CS8795:Method|}}(out int ret);
+
+ [GeneratedDllImport(""DoesNotExist"", EntryPoint = ""Entry"")]
public static partial int {{|CS8795:Method1|}}(out int ret);
[GeneratedDllImport(""DoesNotExist"")]
using System.Runtime.InteropServices;
partial class Test
{{
- [DllImport(""DoesNotExist"", SetLastError = true, EntryPoint = ""Entry"", ExactSpelling = true, CharSet = CharSet.Unicode)]
+ [DllImport(""DoesNotExist"", SetLastError = true, EntryPoint = ""Entry"", CharSet = CharSet.Unicode)]
public static extern int [|Method|](out int ret);
}}";
// Fixed source will have CS8795 (Partial method must have an implementation) without generator run
using System.Runtime.InteropServices;
partial class Test
{{
- [GeneratedDllImport(""DoesNotExist"", EntryPoint = ""Entry"", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
+ [GeneratedDllImport(""DoesNotExist"", EntryPoint = ""Entry"", CharSet = CharSet.Unicode, SetLastError = true)]
public static partial int {{|CS8795:Method|}}(out int ret);
}}";
await VerifyCS.VerifyCodeFixAsync(
fixedSource);
}
+ [InlineData(CharSet.Ansi, 'A')]
+ [InlineData(CharSet.Unicode, 'W')]
+ [ConditionalTheory]
+ public async Task ExactSpelling_False_NoAutoCharSet_Provides_No_Suffix_And_Suffix_Fix(CharSet charSet, char suffix)
+ {
+ string source = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ [DllImport(""DoesNotExist"", EntryPoint = ""Entry"", ExactSpelling = false, CharSet = CharSet.{charSet})]
+ public static extern void [|Method|]();
+}}";
+ string fixedSourceNoSuffix = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ [GeneratedDllImport(""DoesNotExist"", EntryPoint = ""Entry"", CharSet = CharSet.{charSet})]
+ public static partial void {{|CS8795:Method|}}();
+}}";
+ await VerifyCS.VerifyCodeFixAsync(source, fixedSourceNoSuffix, "ConvertToGeneratedDllImport");
+ string fixedSourceWithSuffix = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ [GeneratedDllImport(""DoesNotExist"", EntryPoint = ""Entry{suffix}"", CharSet = CharSet.{charSet})]
+ public static partial void {{|CS8795:Method|}}();
+}}";
+ await VerifyCS.VerifyCodeFixAsync(source, fixedSourceWithSuffix, $"ConvertToGeneratedDllImport{suffix}");
+ }
+
+ [ConditionalFact]
+ public async Task ExactSpelling_False_AutoCharSet_Provides_No_Suffix_And_Both_Suffix_Fixes()
+ {
+ string source = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ [DllImport(""DoesNotExist"", EntryPoint = ""Entry"", ExactSpelling = false, CharSet = CharSet.Auto)]
+ public static extern void [|Method|]();
+}}";
+ string fixedSourceNoSuffix = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ [GeneratedDllImport(""DoesNotExist"", EntryPoint = ""Entry"", CharSet = CharSet.Auto)]
+ public static partial void {{|CS8795:Method|}}();
+}}";
+ await VerifyCS.VerifyCodeFixAsync(source, fixedSourceNoSuffix, "ConvertToGeneratedDllImport");
+ string fixedSourceWithASuffix = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ [GeneratedDllImport(""DoesNotExist"", EntryPoint = ""EntryA"", CharSet = CharSet.Auto)]
+ public static partial void {{|CS8795:Method|}}();
+}}";
+ await VerifyCS.VerifyCodeFixAsync(source, fixedSourceWithASuffix, "ConvertToGeneratedDllImportA");
+ string fixedSourceWithWSuffix = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ [GeneratedDllImport(""DoesNotExist"", EntryPoint = ""EntryW"", CharSet = CharSet.Auto)]
+ public static partial void {{|CS8795:Method|}}();
+}}";
+ await VerifyCS.VerifyCodeFixAsync(source, fixedSourceWithWSuffix, "ConvertToGeneratedDllImportW");
+ }
+
+ [ConditionalFact]
+ public async Task ExactSpelling_False_ImplicitAnsiCharSet_Provides_No_Suffix_And_Suffix_Fix()
+ {
+ string source = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ [DllImport(""DoesNotExist"", EntryPoint = ""Entry"", ExactSpelling = false)]
+ public static extern void [|Method|]();
+}}";
+ string fixedSourceNoSuffix = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ [GeneratedDllImport(""DoesNotExist"", EntryPoint = ""Entry"")]
+ public static partial void {{|CS8795:Method|}}();
+}}";
+ await VerifyCS.VerifyCodeFixAsync(source, fixedSourceNoSuffix, "ConvertToGeneratedDllImport");
+ string fixedSourceWithASuffix = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ [GeneratedDllImport(""DoesNotExist"", EntryPoint = ""EntryA"")]
+ public static partial void {{|CS8795:Method|}}();
+}}";
+ await VerifyCS.VerifyCodeFixAsync(source, fixedSourceWithASuffix, "ConvertToGeneratedDllImportA");
+ }
+
+ [ConditionalFact]
+ public async Task ExactSpelling_False_ConstantNonLiteralEntryPoint()
+ {
+ string source = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ private const string EntryPoint = ""Entry"";
+ [DllImport(""DoesNotExist"", EntryPoint = EntryPoint, CharSet = CharSet.Ansi, ExactSpelling = false)]
+ public static extern void [|Method|]();
+}}";
+ string fixedSourceWithASuffix = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ private const string EntryPoint = ""Entry"";
+ [GeneratedDllImport(""DoesNotExist"", EntryPoint = EntryPoint + ""A"", CharSet = CharSet.Ansi)]
+ public static partial void {{|CS8795:Method|}}();
+}}";
+ await VerifyCS.VerifyCodeFixAsync(source, fixedSourceWithASuffix, "ConvertToGeneratedDllImportA");
+ }
+
+ [ConditionalFact]
+ public async Task Implicit_ExactSpelling_False_Offers_Suffix_Fix()
+ {
+ string source = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ [DllImport(""DoesNotExist"", CharSet = CharSet.Ansi)]
+ public static extern void [|Method|]();
+}}";
+ string fixedSourceWithASuffix = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ [GeneratedDllImport(""DoesNotExist"", EntryPoint = ""MethodA"", CharSet = CharSet.Ansi)]
+ public static partial void {{|CS8795:Method|}}();
+}}";
+ await VerifyCS.VerifyCodeFixAsync(source, fixedSourceWithASuffix, "ConvertToGeneratedDllImportA");
+ }
+
+ [ConditionalFact]
+ public async Task ExactSpelling_False_NameOfEntryPoint()
+ {
+ string source = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ private const string Foo = ""Bar"";
+ [DllImport(""DoesNotExist"", EntryPoint = nameof(Foo), CharSet = CharSet.Ansi, ExactSpelling = false)]
+ public static extern void [|Method|]();
+}}";
+ string fixedSourceWithASuffix = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ private const string Foo = ""Bar"";
+ [GeneratedDllImport(""DoesNotExist"", EntryPoint = nameof(Foo) + ""A"", CharSet = CharSet.Ansi)]
+ public static partial void {{|CS8795:Method|}}();
+}}";
+ await VerifyCS.VerifyCodeFixAsync(source, fixedSourceWithASuffix, "ConvertToGeneratedDllImportA");
+ }
+
+ [ConditionalFact]
+ public async Task ExactSpelling_False_ImplicitEntryPointName()
+ {
+ string source = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ [DllImport(""DoesNotExist"", CharSet = CharSet.Ansi, ExactSpelling = false)]
+ public static extern void [|Method|]();
+}}";
+ string fixedSourceWithASuffix = $@"
+using System.Runtime.InteropServices;
+partial class Test
+{{
+ [GeneratedDllImport(""DoesNotExist"", EntryPoint = ""MethodA"", CharSet = CharSet.Ansi)]
+ public static partial void {{|CS8795:Method|}}();
+}}";
+ await VerifyCS.VerifyCodeFixAsync(source, fixedSourceWithASuffix, "ConvertToGeneratedDllImportA");
+ }
+
[ConditionalFact]
public async Task PreserveSigFalseSignatureModified()
{
}
/// <inheritdoc cref="CodeFixVerifier{TAnalyzer, TCodeFix, TTest, TVerifier}.VerifyCodeFixAsync(string, string)"/>
- public static async Task VerifyCodeFixAsync(string source, string fixedSource)
- => await VerifyCodeFixAsync(source, DiagnosticResult.EmptyDiagnosticResults, fixedSource);
+ public static async Task VerifyCodeFixAsync(string source, string fixedSource, string? fixEquivalenceKey = null)
+ => await VerifyCodeFixAsync(source, DiagnosticResult.EmptyDiagnosticResults, fixedSource, fixEquivalenceKey);
/// <inheritdoc cref="CodeFixVerifier{TAnalyzer, TCodeFix, TTest, TVerifier}.VerifyCodeFixAsync(string, DiagnosticResult, string)"/>
- public static async Task VerifyCodeFixAsync(string source, DiagnosticResult expected, string fixedSource)
- => await VerifyCodeFixAsync(source, new[] { expected }, fixedSource);
+ public static async Task VerifyCodeFixAsync(string source, DiagnosticResult expected, string fixedSource, string? fixEquivalenceKey = null)
+ => await VerifyCodeFixAsync(source, new[] { expected }, fixedSource, fixEquivalenceKey);
/// <inheritdoc cref="CodeFixVerifier{TAnalyzer, TCodeFix, TTest, TVerifier}.VerifyCodeFixAsync(string, DiagnosticResult[], string)"/>
- public static async Task VerifyCodeFixAsync(string source, DiagnosticResult[] expected, string fixedSource)
+ public static async Task VerifyCodeFixAsync(string source, DiagnosticResult[] expected, string fixedSource, string? fixEquivalenceKey = null)
{
var test = new Test
{
TestCode = source,
FixedCode = fixedSource,
+ CodeActionEquivalenceKey = fixEquivalenceKey,
};
test.ExpectedDiagnostics.AddRange(expected);