Update ns-winsock2-wsaoverlapped.md#2156
Update ns-winsock2-wsaoverlapped.md#2156denkisikinoneko wants to merge 2 commits intoMicrosoftDocs:docsfrom
Conversation
|
@denkisikinoneko : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change. |
|
Thanks for raising this — the underlying issue is valid and worth fixing. However, there may be a concern with the proposed change: In Win32, Could you confirm whether the |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the WSAOVERLAPPED documentation to better match the structure’s datatype expectations and clarify field typings for modern Windows SDK usage.
Changes:
- Updated WSAOVERLAPPED field types for
Internal,InternalHigh, andhEvent - Removed the
Pointersub-section under the struct fields - Adjusted formatting/indentation for some field type lines and a “see also” link
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
GrantMeStrength
left a comment
There was a problem hiding this comment.
Thank you for looking at this — the observation about WSAOVERLAPPED being typedef'd to OVERLAPPED in Win32 is correct and worth documenting. However, the changes have the Win16/Win32 distinction backwards:
Internal and InternalHigh (revert to ULONG_PTR): In Win32, WSAOVERLAPPED is #define'd to OVERLAPPED, where these fields are ULONG_PTR (pointer-sized). Changing them to DWORD introduces the Win16 layout, not the Win32 one. The original ULONG_PTR was correct.
Pointer field (restore): The OVERLAPPED struct (which WSAOVERLAPPED maps to in Win32) contains a union with Offset/OffsetHigh and Pointer as alternatives. Removing the Pointer field documentation makes the page incomplete for Win32.
hEvent (WSAEVENT is fine): Changing HANDLE to WSAEVENT is acceptable since WSAEVENT is #define'd to HANDLE in Win32 and is semantically clearer in the WSA context. You can keep this change.
Suggested fix: Revert Internal and InternalHigh back to ULONG_PTR, restore the Pointer field documentation, and keep the hEvent type change.
|
@copilot apply changes based on the comments in this thread |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Thank you for raising this — you've correctly identified a genuine documentation gap. The observation that However, the changes in this PR unfortunately go in the wrong direction:
We're closing this PR, but we'll take your feedback on board and look at doing a proper rewrite of this page to clearly document the Win32 typedef relationship and correct field semantics. We appreciate you digging into this! |
…antics - Clarify that on Win32, WSAOVERLAPPED is a typedef for OVERLAPPED (and LPWSAOVERLAPPED is a typedef for _OVERLAPPED*); add Win16 historical note - Internal/InternalHigh: document as ULONG_PTR (pointer-sized, not DWORD); clarify OS-managed semantics (STATUS_PENDING on issue, status on completion) - Offset/OffsetHigh: note they are part of a union with Pointer; clarify they are not meaningful for socket I/O and should be zero-initialized - hEvent: expand to cover all three completion scenarios (event object, completion routine, I/O completion port) and their interactions - Pointer: document as the union alternative to Offset/OffsetHigh - Add -remarks section: initialization, lifetime, and completion mechanism table - Add OVERLAPPED to -see-also section - Update ms.date Closes ADO #570330 Relates to community PR #2156 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Uses the correct datatypes as shown by the struct on the page, however:
The presented syntax on the site is incorrect, for modern Windows! It is using the Win16 format of the structure, while in Win32 the structure is typedef'd to OVERLAPPED, along with LPWSAOVERLAPPED to _OVERLAPPED*. Interpreting the structure as-is and passing it to functions in Win32 will cause them to error with WSA_INVALID_HANDLE. I do not know how to modify the displayed struct, any help there would be useful.
Additionally, hEvent is a little unclear when it comes to using it with I/O completion ports, but I'm unsure how to transform the current description.
Relevant excerpt from um/WinSock2.h, SDK version 10.0.26100.0: