Fixed bug in SOCKET_ADDRESS.GetSOCKADDR that prevented 16 bit entries from translating

pull/423/head
David Hall 2023-09-07 15:01:26 -06:00
parent f968d1aafa
commit d6ac8d8120
1 changed files with 2 additions and 2 deletions

View File

@ -1703,7 +1703,7 @@ public static partial class Ws2_32
// https://docs.microsoft.com/en-us/windows/win32/api/ws2def/ns-ws2def-socket_address typedef struct _SOCKET_ADDRESS { LPSOCKADDR
// lpSockaddr; INT iSockaddrLength; } SOCKET_ADDRESS, *PSOCKET_ADDRESS, *LPSOCKET_ADDRESS;
[PInvokeData("ws2def.h", MSDNShortId = "37fbcb96-a859-4eca-8928-8051f95407b9")]
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructLayout(LayoutKind.Sequential)]
public struct SOCKET_ADDRESS
{
/// <summary>A pointer to a socket address represented as a SOCKADDR structure.</summary>
@ -1716,7 +1716,7 @@ public static partial class Ws2_32
/// <summary>Gets the <see cref="SOCKADDR_INET"/> from this instance.</summary>
/// <returns>The <see cref="SOCKADDR_INET"/> value pointed to by this instance.</returns>
public SOCKADDR_INET GetSOCKADDR() => lpSockaddr.ToStructure<SOCKADDR_INET>(iSockaddrLength);
public SOCKADDR_INET GetSOCKADDR() => iSockaddrLength == 16 ? lpSockaddr.ToStructure<SOCKADDR_IN>(iSockaddrLength) : lpSockaddr.ToStructure<SOCKADDR_INET>(iSockaddrLength);
/// <summary>Performs an implicit conversion from <see cref="SOCKET_ADDRESS"/> to <see cref="SOCKADDR"/>.</summary>
/// <param name="address">The address.</param>