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

change win32 to derived types #53146

Closed
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
10 changes: 5 additions & 5 deletions src/libraries/Common/src/Interop/Windows/SspiCli/SSPIWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal static SecurityPackageInfoClass[] EnumerateSecurityPackages(ISSPIInterf
if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(null, $"arrayBase: {arrayBaseHandle}");
if (errorCode != 0)
{
throw new Win32Exception(errorCode);
throw new HttpListenerException(errorCode);
}

var securityPackages = new SecurityPackageInfoClass[moduleCount];
Expand Down Expand Up @@ -86,7 +86,7 @@ public static SafeFreeCredentials AcquireDefaultCredential(ISSPIInterface secMod
if (errorCode != 0)
{
if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(null, SR.Format(SR.net_log_operation_failed_with_error, nameof(AcquireDefaultCredential), $"0x{errorCode:X}"));
throw new Win32Exception(errorCode);
throw new HttpListenerException(errorCode);
}
return outCredential;
}
Expand All @@ -101,7 +101,7 @@ public static SafeFreeCredentials AcquireCredentialsHandle(ISSPIInterface secMod
if (errorCode != 0)
{
if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(null, SR.Format(SR.net_log_operation_failed_with_error, nameof(AcquireCredentialsHandle), $"0x{errorCode:X}"));
throw new Win32Exception(errorCode);
throw new HttpListenerException(errorCode);
}

return credentialsHandle;
Expand All @@ -118,7 +118,7 @@ public static unsafe SafeFreeCredentials AcquireCredentialsHandle(ISSPIInterface
if (errorCode != 0)
{
if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(null, SR.Format(SR.net_log_operation_failed_with_error, nameof(AcquireCredentialsHandle), $"0x{errorCode:X}"));
throw new Win32Exception(errorCode);
throw new HttpListenerException(errorCode);
}

return outCredential;
Expand All @@ -135,7 +135,7 @@ public static unsafe SafeFreeCredentials AcquireCredentialsHandle(ISSPIInterface
if (errorCode != 0)
{
if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(null, SR.Format(SR.net_log_operation_failed_with_error, nameof(AcquireCredentialsHandle), $"0x{errorCode:X}"));
throw new Win32Exception(errorCode);
throw new HttpListenerException(errorCode);
}

return outCredential;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal static SafeFreeCredentials AcquireCredentialsHandle(string package, boo
if (result != Interop.SECURITY_STATUS.OK)
{
if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(null, SR.Format(SR.net_log_operation_failed_with_error, nameof(Interop.SspiCli.SspiEncodeStringsAsAuthIdentity), $"0x{(int)result:X}"));
throw new Win32Exception((int)result);
throw new HttpListenerException((int)result);
}

return SSPIWrapper.AcquireCredentialsHandle(GlobalSSPI.SSPIAuth,
Expand Down Expand Up @@ -169,9 +169,9 @@ internal static SecurityStatusPal AcceptSecurityContext(
return SecurityStatusAdapterPal.GetSecurityStatusPalFromInterop(winStatus);
}

internal static Win32Exception CreateExceptionFromError(SecurityStatusPal statusCode)
internal static HttpListenerException CreateExceptionFromError(SecurityStatusPal statusCode)
{
return new Win32Exception((int)SecurityStatusAdapterPal.GetInteropFromSecurityStatusPal(statusCode));
return new HttpListenerException((int)SecurityStatusAdapterPal.GetInteropFromSecurityStatusPal(statusCode));
}

internal static int VerifySignature(SafeDeleteContext securityContext, byte[] buffer, int offset, int count)
Expand Down Expand Up @@ -213,7 +213,7 @@ internal static int VerifySignature(SafeDeleteContext securityContext, byte[] bu
if (errorCode != 0)
{
NetEventSource.Info($"VerifySignature threw error: {errorCode.ToString("x", NumberFormatInfo.InvariantInfo)}");
throw new Win32Exception(errorCode);
throw new HttpListenerException(errorCode);
}

// not sure why this is here - retained from Encrypt code above
Expand Down Expand Up @@ -257,7 +257,7 @@ internal static int MakeSignature(SafeDeleteContext securityContext, byte[] buff
if (errorCode != 0)
{
NetEventSource.Info($"MakeSignature threw error: {errorCode.ToString("x", NumberFormatInfo.InvariantInfo)}");
throw new Win32Exception(errorCode);
throw new HttpListenerException(errorCode);
}

// return signed size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ internal static SecurityStatusPal GetSecurityStatusPalFromInterop(Interop.SECURI

if (attachException)
{
return new SecurityStatusPal(statusCode, new Win32Exception((int)win32SecurityStatus));
return new SecurityStatusPal(statusCode, new HttpListenerException((int)win32SecurityStatus));
}
else
{
Expand Down