We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
WINHTTP_CONNECTION_INFO
Describe the bug and how to reproduce
The WINHTTP_CONNECTION_INFO maybe has wrong padding between field cbSize and LocalAddress.
cbSize
LocalAddress
What code is involved
uint bufferLength = (uint)Marshal.SizeOf<WINHTTP_CONNECTION_INFO>(); using var buffer = new SafeByteArray((int)bufferLength); if (WinHttpQueryOption(hInternet, WINHTTP_OPTION.WINHTTP_OPTION_CONNECTION_INFO, buffer, ref bufferLength)) { var info1 = Marshal.PtrToStructure<WINHTTP_CONNECTION_INFO>(buffer); Console.WriteLine($"{SockaddrStorageToEndPoint(info1.LocalAddress)} -> {SockaddrStorageToEndPoint(info1.RemoteAddress)}"); } else { Console.WriteLine(GetLastError()); // Always go here, because the WINHTTP_CONNECTION_INFO size incorrect. }
Expected behavior
Marshal.SizeOf<WINHTTP_CONNECTION_INFO>() should be 264.
Marshal.SizeOf<WINHTTP_CONNECTION_INFO>()
264
The text was updated successfully, but these errors were encountered:
I try to define a duplicate of WINHTTP_CONNECTION_INFO with Pack = 8, which fix this issue.
Pack = 8
Vanara/PInvoke/WinHTTP/WinHTTP.Structs.cs
Line 372 in 72cb218
Sorry, something went wrong.
Fixed packing on WINHTTP_CONNECTION_INFO (#368)
5a012be
No branches or pull requests
Describe the bug and how to reproduce
The
WINHTTP_CONNECTION_INFO
maybe has wrong padding between fieldcbSize
andLocalAddress
.C#
C++
What code is involved
Expected behavior
Marshal.SizeOf<WINHTTP_CONNECTION_INFO>()
should be264
.The text was updated successfully, but these errors were encountered: