Skip to content

Commit 9f9485d

Browse files
authored
Update SetCredentialsAttributesW to match the native C API declaration (#131425)
Change the P/Invoke declaration for `SetCredentialsAttributesW` to use uint rather than long, since C unsigned long is 4 bytes on Windows. Fix #131416
1 parent 4d07108 commit 9f9485d

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/libraries/Common/src/Interop/Windows/SspiCli/Interop.SSPI.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,8 @@ internal static partial SECURITY_STATUS SspiEncodeStringsAsAuthIdentity(
538538
[LibraryImport(Interop.Libraries.SspiCli, SetLastError = true)]
539539
internal static partial SECURITY_STATUS SetCredentialsAttributesW(
540540
in CredHandle handlePtr,
541-
long ulAttribute,
541+
uint ulAttribute,
542542
in SecPkgCred_ClientCertPolicy pBuffer,
543-
long cbBuffer);
543+
uint cbBuffer);
544544
}
545545
}

src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,9 @@ private static unsafe void AttachCertificateStore(SafeFreeCredentials cred, X509
317317
clientCertPolicy.pwszSslCtlStoreName = ptr;
318318
Interop.SECURITY_STATUS errorCode = Interop.SspiCli.SetCredentialsAttributesW(
319319
cred._handle,
320-
(long)Interop.SspiCli.ContextAttribute.SECPKG_ATTR_CLIENT_CERT_POLICY,
320+
(uint)Interop.SspiCli.ContextAttribute.SECPKG_ATTR_CLIENT_CERT_POLICY,
321321
clientCertPolicy,
322-
sizeof(Interop.SspiCli.SecPkgCred_ClientCertPolicy));
322+
(uint)sizeof(Interop.SspiCli.SecPkgCred_ClientCertPolicy));
323323

324324
if (errorCode != Interop.SECURITY_STATUS.OK)
325325
{

0 commit comments

Comments
 (0)