@@ -889,8 +889,7 @@ private static unsafe void SNIPacketSetData(SNIPacket pPacket, [In] byte* pbBuf,
889
889
890
890
private static unsafe uint SNISecGenClientContextWrapper (
891
891
[ In ] SNIHandle pConn ,
892
- [ In , Out ] byte [ ] pIn ,
893
- uint cbIn ,
892
+ [ In , Out ] ReadOnlySpan < byte > pIn ,
894
893
[ In , Out ] byte [ ] pOut ,
895
894
[ In ] ref uint pcbOut ,
896
895
[ MarshalAsAttribute ( UnmanagedType . Bool ) ] out bool pfDone ,
@@ -899,16 +898,19 @@ private static unsafe uint SNISecGenClientContextWrapper(
899
898
[ MarshalAsAttribute ( UnmanagedType . LPWStr ) ] string pwszUserName ,
900
899
[ MarshalAsAttribute ( UnmanagedType . LPWStr ) ] string pwszPassword )
901
900
{
902
- switch ( s_architecture )
901
+ fixed ( byte * pInPtr = pIn )
903
902
{
904
- case System . Runtime . InteropServices . Architecture . Arm64 :
905
- return SNINativeManagedWrapperARM64 . SNISecGenClientContextWrapper ( pConn , pIn , cbIn , pOut , ref pcbOut , out pfDone , szServerInfo , cbServerInfo , pwszUserName , pwszPassword ) ;
906
- case System . Runtime . InteropServices . Architecture . X64 :
907
- return SNINativeManagedWrapperX64 . SNISecGenClientContextWrapper ( pConn , pIn , cbIn , pOut , ref pcbOut , out pfDone , szServerInfo , cbServerInfo , pwszUserName , pwszPassword ) ;
908
- case System . Runtime . InteropServices . Architecture . X86 :
909
- return SNINativeManagedWrapperX86 . SNISecGenClientContextWrapper ( pConn , pIn , cbIn , pOut , ref pcbOut , out pfDone , szServerInfo , cbServerInfo , pwszUserName , pwszPassword ) ;
910
- default :
911
- throw ADP . SNIPlatformNotSupported ( s_architecture . ToString ( ) ) ;
903
+ switch ( s_architecture )
904
+ {
905
+ case System . Runtime . InteropServices . Architecture . Arm64 :
906
+ return SNINativeManagedWrapperARM64 . SNISecGenClientContextWrapper ( pConn , pInPtr , ( uint ) pIn . Length , pOut , ref pcbOut , out pfDone , szServerInfo , cbServerInfo , pwszUserName , pwszPassword ) ;
907
+ case System . Runtime . InteropServices . Architecture . X64 :
908
+ return SNINativeManagedWrapperX64 . SNISecGenClientContextWrapper ( pConn , pInPtr , ( uint ) pIn . Length , pOut , ref pcbOut , out pfDone , szServerInfo , cbServerInfo , pwszUserName , pwszPassword ) ;
909
+ case System . Runtime . InteropServices . Architecture . X86 :
910
+ return SNINativeManagedWrapperX86 . SNISecGenClientContextWrapper ( pConn , pInPtr , ( uint ) pIn . Length , pOut , ref pcbOut , out pfDone , szServerInfo , cbServerInfo , pwszUserName , pwszPassword ) ;
911
+ default :
912
+ throw ADP . SNIPlatformNotSupported ( s_architecture . ToString ( ) ) ;
913
+ }
912
914
}
913
915
}
914
916
@@ -1378,15 +1380,14 @@ Int32[] passwordOffsets // Offset into data buffer where the password to be w
1378
1380
}
1379
1381
}
1380
1382
1381
- internal static unsafe uint SNISecGenClientContext ( SNIHandle pConnectionObject , byte [ ] inBuff , uint receivedLength , byte [ ] OutBuff , ref uint sendLength , byte [ ] serverUserName )
1383
+ internal static unsafe uint SNISecGenClientContext ( SNIHandle pConnectionObject , ReadOnlySpan < byte > inBuff , byte [ ] OutBuff , ref uint sendLength , byte [ ] serverUserName )
1382
1384
{
1383
1385
fixed ( byte * pin_serverUserName = & serverUserName [ 0 ] )
1384
1386
{
1385
1387
bool local_fDone ;
1386
1388
return SNISecGenClientContextWrapper (
1387
1389
pConnectionObject ,
1388
1390
inBuff ,
1389
- receivedLength ,
1390
1391
OutBuff ,
1391
1392
ref sendLength ,
1392
1393
out local_fDone ,
0 commit comments