4 Commits
Author SHA1 Message Date
Mikhail Tyukin c5c0e5987d [MSAFD][AFD] Implement WSPConnectEx and SO_UPDATE_CONNECT_CONTEXT (#8636)
- Update AFD to use the shared structure
- Fix AFD get context to match windows behavior
- implement SO_UPDATE_CONNECT_CONTEXT

CORE-17174
CORE-16335
2026-02-04 00:14:55 -06:00
Mikhail Tyukin 4e7a64b3ec [MSAFD][AFD] Asynchronous connection support (#8573)
* [MSAFD] async support

- Allow APCs to be processed while waiting for blocking IO
- Remove SleepEx hacks

[MSAFD][AFD][TCPIP] Patch CORE-12152

Original author: Peter Hater <[email protected]>

TCPConnect: Always copy bind address into connection.

[MSAFD] SetSocketInformation: Remove unnecessary TRACE code blocks

[MSAFD] AfdRecvAPC and AfdSendAPC: Remove unnecessary NULL checks

[MSAFD] WSPRecv, WSPRecvFrom and WSPSend: Fix leaks and fix IOCTL input buffer handling

[MSAFD] Rewrite WSPSendTo

[MSAFD] Rewrite WSPConnect and AfdConnectAPC

[MSAFD] Remove hacky SleepEx calls

[MSAFD] Don't wait with no timeout

[MSAFD] send/receive: Fixes for overlapped socket

- Fix IOCTL buffers handling
- Allow APC to be processed

[MSAFD] connect: Fixes for async connect

- Allow APC to be processed
- Remove "mark as connected" hack for non-blocking socket

[MSAFD] Get/SetSocketInformation: Fixes for overlapped socket

- Fix IOCTL buffer handling
- Allow APC to be processed

[MSAFD] APC fixes

Fix New Moon 28 crash on website ads.

[MSAFD] Code cleanup

- Rename APC context data type
- Rename APC functions (Afd* -> Msafd*)
- Add SAL annotation
- BUGBUG -> FIXME
- Use sizeof(*ptr) instead of sizeof(type)
- Fix debug prints

[MSAFD] Add comment for SleepEx hacks

[MSAFD] WSPGetOverlappedResult: Fix failed ws2_32:recv tests

[MSAFD] WSPConnect: Fix IOCTL status handling

[MSAFD] send/receive: Simplify IOCTL status handling

[MSAFD] Get/SetSocketInformation: Simplify IOCTL status handling

Co-Authored-By: Emmanuel Gonzalez <[email protected]>
Co-Authored-By: Julio Carchi Ruiz <[email protected]>

* [MSAFD] Fixes
- pass overlapped structure pointer to apc context when there no completion routine. .NET expects this behavior
- Fix WSPGetOverlappedResult to return flags and status code upon failure
---------
Original author: Peter Hater <[email protected]>
Co-authored-by: Thamatip Chitpong <[email protected]>
Co-authored-by: Emmanuel Gonzalez <[email protected]>
Co-authored-by: Julio Carchi Ruiz <[email protected]>
2026-01-18 13:42:24 -06:00
Johannes Thoma b18a46e315 [NETIO] Implement an in-kernel BSD-style networking API driver
This patch adds the NETIO.SYS driver to ReactOS. NETIO.SYS
is part of Windows since NT6 (Vista).

The driver is not feature complete (meaning some functionality is
unimplemented) but does its job quite good for what it originally
was written for (which is getting WinDRBD working on
ReactOS/Windows Server 2003 SP2).

The driver re-uses parts of the AFD.SYS driver, namely those
functions that ease communitating with the transport device
interface (TDI). Other than that, following features are implemented
and should work:

 * TCP/IP networking: connect, listen, accept, read, write
 * UDP/IP networking: write

So in a nutshell TCP/IP support is completed, UDP support is
partially complete and ICMP support does not exist yet.
In particular the listen/accept mechanism allows one to write
kernel side TCP servers that one can connect to via the internet.

The netio driver is licensed under the MIT license, see the file
netio.c for more details.

Have fun with it :)

Signed-off-by: Johannes Khoshnazar-Thoma <[email protected]>
2025-11-21 21:08:03 +02:00
Johannes Thoma c425244a36 [TDIHELPERS] Move TDI helpers from AFD driver to separate directory
We want to use the TDI helper functions also in the NETIO.SYS
driver which comes with the next commit. The code was modernized
a bit (usage of DPRINT, doxygen style comments) but other than
that it was left unchanged.
2025-11-21 21:08:03 +02:00