Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
10f15f7
System.Private.CoreLib
reflectronic Jun 20, 2021
61340eb
System.Net.Security
reflectronic Jun 20, 2021
96d410b
System.Net.NameResolution
reflectronic Jun 20, 2021
f93fe74
System.Net.NetworkInformation
reflectronic Jun 20, 2021
6badbdd
System.Net.Quic
reflectronic Jun 20, 2021
d2b561f
System.Net.HttpListener
reflectronic Jun 20, 2021
38824c5
nint casts
reflectronic Jun 20, 2021
8ec610e
System.Text.Encoding.CodePages
reflectronic Jun 20, 2021
2db0e86
intptr casts
reflectronic Jun 20, 2021
658bf85
System.Speech
reflectronic Jun 20, 2021
0930248
System.ServiceProcess.ServiceController
reflectronic Jun 20, 2021
89ded43
NativeMemoryHelper in System.Speech
reflectronic Jun 20, 2021
340735a
NativeMemoryHelper System.Text.Encoding.CodePages
reflectronic Jun 20, 2021
7038fca
Crypto
reflectronic Jun 20, 2021
453f15e
System.Reflection.Metadata
reflectronic Jun 20, 2021
325b20d
System.Net.Http.WinHttpHandler
reflectronic Jun 20, 2021
36c48a4
System.Management
reflectronic Jun 20, 2021
09d0361
System.Diagnostics.EventLog
reflectronic Jun 20, 2021
190fb6b
System.Drawing.Common
reflectronic Jun 20, 2021
673925a
System.DirectoryServices.Protocols
reflectronic Jun 20, 2021
29e37a5
System.DirectoryServices.AccountManagement
reflectronic Jun 20, 2021
2510792
System.DirectoryServices
reflectronic Jun 20, 2021
935a77a
System.Data.Odbc
reflectronic Jun 20, 2021
68a9dc7
System.Diagnostics.PerformanceCounter
reflectronic Jun 20, 2021
443c362
more System.Drawing.Common
reflectronic Jun 20, 2021
5dd3cf6
more System.Private.CoreLib
reflectronic Jun 21, 2021
8783e8c
Fix build break
reflectronic Jun 21, 2021
3184c15
Fix additional embarrassing mistakes
reflectronic Jun 21, 2021
6a0746a
Fix mistake
reflectronic Jun 21, 2021
59cfa9b
fixing
reflectronic Jun 21, 2021
f8d77c2
fix project files
reflectronic Jun 21, 2021
8bc626d
powershell doesn't know how to preserve BOM
reflectronic Jun 21, 2021
d52bb61
fix project files
reflectronic Jun 23, 2021
aa86b70
does SRM csproj have BOM?
reflectronic Jun 23, 2021
e6b6e8e
more csproj fixes
reflectronic Jun 23, 2021
f0fb97a
one last time
reflectronic Jun 23, 2021
3423d98
Some changes
reflectronic Jun 23, 2021
b5dd0da
revert System.DirectoryServices.Protocols
reflectronic Jun 30, 2021
8a1f781
revert System.DirectoryServices.AccountManagement
reflectronic Jun 30, 2021
6fe4d7c
revert System.DirectoryServices
reflectronic Jun 30, 2021
c2275fc
fix corelib and other stuff
reflectronic Jun 30, 2021
068248c
revert System.Drawing.Common
reflectronic Jun 30, 2021
b875528
fix SafeNativeMemoryHandle
reflectronic Jun 30, 2021
f89bc04
Sysem.Text.Encoding.CodePages safenativememoryhandle
reflectronic Jun 30, 2021
2a961d3
fixxxx
reflectronic Jun 30, 2021
1b0f51a
do it again
reflectronic Jun 30, 2021
af272a8
Improve crypto
reflectronic Jun 30, 2021
a2042c6
EventLog and other stuff
reflectronic Jul 14, 2021
6e57302
misc other updates
reflectronic Jul 14, 2021
db1ee0c
Back out System.ServiceProcess
reflectronic Jul 14, 2021
e79d136
final fix perhaps
reflectronic Jul 14, 2021
b7c3292
Merge branch 'main' into replace-allochglobal
reflectronic Jul 14, 2021
7156b1e
source.dot.net lied to me
reflectronic Jul 14, 2021
3ea5947
Update MsQuicStream.cs
reflectronic Jul 14, 2021
fc6147a
fix
reflectronic Jul 14, 2021
1b3e561
Compile errors
reflectronic Jul 30, 2021
1f60dbf
Another fix
reflectronic Jul 30, 2021
852508b
Fix
reflectronic Jul 30, 2021
332e3aa
add unsafe
reflectronic Jul 30, 2021
de3481e
revert ldap interop
reflectronic Jul 30, 2021
8d3fbdd
temp change
reflectronic Jul 30, 2021
c31c674
improvement
reflectronic Jul 30, 2021
8a12cec
add unsafe
reflectronic Jul 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ internal static X509Certificate2[] X509ChainGetCertificates(SafeX509ChainContext
}

