Commit Graph

1322 Commits

Author SHA1 Message Date
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 <7element@mail.bg>

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 <momo16136@tamu.edu>
Co-Authored-By: Julio Carchi Ruiz <juliocarchi@yahoo.com>

* [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 <7element@mail.bg>
Co-authored-by: Thamatip Chitpong <thamatip.chitpong@reactos.org>
Co-authored-by: Emmanuel Gonzalez <momo16136@tamu.edu>
Co-authored-by: Julio Carchi Ruiz <juliocarchi@yahoo.com>
2026-01-18 13:42:24 -06:00
Hermès Bélusca-Maïto
fda2ee2ad8 [BOOTVID] Modularize the different bootvid's build rules (#8548)
The aim is to be able to compile multiple bootvids for a given ReactOS
build without having to duplicate the same commands.
2026-01-18 18:19:01 +01:00
Hermès Bélusca-Maïto
d4ffcf81be [BOOTVID][NTOS:INBV] Improve SAL annotations for *BufferToScreenBlt() and *ScreenToBufferBlt() 2026-01-03 14:19:25 +01:00
Hermès Bélusca-Maïto
5674e5d32b [BOOTVID][HAL][NTOS:INBV][NDK] *DisplayString(): Use a more suitable string pointer parameter type
Use `PCSTR` for the type of the (Hal,Inbv,Vid)DisplayString() routines'
`String` parameter, instead of `PCHAR` or `PUCHAR`, since it points to a
NUL-terminated string. (The buffer isn't a counted string.)

And improve SAL annotations along the way.
2026-01-03 14:19:24 +01:00
Hermès Bélusca-Maïto
3b33b1025e [BOOTVID] Use an "unsigned" (U)RECT structure for the VidpScrollRegion (#8547)
This makes the code more readable than using e.g. `VidpScrollRegion[0]`,
`VidpScrollRegion[1]` etc. instead of `VidpScrollRegion.Left`,
`VidpScrollRegion.Top` respectively.

Based on a suggestion by Dmitry Borisov.
2026-01-03 14:19:23 +01:00
Hermès Bélusca-Maïto
5894d0b443 [BOOTVID] Reorganize some definitions used in the per-architecture bootvids (#8547)
In addition:
- simplify the no-op `PrepareForSetPixel()` definitions;
- const-ify immutable data arrays for the VGA PC bootvid.
2026-01-03 14:19:15 +01:00
Hermès Bélusca-Maïto
44e4781600 [BOOTVID] Split common.c into graphics-specific and console (in console.c) parts (#8547)
In addition:
- move back common function prototypes to precomp.h;
- const-ify `VidpFontData` and adjust its usages;
- improve SAL annotations for `InitPaletteWithTable()`;
- rename the (Vid)ResetDisplay() parameter to "SetMode".
2026-01-03 13:42:47 +01:00
Max Korostil
e04d05254a [NDIS] Add IRP_MN_REMOVE_DEVICE processing (#8365)
Fixes BSOD after installation of HotSpot Shield 3.42.

CORE-20150
2025-12-31 15:36:15 +03:00
Dmitry Borisov
f1ef706c76 [DRIVERS] Disable some drivers on PC-98 (#8541)
These drivers expect PC/AT compatible hardware thus they are unsuitable for PC-98.
Disable the drivers for the time being until we have a proper implementation.

CORE-17977
2025-12-31 14:30:16 +03:00
Dmitry Borisov
c8e1772109 [BOOTVID:PC98][PC98VID] Disable the text layer when setting mode (#8539)
The previous approach was causing the contents of TVRAM to be visible after boot:
https://github.com/user-attachments/assets/df6d2782-4d54-41ab-b4c9-caeb170c4e1e

Fixes a regression introduced in 0fa49018cd.

CORE-17977
2025-12-28 14:40:17 +03:00
Stanislav Motylkov
c3f3b2b0ad [BOOTVID:XBOX] Fix MSVC build
Fix two similar warnings, that were treated as errors:
- warning C4146: unary minus operator applied to unsigned type, result still unsigned

Addendum to fa1ec0a2ed. CORE-16216 CORE-16219
2025-12-19 15:56:07 +01:00
Justin Miller
52006dd926 [USBCCGP][USBPORT][USBSTOR][USBHUB] Misc USB stack stability improvements. (#8453)
* [USBCCGP] CORE-18689 - Don't do a double IRP completion

* [USBPORT] CORE-17052 Handle port status better and CreateDevice
MaxPacketSize

* [USBSTOR] CORE-19773 Clamp LUN - Don't just assert on a POSSIBLE case

* [USB] Disable LIST_ENTRY_CHECKS privately for USB

* [CODEREVIEW]

Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>

* [CODEREVIEW]

Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>

---------

Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
2025-12-03 13:14:22 -08:00
Timo Kreuzer
f4436f549f [ACPICA][UDFS][BTRFS] Fix MSVC warning C4319
"warning C4319: '~': zero extending 'uint32_t' to 'uint64_t' of greater size"
Fixes build with VS 2026.
2025-11-26 21:39:16 +02: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 <johannes@johannesthoma.com>
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
Hervé Poussineau
318a040ccf [PARPORT] Fix MSVC compilation error when NDEBUG is defined 2025-11-09 11:38:56 +01:00
Hervé Poussineau
c28500c0d9 [PARPORT] Disable debug output 2025-11-09 09:11:06 +01:00
Hervé Poussineau
5bfaecdab0 [E1000] Mark register bits as unsigned 2025-11-09 09:06:39 +01:00
Adam Słaboń
3000d45250 [NETKVM] Reduce log level and default to 10 Gbit/s connection (#8448)
Reduces debug spam and maybe improves network throughput a bit.

CORE-15841
2025-11-05 13:20:36 +03:00
Justin Miller
18f9a03338 [PCIX] Fix a few easy bugs (#8443)
* [PCIX] Fix the weird text corruption in PciGetDescriptionMessage

* [PCIX] Return the buffer to the caller PciQueryBusInformation


Co-authored-by: Stanislav Motylkov <x86corez@gmail.com>
2025-11-03 10:52:19 -08:00
Justin Miller
3fe5b8b0bb [SDK][WDF][USBDEX][NTOSKRNL_VISTA] Fully enable KMDF (#8396)
[SDK][WDFLDR] Add kmdf loader driver
[SDK][WDF] Add kmdf drver init static library
[SDK][WDF] Modify kmdf driver for working with wdfldr driver
[SDK][CDROM] Cdrom driver dynamically linking with kmdf
[SDK][WDF] Add kmdfdriver module type
[SDK][WDF][USBDEX][NTOSKRNL_VISTA] Fully enable KMDF
[KMDF][WDFLDR][WDF01000] Fix Windows 10 Compatibility WDFLDR and WDF01000
[WDF01000] NO_KERNEL_LIST_ENTRY_CHECKS for wdf01000 3rd party code

This PR is an accumulation of three peoples work, with the goal of the trying to get WDF to work like it should.
This has been tested in combination with some extra NT6+ ntoskrnl against multiple drivers.

---------

Co-authored-by: Max Korostil <mrmks04@yandex.ru>
Co-authored-by: Victor Perevertkin <victor.perevertkin@reactos.org>
Co-authored-by: Adam Słaboń <asaillen@protonmail.com>
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
2025-11-03 06:38:52 -08:00
Hermès Bélusca-Maïto
df49026976 [NETWORK:NE2000] Move the NDIS_* defines to the CMakeFiles.txt 2025-10-26 18:23:54 +01:00
Serge Gautherie
5b1224b8a3 [NETWORK:DD][NDIS] Be explicit about NDIS_LEGACY_MINIPORT value (#8315)
Also, NDIS_LEGACY_DRIVER and NDIS_LEGACY_PROTOCOL.
2025-10-26 18:23:53 +01:00
Serge Gautherie
04f052bec8 [NETWORK:DD] NDIS_MINIPORT_DRIVER and NDIS51_MINIPORT do not need a value (#8315) 2025-10-26 18:23:48 +01:00
Serge Gautherie
ca2fb5f666 [NDIS] NdisRegisterProtocol(): Add a comment about NDIS51 (#8314)
CORE-20300

- `NdisRegisterProtocol()`: Add a comment about `NDIS51`: the
  `NDIS50_PROTOCOL_CHARACTERISTICS` structure is common to both
  NDIS 5.0 and 5.1.
  This is in contrast to the `NDIS50/NDIS51_MINIPORT_CHARACTERISTICS`
  structures, see for example commit 3e169e3cb2 (r49961).

- Remove obsolete SOURCES file. Addendum to commit d9e83ed22d (r40142).
2025-10-26 17:28:51 +01:00
Serge Gautherie
dd00ebdd51 [PCNET] CMakeLists.txt: Remove superseded -DNDIS50_MINIPORT (#8313)
Addendum to commit 74015adb69 (r20671).
CORE-20300
2025-10-26 17:17:07 +01:00
Hermès Bélusca-Maïto
ad10c08b3d [SCSIPORT] Fix "Targed" typo 2025-10-19 17:13:51 +02:00
Hermès Bélusca-Maïto
e969fbeea8 [UDFS] Add missing NTAPI for PIO_APC_ROUTINE (#8417) 2025-10-19 17:11:55 +02:00
Hermès Bélusca-Maïto
1af29a66ca [CMBATT] Inform when a discovered battery doesn't support the _BTP trip-point method (#8384) 2025-09-15 16:26:06 +02:00
Hermès Bélusca-Maïto
b73159fecf [BATTC][COMPBATT] Move the IOCTL_BATTERY_QUERY_STATUS wait hack to BATTC (#8384)
CORE-20343

The 3-second timeout FIXME (instead of waiting indefinitely), made in the
COMPBATT worker thread for the `IOCTL_BATTERY_QUERY_STATUS` case, was done
because _*our*_ BATTC handler expects the batteries to always support the
BTP (Battery Trip Point) feature for signaling a change of battery status,
but in the cases where it isn't supported, any waits it tried for the
battery to notify about a status change would never happen.

Furthermore, following commit 3a6e0d4b65, the `SetStatusNotify()` call
(_which always fails if the battery doesn't support the BTP feature_)
would now always exit the `IOCTL_BATTERY_QUERY_STATUS` handling without
any waiting nor battery polling [^1], and this would cause the COMPBATT
worker thread to busy-poll again forever.

The timeout FIXME is now moved to BATTC, instead of COMPBATT, since the
actual fixes should be in BATTC. In particular, it should queue all the
query IOCTLs and then serve them, either using the StatusNotify (BTP)
functionality if the battery supports it, or if not, do a very-slow
battery polling.

I've also increased the timeout a little bit more (5 seconds and not 3).

[^1]: Per the ACPI specification, it is expected that the operating system
  performs battery polling if the battery doesn't support BTP, see:
  https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/10_Power_Source_and_Power_Meter_Devices/Power_Source_and_Power_Meter_Devices.html#btp-battery-trip-point
2025-09-15 16:25:14 +02:00
Hermès Bélusca-Maïto
54489d6cce [CMBATT] Fix a debug print 2025-09-15 16:25:13 +02:00
Hermès Bélusca-Maïto
20d7fd78ae [CMBATT] Fix "TripPpoint" typo 2025-09-13 21:34:18 +02:00
Timo Kreuzer
3a6e0d4b65 [BATTC] Fix IOCTL_BATTERY_QUERY_STATUS
Previously the function waited for the conditions *after* querying the status, and then returned the old status. Also, if querying failed, it waited and when the wait timed out it returned STATUS_SUCCESS without returning any data. If the call to SetStatusNotify failed and there was no timeout, it would wait forever.
This is all fixed now.
2025-09-13 11:38:38 +03:00
Timo Kreuzer
01872b8495 [NPFS] Fix dereference of uninitialized variable
- Avoid uninitialized return variables
- Fix a parameter check
2025-09-11 12:31:14 +03:00
Serge Gautherie
c3bb9d6ca9 [UNIATA] UniataChipDetect(): Workaround AHCI detection (#8184)
Fix AHCI support regression.
Disable a "new" code block, which is broken.

Reverts a part of commit 1afae58191 (r69699).
CORE-13346
2025-08-26 22:50:22 +02:00
Serge Gautherie
5ae1c72395 [NDIS] NDIS_TAG: Fix definition and usages (#8243)
- Let it be `"NDIS"`, instead of variations of `"SIMN"`.
- Use matching `ExFreePoolWithTag()`.
- Remove a redundant `KeyInformation = NULL;`.

Addendum to commits e8861acfb2 (r12196) and 5658b2154c (r53045).
CORE-18791
2025-08-16 19:01:55 +02:00
Serge Gautherie
7e294faff4 [UNIATA] Upgrade to v0.47b from v0.47a (#8177)
- Remove unused idedma.def
  Addendum to commit 1daf74908e (r29256).

- Convert a few files to UTF-8 from ANSI
  Plus, 2 tiny formatting fixes.

- id_ata.cpp: Unmark a ReactOS own diff
  Addendum to commit 7fdf078134.

- id_init.cpp: Mark a diff
  Addendum to commit 09dde2cff9.

- Upgrade to v0.47b from v0.47a

CORE-17876
2025-08-16 18:56:58 +02:00
Serge Gautherie
f100d34638 [NDIS][PSDK] Define IOCTL_NDIS_RESERVED7 and add a stub (#8240)
Another small step, until further investigation and implementation.

CORE-13831
2025-08-16 19:54:21 +03:00
Serge Gautherie
f24b57378e [PSDK][KS] IKsProcessingObject_fnProcessingObjectWork(): Fix mutex copypastas (#8288)
- ks.h: Add KsFilterReleaseProcessingMutex() declaration

- `IKsProcessingObject_fnProcessingObjectWork()`: Fix mutex copypastas

Addendum to commit c6b26fa452 (r50531).
CORE-19511
2025-08-08 23:35:56 +02:00
Oleg Dubinskiy
62f9d1ad46 [TCPIP] Return MIB_IF_TYPE_ETHERNET for WLAN adapter types when compiling ReactOS as NT 5.2 (#8300)
Split Windows Server 2003 and Windows Vista behaviour in two different cases and make them used separately: when ReactOS target version is NT 5.2, use the 1st case, otherwise use the 2nd one instead.
Also, handle NdisPhysicalMediumNative802_11 case only for NT 6.0 and newer, since that's actually supported starting from NDIS 6.0, according to MSDN:
https://learn.microsoft.com/en-us/windows-hardware/drivers/network/oid-gen-physical-medium
while for NDIS 5.1 and newer it's:
https://learn.microsoft.com/en-us/previous-versions/windows/hardware/network/ff560255(v=vs.85)
This fixes:
1. A critical regression with unavailable networking in ReactOS when 3rd-party NT5-compatible Ethernet/Wi-Fi drivers are used (both in VM and on real hardware) caused by commit 3842b59f75 from @EricKohl.
2. Failure to open Network Properties and Network Status from the Network tray icon (caused by the same commit too).
MSDN tells us this is done so for Windows XP and Server 2003 as well, and IF_TYPE_IEEE80211 is returned only in Windows Vista and newer, so the following Microsoft documentation is actually correct in this case:
https://learn.microsoft.com/en-us/windows/win32/api/iptypes/ns-iptypes-ip_adapter_info
(see the information about "IP_ADAPTER_INFO.Type" member below on that page)
!!!Please note that the behaviour of Vista+ case (e. g., when compiling ReactOS targeted as NT 6.0 and newer) remains unchanged after this fix (networking still may not work), so it still requires the proper support of 3rd-party NT6+ compatible network miniport drivers (by handling this case via the Vista/NDIS6-style way) for NT6 target!!!
CORE-20244
2025-08-08 16:10:50 +02:00
Timo Kreuzer
b7066b9232 [TCPIP] Fix "mbox" queue synchronization
Use a KSEMAPHORE instead of a NotificationEvent to signal availability. This is to prevent satisfying the wait for multiple waiters, when only a single entry is on the list.
Fixes crashes on SMP builds.
2025-08-05 09:15:07 +03:00
Timo Kreuzer
069fc049db [TCPIP] Fix global synchronization on SMP
We cannot just raise IRQL! Instead use a global ERESOURCE, which allows to be acquired recursively, as required by LWIP.
2025-08-05 09:15:07 +03:00
Dmitry Borisov
b558596409 [SPTILIB] Introduce SPTI static library for storage drivers (#8209)
Add a SCSI and ATA passthrough support helper library for direct use
from low-level storage drivers.

Tested with: CDRoller, CloneCD, Magic ISO
NOTE: Vbox seems to lack support for CD/DVD burning; tested on real hardware.

CORE-10191 CORE-16452
CORE-14788 CORE-18241
CORE-17256 CORE-13866
2025-07-13 22:49:51 +02:00
Serge Gautherie
2c0782d1e0 [SCSIPORT] Add explicit IOCTL_ATA_PASS_THROUGH* cases (#1969)
ATA passthrough IOCTLs not supported by MS scsiport.
The implementation is optional, especially in SCSI.

IOCTL_SCSI_PASS_THROUGH will be implemented in SPTI library.

CORE-16422
2025-07-05 18:20:42 +03:00
Stanislav Motylkov
52e02af86b [BOOTVID] Fix build for ARM port
- Move functions from header to main source, keeping their definitions
- Fix typo DefaultPalette -> VidpDefaultPalette
- Add missing PrepareForSetPixel() function

Addendum to 5f2ca473dc and cd91271796. CORE-17617 CORE-17604
2025-07-02 22:24:46 +02:00
Hervé Poussineau
7b9ef6b390 [NDIS] NdisOpenFile: close file locally, as we don't need it later
Remove now unused field FileHandle in NDIS_HANDLE_OBJECT structure.
2025-06-29 08:23:33 +02:00
Hervé Poussineau
e2904d3baf [NDIS] NdisOpenFile: read file contents into buffer when opening it
NdisMapFile now returns a non-null buffer.

CORE-20259
2025-06-29 08:23:33 +02:00
Hervé Poussineau
d72bcb149f [NDIS] NdisOpenFile: retrieve and return file length in *FileLength
CORE-20259
2025-06-29 08:23:32 +02:00
Hervé Poussineau
07f305cd59 [NDIS] NdisOpenFile: use local variables instead of using output variables 2025-06-29 08:23:32 +02:00
Justin Miller
8aab5a9b24 [ACPI_NEW] Minimal to build
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
Co-authored-by: Dmitry Borisov <di.sean@protonmail.com>
2025-06-19 20:32:11 -07:00