* Remove all DLLIMPORTGENERATOR_ENABLED usage.
* Explicitly set EnableDllImportGenerator to true in test project.
<PropertyGroup>
<EnableDllImportGenerator Condition="'$(EnableDllImportGenerator)' == ''
and '$(MSBuildProjectName)' == 'System.Private.CoreLib'">true</EnableDllImportGenerator>
- <SetDllImportGeneratorConstants>false</SetDllImportGeneratorConstants>
<IncludeDllImportGeneratorSources Condition="'$(IncludeDllImportGeneratorSources)' == ''">true</IncludeDllImportGeneratorSources>
</PropertyGroup>
<ItemGroup>
CRYPT_VERIFYCONTEXT = 0xF0000000 // CRYPT_VERIFYCONTEXT
}
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Advapi32, EntryPoint = "CryptAcquireContextW", CharSet = CharSet.Unicode, SetLastError = true)]
public static partial bool CryptAcquireContext(
-#else
- [DllImport(Libraries.Advapi32, EntryPoint = "CryptAcquireContextW", CharSet = CharSet.Unicode, SetLastError = true)]
- public static extern bool CryptAcquireContext(
-#endif
out SafeProvHandle phProv,
string? szContainer,
string? szProvider,
{
internal static partial class Advapi32
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
public static partial bool CryptDestroyHash(IntPtr hHash);
-#else
- [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
- public static extern bool CryptDestroyHash(IntPtr hHash);
-#endif
}
}
{
internal static partial class Advapi32
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
public static partial bool CryptDestroyKey(IntPtr hKey);
-#else
- [DllImport(Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
- public static extern bool CryptDestroyKey(IntPtr hKey);
-#endif
}
}
PP_UNIQUE_CONTAINER = 36
}
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
public static partial bool CryptSetProvParam(
-#else
- [DllImport(Libraries.Advapi32, SetLastError = true)]
- public static extern bool CryptSetProvParam(
-#endif
SafeHandle safeProvHandle,
CryptProvParam dwParam,
IntPtr pbData,
int dwFlags);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
public static partial bool CryptSetProvParam(
-#else
- [DllImport(Libraries.Advapi32, SetLastError = true)]
- public static extern bool CryptSetProvParam(
-#endif
SafeProvHandle hProv,
CryptProvParam dwParam,
ref IntPtr pbData,
int dwFlags);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
public static partial bool CryptGetProvParam(
-#else
- [DllImport(Libraries.Advapi32, SetLastError = true)]
- public static extern bool CryptGetProvParam(
-#endif
SafeHandle safeProvHandle,
CryptProvParam dwParam,
IntPtr pbData,
{
internal static partial class Advapi32
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Advapi32, SetLastError = true)]
public static partial bool CryptReleaseContext(
-#else
- [DllImport(Libraries.Advapi32, SetLastError = true)]
- public static extern bool CryptReleaseContext(
-#endif
IntPtr hProv,
int dwFlags);
}
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use EncryptFile.
/// </summary>
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Advapi32, EntryPoint = "EncryptFileW", CharSet = CharSet.Unicode, SetLastError = true)]
private static partial bool EncryptFilePrivate(string lpFileName);
-#else
- [DllImport(Libraries.Advapi32, EntryPoint = "EncryptFileW", CharSet = CharSet.Unicode, SetLastError = true)]
- private static extern bool EncryptFilePrivate(string lpFileName);
-#endif
internal static bool EncryptFile(string path)
{
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use DecryptFile.
/// </summary>
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Advapi32, EntryPoint = "DecryptFileW", CharSet = CharSet.Unicode, SetLastError = true)]
private static partial bool DecryptFileFilePrivate(
-#else
- [DllImport(Libraries.Advapi32, EntryPoint = "DecryptFileW", CharSet = CharSet.Unicode, SetLastError = true)]
- private static extern bool DecryptFileFilePrivate(
-#endif
string lpFileName,
int dwReserved);
{
internal static partial class Advapi32
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.Advapi32, SetLastError = true)]
internal static partial bool OpenProcessToken(
-#else
- [DllImport(Interop.Libraries.Advapi32, SetLastError = true)]
- internal static extern bool OpenProcessToken(
-#endif
IntPtr ProcessToken,
TokenAccessLevels DesiredAccess,
out SafeAccessTokenHandle TokenHandle);
{
internal static partial class Crypt32
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool CertCloseStore(IntPtr hCertStore, uint dwFlags);
-#else
- [DllImport(Interop.Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern bool CertCloseStore(IntPtr hCertStore, uint dwFlags);
-#endif
}
}
{
internal static partial class Crypt32
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial SafeCertContextHandle CertDuplicateCertificateContext(IntPtr pCertContext);
-#else
- [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern SafeCertContextHandle CertDuplicateCertificateContext(IntPtr pCertContext);
-#endif
}
}
{
internal static partial class Crypt32
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
public static unsafe partial CERT_CONTEXT* CertEnumCertificatesInStore(
-#else
- [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
- public static unsafe extern CERT_CONTEXT* CertEnumCertificatesInStore(
-#endif
IntPtr hCertStore,
CERT_CONTEXT* pPrevCertContext);
}
internal static partial class Crypt32
{
// Note: This api always return TRUE, regardless of success.
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool CertFreeCertificateContext(IntPtr pCertContext);
-#else
- [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern bool CertFreeCertificateContext(IntPtr pCertContext);
-#endif
}
}
{
internal static partial class Crypt32
{
-#if DLLIMPORTGENERATOR_ENABLED
-
[GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool CertGetCertificateContextProperty(
SafeCertContextHandle pCertContext,
CertContextPropId dwPropId,
out DATA_BLOB pvData,
ref int pcbData);
-
-#else
-
- [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern bool CertGetCertificateContextProperty(
- SafeCertContextHandle pCertContext,
- CertContextPropId dwPropId,
- [Out] byte[]? pvData,
- [In, Out] ref int pcbData);
-
- [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern bool CertGetCertificateContextProperty(
- SafeCertContextHandle pCertContext,
- CertContextPropId dwPropId,
- out IntPtr pvData,
- [In, Out] ref int pcbData);
-
- [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern bool CertGetCertificateContextProperty(
- SafeCertContextHandle pCertContext,
- CertContextPropId dwPropId,
- [Out] out DATA_BLOB pvData,
- [In, Out] ref int pcbData);
-
-#endif
}
}
{
internal static partial class Crypt32
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool CertGetCertificateContextProperty(
SafeCertContextHandle pCertContext,
CertContextPropId dwPropId,
byte[] pvData,
ref int pcbData);
-#else
- [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern bool CertGetCertificateContextProperty(
- SafeCertContextHandle pCertContext,
- CertContextPropId dwPropId,
- [Out] byte[] pvData,
- [In, Out] ref int pcbData);
-#endif
}
}
{
internal static partial class Crypt32
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Crypt32, EntryPoint = "CertNameToStrW", CharSet = CharSet.Unicode, SetLastError = true)]
internal static unsafe partial int CertNameToStr(
-#else
- [DllImport(Libraries.Crypt32, EntryPoint = "CertNameToStrW", CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern unsafe int CertNameToStr(
-#endif
int dwCertEncodingType,
void* pName,
int dwStrType,
{
internal static partial class Crypt32
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
internal static partial bool CryptMsgClose(IntPtr hCryptMsg);
-#else
- [DllImport(Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern bool CryptMsgClose(IntPtr hCryptMsg);
-#endif
}
}
{
internal static partial class Crypt32
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CryptMsgGetParam(
-#else
- [DllImport(Libraries.Crypt32, SetLastError = true)]
- internal static extern bool CryptMsgGetParam(
-#endif
SafeCryptMsgHandle hCryptMsg,
CryptMsgParamType dwParamType,
int dwIndex,
out int pvData,
ref int pcbData);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static unsafe partial bool CryptMsgGetParam(
-#else
- [DllImport(Libraries.Crypt32, SetLastError = true)]
- internal static unsafe extern bool CryptMsgGetParam(
-#endif
SafeCryptMsgHandle hCryptMsg,
CryptMsgParamType dwParamType,
int dwIndex,
byte* pvData,
ref int pcbData);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CryptMsgGetParam(
-#else
- [DllImport(Libraries.Crypt32, SetLastError = true)]
- internal static extern bool CryptMsgGetParam(
-#endif
SafeCryptMsgHandle hCryptMsg,
CryptMsgParamType dwParamType,
int dwIndex,
out CryptMsgType pvData,
ref int pcbData);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Crypt32, SetLastError = true)]
internal static partial bool CryptMsgGetParam(
-#else
- [DllImport(Libraries.Crypt32, SetLastError = true)]
- internal static extern bool CryptMsgGetParam(
-#endif
SafeCryptMsgHandle hCryptMsg,
CryptMsgParamType dwParamType,
int dwIndex,
{
internal static partial class Crypt32
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static partial bool CertFreeCertificateContext(IntPtr pCertContext);
-#else
- [DllImport(Interop.Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool CertFreeCertificateContext(IntPtr pCertContext);
-#endif
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static partial bool CertVerifyCertificateChainPolicy(
-#else
- [DllImport(Interop.Libraries.Crypt32, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool CertVerifyCertificateChainPolicy(
-#endif
IntPtr pszPolicyOID,
SafeX509ChainHandle pChainContext,
ref CERT_CHAIN_POLICY_PARA pPolicyPara,
/// <summary>
/// WARNING: This method does not implicitly handle long paths. Use CreateFile.
/// </summary>
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateFileW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
private static unsafe partial SafeFileHandle CreateFilePrivate(
-#else
- [DllImport(Libraries.Kernel32, EntryPoint = "CreateFileW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
- private static unsafe extern SafeFileHandle CreateFilePrivate(
-#endif
string lpFileName,
int dwDesiredAccess,
FileShare dwShareMode,
{
internal static partial class Kernel32
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static partial bool FlushFileBuffers(SafeHandle hHandle);
-#else
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool FlushFileBuffers(SafeHandle hHandle);
-#endif
}
}
{
internal static partial class Kernel32
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial bool GetConsoleMode(IntPtr handle, out int mode);
-#else
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern bool GetConsoleMode(IntPtr handle, out int mode);
-#endif
internal static bool IsGetConsoleModeCallSuccessful(IntPtr handle)
{
return GetConsoleMode(handle, out mode);
}
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial bool SetConsoleMode(IntPtr handle, int mode);
-#else
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern bool SetConsoleMode(IntPtr handle, int mode);
-#endif
internal const int ENABLE_PROCESSED_INPUT = 0x0001;
internal const uint ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004;
{
internal static partial class Kernel32
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static partial int GetFileType(SafeHandle hFile);
-#else
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern int GetFileType(SafeHandle hFile);
-#endif
}
}
{
internal static partial class Kernel32
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static unsafe partial int ReadFile(
-#else
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe int ReadFile(
-#endif
SafeHandle handle,
byte* bytes,
int numBytesToRead,
{
internal static partial class Kernel32
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static unsafe partial int ReadFile(
-#else
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe int ReadFile(
-#endif
SafeHandle handle,
byte* bytes,
int numBytesToRead,
IntPtr numBytesRead_mustBeZero,
NativeOverlapped* overlapped);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static unsafe partial int ReadFile(
-#else
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe int ReadFile(
-#endif
SafeHandle handle,
byte* bytes,
int numBytesToRead,
internal const int CTRL_LOGOFF_EVENT = 5;
internal const int CTRL_SHUTDOWN_EVENT = 6;
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static unsafe partial bool SetConsoleCtrlHandler(delegate* unmanaged<int, BOOL> handler, bool Add);
-#else
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe bool SetConsoleCtrlHandler(delegate* unmanaged<int, BOOL> HandlerRoutine, bool Add);
-#endif
}
}
// struct in a callback (or an EndWrite method called by that callback),
// and pass in an address for the numBytesRead parameter.
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static unsafe partial int WriteFile(
-#else
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe int WriteFile(
-#endif
SafeHandle handle,
byte* bytes,
int numBytesToWrite,
// simultaneously: overlapped IO, free the memory for the overlapped
// struct in a callback (or an EndWrite method called by that callback),
// and pass in an address for the numBytesRead parameter.
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static unsafe partial int WriteFile(
-#else
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe int WriteFile(
-#endif
SafeHandle handle,
byte* bytes,
int numBytesToWrite,
IntPtr numBytesWritten_mustBeZero,
NativeOverlapped* lpOverlapped);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
internal static unsafe partial int WriteFile(
-#else
- [DllImport(Libraries.Kernel32, SetLastError = true)]
- internal static extern unsafe int WriteFile(
-#endif
SafeHandle handle,
byte* bytes,
int numBytesToWrite,
{
internal static partial class NCrypt
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)]
internal static unsafe partial ErrorCode NCryptGetProperty(
-#else
- [DllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)]
- internal static extern unsafe ErrorCode NCryptGetProperty(
-#endif
SafeNCryptHandle hObject,
string pszProperty,
void* pbOutput,
out int pcbResult,
CngPropertyOptions dwFlags);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)]
internal static unsafe partial ErrorCode NCryptSetProperty(
-#else
- [DllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)]
- internal static extern unsafe ErrorCode NCryptSetProperty(
-#endif
SafeNCryptHandle hObject,
string pszProperty,
void* pbInput,
{
internal static partial class WinHttp
{
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
public static partial SafeWinHttpHandle WinHttpOpen(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- public static extern SafeWinHttpHandle WinHttpOpen(
-#endif
IntPtr userAgent,
uint accessType,
string? proxyName,
string? proxyBypass, int flags);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpCloseHandle(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpCloseHandle(
-#endif
IntPtr handle);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
public static partial SafeWinHttpHandle WinHttpConnect(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- public static extern SafeWinHttpHandle WinHttpConnect(
-#endif
SafeWinHttpHandle sessionHandle,
string serverName,
ushort serverPort,
uint reserved);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
public static partial SafeWinHttpHandle WinHttpOpenRequest(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- public static extern SafeWinHttpHandle WinHttpOpenRequest(
-#endif
SafeWinHttpHandle connectHandle,
string verb,
string objectName,
uint headersLength,
uint modifiers);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpAddRequestHeaders(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpAddRequestHeaders(
-#endif
SafeWinHttpHandle requestHandle,
string headers,
uint headersLength,
uint modifiers);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpSendRequest(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpSendRequest(
-#endif
SafeWinHttpHandle requestHandle,
IntPtr headers,
uint headersLength,
uint totalLength,
IntPtr context);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpReceiveResponse(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpReceiveResponse(
-#endif
SafeWinHttpHandle requestHandle,
IntPtr reserved);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpQueryDataAvailable(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpQueryDataAvailable(
-#endif
SafeWinHttpHandle requestHandle,
IntPtr parameterIgnoredAndShouldBeNullForAsync);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpReadData(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpReadData(
-#endif
SafeWinHttpHandle requestHandle,
IntPtr buffer,
uint bufferSize,
IntPtr parameterIgnoredAndShouldBeNullForAsync);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpQueryHeaders(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpQueryHeaders(
-#endif
SafeWinHttpHandle requestHandle,
uint infoLevel,
string name,
ref uint bufferLength,
ref uint index);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpQueryHeaders(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpQueryHeaders(
-#endif
SafeWinHttpHandle requestHandle,
uint infoLevel,
string name,
ref uint bufferLength,
IntPtr index);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpQueryOption(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpQueryOption(
-#endif
SafeWinHttpHandle handle,
uint option,
ref IntPtr buffer,
ref uint bufferSize);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpQueryOption(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpQueryOption(
-#endif
SafeWinHttpHandle handle,
uint option,
IntPtr buffer,
ref uint bufferSize);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpQueryOption(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpQueryOption(
-#endif
SafeWinHttpHandle handle,
uint option,
ref uint buffer,
ref uint bufferSize);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpWriteData(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpWriteData(
-#endif
SafeWinHttpHandle requestHandle,
IntPtr buffer,
uint bufferSize,
IntPtr parameterIgnoredAndShouldBeNullForAsync);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpSetOption(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpSetOption(
-#endif
SafeWinHttpHandle handle,
uint option,
ref uint optionData,
uint optionLength = sizeof(uint));
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpSetOption(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpSetOption(
-#endif
SafeWinHttpHandle handle,
uint option,
IntPtr optionData,
uint optionLength);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpSetCredentials(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpSetCredentials(
-#endif
SafeWinHttpHandle requestHandle,
uint authTargets,
uint authScheme,
string? password,
IntPtr reserved);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpQueryAuthSchemes(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpQueryAuthSchemes(
-#endif
SafeWinHttpHandle requestHandle,
out uint supportedSchemes,
out uint firstScheme,
out uint authTarget);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpSetTimeouts(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpSetTimeouts(
-#endif
SafeWinHttpHandle handle,
int resolveTimeout,
int connectTimeout,
int sendTimeout,
int receiveTimeout);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool WinHttpGetIEProxyConfigForCurrentUser(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- [return: MarshalAs(UnmanagedType.Bool)]
- public static extern bool WinHttpGetIEProxyConfigForCurrentUser(
-#endif
out WINHTTP_CURRENT_USER_IE_PROXY_CONFIG proxyConfig);
[DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
ref WINHTTP_AUTOPROXY_OPTIONS autoProxyOptions,
out WINHTTP_PROXY_INFO proxyInfo);
-#if DLLIMPORTGENERATOR_ENABLED
[GeneratedDllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
public static partial IntPtr WinHttpSetStatusCallback(
-#else
- [DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
- public static extern IntPtr WinHttpSetStatusCallback(
-#endif
SafeWinHttpHandle handle,
WINHTTP_STATUS_CALLBACK callback,
uint notificationFlags,
<!-- Use targeting pack references instead of granular ones in the project file. -->
<DisableImplicitAssemblyReferences>false</DisableImplicitAssemblyReferences>
<IncludePlatformAttributes>true</IncludePlatformAttributes>
+ <EnableDllImportGenerator>true</EnableDllImportGenerator>
<PackageDescription>Console logger provider implementation for Microsoft.Extensions.Logging.</PackageDescription>
</PropertyGroup>
<PackageReference Include="System.Buffers" Version="$(SystemBuffersVersion)" />
</ItemGroup>
+ <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
+ <ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.CompilerServices.Unsafe\src\System.Runtime.CompilerServices.Unsafe.ilproj" />
+ </ItemGroup>
+
<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.DependencyInjection.Abstractions\src\Microsoft.Extensions.DependencyInjection.Abstractions.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Extensions.Logging\src\Microsoft.Extensions.Logging.csproj" />
<Reference Include="System.Collections" />
<Reference Include="System.Collections.Concurrent" Condition="'$(TargetsUnix)' == 'true'" />
<Reference Include="System.ComponentModel.Primitives" />
- <Reference Include="System.Memory" Condition="'$(TargetPlatformIdentifier)' == 'windows'" />
+ <Reference Include="System.Memory" />
<Reference Include="System.Net.Primitives" />
<Reference Include="System.Net.Sockets" Condition="'$(TargetsUnix)' == 'true'" />
<Reference Include="System.Runtime" />
+ <Reference Include="System.Runtime.CompilerServices.Unsafe" />
<Reference Include="System.Runtime.InteropServices" />
<Reference Include="System.Runtime.InteropServices.RuntimeInformation" Condition="'$(TargetsUnix)' == 'true'" />
<Reference Include="System.Text.Encoding.Extensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Primitives" />
<Reference Include="System.Runtime" />
+ <Reference Include="System.Runtime.CompilerServices.Unsafe" />
<Reference Include="System.Runtime.InteropServices" />
<Reference Include="System.Security.Cryptography.Encoding" />
<Reference Include="System.Security.Cryptography.X509Certificates" />
<StringResourcesPath>../../src/Resources/Strings.resx</StringResourcesPath>
<TargetFrameworks>$(NetCoreAppCurrent)-windows</TargetFrameworks>
<DefineConstants>UNITTEST</DefineConstants>
+ <EnableDllImportGenerator>true</EnableDllImportGenerator>
<Nullable>annotations</Nullable>
</PropertyGroup>
<ItemGroup>
-->
<CompilerVisibleProperty Include="DllImportGenerator_UseInternalUnsafeType" />
</ItemGroup>
- <PropertyGroup Condition="'$(SetDllImportGeneratorConstants)' != 'false'">
- <DefineConstants>$(DefineConstants);DLLIMPORTGENERATOR_ENABLED</DefineConstants>
- </PropertyGroup>
</Project>
<Reference Include="System.Memory" />
<Reference Include="System.Resources.ResourceManager" />
<Reference Include="System.Runtime" />
+ <Reference Include="System.Runtime.CompilerServices.Unsafe" />
<Reference Include="System.Runtime.Extensions" />
<Reference Include="System.Runtime.InteropServices" />
<Reference Include="System.Runtime.InteropServices.RuntimeInformation" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <Nullable>annotations</Nullable>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);$(NetCoreAppMinimum)-windows;$(NetCoreAppMinimum)</TargetFrameworks>
<IsPackable>true</IsPackable>
<PackageDescription>Provides miscellaneous Windows-specific types
<Reference Include="System.Memory" />
<Reference Include="System.Net.Requests" />
<Reference Include="System.Resources.ResourceManager" />
+ <Reference Include="System.Runtime.CompilerServices.Unsafe" />
<Reference Include="System.Runtime.Extensions" />
<Reference Include="System.Runtime.InteropServices" />
<Reference Include="System.Runtime" />