[StructLayout(LayoutKind.Sequential)]
internal struct ValidationError
internal unsafe struct ValidationError
{
public IntPtr Message; // UTF-16 string
public char* Message; // UTF-16 string
public int Index;
public int Status;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal static unsafe void Sysctl(Span<int> name, ref byte* value, ref int len)

private static unsafe void Sysctl(int* name, int name_len, ref byte* value, ref int len)
{
IntPtr bytesLength = (IntPtr)len;
var bytesLength = (nint)len;
int ret = -1;
bool autoSize = (value == null && len == 0);

Expand All @@ -45,36 +45,36 @@ private static unsafe void Sysctl(int* name, int name_len, ref byte* value, ref
{
throw new InvalidOperationException(SR.Format(SR.InvalidSysctl, *name, Marshal.GetLastWin32Error()));
}
value = (byte*)Marshal.AllocHGlobal((int)bytesLength);
value = (byte*)NativeMemory.Alloc((nuint)bytesLength);
}

ret = Sysctl(name, name_len, value, &bytesLength);
while (autoSize && ret != 0 && GetLastErrorInfo().Error == Error.ENOMEM)
{
// Do not use ReAllocHGlobal() here: we don't care about
// Do not use Realloc here: we don't care about
// previous contents, and proper checking of value returned
// will make code more complex.
Marshal.FreeHGlobal((IntPtr)value);
NativeMemory.Free(value);
if ((int)bytesLength == int.MaxValue)
{
throw new OutOfMemoryException();
}
if ((int)bytesLength >= int.MaxValue / 2)
{
bytesLength = (IntPtr)int.MaxValue;
bytesLength = int.MaxValue;
}
else
{
bytesLength = (IntPtr)((int)bytesLength * 2);
bytesLength = ((int)bytesLength * 2);
}
value = (byte*)Marshal.AllocHGlobal(bytesLength);
value = (byte*)NativeMemory.Alloc((nuint)bytesLength);
ret = Sysctl(name, name_len, value, &bytesLength);
}
if (ret != 0)
{
if (autoSize)
{
Marshal.FreeHGlobal((IntPtr)value);
NativeMemory.Free(value);
}
throw new InvalidOperationException(SR.Format(SR.InvalidSysctl, *name, Marshal.GetLastWin32Error()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static int ber_printf_int(SafeBerHandle berElement, string format, int va
[DllImport(Libraries.OpenLdap, EntryPoint = "ber_put_boolean", CharSet = CharSet.Ansi)]
public static extern int ber_put_boolean(SafeBerHandle berElement, int value, nuint tag);

public static int ber_printf_bytearray(SafeBerHandle berElement, string format, HGlobalMemHandle value, nuint length, nuint tag)
public static int ber_printf_bytearray(SafeBerHandle berElement, string format, NativeMemoryHandle value, nuint length, nuint tag)
{
if (format == "o")
{
Expand All @@ -105,13 +105,13 @@ public static int ber_printf_bytearray(SafeBerHandle berElement, string format,
}

[DllImport(Libraries.OpenLdap, EntryPoint = "ber_put_ostring", CharSet = CharSet.Ansi)]
private static extern int ber_put_ostring(SafeBerHandle berElement, HGlobalMemHandle value, nuint length, nuint tag);
private static extern int ber_put_ostring(SafeBerHandle berElement, NativeMemoryHandle value, nuint length, nuint tag);

[DllImport(Libraries.OpenLdap, EntryPoint = "ber_put_string", CharSet = CharSet.Ansi)]
private static extern int ber_put_string(SafeBerHandle berElement, HGlobalMemHandle value, nuint tag);
private static extern int ber_put_string(SafeBerHandle berElement, NativeMemoryHandle value, nuint tag);

[DllImport(Libraries.OpenLdap, EntryPoint = "ber_put_bitstring", CharSet = CharSet.Ansi)]
private static extern int ber_put_bitstring(SafeBerHandle berElement, HGlobalMemHandle value, nuint length, nuint tag);
private static extern int ber_put_bitstring(SafeBerHandle berElement, NativeMemoryHandle value, nuint length, nuint tag);

[DllImport(Libraries.OpenLdap, EntryPoint = "ber_flatten", CharSet = CharSet.Ansi)]
public static extern int ber_flatten(SafeBerHandle berElement, ref IntPtr value);
Expand Down
10 changes: 5 additions & 5 deletions src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ internal static partial class Interop
{
public const string LDAP_SASL_SIMPLE = null;

internal static partial class Ldap
internal static unsafe partial class Ldap
{
static Ldap()
{
Expand Down Expand Up @@ -155,7 +155,7 @@ static Ldap()
internal static extern int ldap_sasl_bind([In] ConnectionHandle ld, string dn, string mechanism, berval cred, IntPtr serverctrls, IntPtr clientctrls, IntPtr servercredp);

[DllImport(Libraries.OpenLdap, EntryPoint = "ldap_sasl_interactive_bind_s", CharSet = CharSet.Ansi)]
internal static extern int ldap_sasl_interactive_bind([In] ConnectionHandle ld, string dn, string mechanism, IntPtr serverctrls, IntPtr clientctrls, uint flags, [MarshalAs(UnmanagedType.FunctionPtr)] LDAP_SASL_INTERACT_PROC proc, IntPtr defaults);
internal static extern int ldap_sasl_interactive_bind([In] ConnectionHandle ld, string dn, string mechanism, IntPtr serverctrls, IntPtr clientctrls, uint flags, [MarshalAs(UnmanagedType.FunctionPtr)] LDAP_SASL_INTERACT_PROC proc, void* defaults);

[DllImport(Libraries.OpenLdap, EntryPoint = "ldap_err2string", CharSet = CharSet.Ansi)]
public static extern IntPtr ldap_err2string(int err);
Expand All @@ -173,7 +173,7 @@ static Ldap()
public static extern IntPtr ldap_first_reference([In] ConnectionHandle ldapHandle, [In] IntPtr result);

[DllImport(Libraries.OpenLdap, EntryPoint = "ldap_create_sort_control", CharSet = CharSet.Ansi)]
public static extern int ldap_create_sort_control(ConnectionHandle handle, IntPtr keys, byte critical, ref IntPtr control);
public static extern int ldap_create_sort_control(ConnectionHandle handle, void** keys, byte critical, ref IntPtr control);

[DllImport(Libraries.OpenLdap, EntryPoint = "ldap_control_free", CharSet = CharSet.Ansi)]
public static extern int ldap_control_free(IntPtr control);
Expand Down Expand Up @@ -212,10 +212,10 @@ static Ldap()
public static extern int ldap_add([In] ConnectionHandle ldapHandle, string dn, IntPtr attrs, IntPtr servercontrol, IntPtr clientcontrol, ref int messageNumber);

[DllImport(Libraries.OpenLdap, EntryPoint = "ldap_delete_ext", CharSet = CharSet.Ansi)]
public static extern int ldap_delete_ext([In] ConnectionHandle ldapHandle, string dn, IntPtr servercontrol, IntPtr clientcontrol, ref int messageNumber);
public static extern int ldap_delete_ext([In] ConnectionHandle ldapHandle, string dn, void** servercontrol, void** clientcontrol, ref int messageNumber);

[DllImport(Libraries.OpenLdap, EntryPoint = "ldap_rename", CharSet = CharSet.Ansi)]
public static extern int ldap_rename([In] ConnectionHandle ldapHandle, string dn, string newRdn, string newParentDn, int deleteOldRdn, IntPtr servercontrol, IntPtr clientcontrol, ref int messageNumber);
public static extern int ldap_rename([In] ConnectionHandle ldapHandle, string dn, string newRdn, string newParentDn, int deleteOldRdn, void** servercontrol, void** clientcontrol, ref int messageNumber);

[DllImport(Libraries.OpenLdap, EntryPoint = "ldap_compare_ext", CharSet = CharSet.Ansi)]
public static extern int ldap_compare([In] ConnectionHandle ldapHandle, string dn, string attributeName, berval binaryValue, IntPtr servercontrol, IntPtr clientcontrol, ref int messageNumber);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private static unsafe void AllocNullTerminatedArray(string[] arr, ref byte** arr

// Allocate the unmanaged array to hold each string pointer.
// It needs to have an extra element to null terminate the array.
arrPtr = (byte**)Marshal.AllocHGlobal(sizeof(IntPtr) * arrLength);
arrPtr = (byte**)NativeMemory.Alloc((uint)(sizeof(IntPtr) * arrLength));
Debug.Assert(arrPtr != null);

// Zero the memory so that if any of the individual string allocations fails,
Expand All @@ -70,10 +70,10 @@ private static unsafe void AllocNullTerminatedArray(string[] arr, ref byte** arr
{
byte[] byteArr = Encoding.UTF8.GetBytes(arr[i]);

arrPtr[i] = (byte*)Marshal.AllocHGlobal(byteArr.Length + 1); //+1 for null termination
arrPtr[i] = (byte*)NativeMemory.Alloc((uint)(byteArr.Length + 1u)); //+1 for null termination
Debug.Assert(arrPtr[i] != null);

Marshal.Copy(byteArr, 0, (IntPtr)arrPtr[i], byteArr.Length); // copy over the data from the managed byte array
Marshal.Copy(byteArr, 0, (nint)arrPtr[i], byteArr.Length); // copy over the data from the managed byte array
arrPtr[i][byteArr.Length] = (byte)'\0'; // null terminate
}
}
Expand All @@ -87,13 +87,13 @@ private static unsafe void FreeArray(byte** arr, int length)
{
if (arr[i] != null)
{
Marshal.FreeHGlobal((IntPtr)arr[i]);
NativeMemory.Free(arr[i]);
arr[i] = null;
}
}

// And then the array itself
Marshal.FreeHGlobal((IntPtr)arr);
NativeMemory.Free(arr);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal static partial class Advapi32
internal static extern bool ConvertStringSecurityDescriptorToSecurityDescriptor(
string StringSecurityDescriptor,
int StringSDRevision,
out SafeLocalAllocHandle pSecurityDescriptor,
out SafeNativeMemoryHandle pSecurityDescriptor,
IntPtr SecurityDescriptorSize);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ internal static partial class Advapi32
internal static extern bool GetTokenInformation(
SafeAccessTokenHandle TokenHandle,
uint TokenInformationClass,
SafeLocalAllocHandle TokenInformation,
SafeNativeMemoryHandle TokenInformation,
uint TokenInformationLength,
out uint ReturnLength);

[DllImport(Interop.Libraries.Advapi32, SetLastError = true)]
internal static extern bool GetTokenInformation(
IntPtr TokenHandle,
uint TokenInformationClass,
SafeLocalAllocHandle TokenInformation,
SafeNativeMemoryHandle TokenInformation,
uint TokenInformationLength,
out uint ReturnLength);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ internal static partial class Interop
internal static partial class BCrypt
{
[StructLayout(LayoutKind.Sequential)]
internal struct BCRYPT_OAEP_PADDING_INFO
internal unsafe struct BCRYPT_OAEP_PADDING_INFO
{
/// <summary>
/// Null-terminated Unicode string that identifies the hashing algorithm used to create the padding.
/// </summary>
internal IntPtr pszAlgId;
internal char* pszAlgId;

/// <summary>
/// Address of a buffer that contains the data used to create the padding.
Expand All @@ -32,21 +32,21 @@ internal struct BCRYPT_OAEP_PADDING_INFO
}

[StructLayout(LayoutKind.Sequential)]
internal struct BCRYPT_PKCS1_PADDING_INFO
internal unsafe struct BCRYPT_PKCS1_PADDING_INFO
{
/// <summary>
/// Null-terminated Unicode string that identifies the hashing algorithm used to create the padding.
/// </summary>
internal IntPtr pszAlgId;
internal char* pszAlgId;
}

[StructLayout(LayoutKind.Sequential)]
internal struct BCRYPT_PSS_PADDING_INFO
internal unsafe struct BCRYPT_PSS_PADDING_INFO
{
/// <summary>
/// Null-terminated Unicode string that identifies the hashing algorithm used to create the padding.
/// </summary>
internal IntPtr pszAlgId;
internal char* pszAlgId;

/// <summary>
/// The size, in bytes, of the random salt to use for the padding.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,11 @@ internal struct BCryptBuffer
/// Contains a set of generic CNG buffers.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
internal struct BCryptBufferDesc
internal unsafe struct BCryptBufferDesc
{
internal int ulVersion; // Version number
internal int cBuffers; // Number of buffers
internal IntPtr pBuffers; // Pointer to array of BCryptBuffers
internal BCryptBuffer* pBuffers; // Pointer to array of BCryptBuffers
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ internal static extern unsafe uint HttpCreateRequestQueue(HTTPAPI_VERSION versio
internal static extern unsafe uint HttpReceiveHttpRequest(SafeHandle requestQueueHandle, ulong requestId, uint flags, HTTP_REQUEST* pRequestBuffer, uint requestBufferLength, uint* pBytesReturned, NativeOverlapped* pOverlapped);

[DllImport(Libraries.HttpApi, SetLastError = true)]
internal static extern unsafe uint HttpSendHttpResponse(SafeHandle requestQueueHandle, ulong requestId, uint flags, HTTP_RESPONSE* pHttpResponse, void* pCachePolicy, uint* pBytesSent, SafeLocalAllocHandle pRequestBuffer, uint requestBufferLength, NativeOverlapped* pOverlapped, void* pLogData);
internal static extern unsafe uint HttpSendHttpResponse(SafeHandle requestQueueHandle, ulong requestId, uint flags, HTTP_RESPONSE* pHttpResponse, void* pCachePolicy, uint* pBytesSent, SafeNativeMemoryHandle pRequestBuffer, uint requestBufferLength, NativeOverlapped* pOverlapped, void* pLogData);

[DllImport(Libraries.HttpApi, SetLastError = true)]
internal static extern unsafe uint HttpWaitForDisconnect(SafeHandle requestQueueHandle, ulong connectionId, NativeOverlapped* pOverlapped);
Expand All @@ -493,7 +493,7 @@ internal static extern unsafe uint HttpCreateRequestQueue(HTTPAPI_VERSION versio
internal static extern unsafe uint HttpReceiveRequestEntityBody(SafeHandle requestQueueHandle, ulong requestId, uint flags, void* pEntityBuffer, uint entityBufferLength, out uint bytesReturned, NativeOverlapped* pOverlapped);

[DllImport(Libraries.HttpApi, SetLastError = true)]
internal static extern unsafe uint HttpSendResponseEntityBody(SafeHandle requestQueueHandle, ulong requestId, uint flags, ushort entityChunkCount, HTTP_DATA_CHUNK* pEntityChunks, uint* pBytesSent, SafeLocalAllocHandle pRequestBuffer, uint requestBufferLength, NativeOverlapped* pOverlapped, void* pLogData);
internal static extern unsafe uint HttpSendResponseEntityBody(SafeHandle requestQueueHandle, ulong requestId, uint flags, ushort entityChunkCount, HTTP_DATA_CHUNK* pEntityChunks, uint* pBytesSent, SafeNativeMemoryHandle pRequestBuffer, uint requestBufferLength, NativeOverlapped* pOverlapped, void* pLogData);

[DllImport(Libraries.HttpApi, SetLastError = true)]
internal static extern uint HttpCloseRequestQueue(IntPtr pReqQueueHandle);
Expand All @@ -515,17 +515,17 @@ public override int Size
get { return _size; }
}

public static SafeLocalFreeChannelBinding LocalAlloc(int cb)
public static unsafe SafeLocalFreeChannelBinding Alloc(int cb)
{
SafeLocalFreeChannelBinding result = new SafeLocalFreeChannelBinding();
result.SetHandle(Marshal.AllocHGlobal(cb));
result.SetHandle((nint)NativeMemory.Alloc((uint)cb));
result._size = cb;
return result;
}

protected override bool ReleaseHandle()
protected override unsafe bool ReleaseHandle()
{
Marshal.FreeHGlobal(handle);
NativeMemory.Free((void*)(nint)handle);
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ protected override bool ReleaseHandle()

[DllImport(Interop.Libraries.IpHlpApi, SetLastError = true)]
internal static extern uint IcmpSendEcho2(SafeCloseIcmpHandle icmpHandle, SafeWaitHandle Event, IntPtr apcRoutine, IntPtr apcContext,
uint ipAddress, [In] SafeLocalAllocHandle data, ushort dataSize, ref IPOptions options, SafeLocalAllocHandle replyBuffer, uint replySize, uint timeout);
uint ipAddress, [In] SafeNativeMemoryHandle data, ushort dataSize, ref IPOptions options, SafeNativeMemoryHandle replyBuffer, uint replySize, uint timeout);

[DllImport(Interop.Libraries.IpHlpApi, SetLastError = true)]
internal static extern uint Icmp6SendEcho2(SafeCloseIcmpHandle icmpHandle, SafeWaitHandle Event, IntPtr apcRoutine, IntPtr apcContext,
byte[] sourceSocketAddress, byte[] destSocketAddress, [In] SafeLocalAllocHandle data, ushort dataSize, ref IPOptions options, SafeLocalAllocHandle replyBuffer, uint replySize, uint timeout);
byte[] sourceSocketAddress, byte[] destSocketAddress, [In] SafeNativeMemoryHandle data, ushort dataSize, ref IPOptions options, SafeNativeMemoryHandle replyBuffer, uint replySize, uint timeout);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal static partial class NCrypt
internal static extern ErrorCode NCryptOpenKey(SafeNCryptProviderHandle hProvider, out SafeNCryptKeyHandle phKey, string pszKeyName, int dwLegacyKeySpec, CngKeyOpenOptions dwFlags);

[DllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)]
internal static extern ErrorCode NCryptImportKey(SafeNCryptProviderHandle hProvider, IntPtr hImportKey, string pszBlobType, IntPtr pParameterList, [Out] out SafeNCryptKeyHandle phKey, ref byte pbData, int cbData, int dwFlags);
internal static unsafe extern ErrorCode NCryptImportKey(SafeNCryptProviderHandle hProvider, IntPtr hImportKey, string pszBlobType, NCryptBufferDesc* pParameterList, [Out] out SafeNCryptKeyHandle phKey, ref byte pbData, int cbData, int dwFlags);

[DllImport(Interop.Libraries.NCrypt, CharSet = CharSet.Unicode)]
internal static extern ErrorCode NCryptImportKey(SafeNCryptProviderHandle hProvider, IntPtr hImportKey, string pszBlobType, ref NCryptBufferDesc pParameterList, [Out] out SafeNCryptKeyHandle phKey, ref byte pbData, int cbData, int dwFlags);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ public static extern bool WinHttpQueryOption(

[DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool WinHttpQueryOption(
public static extern unsafe bool WinHttpQueryOption(
SafeWinHttpHandle handle,
uint option,
IntPtr buffer,
void* buffer,
ref uint bufferSize);

[DllImport(Interop.Libraries.WinHttp, CharSet = CharSet.Unicode, SetLastError = true)]
Expand Down
Loading