The MSDN docs state that `::ConnectEx` must be retrieved through `::WSAIoctl`. See the remarks section of the docs: https://msdn.microsoft.com/en-us/library/windows/desktop/ms737606(v=vs.85).aspx // NOLINT(whitespace/line_length)
| 602 | // `::WSAIoctl`. See the remarks section of the docs: |
| 603 | // https://msdn.microsoft.com/en-us/library/windows/desktop/ms737606(v=vs.85).aspx // NOLINT(whitespace/line_length) |
| 604 | static LPFN_CONNECTEX init_connect_ex(const int_fd& fd) |
| 605 | { |
| 606 | LPFN_CONNECTEX connect_ex; |
| 607 | GUID connect_ex_guid = WSAID_CONNECTEX; |
| 608 | DWORD bytes; |
| 609 | |
| 610 | int res = ::WSAIoctl( |
| 611 | fd, |
| 612 | SIO_GET_EXTENSION_FUNCTION_POINTER, |
| 613 | &connect_ex_guid, |
| 614 | sizeof(connect_ex_guid), |
| 615 | &connect_ex, |
| 616 | sizeof(connect_ex), |
| 617 | &bytes, |
| 618 | nullptr, |
| 619 | nullptr); |
| 620 | |
| 621 | // We can't use connect if we failed to get the function, so we just force |
| 622 | // an abort. |
| 623 | CHECK_EQ(res, 0); |
| 624 | return connect_ex; |
| 625 | } |
| 626 | |
| 627 | |
| 628 | static LPFN_CONNECTEX& get_connect_ex_ptr(const int_fd& fd) |