Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inconsistency in p/invoke arguments introduced when switching some to be blittable #61071

Merged
merged 1 commit into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -11,8 +11,8 @@ internal static partial class Interop
{
internal static partial class NetSecurityNative
{
[DllImport(Interop.Libraries.NetSecurityNative, EntryPoint="NetSecurityNative_ReleaseGssBuffer")]
internal static extern void ReleaseGssBuffer(
[GeneratedDllImport(Interop.Libraries.NetSecurityNative, EntryPoint="NetSecurityNative_ReleaseGssBuffer")]
internal static partial void ReleaseGssBuffer(
IntPtr bufferPtr,
ulong length);

Expand Down Expand Up @@ -42,10 +42,10 @@ internal static partial Status ImportPrincipalName(
int inputNameByteCount,
out SafeGssNameHandle outputName);

[DllImport(Interop.Libraries.NetSecurityNative, EntryPoint="NetSecurityNative_ReleaseName")]
internal static unsafe extern Status ReleaseName(
Status* minorStatus,
IntPtr* inputName);
[GeneratedDllImport(Interop.Libraries.NetSecurityNative, EntryPoint="NetSecurityNative_ReleaseName")]
internal static partial Status ReleaseName(
out Status minorStatus,
ref IntPtr inputName);

[GeneratedDllImport(Interop.Libraries.NetSecurityNative, EntryPoint="NetSecurityNative_AcquireAcceptorCred")]
internal static partial Status AcquireAcceptorCred(
Expand All @@ -67,10 +67,10 @@ internal static partial Status InitiateCredWithPassword(
int passwordLen,
out SafeGssCredHandle outputCredHandle);

[DllImport(Interop.Libraries.NetSecurityNative, EntryPoint="NetSecurityNative_ReleaseCred")]
internal static unsafe extern Status ReleaseCred(
Status* minorStatus,
IntPtr* credHandle);
[GeneratedDllImport(Interop.Libraries.NetSecurityNative, EntryPoint="NetSecurityNative_ReleaseCred")]
internal static partial Status ReleaseCred(
out Status minorStatus,
ref IntPtr credHandle);

[GeneratedDllImport(Interop.Libraries.NetSecurityNative, EntryPoint="NetSecurityNative_InitSecContext")]
internal static partial Status InitSecContext(
Expand Down Expand Up @@ -113,10 +113,10 @@ internal static partial Status AcceptSecContext(
out uint retFlags,
out bool isNtlmUsed);

[DllImport(Interop.Libraries.NetSecurityNative, EntryPoint="NetSecurityNative_DeleteSecContext")]
internal static unsafe extern Status DeleteSecContext(
Status* minorStatus,
IntPtr* contextHandle);
[GeneratedDllImport(Interop.Libraries.NetSecurityNative, EntryPoint="NetSecurityNative_DeleteSecContext")]
internal static partial Status DeleteSecContext(
out Status minorStatus,
ref IntPtr contextHandle);

[GeneratedDllImport(Interop.Libraries.NetSecurityNative, EntryPoint="NetSecurityNative_GetUser")]
internal static partial Status GetUser(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,12 @@ public override bool IsInvalid
get { return handle == IntPtr.Zero; }
}

protected override unsafe bool ReleaseHandle()
protected override bool ReleaseHandle()
{
Interop.NetSecurityNative.Status minorStatus;
fixed (IntPtr* handleRef = &handle)
{
Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseName(&minorStatus, handleRef);
SetHandle(IntPtr.Zero);
return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE;
}
Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseName(out minorStatus, ref handle);
SetHandle(IntPtr.Zero);
return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE;
}

public SafeGssNameHandle()
Expand Down Expand Up @@ -144,15 +141,12 @@ public override bool IsInvalid
get { return handle == IntPtr.Zero; }
}

protected override unsafe bool ReleaseHandle()
protected override bool ReleaseHandle()
{
Interop.NetSecurityNative.Status minorStatus;
fixed (IntPtr* handlePtr = &handle)
{
Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseCred(&minorStatus, handlePtr);
SetHandle(IntPtr.Zero);
return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE;
}
Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseCred(out minorStatus, ref handle);
SetHandle(IntPtr.Zero);
return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE;
}

private static bool InitIsNtlmInstalled()
Expand All @@ -176,12 +170,9 @@ public override bool IsInvalid
protected override unsafe bool ReleaseHandle()
{
Interop.NetSecurityNative.Status minorStatus;
fixed (IntPtr* handlePtr = &handle)
{
Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.DeleteSecContext(&minorStatus, handlePtr);
SetHandle(IntPtr.Zero);
return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE;
}
Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.DeleteSecContext(out minorStatus, ref handle);
SetHandle(IntPtr.Zero);
return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE;
}
}
}