ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
June 2021
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
19 participants
228 discussions
Start a n
N
ew thread
[reactos] 01/01: [UMPNPMGR] Add missing parameter checks to PNP_GetDeviceStatus
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=830e15b622515b3f70e7c…
commit 830e15b622515b3f70e7cafc07d15173fa3df1b1 Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Mon Jun 21 21:33:24 2021 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Mon Jun 21 21:33:24 2021 +0200 [UMPNPMGR] Add missing parameter checks to PNP_GetDeviceStatus --- base/services/umpnpmgr/rpcserver.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/base/services/umpnpmgr/rpcserver.c b/base/services/umpnpmgr/rpcserver.c index d84e0cab4ff..bb63bce02bd 100644 --- a/base/services/umpnpmgr/rpcserver.c +++ b/base/services/umpnpmgr/rpcserver.c @@ -22,7 +22,7 @@ * FILE: base/services/umpnpmgr/rpcserver.c * PURPOSE: RPC server * PROGRAMMER: Eric Kohl (eric.kohl(a)reactos.org) - * Herv� Poussineau (hpoussin(a)reactos.org) + * Hervé Poussineau (hpoussin(a)reactos.org) * Colin Finck (colin(a)reactos.org) */ @@ -3199,6 +3199,12 @@ PNP_GetDeviceStatus( DPRINT("PNP_GetDeviceStatus(%p %S %p %p 0x%08lx)\n", hBinding, pDeviceID, pulStatus, pulProblem, ulFlags); + if (ulFlags != 0) + return CR_INVALID_FLAG; + + if ((pulStatus == NULL) || (pulProblem == NULL)) + return CR_INVALID_POINTER; + if (!IsValidDeviceInstanceID(pDeviceID)) return CR_INVALID_DEVINST;
3 years, 6 months
1
0
0
0
[reactos] 02/02: [NTOS:KE] Do not allow waiting at IRQL >= DISPATCH_LEVEL when providing a timeout in KeWaitForMultipleObjects
by Jérôme Gardou
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=41de1bd7241f3ce1b2020…
commit 41de1bd7241f3ce1b2020259161e534f1efa6433 Author: Jérôme Gardou <jerome.gardou(a)reactos.org> AuthorDate: Fri May 21 09:41:27 2021 +0200 Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com> CommitDate: Mon Jun 21 11:42:01 2021 +0200 [NTOS:KE] Do not allow waiting at IRQL >= DISPATCH_LEVEL when providing a timeout in KeWaitForMultipleObjects CORE-6473 --- ntoskrnl/ke/wait.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ntoskrnl/ke/wait.c b/ntoskrnl/ke/wait.c index 3863b8e4779..26869fdd7de 100644 --- a/ntoskrnl/ke/wait.c +++ b/ntoskrnl/ke/wait.c @@ -605,12 +605,9 @@ KeWaitForMultipleObjects(IN ULONG Count, if (Thread->WaitNext) ASSERT(KeGetCurrentIrql() == SYNCH_LEVEL); - else if (KeGetCurrentIrql() == DISPATCH_LEVEL && - (!Timeout || Timeout->QuadPart != 0)) + else if (!Timeout || (Timeout->QuadPart != 0)) { - /* HACK: tcpip is broken and waits with spinlocks acquired (CORE-6473) */ - DPRINT("%s called at DISPATCH_LEVEL with non-zero timeout!\n", - __FUNCTION__); + ASSERT(KeGetCurrentIrql() <= APC_LEVEL); } else ASSERT(KeGetCurrentIrql() <= DISPATCH_LEVEL);
3 years, 6 months
1
0
0
0
[reactos] 01/02: [TCPIP][IP] Use an ERESOURCE as mutex for address files & connection end points
by Jérôme Gardou
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=27fcfe66a2a7a8beb4b29…
commit 27fcfe66a2a7a8beb4b29eee18bb251a3a9aae22 Author: Jérôme Gardou <jerome.gardou(a)reactos.org> AuthorDate: Fri May 21 09:36:27 2021 +0200 Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com> CommitDate: Mon Jun 21 11:42:01 2021 +0200 [TCPIP][IP] Use an ERESOURCE as mutex for address files & connection end points Spinlocks are not reentrant (and this is done a lot), using them forces us to have an horrible hack in the kernel, which unschedules threads which are at DISPATCH_LEVEL thus allowing another thread to take ownership of the spinlock while the unscheduled thread should already hold it. CORE-6473 --- drivers/network/tcpip/include/tcp.h | 6 +- drivers/network/tcpip/include/titypes.h | 52 ++---- drivers/network/tcpip/tcpip/ainfo.c | 18 +-- drivers/network/tcpip/tcpip/dispatch.c | 33 ++-- drivers/network/tcpip/tcpip/fileobjs.c | 32 ++-- drivers/network/tcpip/tcpip/icmp.c | 15 +- sdk/lib/drivers/ip/transport/datagram/datagram.c | 27 ++-- sdk/lib/drivers/ip/transport/rawip/rawip.c | 11 +- sdk/lib/drivers/ip/transport/tcp/accept.c | 15 +- sdk/lib/drivers/ip/transport/tcp/event.c | 194 ++++++++-------------- sdk/lib/drivers/ip/transport/tcp/tcp.c | 197 ++++++++++++++--------- sdk/lib/drivers/ip/transport/udp/udp.c | 11 +- sdk/lib/drivers/lwip/src/include/rosip.h | 4 + sdk/lib/drivers/lwip/src/rostcp.c | 40 ++++- 14 files changed, 319 insertions(+), 336 deletions(-) diff --git a/drivers/network/tcpip/include/tcp.h b/drivers/network/tcpip/include/tcp.h index 6bb8280d5a1..65a5d11b355 100644 --- a/drivers/network/tcpip/include/tcp.h +++ b/drivers/network/tcpip/include/tcp.h @@ -201,13 +201,13 @@ VOID FlushConnectQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status); VOID -FlushReceiveQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked); +FlushReceiveQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status); VOID -FlushSendQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked); +FlushSendQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status); VOID -FlushShutdownQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked); +FlushShutdownQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status); VOID FlushAllQueues(PCONNECTION_ENDPOINT Connection, NTSTATUS Status); diff --git a/drivers/network/tcpip/include/titypes.h b/drivers/network/tcpip/include/titypes.h index 14541a24a65..0290c2dd54d 100644 --- a/drivers/network/tcpip/include/titypes.h +++ b/drivers/network/tcpip/include/titypes.h @@ -29,44 +29,26 @@ } /* - * VOID LockObject(PVOID Object, PKIRQL OldIrql) + * VOID LockObject(PVOID Object) */ -#define LockObject(Object, Irql) \ -{ \ - ReferenceObject(Object); \ - KeAcquireSpinLock(&((Object)->Lock), Irql); \ - memcpy(&(Object)->OldIrql, Irql, sizeof(KIRQL)); \ -} - -/* - * VOID LockObjectAtDpcLevel(PVOID Object) - */ -#define LockObjectAtDpcLevel(Object) \ -{ \ - ReferenceObject(Object); \ - KeAcquireSpinLockAtDpcLevel(&((Object)->Lock)); \ - (Object)->OldIrql = DISPATCH_LEVEL; \ -} - -/* - * VOID UnlockObject(PVOID Object, KIRQL OldIrql) - */ -#define UnlockObject(Object, OldIrql) \ -{ \ - KeReleaseSpinLock(&((Object)->Lock), OldIrql); \ - DereferenceObject(Object); \ -} +#define LockObject(Object) do \ +{ \ + ReferenceObject(Object); \ + KeEnterCriticalRegion(); \ + ExAcquireResourceExclusiveLite(&(Object)->Resource, TRUE); \ +} while(0) /* - * VOID UnlockObjectFromDpcLevel(PVOID Object) + * VOID UnlockObject(PVOID Object) */ -#define UnlockObjectFromDpcLevel(Object) \ +#define UnlockObject(Object) do \ { \ - KeReleaseSpinLockFromDpcLevel(&((Object)->Lock)); \ + ExReleaseResourceLite(&(Object)->Resource); \ + KeLeaveCriticalRegion(); \ DereferenceObject(Object); \ -} - +} while(0) +#define ASSERT_TCPIP_OBJECT_LOCKED(Object) ASSERT(ExIsResourceAcquiredExclusiveLite(&(Object)->Resource)) #include <ip.h> @@ -131,8 +113,7 @@ typedef struct _ADDRESS_FILE { LIST_ENTRY ListEntry; /* Entry on list */ LONG RefCount; /* Reference count */ OBJECT_FREE_ROUTINE Free; /* Routine to use to free resources for the object */ - KSPIN_LOCK Lock; /* Spin lock to manipulate this structure */ - KIRQL OldIrql; /* Currently not used */ + ERESOURCE Resource; /* Resource to manipulate this structure */ IP_ADDRESS Address; /* Address of this address file */ USHORT Family; /* Address family */ USHORT Protocol; /* Protocol number */ @@ -142,7 +123,6 @@ typedef struct _ADDRESS_FILE { UINT DF; /* Don't fragment */ UINT BCast; /* Receive broadcast packets */ UINT HeaderIncl; /* Include header in RawIP packets */ - WORK_QUEUE_ITEM WorkItem; /* Work queue item handle */ DATAGRAM_COMPLETION_ROUTINE Complete; /* Completion routine for delete request */ PVOID Context; /* Delete request context */ DATAGRAM_SEND_ROUTINE Send; /* Routine to send a datagram */ @@ -262,8 +242,7 @@ typedef struct _CONNECTION_ENDPOINT { LIST_ENTRY ListEntry; /* Entry on list */ LONG RefCount; /* Reference count */ OBJECT_FREE_ROUTINE Free; /* Routine to use to free resources for the object */ - KSPIN_LOCK Lock; /* Spin lock to protect this structure */ - KIRQL OldIrql; /* The old irql is stored here for use in HandleSignalledConnection */ + ERESOURCE Resource; /* The lock protecting this structure */ PVOID ClientContext; /* Pointer to client context information */ PADDRESS_FILE AddressFile; /* Associated address file object (NULL if none) */ @@ -279,6 +258,7 @@ typedef struct _CONNECTION_ENDPOINT { /* Disconnect Timer */ KTIMER DisconnectTimer; KDPC DisconnectDpc; + PIO_WORKITEM DisconnectWorkItem; /* Socket state */ BOOLEAN SendShutdown; diff --git a/drivers/network/tcpip/tcpip/ainfo.c b/drivers/network/tcpip/tcpip/ainfo.c index bba0affc1bc..1553149dc1e 100644 --- a/drivers/network/tcpip/tcpip/ainfo.c +++ b/drivers/network/tcpip/tcpip/ainfo.c @@ -13,17 +13,15 @@ TDI_STATUS SetAddressFileInfo(TDIObjectID *ID, PVOID Buffer, UINT BufferSize) { - KIRQL OldIrql; - switch (ID->toi_id) { case AO_OPTION_TTL: if (BufferSize < sizeof(UINT)) return TDI_INVALID_PARAMETER; - LockObject(AddrFile, &OldIrql); + LockObject(AddrFile); AddrFile->TTL = *((PUCHAR)Buffer); - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); return TDI_SUCCESS; @@ -31,9 +29,9 @@ TDI_STATUS SetAddressFileInfo(TDIObjectID *ID, if (BufferSize < sizeof(UINT)) return TDI_INVALID_PARAMETER; - LockObject(AddrFile, &OldIrql); + LockObject(AddrFile); AddrFile->DF = *((PUINT)Buffer); - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); return TDI_SUCCESS; @@ -41,9 +39,9 @@ TDI_STATUS SetAddressFileInfo(TDIObjectID *ID, if (BufferSize < sizeof(UINT)) return TDI_INVALID_PARAMETER; - LockObject(AddrFile, &OldIrql); + LockObject(AddrFile); AddrFile->BCast = *((PUINT)Buffer); - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); return TDI_SUCCESS; @@ -51,9 +49,9 @@ TDI_STATUS SetAddressFileInfo(TDIObjectID *ID, if (BufferSize < sizeof(UINT)) return TDI_INVALID_PARAMETER; - LockObject(AddrFile, &OldIrql); + LockObject(AddrFile); AddrFile->HeaderIncl = *((PUINT)Buffer); - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); return TDI_SUCCESS; diff --git a/drivers/network/tcpip/tcpip/dispatch.c b/drivers/network/tcpip/tcpip/dispatch.c index da2a00ba5bd..375c0bc5fd5 100644 --- a/drivers/network/tcpip/tcpip/dispatch.c +++ b/drivers/network/tcpip/tcpip/dispatch.c @@ -284,7 +284,6 @@ NTSTATUS DispTdiAssociateAddress( PFILE_OBJECT FileObject; PADDRESS_FILE AddrFile = NULL; NTSTATUS Status; - KIRQL OldIrql; TI_DbgPrint(DEBUG_IRP, ("Called.\n")); @@ -319,18 +318,18 @@ NTSTATUS DispTdiAssociateAddress( return STATUS_INVALID_PARAMETER; } - LockObject(Connection, &OldIrql); + LockObject(Connection); if (Connection->AddressFile) { ObDereferenceObject(FileObject); - UnlockObject(Connection, OldIrql); + UnlockObject(Connection); TI_DbgPrint(MID_TRACE, ("An address file is already associated.\n")); return STATUS_INVALID_PARAMETER; } if (FileObject->FsContext2 != (PVOID)TDI_TRANSPORT_ADDRESS_FILE) { ObDereferenceObject(FileObject); - UnlockObject(Connection, OldIrql); + UnlockObject(Connection); TI_DbgPrint(MID_TRACE, ("Bad address file object. Magic (0x%X).\n", FileObject->FsContext2)); return STATUS_INVALID_PARAMETER; @@ -341,20 +340,20 @@ NTSTATUS DispTdiAssociateAddress( TranContext = FileObject->FsContext; if (!TranContext) { ObDereferenceObject(FileObject); - UnlockObject(Connection, OldIrql); + UnlockObject(Connection); TI_DbgPrint(MID_TRACE, ("Bad transport context.\n")); return STATUS_INVALID_PARAMETER; } AddrFile = (PADDRESS_FILE)TranContext->Handle.AddressHandle; if (!AddrFile) { - UnlockObject(Connection, OldIrql); + UnlockObject(Connection); ObDereferenceObject(FileObject); TI_DbgPrint(MID_TRACE, ("No address file object.\n")); return STATUS_INVALID_PARAMETER; } - LockObjectAtDpcLevel(AddrFile); + LockObject(AddrFile); ReferenceObject(AddrFile); Connection->AddressFile = AddrFile; @@ -373,8 +372,8 @@ NTSTATUS DispTdiAssociateAddress( ObDereferenceObject(FileObject); - UnlockObjectFromDpcLevel(AddrFile); - UnlockObject(Connection, OldIrql); + UnlockObject(AddrFile); + UnlockObject(Connection); return STATUS_SUCCESS; } @@ -563,7 +562,6 @@ NTSTATUS DispTdiListen( PTRANSPORT_CONTEXT TranContext; PIO_STACK_LOCATION IrpSp; NTSTATUS Status = STATUS_SUCCESS; - KIRQL OldIrql; TI_DbgPrint(DEBUG_IRP, ("Called.\n")); @@ -596,17 +594,17 @@ NTSTATUS DispTdiListen( Irp, (PDRIVER_CANCEL)DispCancelListenRequest); - LockObject(Connection, &OldIrql); + LockObject(Connection); if (Connection->AddressFile == NULL) { TI_DbgPrint(MID_TRACE, ("No associated address file\n")); - UnlockObject(Connection, OldIrql); + UnlockObject(Connection); Status = STATUS_INVALID_PARAMETER; goto done; } - LockObjectAtDpcLevel(Connection->AddressFile); + LockObject(Connection->AddressFile); /* Listening will require us to create a listening socket and store it in * the address file. It will be signalled, and attempt to complete an irp @@ -647,8 +645,8 @@ NTSTATUS DispTdiListen( Irp ); } - UnlockObjectFromDpcLevel(Connection->AddressFile); - UnlockObject(Connection, OldIrql); + UnlockObject(Connection->AddressFile); + UnlockObject(Connection); done: if (Status != STATUS_PENDING) { @@ -1116,7 +1114,6 @@ NTSTATUS DispTdiSetEventHandler(PIRP Irp) PIO_STACK_LOCATION IrpSp; PADDRESS_FILE AddrFile; NTSTATUS Status; - KIRQL OldIrql; TI_DbgPrint(DEBUG_IRP, ("Called.\n")); @@ -1139,7 +1136,7 @@ NTSTATUS DispTdiSetEventHandler(PIRP Irp) Parameters = (PTDI_REQUEST_KERNEL_SET_EVENT)&IrpSp->Parameters; Status = STATUS_SUCCESS; - LockObject(AddrFile, &OldIrql); + LockObject(AddrFile); /* Set the event handler. if an event handler is associated with a specific event, it's flag (RegisteredXxxHandler) is TRUE. @@ -1260,7 +1257,7 @@ NTSTATUS DispTdiSetEventHandler(PIRP Irp) Status = STATUS_INVALID_PARAMETER; } - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); return Status; } diff --git a/drivers/network/tcpip/tcpip/fileobjs.c b/drivers/network/tcpip/tcpip/fileobjs.c index 6854acc7da7..d926abed97e 100644 --- a/drivers/network/tcpip/tcpip/fileobjs.c +++ b/drivers/network/tcpip/tcpip/fileobjs.c @@ -310,7 +310,7 @@ VOID AddrFileFree( PADDRESS_FILE AddrFile = Object; KIRQL OldIrql; PDATAGRAM_RECEIVE_REQUEST ReceiveRequest; - PDATAGRAM_SEND_REQUEST SendRequest; + // PDATAGRAM_SEND_REQUEST SendRequest; See WTF below PLIST_ENTRY CurrentEntry; TI_DbgPrint(MID_TRACE, ("Called.\n")); @@ -330,20 +330,26 @@ VOID AddrFileFree( TI_DbgPrint(DEBUG_ADDRFILE, ("Aborting receive requests on AddrFile at (0x%X).\n", AddrFile)); /* Go through pending receive request list and cancel them all */ - while ((CurrentEntry = ExInterlockedRemoveHeadList(&AddrFile->ReceiveQueue, &AddrFile->Lock))) { + while (!IsListEmpty(&AddrFile->ReceiveQueue)) + { + CurrentEntry = RemoveHeadList(&AddrFile->ReceiveQueue); ReceiveRequest = CONTAINING_RECORD(CurrentEntry, DATAGRAM_RECEIVE_REQUEST, ListEntry); (*ReceiveRequest->Complete)(ReceiveRequest->Context, STATUS_CANCELLED, 0); - /* ExFreePoolWithTag(ReceiveRequest, DATAGRAM_RECV_TAG); FIXME: WTF? */ + ExFreePoolWithTag(ReceiveRequest, DATAGRAM_RECV_TAG); } TI_DbgPrint(DEBUG_ADDRFILE, ("Aborting send requests on address file at (0x%X).\n", AddrFile)); +#if 0 /* Biggest WTF. All of this was taken care of above as DATAGRAM_RECEIVE_REQUEST. */ /* Go through pending send request list and cancel them all */ - while ((CurrentEntry = ExInterlockedRemoveHeadList(&AddrFile->ReceiveQueue, &AddrFile->Lock))) { + while (!IsListEmpty(&AddrFile->ReceiveQueue)) + { + CurrentEntry = RemoveHeadList(&AddrFile->ReceiveQueue); SendRequest = CONTAINING_RECORD(CurrentEntry, DATAGRAM_SEND_REQUEST, ListEntry); (*SendRequest->Complete)(SendRequest->Context, STATUS_CANCELLED, 0); ExFreePoolWithTag(SendRequest, DATAGRAM_SEND_TAG); } +#endif /* Protocol specific handling */ switch (AddrFile->Protocol) { @@ -361,6 +367,8 @@ VOID AddrFileFree( RemoveEntityByContext(AddrFile); + ExDeleteResourceLite(&AddrFile->Resource); + ExFreePoolWithTag(Object, ADDR_FILE_TAG); } @@ -553,7 +561,7 @@ NTSTATUS FileOpenAddress( InitializeListHead(&AddrFile->TransmitQueue); /* Initialize spin lock that protects the address file object */ - KeInitializeSpinLock(&AddrFile->Lock); + ExInitializeResourceLite(&AddrFile->Resource); /* Return address file object */ Request->Handle.AddressHandle = AddrFile; @@ -581,27 +589,27 @@ NTSTATUS FileCloseAddress( PTDI_REQUEST Request) { PADDRESS_FILE AddrFile = Request->Handle.AddressHandle; - KIRQL OldIrql; + PCONNECTION_ENDPOINT Listener; if (!Request->Handle.AddressHandle) return STATUS_INVALID_PARAMETER; - LockObject(AddrFile, &OldIrql); + LockObject(AddrFile); if (InterlockedDecrement(&AddrFile->Sharers) != 0) { /* Still other guys have open handles to this, so keep it around */ - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); return STATUS_SUCCESS; } /* We have to close this listener because we started it */ - if( AddrFile->Listener ) + Listener = AddrFile->Listener; + UnlockObject(AddrFile); + if( Listener ) { - TCPClose( AddrFile->Listener ); + TCPClose( Listener ); } - UnlockObject(AddrFile, OldIrql); - DereferenceObject(AddrFile); TI_DbgPrint(MAX_TRACE, ("Leaving.\n")); diff --git a/drivers/network/tcpip/tcpip/icmp.c b/drivers/network/tcpip/tcpip/icmp.c index 7603e2551a5..67d77c14693 100644 --- a/drivers/network/tcpip/tcpip/icmp.c +++ b/drivers/network/tcpip/tcpip/icmp.c @@ -74,11 +74,9 @@ VOID ClearReceiveHandler( _In_ PADDRESS_FILE AddrFile) { - KIRQL OldIrql; - - LockObject(AddrFile, &OldIrql); + LockObject(AddrFile); AddrFile->RegisteredReceiveDatagramHandler = FALSE; - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); } IO_WORKITEM_ROUTINE EndRequestHandler; @@ -95,6 +93,8 @@ EndRequestHandler( UINT32 nReplies; KIRQL OldIrql; + ClearReceiveHandler((PADDRESS_FILE)Context->TdiRequest.Handle.AddressHandle); + KeWaitForSingleObject(&Context->DatagramProcessedEvent, Executive, KernelMode, FALSE, NULL); TI_DbgPrint(DEBUG_ICMP, ("Finishing request Context: %p\n", Context)); @@ -267,8 +267,6 @@ TimeoutHandler( _In_opt_ PVOID SystemArgument2) { PICMP_PACKET_CONTEXT Context = (PICMP_PACKET_CONTEXT)_Context; - PADDRESS_FILE AddrFile = (PADDRESS_FILE)Context->TdiRequest.Handle.AddressHandle; - ClearReceiveHandler(AddrFile); IoQueueWorkItem(Context->FinishWorker, &EndRequestHandler, DelayedWorkQueue, _Context); } @@ -290,7 +288,6 @@ DispEchoRequest( PUCHAR Buffer; UINT16 RequestSize; PICMP_PACKET_CONTEXT SendContext; - KIRQL OldIrql; LARGE_INTEGER RequestTimeout; UINT8 SavedTtl; @@ -390,14 +387,14 @@ DispEchoRequest( RtlZeroMemory(Irp->AssociatedIrp.SystemBuffer, OutputBufferLength); - LockObject(AddrFile, &OldIrql); + LockObject(AddrFile); AddrFile->TTL = SavedTtl; AddrFile->ReceiveDatagramHandlerContext = SendContext; AddrFile->ReceiveDatagramHandler = ReceiveDatagram; AddrFile->RegisteredReceiveDatagramHandler = TRUE; - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); Status = AddrFile->Send(AddrFile, &ConnectionInfo, (PCHAR)Buffer, RequestSize, &DataUsed); diff --git a/sdk/lib/drivers/ip/transport/datagram/datagram.c b/sdk/lib/drivers/ip/transport/datagram/datagram.c index 053a3020894..2840dc950a7 100644 --- a/sdk/lib/drivers/ip/transport/datagram/datagram.c +++ b/sdk/lib/drivers/ip/transport/datagram/datagram.c @@ -16,13 +16,12 @@ BOOLEAN DGRemoveIRP( { PLIST_ENTRY ListEntry; PDATAGRAM_RECEIVE_REQUEST ReceiveRequest; - KIRQL OldIrql; BOOLEAN Found = FALSE; TI_DbgPrint(MAX_TRACE, ("Called (Cancel IRP %08x for file %08x).\n", Irp, AddrFile)); - LockObject(AddrFile, &OldIrql); + LockObject(AddrFile); for( ListEntry = AddrFile->ReceiveQueue.Flink; ListEntry != &AddrFile->ReceiveQueue; @@ -42,7 +41,7 @@ BOOLEAN DGRemoveIRP( } } - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); TI_DbgPrint(MAX_TRACE, ("Done.\n")); @@ -73,7 +72,6 @@ DGDeliverData( * handler if it exists, otherwise we drop the packet. */ { - KIRQL OldIrql; LONG AddressLength; PVOID SourceAddress; ULONG BytesTaken; @@ -82,7 +80,7 @@ DGDeliverData( TI_DbgPrint(MIN_TRACE, ("Called.\n")); - LockObject(AddrFile, &OldIrql); + LockObject(AddrFile); if (AddrFile->Protocol == IPPROTO_UDP) { @@ -145,7 +143,7 @@ DGDeliverData( SrcAddress->Address.IPv4Address, SrcPort)); ReferenceObject(AddrFile); - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); /* Complete the receive request */ if (Current->BufferSize < DataSize) @@ -153,12 +151,12 @@ DGDeliverData( else Current->Complete(Current->Context, STATUS_SUCCESS, DataSize); - LockObject(AddrFile, &OldIrql); + LockObject(AddrFile); DereferenceObject(AddrFile); } } - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); } else if (AddrFile->RegisteredReceiveDatagramHandler) { @@ -186,7 +184,7 @@ DGDeliverData( } ReferenceObject(AddrFile); - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); TI_DbgPrint(MIN_TRACE, ("OptionsSize %d DataSize: %u\n", OptionsSize, DataSize)); @@ -209,7 +207,7 @@ DGDeliverData( } else { - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); TI_DbgPrint(MAX_TRACE, ("Discarding datagram.\n")); } @@ -254,11 +252,10 @@ NTSTATUS DGReceiveDatagram( { NTSTATUS Status; PDATAGRAM_RECEIVE_REQUEST ReceiveRequest; - KIRQL OldIrql; TI_DbgPrint(MAX_TRACE, ("Called.\n")); - LockObject(AddrFile, &OldIrql); + LockObject(AddrFile); ReceiveRequest = ExAllocatePoolWithTag(NonPagedPool, sizeof(DATAGRAM_RECEIVE_REQUEST), DATAGRAM_RECV_TAG); @@ -276,7 +273,7 @@ NTSTATUS DGReceiveDatagram( if (!NT_SUCCESS(Status)) { ExFreePoolWithTag(ReceiveRequest, DATAGRAM_RECV_TAG); - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); return Status; } } @@ -304,13 +301,13 @@ NTSTATUS DGReceiveDatagram( TI_DbgPrint(MAX_TRACE, ("Leaving (pending %08x).\n", ReceiveRequest)); - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); return STATUS_PENDING; } else { - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); Status = STATUS_INSUFFICIENT_RESOURCES; } diff --git a/sdk/lib/drivers/ip/transport/rawip/rawip.c b/sdk/lib/drivers/ip/transport/rawip/rawip.c index 7e7fb22436a..cb32d4b02e3 100644 --- a/sdk/lib/drivers/ip/transport/rawip/rawip.c +++ b/sdk/lib/drivers/ip/transport/rawip/rawip.c @@ -191,9 +191,8 @@ NTSTATUS RawIPSendDatagram( USHORT RemotePort; NTSTATUS Status; PNEIGHBOR_CACHE_ENTRY NCE; - KIRQL OldIrql; - LockObject(AddrFile, &OldIrql); + LockObject(AddrFile); TI_DbgPrint(MID_TRACE,("Sending Datagram(%x %x %x %d)\n", AddrFile, ConnInfo, BufferData, DataSize)); @@ -208,7 +207,7 @@ NTSTATUS RawIPSendDatagram( break; default: - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); return STATUS_UNSUCCESSFUL; } @@ -222,7 +221,7 @@ NTSTATUS RawIPSendDatagram( * interface we're sending over */ if(!(NCE = RouteGetRouteToDestination( &RemoteAddress ))) { - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); return STATUS_NETWORK_UNREACHABLE; } @@ -231,7 +230,7 @@ NTSTATUS RawIPSendDatagram( else { if(!(NCE = NBLocateNeighbor( &LocalAddress, NULL ))) { - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); return STATUS_INVALID_PARAMETER; } } @@ -245,7 +244,7 @@ NTSTATUS RawIPSendDatagram( BufferData, DataSize ); - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); if( !NT_SUCCESS(Status) ) return Status; diff --git a/sdk/lib/drivers/ip/transport/tcp/accept.c b/sdk/lib/drivers/ip/transport/tcp/accept.c index aab177a94ad..19b6d4644ca 100644 --- a/sdk/lib/drivers/ip/transport/tcp/accept.c +++ b/sdk/lib/drivers/ip/transport/tcp/accept.c @@ -48,12 +48,11 @@ NTSTATUS TCPListen(PCONNECTION_ENDPOINT Connection, UINT Backlog) { NTSTATUS Status = STATUS_SUCCESS; struct ip_addr AddressToBind; - KIRQL OldIrql; TA_IP_ADDRESS LocalAddress; ASSERT(Connection); - LockObject(Connection, &OldIrql); + LockObject(Connection); ASSERT_KM_POINTER(Connection->AddressFile); @@ -93,7 +92,7 @@ NTSTATUS TCPListen(PCONNECTION_ENDPOINT Connection, UINT Backlog) Status = STATUS_UNSUCCESSFUL; } - UnlockObject(Connection, OldIrql); + UnlockObject(Connection); TI_DbgPrint(DEBUG_TCP,("[IP, TCPListen] Leaving. Status = %x\n", Status)); @@ -106,10 +105,9 @@ BOOLEAN TCPAbortListenForSocket { PLIST_ENTRY ListEntry; PTDI_BUCKET Bucket; - KIRQL OldIrql; BOOLEAN Found = FALSE; - LockObject(Listener, &OldIrql); + LockObject(Listener); ListEntry = Listener->ListenRequest.Flink; while (ListEntry != &Listener->ListenRequest) @@ -128,7 +126,7 @@ BOOLEAN TCPAbortListenForSocket ListEntry = ListEntry->Flink; } - UnlockObject(Listener, OldIrql); + UnlockObject(Listener); return Found; } @@ -141,9 +139,8 @@ NTSTATUS TCPAccept ( PTDI_REQUEST Request, { NTSTATUS Status; PTDI_BUCKET Bucket; - KIRQL OldIrql; - LockObject(Listener, &OldIrql); + LockObject(Listener); Bucket = ExAllocateFromNPagedLookasideList(&TdiBucketLookasideList); @@ -160,7 +157,7 @@ NTSTATUS TCPAccept ( PTDI_REQUEST Request, else Status = STATUS_NO_MEMORY; - UnlockObject(Listener, OldIrql); + UnlockObject(Listener); return Status; } diff --git a/sdk/lib/drivers/ip/transport/tcp/event.c b/sdk/lib/drivers/ip/transport/tcp/event.c index 02613c2af17..9294815d3d1 100644 --- a/sdk/lib/drivers/ip/transport/tcp/event.c +++ b/sdk/lib/drivers/ip/transport/tcp/event.c @@ -50,125 +50,66 @@ CompleteBucket(PCONNECTION_ENDPOINT Connection, PTDI_BUCKET Bucket, const BOOLEA } VOID -FlushReceiveQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked) +FlushReceiveQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status) { PTDI_BUCKET Bucket; PLIST_ENTRY Entry; - ReferenceObject(Connection); + ASSERT_TCPIP_OBJECT_LOCKED(Connection); - if (interlocked) + while (!IsListEmpty(&Connection->ReceiveRequest)) { - while ((Entry = ExInterlockedRemoveHeadList(&Connection->ReceiveRequest, &Connection->Lock))) - { - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - - TI_DbgPrint(DEBUG_TCP, - ("Completing Receive request: %x %x\n", - Bucket->Request, Status)); + Entry = RemoveHeadList(&Connection->ReceiveRequest); - Bucket->Status = Status; - Bucket->Information = 0; + Bucket = CONTAINING_RECORD(Entry, TDI_BUCKET, Entry); - CompleteBucket(Connection, Bucket, FALSE); - } - } - else - { - while (!IsListEmpty(&Connection->ReceiveRequest)) - { - Entry = RemoveHeadList(&Connection->ReceiveRequest); - - Bucket = CONTAINING_RECORD(Entry, TDI_BUCKET, Entry); - - Bucket->Information = 0; - Bucket->Status = Status; + Bucket->Information = 0; + Bucket->Status = Status; - CompleteBucket(Connection, Bucket, FALSE); - } + CompleteBucket(Connection, Bucket, FALSE); } - - DereferenceObject(Connection); } VOID -FlushSendQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked) +FlushSendQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status) { PTDI_BUCKET Bucket; PLIST_ENTRY Entry; - ReferenceObject(Connection); + ASSERT_TCPIP_OBJECT_LOCKED(Connection); - if (interlocked) + while (!IsListEmpty(&Connection->SendRequest)) { - while ((Entry = ExInterlockedRemoveHeadList(&Connection->SendRequest, &Connection->Lock))) - { - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - - TI_DbgPrint(DEBUG_TCP, - ("Completing Send request: %x %x\n", - Bucket->Request, Status)); - - Bucket->Status = Status; - Bucket->Information = 0; - - CompleteBucket(Connection, Bucket, FALSE); - } - } - else - { - while (!IsListEmpty(&Connection->SendRequest)) - { - Entry = RemoveHeadList(&Connection->SendRequest); + Entry = RemoveHeadList(&Connection->SendRequest); - Bucket = CONTAINING_RECORD(Entry, TDI_BUCKET, Entry); + Bucket = CONTAINING_RECORD(Entry, TDI_BUCKET, Entry); - Bucket->Information = 0; - Bucket->Status = Status; + Bucket->Information = 0; + Bucket->Status = Status; - CompleteBucket(Connection, Bucket, FALSE); - } + CompleteBucket(Connection, Bucket, FALSE); } - - DereferenceObject(Connection); } VOID -FlushShutdownQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked) +FlushShutdownQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status) { PTDI_BUCKET Bucket; PLIST_ENTRY Entry; - ReferenceObject(Connection); - - if (interlocked) - { - while ((Entry = ExInterlockedRemoveHeadList(&Connection->ShutdownRequest, &Connection->Lock))) - { - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - - Bucket->Status = Status; - Bucket->Information = 0; + ASSERT_TCPIP_OBJECT_LOCKED(Connection); - CompleteBucket(Connection, Bucket, FALSE); - } - } - else + while (!IsListEmpty(&Connection->ShutdownRequest)) { - while (!IsListEmpty(&Connection->ShutdownRequest)) - { - Entry = RemoveHeadList(&Connection->ShutdownRequest); + Entry = RemoveHeadList(&Connection->ShutdownRequest); - Bucket = CONTAINING_RECORD(Entry, TDI_BUCKET, Entry); + Bucket = CONTAINING_RECORD(Entry, TDI_BUCKET, Entry); - Bucket->Information = 0; - Bucket->Status = Status; + Bucket->Information = 0; + Bucket->Status = Status; - CompleteBucket(Connection, Bucket, FALSE); - } + CompleteBucket(Connection, Bucket, FALSE); } - - DereferenceObject(Connection); } VOID @@ -177,10 +118,11 @@ FlushConnectQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status) PTDI_BUCKET Bucket; PLIST_ENTRY Entry; - ReferenceObject(Connection); + ASSERT_TCPIP_OBJECT_LOCKED(Connection); - while ((Entry = ExInterlockedRemoveHeadList(&Connection->ConnectRequest, &Connection->Lock))) + while (!IsListEmpty(&Connection->ConnectRequest)) { + Entry = RemoveHeadList(&Connection->ConnectRequest); Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); Bucket->Status = Status; @@ -188,8 +130,6 @@ FlushConnectQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status) CompleteBucket(Connection, Bucket, FALSE); } - - DereferenceObject(Connection); } VOID @@ -198,10 +138,11 @@ FlushListenQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status) PTDI_BUCKET Bucket; PLIST_ENTRY Entry; - ReferenceObject(Connection); + ASSERT_TCPIP_OBJECT_LOCKED(Connection); - while ((Entry = ExInterlockedRemoveHeadList(&Connection->ListenRequest, &Connection->Lock))) + while (!IsListEmpty(&Connection->ListenRequest)) { + Entry = RemoveHeadList(&Connection->ListenRequest); Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); Bucket->Status = Status; @@ -210,17 +151,13 @@ FlushListenQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status) DereferenceObject(Bucket->AssociatedEndpoint); CompleteBucket(Connection, Bucket, FALSE); } - - DereferenceObject(Connection); } VOID FlushAllQueues(PCONNECTION_ENDPOINT Connection, NTSTATUS Status) { - ReferenceObject(Connection); - // flush receive queue - FlushReceiveQueue(Connection, Status, TRUE); + FlushReceiveQueue(Connection, Status); /* We completed the reads successfully but we need to return failure now */ if (Status == STATUS_SUCCESS) @@ -232,15 +169,13 @@ FlushAllQueues(PCONNECTION_ENDPOINT Connection, NTSTATUS Status) FlushListenQueue(Connection, Status); // flush send queue - FlushSendQueue(Connection, Status, TRUE); + FlushSendQueue(Connection, Status); // flush connect queue FlushConnectQueue(Connection, Status); // flush shutdown queue - FlushShutdownQueue(Connection, Status, TRUE); - - DereferenceObject(Connection); + FlushShutdownQueue(Connection, Status); } VOID @@ -248,18 +183,17 @@ TCPFinEventHandler(void *arg, const err_t err) { PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)arg, LastConnection; const NTSTATUS Status = TCPTranslateError(err); - KIRQL OldIrql; ASSERT(Connection->SocketContext == NULL); ASSERT(Connection->AddressFile); ASSERT(err != ERR_OK); + LockObject(Connection); + /* Complete all outstanding requests now */ FlushAllQueues(Connection, Status); - LockObject(Connection, &OldIrql); - - LockObjectAtDpcLevel(Connection->AddressFile); + LockObject(Connection->AddressFile); /* Unlink this connection from the address file */ if (Connection->AddressFile->Connection == Connection) @@ -284,13 +218,13 @@ TCPFinEventHandler(void *arg, const err_t err) } } - UnlockObjectFromDpcLevel(Connection->AddressFile); + UnlockObject(Connection->AddressFile); /* Remove the address file from this connection */ DereferenceObject(Connection->AddressFile); Connection->AddressFile = NULL; - UnlockObject(Connection, OldIrql); + UnlockObject(Connection); } VOID @@ -301,14 +235,15 @@ TCPAcceptEventHandler(void *arg, PTCP_PCB newpcb) PLIST_ENTRY Entry; PIRP Irp; NTSTATUS Status; - KIRQL OldIrql; - ReferenceObject(Connection); + LockObject(Connection); - while ((Entry = ExInterlockedRemoveHeadList(&Connection->ListenRequest, &Connection->Lock))) + while (!IsListEmpty(&Connection->ListenRequest)) { PIO_STACK_LOCATION IrpSp; + Entry = RemoveHeadList(&Connection->ListenRequest); + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); Irp = Bucket->Request.RequestContext; @@ -326,7 +261,7 @@ TCPAcceptEventHandler(void *arg, PTCP_PCB newpcb) if (Status == STATUS_SUCCESS) { - LockObject(Bucket->AssociatedEndpoint, &OldIrql); + LockObject(Bucket->AssociatedEndpoint); /* sanity assert...this should never be in anything else but a CLOSED state */ ASSERT( ((PTCP_PCB)Bucket->AssociatedEndpoint->SocketContext)->state == CLOSED ); @@ -337,9 +272,9 @@ TCPAcceptEventHandler(void *arg, PTCP_PCB newpcb) /* free previously created socket context (we don't use it, we use newpcb) */ Bucket->AssociatedEndpoint->SocketContext = newpcb; - LibTCPAccept(newpcb, (PTCP_PCB)Connection->SocketContext, Bucket->AssociatedEndpoint); + UnlockObject(Bucket->AssociatedEndpoint); - UnlockObject(Bucket->AssociatedEndpoint, OldIrql); + LibTCPAccept(newpcb, (PTCP_PCB)Connection->SocketContext, Bucket->AssociatedEndpoint); } DereferenceObject(Bucket->AssociatedEndpoint); @@ -352,7 +287,7 @@ TCPAcceptEventHandler(void *arg, PTCP_PCB newpcb) } } - DereferenceObject(Connection); + UnlockObject(Connection); } VOID @@ -367,12 +302,17 @@ TCPSendEventHandler(void *arg, const u16_t space) ULONG BytesSent; ReferenceObject(Connection); + LockObject(Connection); - while ((Entry = ExInterlockedRemoveHeadList(&Connection->SendRequest, &Connection->Lock))) + while (!IsListEmpty(&Connection->SendRequest)) { UINT SendLen = 0; PVOID SendBuffer = 0; + Entry = RemoveHeadList(&Connection->SendRequest); + + UnlockObject(Connection); + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); Irp = Bucket->Request.RequestContext; @@ -400,9 +340,8 @@ TCPSendEventHandler(void *arg, const u16_t space) if( Status == STATUS_PENDING ) { - ExInterlockedInsertHeadList(&Connection->SendRequest, - &Bucket->Entry, - &Connection->Lock); + LockObject(Connection); + InsertHeadList(&Connection->SendRequest, &Bucket->Entry); break; } else @@ -416,13 +355,15 @@ TCPSendEventHandler(void *arg, const u16_t space) CompleteBucket(Connection, Bucket, FALSE); } + + LockObject(Connection); } // If we completed all outstanding send requests then finish all pending shutdown requests, // cancel the timer and dereference the connection if (IsListEmpty(&Connection->SendRequest)) { - FlushShutdownQueue(Connection, STATUS_SUCCESS, FALSE); + FlushShutdownQueue(Connection, STATUS_SUCCESS); if (KeCancelTimer(&Connection->DisconnectTimer)) { @@ -430,6 +371,8 @@ TCPSendEventHandler(void *arg, const u16_t space) } } + UnlockObject(Connection); + DereferenceObject(Connection); } @@ -446,10 +389,11 @@ TCPRecvEventHandler(void *arg) PUCHAR RecvBuffer; NTSTATUS Status; - ReferenceObject(Connection); + LockObject(Connection); - while ((Entry = ExInterlockedRemoveHeadList(&Connection->ReceiveRequest, &Connection->Lock))) + while(!IsListEmpty(&Connection->ReceiveRequest)) { + Entry = RemoveHeadList(&Connection->ReceiveRequest); Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); Irp = Bucket->Request.RequestContext; @@ -460,9 +404,7 @@ TCPRecvEventHandler(void *arg) Status = LibTCPGetDataFromConnectionQueue(Connection, RecvBuffer, RecvLen, &Received); if (Status == STATUS_PENDING) { - ExInterlockedInsertHeadList(&Connection->ReceiveRequest, - &Bucket->Entry, - &Connection->Lock); + InsertHeadList(&Connection->ReceiveRequest, &Bucket->Entry); break; } @@ -471,8 +413,7 @@ TCPRecvEventHandler(void *arg) CompleteBucket(Connection, Bucket, FALSE); } - - DereferenceObject(Connection); + UnlockObject(Connection); } VOID @@ -482,10 +423,11 @@ TCPConnectEventHandler(void *arg, const err_t err) PTDI_BUCKET Bucket; PLIST_ENTRY Entry; - ReferenceObject(Connection); + LockObject(Connection); - while ((Entry = ExInterlockedRemoveHeadList(&Connection->ConnectRequest, &Connection->Lock))) + while (!IsListEmpty(&Connection->ConnectRequest)) { + Entry = RemoveHeadList(&Connection->ConnectRequest); Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); @@ -495,5 +437,5 @@ TCPConnectEventHandler(void *arg, const err_t err) CompleteBucket(Connection, Bucket, FALSE); } - DereferenceObject(Connection); + UnlockObject(Connection); } diff --git a/sdk/lib/drivers/ip/transport/tcp/tcp.c b/sdk/lib/drivers/ip/transport/tcp/tcp.c index d18b350a967..7bdc8ab7486 100644 --- a/sdk/lib/drivers/ip/transport/tcp/tcp.c +++ b/sdk/lib/drivers/ip/transport/tcp/tcp.c @@ -25,21 +25,27 @@ PORT_SET TCPPorts; NPAGED_LOOKASIDE_LIST TdiBucketLookasideList; -VOID NTAPI -DisconnectTimeoutDpc(PKDPC Dpc, - PVOID DeferredContext, - PVOID SystemArgument1, - PVOID SystemArgument2) +static +IO_WORKITEM_ROUTINE +DisconnectWorker; + +_Use_decl_annotations_ +VOID +NTAPI +DisconnectWorker( + _Unreferenced_parameter_ PDEVICE_OBJECT DeviceObject, + _In_ PVOID Context +) { - PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)DeferredContext; + PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)Context; PLIST_ENTRY Entry; PTDI_BUCKET Bucket; - LockObjectAtDpcLevel(Connection); - /* We timed out waiting for pending sends so force it to shutdown */ TCPTranslateError(LibTCPShutdown(Connection, 0, 1)); + LockObject(Connection); + while (!IsListEmpty(&Connection->SendRequest)) { Entry = RemoveHeadList(&Connection->SendRequest); @@ -64,11 +70,23 @@ DisconnectTimeoutDpc(PKDPC Dpc, CompleteBucket(Connection, Bucket, FALSE); } - UnlockObjectFromDpcLevel(Connection); + UnlockObject(Connection); DereferenceObject(Connection); } +VOID +NTAPI +DisconnectTimeoutDpc(PKDPC Dpc, + PVOID DeferredContext, + PVOID SystemArgument1, + PVOID SystemArgument2) +{ + PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)DeferredContext; + + IoQueueWorkItem(Connection->DisconnectWorkItem, DisconnectWorker, DelayedWorkQueue, Connection); +} + VOID ConnectionFree(PVOID Object) { PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)Object; @@ -80,6 +98,9 @@ VOID ConnectionFree(PVOID Object) RemoveEntryList(&Connection->ListEntry); TcpipReleaseSpinLock(&ConnectionEndpointListLock, OldIrql); + ExDeleteResourceLite(&Connection->Resource); + IoFreeWorkItem(Connection->DisconnectWorkItem); + ExFreePoolWithTag( Connection, CONN_ENDPT_TAG ); } @@ -96,7 +117,7 @@ PCONNECTION_ENDPOINT TCPAllocateConnectionEndpoint( PVOID ClientContext ) RtlZeroMemory(Connection, sizeof(CONNECTION_ENDPOINT)); /* Initialize spin lock that protects the connection endpoint file object */ - KeInitializeSpinLock(&Connection->Lock); + ExInitializeResourceLite(&Connection->Resource); InitializeListHead(&Connection->ConnectRequest); InitializeListHead(&Connection->ListenRequest); InitializeListHead(&Connection->ReceiveRequest); @@ -107,6 +128,13 @@ PCONNECTION_ENDPOINT TCPAllocateConnectionEndpoint( PVOID ClientContext ) /* Initialize disconnect timer */ KeInitializeTimer(&Connection->DisconnectTimer); KeInitializeDpc(&Connection->DisconnectDpc, DisconnectTimeoutDpc, Connection); + Connection->DisconnectWorkItem = IoAllocateWorkItem(TCPDeviceObject); + if (!Connection->DisconnectWorkItem) + { + ExDeleteResourceLite(&Connection->Resource); + ExFreePoolWithTag( Connection, CONN_ENDPT_TAG ); + return NULL; + } /* Save client context pointer */ Connection->ClientContext = ClientContext; @@ -126,9 +154,8 @@ NTSTATUS TCPSocket( PCONNECTION_ENDPOINT Connection, UINT Family, UINT Type, UINT Proto ) { NTSTATUS Status; - KIRQL OldIrql; - LockObject(Connection, &OldIrql); + LockObject(Connection); TI_DbgPrint(DEBUG_TCP,("[IP, TCPSocket] Called: Connection %x, Family %d, Type %d, " "Proto %d, sizeof(CONNECTION_ENDPOINT) = %d\n", @@ -140,7 +167,7 @@ NTSTATUS TCPSocket( PCONNECTION_ENDPOINT Connection, else Status = STATUS_INSUFFICIENT_RESOURCES; - UnlockObject(Connection, OldIrql); + UnlockObject(Connection); TI_DbgPrint(DEBUG_TCP,("[IP, TCPSocket] Leaving. Status = 0x%x\n", Status)); @@ -149,15 +176,13 @@ NTSTATUS TCPSocket( PCONNECTION_ENDPOINT Connection, NTSTATUS TCPClose( PCONNECTION_ENDPOINT Connection ) { - KIRQL OldIrql; - - LockObject(Connection, &OldIrql); + LockObject(Connection); FlushAllQueues(Connection, STATUS_CANCELLED); - LibTCPClose(Connection, FALSE, TRUE); + UnlockObject(Connection); - UnlockObject(Connection, OldIrql); + LibTCPClose(Connection, FALSE, TRUE); DereferenceObject(Connection); @@ -287,7 +312,6 @@ NTSTATUS TCPConnect TA_IP_ADDRESS LocalAddress; PTDI_BUCKET Bucket; PNEIGHBOR_CACHE_ENTRY NCE; - KIRQL OldIrql; TI_DbgPrint(DEBUG_TCP,("[IP, TCPConnect] Called\n")); @@ -308,11 +332,11 @@ NTSTATUS TCPConnect RemoteAddress.Address.IPv4Address, RemotePort)); - LockObject(Connection, &OldIrql); + LockObject(Connection); if (!Connection->AddressFile) { - UnlockObject(Connection, OldIrql); + UnlockObject(Connection); return STATUS_INVALID_PARAMETER; } @@ -320,7 +344,7 @@ NTSTATUS TCPConnect { if (!(NCE = RouteGetRouteToDestination(&RemoteAddress))) { - UnlockObject(Connection, OldIrql); + UnlockObject(Connection); return STATUS_NETWORK_UNREACHABLE; } @@ -335,48 +359,51 @@ NTSTATUS TCPConnect &bindaddr, Connection->AddressFile->Port)); - if (NT_SUCCESS(Status)) + if (!NT_SUCCESS(Status)) { - /* Copy bind address into connection */ - Connection->AddressFile->Address.Address.IPv4Address = bindaddr.addr; - /* Check if we had an unspecified port */ - if (!Connection->AddressFile->Port) - { - /* We did, so we need to copy back the port */ - Status = TCPGetSockAddress(Connection, (PTRANSPORT_ADDRESS)&LocalAddress, FALSE); - if (NT_SUCCESS(Status)) - { - /* Allocate the port in the port bitmap */ - Connection->AddressFile->Port = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port); - - /* This should never fail */ - ASSERT(Connection->AddressFile->Port != 0xFFFF); - } - } + UnlockObject(Connection); + return Status; + } - if (NT_SUCCESS(Status)) + /* Copy bind address into connection */ + Connection->AddressFile->Address.Address.IPv4Address = bindaddr.addr; + /* Check if we had an unspecified port */ + if (!Connection->AddressFile->Port) + { + /* We did, so we need to copy back the port */ + Status = TCPGetSockAddress(Connection, (PTRANSPORT_ADDRESS)&LocalAddress, FALSE); + if (!NT_SUCCESS(Status)) { - connaddr.addr = RemoteAddress.Address.IPv4Address; + UnlockObject(Connection); + return Status; + } - Bucket = ExAllocateFromNPagedLookasideList(&TdiBucketLookasideList); - if (!Bucket) - { - UnlockObject(Connection, OldIrql); - return STATUS_NO_MEMORY; - } + /* Allocate the port in the port bitmap */ + Connection->AddressFile->Port = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port); - Bucket->Request.RequestNotifyObject = (PVOID)Complete; - Bucket->Request.RequestContext = Context; + /* This should never fail */ + ASSERT(Connection->AddressFile->Port != 0xFFFF); + } - InsertTailList( &Connection->ConnectRequest, &Bucket->Entry ); + connaddr.addr = RemoteAddress.Address.IPv4Address; - Status = TCPTranslateError(LibTCPConnect(Connection, - &connaddr, - RemotePort)); - } + Bucket = ExAllocateFromNPagedLookasideList(&TdiBucketLookasideList); + if (!Bucket) + { + UnlockObject(Connection); + return STATUS_NO_MEMORY; } - UnlockObject(Connection, OldIrql); + Bucket->Request.RequestNotifyObject = (PVOID)Complete; + Bucket->Request.RequestContext = Context; + + InsertTailList( &Connection->ConnectRequest, &Bucket->Entry ); + + UnlockObject(Connection); + + Status = TCPTranslateError(LibTCPConnect(Connection, + &connaddr, + RemotePort)); TI_DbgPrint(DEBUG_TCP,("[IP, TCPConnect] Leaving. Status = 0x%x\n", Status)); @@ -394,12 +421,11 @@ NTSTATUS TCPDisconnect { NTSTATUS Status = STATUS_INVALID_PARAMETER; PTDI_BUCKET Bucket; - KIRQL OldIrql; LARGE_INTEGER ActualTimeout; TI_DbgPrint(DEBUG_TCP,("[IP, TCPDisconnect] Called\n")); - LockObject(Connection, &OldIrql); + LockObject(Connection); if (Connection->SocketContext) { @@ -407,12 +433,20 @@ NTSTATUS TCPDisconnect { if (IsListEmpty(&Connection->SendRequest)) { + ReferenceObject(Connection); + UnlockObject(Connection); Status = TCPTranslateError(LibTCPShutdown(Connection, 0, 1)); + LockObject(Connection); + DereferenceObject(Connection); } else if (Timeout && Timeout->QuadPart == 0) { - FlushSendQueue(Connection, STATUS_FILE_CLOSED, FALSE); - TCPTranslateError(LibTCPShutdown(Connection, 0, 1)); + FlushSendQueue(Connection, STATUS_FILE_CLOSED); + ReferenceObject(Connection); + UnlockObject(Connection); + LibTCPShutdown(Connection, 0, 1); + LockObject(Connection); + DereferenceObject(Connection); Status = STATUS_TIMEOUT; } else @@ -431,7 +465,7 @@ NTSTATUS TCPDisconnect Bucket = ExAllocateFromNPagedLookasideList(&TdiBucketLookasideList); if (!Bucket) { - UnlockObject(Connection, OldIrql); + UnlockObject(Connection); return STATUS_NO_MEMORY; } @@ -441,11 +475,11 @@ NTSTATUS TCPDisconnect InsertTailList(&Connection->ShutdownRequest, &Bucket->Entry); ReferenceObject(Connection); - if (KeCancelTimer(&Connection->DisconnectTimer)) + if (KeSetTimer(&Connection->DisconnectTimer, ActualTimeout, &Connection->DisconnectDpc)) { + /* Timer was already in the queue. */ DereferenceObject(Connection); } - KeSetTimer(&Connection->DisconnectTimer, ActualTimeout, &Connection->DisconnectDpc); Status = STATUS_PENDING; } @@ -453,20 +487,26 @@ NTSTATUS TCPDisconnect if ((Flags & TDI_DISCONNECT_ABORT) || !Flags) { - FlushReceiveQueue(Connection, STATUS_FILE_CLOSED, FALSE); - FlushSendQueue(Connection, STATUS_FILE_CLOSED, FALSE); - FlushShutdownQueue(Connection, STATUS_FILE_CLOSED, FALSE); + FlushReceiveQueue(Connection, STATUS_FILE_CLOSED); + FlushSendQueue(Connection, STATUS_FILE_CLOSED); + FlushShutdownQueue(Connection, STATUS_FILE_CLOSED); + ReferenceObject(Connection); + UnlockObject(Connection); Status = TCPTranslateError(LibTCPShutdown(Connection, 1, 1)); + DereferenceObject(Connection); + } + else + { + UnlockObject(Connection); } } else { + UnlockObject(Connection); /* We already got closed by the other side so just return success */ Status = STATUS_SUCCESS; } - UnlockObject(Connection, OldIrql); - TI_DbgPrint(DEBUG_TCP,("[IP, TCPDisconnect] Leaving. Status = 0x%x\n", Status)); return Status; @@ -506,7 +546,9 @@ NTSTATUS TCPReceiveData Bucket->Request.RequestNotifyObject = Complete; Bucket->Request.RequestContext = Context; - ExInterlockedInsertTailList( &Connection->ReceiveRequest, &Bucket->Entry, &Connection->Lock ); + LockObject(Connection); + InsertTailList( &Connection->ReceiveRequest, &Bucket->Entry ); + UnlockObject(Connection); TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Queued read irp\n")); TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Leaving. Status = STATUS_PENDING\n")); @@ -532,9 +574,8 @@ NTSTATUS TCPSendData { NTSTATUS Status; PTDI_BUCKET Bucket; - KIRQL OldIrql; - LockObject(Connection, &OldIrql); + ReferenceObject(Connection); TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Called for %d bytes (on socket %x)\n", SendLength, Connection->SocketContext)); @@ -558,7 +599,7 @@ NTSTATUS TCPSendData Bucket = ExAllocateFromNPagedLookasideList(&TdiBucketLookasideList); if (!Bucket) { - UnlockObject(Connection, OldIrql); + DereferenceObject(Connection); TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Failed to allocate bucket\n")); return STATUS_NO_MEMORY; } @@ -566,13 +607,15 @@ NTSTATUS TCPSendData Bucket->Request.RequestNotifyObject = Complete; Bucket->Request.RequestContext = Context; + LockObject(Connection); InsertTailList( &Connection->SendRequest, &Bucket->Entry ); TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Queued write irp\n")); + UnlockObject(Connection); } - UnlockObject(Connection, OldIrql); TI_DbgPrint(DEBUG_TCP, ("[IP, TCPSendData] Leaving. Status = %x\n", Status)); + DereferenceObject(Connection); return Status; } @@ -606,13 +649,12 @@ NTSTATUS TCPGetSockAddress PTA_IP_ADDRESS AddressIP = (PTA_IP_ADDRESS)Address; struct ip_addr ipaddr; NTSTATUS Status; - KIRQL OldIrql; AddressIP->TAAddressCount = 1; AddressIP->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP; AddressIP->Address[0].AddressType = TDI_ADDRESS_TYPE_IP; - LockObject(Connection, &OldIrql); + LockObject(Connection); if (GetRemote) { @@ -627,7 +669,7 @@ NTSTATUS TCPGetSockAddress &AddressIP->Address[0].Address[0].sin_port)); } - UnlockObject(Connection, OldIrql); + UnlockObject(Connection); AddressIP->Address[0].Address[0].in_addr = ipaddr.addr; @@ -641,7 +683,6 @@ BOOLEAN TCPRemoveIRP( PCONNECTION_ENDPOINT Endpoint, PIRP Irp ) { PLIST_ENTRY Entry; PLIST_ENTRY ListHead[5]; - KIRQL OldIrql; PTDI_BUCKET Bucket; UINT i = 0; BOOLEAN Found = FALSE; @@ -652,7 +693,7 @@ BOOLEAN TCPRemoveIRP( PCONNECTION_ENDPOINT Endpoint, PIRP Irp ) ListHead[3] = &Endpoint->ListenRequest; ListHead[4] = &Endpoint->ShutdownRequest; - LockObject(Endpoint, &OldIrql); + LockObject(Endpoint); for( i = 0; i < 5; i++ ) { @@ -671,7 +712,7 @@ BOOLEAN TCPRemoveIRP( PCONNECTION_ENDPOINT Endpoint, PIRP Irp ) } } - UnlockObject(Endpoint, OldIrql); + UnlockObject(Endpoint); return Found; } diff --git a/sdk/lib/drivers/ip/transport/udp/udp.c b/sdk/lib/drivers/ip/transport/udp/udp.c index 783dae988b9..0ad09fa7bf3 100644 --- a/sdk/lib/drivers/ip/transport/udp/udp.c +++ b/sdk/lib/drivers/ip/transport/udp/udp.c @@ -171,9 +171,8 @@ NTSTATUS UDPSendDatagram( USHORT RemotePort; NTSTATUS Status; PNEIGHBOR_CACHE_ENTRY NCE; - KIRQL OldIrql; - LockObject(AddrFile, &OldIrql); + LockObject(AddrFile); TI_DbgPrint(MID_TRACE,("Sending Datagram(%x %x %x %d)\n", AddrFile, ConnInfo, BufferData, DataSize)); @@ -188,7 +187,7 @@ NTSTATUS UDPSendDatagram( break; default: - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); return STATUS_UNSUCCESSFUL; } @@ -200,7 +199,7 @@ NTSTATUS UDPSendDatagram( * interface we're sending over */ if(!(NCE = RouteGetRouteToDestination( &RemoteAddress ))) { - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); return STATUS_NETWORK_UNREACHABLE; } @@ -209,7 +208,7 @@ NTSTATUS UDPSendDatagram( else { if(!(NCE = NBLocateNeighbor( &LocalAddress, NULL ))) { - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); return STATUS_INVALID_PARAMETER; } } @@ -223,7 +222,7 @@ NTSTATUS UDPSendDatagram( BufferData, DataSize ); - UnlockObject(AddrFile, OldIrql); + UnlockObject(AddrFile); if( !NT_SUCCESS(Status) ) return Status; diff --git a/sdk/lib/drivers/lwip/src/include/rosip.h b/sdk/lib/drivers/lwip/src/include/rosip.h index af852910d2f..701a65614da 100644 --- a/sdk/lib/drivers/lwip/src/include/rosip.h +++ b/sdk/lib/drivers/lwip/src/include/rosip.h @@ -31,6 +31,9 @@ struct lwip_callback_msg struct { PVOID Arg; } Socket; + struct { + struct tcp_pcb* pcb; + } FreeSocket; struct { PCONNECTION_ENDPOINT Connection; struct ip_addr *IpAddress; @@ -99,6 +102,7 @@ extern void TCPRecvEventHandler(void *arg); /* TCP functions */ PTCP_PCB LibTCPSocket(void *arg); +VOID LibTCPFreeSocket(PTCP_PCB pcb); err_t LibTCPBind(PCONNECTION_ENDPOINT Connection, struct ip_addr *const ipaddr, const u16_t port); PTCP_PCB LibTCPListen(PCONNECTION_ENDPOINT Connection, const u8_t backlog); err_t LibTCPSend(PCONNECTION_ENDPOINT Connection, void *const dataptr, const u16_t len, u32_t *sent, const int safe); diff --git a/sdk/lib/drivers/lwip/src/rostcp.c b/sdk/lib/drivers/lwip/src/rostcp.c index de5564642b8..cc0dd4bc0d6 100644 --- a/sdk/lib/drivers/lwip/src/rostcp.c +++ b/sdk/lib/drivers/lwip/src/rostcp.c @@ -81,7 +81,9 @@ void LibTCPEnqueuePacket(PCONNECTION_ENDPOINT Connection, struct pbuf *p) qp->p = p; qp->Offset = 0; - ExInterlockedInsertTailList(&Connection->PacketQueue, &qp->ListEntry, &Connection->Lock); + LockObject(Connection); + InsertTailList(&Connection->PacketQueue, &qp->ListEntry); + UnlockObject(Connection); } PQUEUE_ENTRY LibTCPDequeuePacket(PCONNECTION_ENDPOINT Connection) @@ -104,11 +106,10 @@ NTSTATUS LibTCPGetDataFromConnectionQueue(PCONNECTION_ENDPOINT Connection, PUCHA struct pbuf* p; NTSTATUS Status; UINT ReadLength, PayloadLength, Offset, Copied; - KIRQL OldIrql; (*Received) = 0; - LockObject(Connection, &OldIrql); + LockObject(Connection); if (!IsListEmpty(&Connection->PacketQueue)) { @@ -132,13 +133,9 @@ NTSTATUS LibTCPGetDataFromConnectionQueue(PCONNECTION_ENDPOINT Connection, PUCHA qp = NULL; } - UnlockObject(Connection, OldIrql); - Copied = pbuf_copy_partial(p, RecvBuffer, ReadLength, Offset); ASSERT(Copied == ReadLength); - LockObject(Connection, &OldIrql); - /* Update trackers */ RecvLen -= ReadLength; RecvBuffer += ReadLength; @@ -172,7 +169,7 @@ NTSTATUS LibTCPGetDataFromConnectionQueue(PCONNECTION_ENDPOINT Connection, PUCHA Status = STATUS_PENDING; } - UnlockObject(Connection, OldIrql); + UnlockObject(Connection); return Status; } @@ -364,6 +361,33 @@ LibTCPSocket(void *arg) return NULL; } +static +void +LibTCPFreeSocketCallback(void *arg) +{ + struct lwip_callback_msg *msg = arg; + + ASSERT(msg); + + /* Calling tcp_close will free it */ + tcp_close(msg->Input.FreeSocket.pcb); + + KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE); +} + +void LibTCPFreeSocket(PTCP_PCB pcb) +{ + struct lwip_callback_msg msg; + + KeInitializeEvent(&msg.Event, NotificationEvent, FALSE); + msg.Input.FreeSocket.pcb = pcb; + + tcpip_callback_with_block(LibTCPFreeSocketCallback, &msg, 1); + + WaitForEventSafely(&msg.Event); +} + + static void LibTCPBindCallback(void *arg)
3 years, 6 months
1
0
0
0
[reactos] 01/01: [USETUP] Update de-DE
by Joachim Henze
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=10e48faf1deada2655ae2…
commit 10e48faf1deada2655ae2641940c01afecbf0831 Author: Joachim Henze <Joachim.Henze(a)reactos.org> AuthorDate: Mon Jun 21 07:37:58 2021 +0200 Commit: Joachim Henze <Joachim.Henze(a)reactos.org> CommitDate: Mon Jun 21 07:37:58 2021 +0200 [USETUP] Update de-DE Translate the Copying-bootloader status bar text that was added during 0.4.15-dev'ing --- base/setup/usetup/lang/de-DE.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/setup/usetup/lang/de-DE.h b/base/setup/usetup/lang/de-DE.h index 10dc56e1175..dc953ecb57f 100644 --- a/base/setup/usetup/lang/de-DE.h +++ b/base/setup/usetup/lang/de-DE.h @@ -1537,7 +1537,7 @@ static MUI_ENTRY deDEBootLoaderInstallPageEntries[] = { 0, 0, - "Installing the bootloader onto the media, please wait...", + "Bootloader wird installiert. Bitte warten...", TEXT_TYPE_STATUS | TEXT_PADDING_BIG, TEXT_ID_STATIC },
3 years, 6 months
1
0
0
0
[reactos] 02/02: [NE2000] Add description for Realtek RTL8019AS (emulated by 86Box)
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5697b485837f45270c5dc…
commit 5697b485837f45270c5dce4e65d509d57d1c75c0 Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Sun Jun 20 20:20:16 2021 +0300 Commit: Stanislav Motylkov <x86corez(a)gmail.com> CommitDate: Sun Jun 20 20:20:16 2021 +0300 [NE2000] Add description for Realtek RTL8019AS (emulated by 86Box) --- drivers/network/dd/ne2000/netne2000.inf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/network/dd/ne2000/netne2000.inf b/drivers/network/dd/ne2000/netne2000.inf index 7f8412c71e2..62823b99d0d 100644 --- a/drivers/network/dd/ne2000/netne2000.inf +++ b/drivers/network/dd/ne2000/netne2000.inf @@ -22,6 +22,7 @@ DefaultDestDir = 12 %*PNP80D6.DeviceDesc% = NE2000_Inst_Isa.ndi,*PNP80D6 [RealtekMfg] +%*RTL8019.DeviceDesc% = NE2000_Inst_Isa.ndi,*RTL8019 %PCI\VEN_10EC&DEV_8029.DeviceDesc% = NE2000_Inst_Pci.ndi,PCI\VEN_10EC&DEV_8029 ;---------------------------- NE2000 DRIVER ----------------------------- @@ -67,6 +68,7 @@ GenericMfg = "(Generic network cards)" *PNP80D6.DeviceDesc = "NE2000-compatible Ethernet Adapter" RealtekMfg = "Realtek Semiconductor Co., Ltd." +*RTL8019.DeviceDesc = "Realtek RTL8019AS ISA Ethernet Adapter" PCI\VEN_10EC&DEV_8029.DeviceDesc = "Realtek RTL8029 PCI Ethernet Adapter" [Strings.0405] @@ -97,6 +99,7 @@ ReactOS = "Zespół ReactOS" GenericMfg = "(Standardowe karty sieciowe)" *PNP80D6.DeviceDesc = "Karta sieciowa kompatybilna z NE2000" +*RTL8019.DeviceDesc = "Karta Realtek RTL8019AS ISA Ethernet Adapter" PCI\VEN_10EC&DEV_8029.DeviceDesc = "Karta Realtek RTL8029 PCI Ethernet Adapter" [Strings.0416]
3 years, 6 months
1
0
0
0
[reactos] 01/02: [NE2000] Combine two INF files into one for ISA and PCI cards
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6924b8ff3985224a2d094…
commit 6924b8ff3985224a2d094ce509e4b843f387ab32 Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Sun Jun 20 20:16:33 2021 +0300 Commit: Stanislav Motylkov <x86corez(a)gmail.com> CommitDate: Sun Jun 20 20:16:33 2021 +0300 [NE2000] Combine two INF files into one for ISA and PCI cards --- drivers/network/dd/ne2000/CMakeLists.txt | 2 +- drivers/network/dd/ne2000/netne2000.inf | 38 ++++++++++++---- drivers/network/dd/ne2000/netrtl8029.inf | 74 -------------------------------- 3 files changed, 31 insertions(+), 83 deletions(-) diff --git a/drivers/network/dd/ne2000/CMakeLists.txt b/drivers/network/dd/ne2000/CMakeLists.txt index ba6af5b8526..23628771d29 100644 --- a/drivers/network/dd/ne2000/CMakeLists.txt +++ b/drivers/network/dd/ne2000/CMakeLists.txt @@ -11,4 +11,4 @@ add_pch(ne2000 include/ne2000.h SOURCE) set_module_type(ne2000 kernelmodedriver) add_importlibs(ne2000 ndis ntoskrnl hal) add_cd_file(TARGET ne2000 DESTINATION reactos/system32/drivers FOR all) -add_driver_inf(ne2000 netne2000.inf netrtl8029.inf) +add_driver_inf(ne2000 netne2000.inf) diff --git a/drivers/network/dd/ne2000/netne2000.inf b/drivers/network/dd/ne2000/netne2000.inf index cbcc1c41d7d..7f8412c71e2 100644 --- a/drivers/network/dd/ne2000/netne2000.inf +++ b/drivers/network/dd/ne2000/netne2000.inf @@ -1,6 +1,6 @@ -; NETISA.INF +; NETNE2000.INF -; Installation file for ISA network cards +; Installation file for NE2000-compatible network cards [Version] Signature = "$Windows NT$" @@ -16,18 +16,28 @@ DefaultDestDir = 12 [Manufacturer] %GenericMfg% = GenericMfg +%RealtekMfg% = RealtekMfg [GenericMfg] -%*PNP80D6.DeviceDesc% = NE2000_Inst.ndi,*PNP80D6 +%*PNP80D6.DeviceDesc% = NE2000_Inst_Isa.ndi,*PNP80D6 + +[RealtekMfg] +%PCI\VEN_10EC&DEV_8029.DeviceDesc% = NE2000_Inst_Pci.ndi,PCI\VEN_10EC&DEV_8029 ;---------------------------- NE2000 DRIVER ----------------------------- -[NE2000_Inst.ndi.NT] +[NE2000_Inst_Isa.ndi.NT] Characteristics = 0x4 ; NCF_PHYSICAL BusType = 14 ; PNPIsaBus AddReg = NE2000_AddReg.NT CopyFiles = NE2000_CopyFiles.NT +[NE2000_Inst_Pci.ndi.NT] +Characteristics = 0x4 ; NCF_PHYSICAL +BusType = 5 ; PCIBus +AddReg = NE2000_AddReg.NT +CopyFiles = NE2000_CopyFiles.NT + [NE2000_AddReg.NT] HKR,,Port,0x00000000,"c100" HKR,,Irq,0x00000000,"B" @@ -35,7 +45,10 @@ HKR,,Irq,0x00000000,"B" [NE2000_CopyFiles.NT] ne2000.sys -[NE2000_Inst.ndi.NT.Services] +[NE2000_Inst_Isa.ndi.NT.Services] +AddService = ne2000, 0x00000002, ne2000_Service_Inst + +[NE2000_Inst_Pci.ndi.NT.Services] AddService = ne2000, 0x00000002, ne2000_Service_Inst [ne2000_Service_Inst] @@ -51,7 +64,10 @@ LoadOrderGroup = NDIS ReactOS = "ReactOS Team" GenericMfg = "(Generic network cards)" -*PNP80D6.DeviceDesc = "NE2000 Compatible ISA Ethernet Adapter" +*PNP80D6.DeviceDesc = "NE2000-compatible Ethernet Adapter" + +RealtekMfg = "Realtek Semiconductor Co., Ltd." +PCI\VEN_10EC&DEV_8029.DeviceDesc = "Realtek RTL8029 PCI Ethernet Adapter" [Strings.0405] GenericMfg = "(Generické síťové karty)" @@ -77,22 +93,27 @@ GenericMfg = "(標準 ネットワーク カード)" [Strings.0415] ReactOS = "Zespół ReactOS" + GenericMfg = "(Standardowe karty sieciowe)" *PNP80D6.DeviceDesc = "Karta sieciowa kompatybilna z NE2000" +PCI\VEN_10EC&DEV_8029.DeviceDesc = "Karta Realtek RTL8029 PCI Ethernet Adapter" + [Strings.0416] GenericMfg = "(Adaptadores de rede padrão)" *PNP80D6.DeviceDesc = "Compatível com NE2000" [Strings.0418] ReactOS = "Echipa ReactOS" + GenericMfg = "(placă de rețea generică)" *PNP80D6.DeviceDesc = "Compatibile cu NE2000" [Strings.0419] ReactOS = "Команда ReactOS" + GenericMfg = "(Стандартные сетевые адаптеры)" -*PNP80D6.DeviceDesc = "NE2000-совместимые" +*PNP80D6.DeviceDesc = "NE2000-совместимый сетевой адаптер" [Strings.041B] GenericMfg = "(Generické sieťové karty)" @@ -106,8 +127,9 @@ GenericMfg = "(Umûmî Ağ Kartları)" [Strings.0422] ReactOS = "Команда ReactOS" + GenericMfg = "(Стандартні мережеві адаптери)" -*PNP80D6.DeviceDesc = "NE2000-сумісні" +*PNP80D6.DeviceDesc = "NE2000-сумісний мережевий адаптер" [Strings.0427] GenericMfg = "(Standartinės tinklo plokštės)" diff --git a/drivers/network/dd/ne2000/netrtl8029.inf b/drivers/network/dd/ne2000/netrtl8029.inf deleted file mode 100644 index 56cd50dc889..00000000000 --- a/drivers/network/dd/ne2000/netrtl8029.inf +++ /dev/null @@ -1,74 +0,0 @@ -; NETRTPNT.INF - -; Installation file for 8029 compatible netcards - -[Version] -Signature = "$Windows NT$" -;Signature = "$ReactOS$" -LayoutFile = layout.inf -Class = Net -ClassGUID = {4D36E972-E325-11CE-BFC1-08002BE10318} -Provider = %ReactOS% -DriverVer = 02/15/2007,1.01 - -[DestinationDirs] -DefaultDestDir = 12 - -[Manufacturer] -%RealtekMfg% = RealtekMfg - -[RealtekMfg] -%PCI\VEN_10EC&DEV_8029.DeviceDesc% = NE2000_Inst.ndi,PCI\VEN_10EC&DEV_8029 - -;---------------------------- NE2000 DRIVER ----------------------------- - -[NE2000_Inst.ndi.NT] -Characteristics = 0x4 ; NCF_PHYSICAL -BusType = 5 ; PCIBus -AddReg = NE2000_AddReg.NT -CopyFiles = NE2000_CopyFiles.NT - -[NE2000_AddReg.NT] -HKR,,Port,0x00000000,"c100" -HKR,,Irq,0x00000000,"B" - -[NE2000_CopyFiles.NT] -ne2000.sys - -[NE2000_Inst.ndi.NT.Services] -AddService = ne2000, 0x00000002, ne2000_Service_Inst - -[ne2000_Service_Inst] -ServiceType = 1 -StartType = 3 -ErrorControl = 1 -ServiceBinary = %12%\ne2000.sys -LoadOrderGroup = NDIS - -;-------------------------------- STRINGS ------------------------------- - -[Strings] -ReactOS = "ReactOS Team" - -RealtekMfg = "Realtek Semiconductor Co., Ltd." -PCI\VEN_10EC&DEV_8029.DeviceDesc = "Realtek RTL8029 PCI Ethernet Adapter" - -[Strings.0a] -ReactOS = "Equipo de ReactOS" - -[Strings.0415] -ReactOS = "Zespół ReactOS" - -PCI\VEN_10EC&DEV_8029.DeviceDesc = "Karta Realtek RTL8029 PCI Ethernet Adapter" - -[Strings.0418] -ReactOS = "Echipa ReactOS" - -[Strings.0419] -ReactOS = "Команда ReactOS" - -[Strings.041f] -ReactOS = "ReactOS Takımı" - -[Strings.0422] -ReactOS = "Команда ReactOS"
3 years, 6 months
1
0
0
0
[reactos] 02/02: [INF] machine.inf: Improve Russian translation
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7b3691df8aa97653181da…
commit 7b3691df8aa97653181da36deed6de129d7fe4a6 Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Wed Apr 28 00:08:16 2021 +0300 Commit: Stanislav Motylkov <x86corez(a)gmail.com> CommitDate: Sun Jun 20 16:58:07 2021 +0300 [INF] machine.inf: Improve Russian translation --- media/inf/machine.inf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/media/inf/machine.inf b/media/inf/machine.inf index 63918682c9a..adfafd3e2a6 100644 --- a/media/inf/machine.inf +++ b/media/inf/machine.inf @@ -607,6 +607,7 @@ PCI\VEN_8086&DEV_7190.DeviceDesc = "Punte Intel 82443BX/ZX/DX Pentium(R) II CPU PCI\VEN_8086&DEV_7192.DeviceDesc = "Punte Intel 82443BX/ZX/DX Pentium(R) II CPU to PCI" [Strings.0419] +ReactOS = "Команда ReactOS" SystemClassName = "Системные устройства" GenericMfg = "(Стандартные системные устройства)" @@ -626,13 +627,16 @@ GenericMfg = "(Стандартные системные устройства)" *PNP0C0D.DeviceDesc = "Крышка ACPI" *PNP0C0E.DeviceDesc = "Кнопка спящего режима ACPI" *PNP0C0F.DeviceDesc = "Контроллер прервываний PCI" -*PNP0C15.DeviceDesc = "Docking Station" +*PNP0C15.DeviceDesc = "Док-станция" ACPI\FixedButton.DeviceDesc = "Кнопка фиксированной возможности ACPI" +ISAPNP\ReadDataPort.DeviceDesc = "Порт чтения данных ISAPNP" PCI\CC_0500.DeviceDesc = "Стандартный контроллер PCI RAM" PCI\CC_0600.DeviceDesc = "Стандартный процессор на мосте PCI" PCI\CC_0601.DeviceDesc = "Стандартный PCI на ISA мосте" PCI\CC_0604.DeviceDesc = "Стандартный PCI на PCI мосте" *ThermalZone.DeviceDesc = "Термальная зона ACPI" +PCI\CC_0C05.DeviceDesc = "Контроллер SMBus" +SWENUM.DeviceDesc = "Перечислитель программных устройств Plug & Play" *INT0800.DeviceDesc = "Устройство Intel 82802 Firmware Hub" PCI\VEN_8086&DEV_1237.DeviceDesc = "Intel 440FX - 82441FX PMC [Natoma]"
3 years, 6 months
1
0
0
0
[reactos] 01/02: [INF] machine.inf: Minor whitespace fixes
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c81e06ddc2ba593c9b346…
commit c81e06ddc2ba593c9b34618af3175a99a3eb7830 Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Wed Apr 28 00:02:17 2021 +0300 Commit: Stanislav Motylkov <x86corez(a)gmail.com> CommitDate: Sun Jun 20 16:56:42 2021 +0300 [INF] machine.inf: Minor whitespace fixes --- media/inf/machine.inf | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/media/inf/machine.inf b/media/inf/machine.inf index a4ef69ab3c1..63918682c9a 100644 --- a/media/inf/machine.inf +++ b/media/inf/machine.inf @@ -201,7 +201,7 @@ PCI\VEN_8086&DEV_7180.DeviceDesc = "Intel 82443LX/EX Pentium(R) II CPU to PCI-Br PCI\VEN_8086&DEV_7190.DeviceDesc = "Intel 82443BX/ZX/DX Pentium(R) II CPU to PCI-Bridge" PCI\VEN_8086&DEV_7192.DeviceDesc = "Intel 82443BX/ZX/DX Pentium(R) II CPU to PCI-Bridge" -nVidiaMfg = "nVidia Corporation" +nVidiaMfg = "nVidia" PCI\VEN_10DE&DEV_01B2.DeviceDesc = "nVidia nForce PCI to ISA Bridge" PCI\VEN_10DE&DEV_01B4.DeviceDesc = "nVidia nForce SMBus Controller" PCI\VEN_10DE&DEV_01B7.DeviceDesc = "nVidia nForce AGP to PCI Bridge" @@ -290,7 +290,6 @@ PCI\CC_0604.DeviceDesc = "Standardní most PCI na PCI" PCI\CC_0C05.DeviceDesc = "SMBus řadič" SWENUM.DeviceDesc = "Výčet zařízení podporujících Plug and Play" -IntelMfg = "Intel" *INT0800.DeviceDesc = "Intel 82802 Firmware Hub Device" PCI\VEN_8086&DEV_1237.DeviceDesc = "Intel 440FX - 82441FX PMC [Natoma]" PCI\VEN_8086&DEV_2413.DeviceDesc = "Intel 82801AA SMBus" @@ -356,7 +355,6 @@ PCI\CC_0601.DeviceDesc = "Πρότυπη γέφυρα από PCI σε ISA" PCI\CC_0604.DeviceDesc = "Πρότυπη γέφυρα από PCI σε PCI" *ThermalZone.DeviceDesc = "ACPI thermal zone" -IntelMfg = "Intel" *INT0800.DeviceDesc = "Intel 82802 Firmware Hub Device" PCI\VEN_8086&DEV_1237.DeviceDesc = "Intel 440FX - 82441FX PMC [Natoma]" PCI\VEN_8086&DEV_2413.DeviceDesc = "Intel 82801AA SMBus" @@ -367,7 +365,6 @@ PCI\VEN_8086&DEV_7180.DeviceDesc = "Intel 82443LX/EX Pentium(R) II CPU σε PCI PCI\VEN_8086&DEV_7190.DeviceDesc = "Intel 82443BX/ZX/DX Pentium(R) II CPU σε PCI-Γέφυρα" PCI\VEN_8086&DEV_7192.DeviceDesc = "Intel 82443BX/ZX/DX Pentium(R) II CPU σε PCI-Γέφυρα" - [Strings.0a] ReactOS = "Equipo de ReactOS" SystemClassName = "Dispositivos del sistema" @@ -397,7 +394,6 @@ PCI\CC_0601.DeviceDesc = "Puente PCI-ISA estándar" PCI\CC_0604.DeviceDesc = "Puente PCI-PCI estándar" *ThermalZone.DeviceDesc = "Zona térmica ACPI" -IntelMfg = "Intel" *INT0800.DeviceDesc = "Dispositivo concentrador Firmware Intel 82802" PCI\VEN_8086&DEV_1237.DeviceDesc = "Intel 440FX - 82441FX PMC [Natoma]" PCI\VEN_8086&DEV_2413.DeviceDesc = "Intel 82801AA SMBus" @@ -473,7 +469,6 @@ PCI\CC_0601.DeviceDesc = "スタンダード PCI to ISA ブリッジ" PCI\CC_0604.DeviceDesc = "スタンダード PCI to PCI ブリッジ" *ThermalZone.DeviceDesc = "ACPI サーマル ゾーン" -IntelMfg = "Intel" *INT0800.DeviceDesc = "Intel 82802 ファームウェア ハブ デバイス" PCI\VEN_8086&DEV_1237.DeviceDesc = "Intel 440FX - 82441FX PMC [Natoma]" PCI\VEN_8086&DEV_2413.DeviceDesc = "Intel 82801AA SMBus" @@ -518,7 +513,6 @@ PCI\CC_0604.DeviceDesc = "Standardowy mostek PCI do PCI" *ThermalZone.DeviceDesc = "Strefa termiczna ACPI" PCI\CC_0C05.DeviceDesc = "Kontroler SMBus" -IntelMfg = "Intel" *INT0800.DeviceDesc = "Urządzenie Intel 82802 Firmware Hub" PCI\VEN_8086&DEV_1237.DeviceDesc = "Intel 440FX - 82441FX PMC [Natoma]" PCI\VEN_8086&DEV_2413.DeviceDesc = "Intel 82801AA SMBus" @@ -557,7 +551,6 @@ PCI\CC_0601.DeviceDesc = "Ponte PCI - ISA" PCI\CC_0604.DeviceDesc = "Ponte PCI - PCI" *ThermalZone.DeviceDesc = "Zona termal ACPI" -IntelMfg = "Intel" *INT0800.DeviceDesc = "Dispositivo concentrador Firmware Intel 82802" PCI\VEN_8086&DEV_1237.DeviceDesc = "Intel 440FX - 82441FX PMC [Natoma]" PCI\VEN_8086&DEV_2413.DeviceDesc = "Intel 82801AA SMBus" @@ -571,6 +564,7 @@ PCI\VEN_8086&DEV_7192.DeviceDesc = "Intel 82443BX/ZX/DX Pentium(R) II Ponte CPU [Strings.0418] ReactOS = "Echipa ReactOS" SystemClassName = "Dispozitive de sistem" + GenericMfg = "(dispozitiv generic de sistem)" *PNP0000.DeviceDesc = "Dispozitiv programabil de control întreruperi" *PNP0001.DeviceDesc = "Dispozitiv programabil EISA de control întreruperi" @@ -601,7 +595,7 @@ PCI\CC_0604.DeviceDesc = "Punte standard PCI spre PCI" *ThermalZone.DeviceDesc = "Zonă termală ACPI" PCI\CC_0C05.DeviceDesc = "Dispozitiv de control magistrală SM" SWENUM.DeviceDesc = "Enumerator logic de magistrală P&P" -IntelMfg = "Intel" + *INT0800.DeviceDesc = "Dispozitiv nod firmware Intel 82802" PCI\VEN_8086&DEV_1237.DeviceDesc = "Intel 440FX - 82441FX PMC [Natoma]" PCI\VEN_8086&DEV_2413.DeviceDesc = "Magistrală SM Intel 82801AA" @@ -722,7 +716,6 @@ PCI\CC_0604.DeviceDesc = "Ölçünlü PCI'dan PCI'ya Köprü" PCI\CC_0C05.DeviceDesc = "SMBus Denetleyicisi" SWENUM.DeviceDesc = "Tak ve Çalıştır Yazılım Veriyolu Numaralandırıcısı" -IntelMfg = "Intel" *INT0800.DeviceDesc = "Intel 82802 Bellenim Göbek Aygıtı" PCI\VEN_8086&DEV_1237.DeviceDesc = "Intel 440FX - 82441FX PMC [Natoma]" PCI\VEN_8086&DEV_2413.DeviceDesc = "Intel 82801AA SMBus" @@ -766,7 +759,6 @@ PCI\CC_0604.DeviceDesc = "Стандартний міст PCI на PCI" PCI\CC_0C05.DeviceDesc = "Контроллер SMBus" *INT0800.DeviceDesc = "Пристрій Intel 82802 Firmware Hub" - PCI\VEN_8086&DEV_7000.DeviceDesc = "Міст Intel 82371SB PIIX3 PCI на ISA" PCI\VEN_8086&DEV_7110.DeviceDesc = "Міст Intel 82371AB/EB PCI на ISA" PCI\VEN_8086&DEV_7113.DeviceDesc = "Контроллер керування живленням Intel 82371AB/EB" @@ -802,7 +794,6 @@ PCI\CC_0601.DeviceDesc = "Standartinis PCI į ISA tiltas" PCI\CC_0604.DeviceDesc = "Standartinis PCI į PCI tiltas" *ThermalZone.DeviceDesc = "ACPI šiluminė zona" -IntelMfg = "Intel" *INT0800.DeviceDesc = "Intel 82802 Firmware šakotuvo įrenginys" PCI\VEN_8086&DEV_1237.DeviceDesc = "Intel 440FX - 82441FX PMC [Natoma]" PCI\VEN_8086&DEV_2413.DeviceDesc = "Intel 82801AA SMBus"
3 years, 6 months
1
0
0
0
[reactos] 20/20: [ISAPNP] Start the driver early in the boot
by Dmitry Borisov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=18b4cc147944cb5feddc5…
commit 18b4cc147944cb5feddc5c87d36a16fb3ac11e4a Author: Dmitry Borisov <di.sean(a)protonmail.com> AuthorDate: Wed May 12 00:11:48 2021 +0600 Commit: Dmitry Borisov <di.sean(a)protonmail.com> CommitDate: Sun Jun 20 19:24:32 2021 +0600 [ISAPNP] Start the driver early in the boot Because our child devices can have boot-start drivers --- boot/bootdata/hivesys.inf | 3 +++ boot/bootdata/txtsetup.sif | 2 +- drivers/bus/isapnp/CMakeLists.txt | 1 + drivers/bus/isapnp/isapnp_reg.inf | 8 ++++++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/boot/bootdata/hivesys.inf b/boot/bootdata/hivesys.inf index 651698173e2..f35501c8a0c 100644 --- a/boot/bootdata/hivesys.inf +++ b/boot/bootdata/hivesys.inf @@ -20,6 +20,9 @@ HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\*PNP0A08","ClassGU HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\PCI#CC_0604","Service",0x00000000,"pci" HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\PCI#CC_0604","ClassGUID",0x00000000,"{4D36E97D-E325-11CE-BFC1-08002BE10318}" +HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\PCI#CC_0601","Service",0x00000000,"isapnp" +HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\PCI#CC_0601","ClassGUID",0x00000000,"{4D36E97D-E325-11CE-BFC1-08002BE10318}" + HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\*PNP0C08","Service",0x00000000,"acpi" HKLM,"SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\*PNP0C08","ClassGUID",0x00000000,"{4D36E97D-E325-11CE-BFC1-08002BE10318}" diff --git a/boot/bootdata/txtsetup.sif b/boot/bootdata/txtsetup.sif index 1fdf60c17f9..8929c94a698 100644 --- a/boot/bootdata/txtsetup.sif +++ b/boot/bootdata/txtsetup.sif @@ -100,7 +100,7 @@ c_1252.nls = 1,,,,,,,2,,,,1,2 cdfs.sys = 1,,,,,,x,4,,,,1,4 cdrom.sys = 1,,,,,,x,4,,,,1,4 classpnp.sys = 1,,,,,,,4,,,,1,4 -isapnp.sys = 1,,,,,,,4,,,,1,4 +isapnp.sys = 1,,,,,,x,4,,,,1,4 kdcom.dll = 1,,,,,,,2,,,,1,2 kdvbox.dll = 1,,,,,,,2,,,,1,2 disk.sys = 1,,,,,,x,4,,,,1,4 diff --git a/drivers/bus/isapnp/CMakeLists.txt b/drivers/bus/isapnp/CMakeLists.txt index c4be1b57da3..e0e1f3e2ee1 100644 --- a/drivers/bus/isapnp/CMakeLists.txt +++ b/drivers/bus/isapnp/CMakeLists.txt @@ -19,3 +19,4 @@ set_module_type(isapnp kernelmodedriver) add_importlibs(isapnp ntoskrnl hal) add_pch(isapnp isapnp.h SOURCE) add_cd_file(TARGET isapnp DESTINATION reactos/system32/drivers NO_CAB FOR all) +add_registry_inf(isapnp_reg.inf) diff --git a/drivers/bus/isapnp/isapnp_reg.inf b/drivers/bus/isapnp/isapnp_reg.inf new file mode 100644 index 00000000000..ff067df5676 --- /dev/null +++ b/drivers/bus/isapnp/isapnp_reg.inf @@ -0,0 +1,8 @@ +; ISA PnP Bus Driver +[AddReg] +HKLM,"SYSTEM\CurrentControlSet\Services\isapnp","ErrorControl",0x00010001,0x00000000 +HKLM,"SYSTEM\CurrentControlSet\Services\isapnp","Group",0x00000000,"Boot Bus Extender" +HKLM,"SYSTEM\CurrentControlSet\Services\isapnp","ImagePath",0x00020000,"system32\drivers\isapnp.sys" +HKLM,"SYSTEM\CurrentControlSet\Services\isapnp","Start",0x00010001,0x00000000 +HKLM,"SYSTEM\CurrentControlSet\Services\isapnp","Type",0x00010001,0x00000001 +HKLM,"SYSTEM\CurrentControlSet\Services\isapnp","Tag",0x00010001,0x00000003
3 years, 6 months
1
0
0
0
[reactos] 19/20: [ISAPNP] Implement device configuration
by Dmitry Borisov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=adac7dc2e5847dc7b2146…
commit adac7dc2e5847dc7b214622484c6f8ce9fc605ae Author: Dmitry Borisov <di.sean(a)protonmail.com> AuthorDate: Sat Mar 20 20:53:54 2021 +0600 Commit: Dmitry Borisov <di.sean(a)protonmail.com> CommitDate: Sun Jun 20 19:24:32 2021 +0600 [ISAPNP] Implement device configuration --- drivers/bus/isapnp/hardware.c | 297 ++++++++++++++++++++++++++++++++++++++++++ drivers/bus/isapnp/isapnp.h | 7 + drivers/bus/isapnp/isapnphw.h | 7 + drivers/bus/isapnp/pdo.c | 14 +- 4 files changed, 323 insertions(+), 2 deletions(-) diff --git a/drivers/bus/isapnp/hardware.c b/drivers/bus/isapnp/hardware.c index 188d1732447..26d6b120671 100644 --- a/drivers/bus/isapnp/hardware.c +++ b/drivers/bus/isapnp/hardware.c @@ -61,6 +61,30 @@ WriteByte( WriteData(Value); } +static +inline +VOID +WriteWord( + _In_ UCHAR Address, + _In_ USHORT Value) +{ + WriteAddress(Address + 1); + WriteData((UCHAR)Value); + WriteAddress(Address); + WriteData(Value >> 8); +} + +static +inline +VOID +WriteDoubleWord( + _In_ UCHAR Address, + _In_ ULONG Value) +{ + WriteWord(Address + 2, (USHORT)Value); + WriteWord(Address, Value >> 16); +} + static inline UCHAR @@ -1164,6 +1188,175 @@ ReadCurrentResources( return TRUE; } +static +CODE_SEG("PAGE") +VOID +WriteResources( + _In_ PUCHAR ReadDataPort, + _In_ PISAPNP_LOGICAL_DEVICE LogDevice, + _In_ PCM_PARTIAL_RESOURCE_LIST PartialResourceList) +{ + UCHAR i, + NumberOfIo = 0, + NumberOfIrq = 0, + NumberOfDma = 0, + NumberOfMemory = 0, + NumberOfMemory32 = 0; + + PAGED_CODE(); + + WriteLogicalDeviceNumber(LogDevice->LDN); + + for (i = 0; i < PartialResourceList->Count; i++) + { + PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor = &PartialResourceList->PartialDescriptors[i]; + UCHAR Index; + + switch (Descriptor->Type) + { + case CmResourceTypePort: + { + (VOID)FindIoDescriptor(LogDevice, + 0, + Descriptor->u.Port.Start.LowPart, + Descriptor->u.Port.Start.LowPart + + Descriptor->u.Port.Length - 1, + NULL, + NULL, + &Index); + + WriteWord(ISAPNP_IOBASE(Index), (USHORT)Descriptor->u.Port.Start.LowPart); + + ++NumberOfIo; + break; + } + + case CmResourceTypeInterrupt: + { + (VOID)FindIrqDescriptor(LogDevice, Descriptor->u.Interrupt.Level, &Index); + + WriteByte(ISAPNP_IRQNO(Index), (UCHAR)Descriptor->u.Interrupt.Level); + WriteByte(ISAPNP_IRQTYPE(Index), + Descriptor->Flags & CM_RESOURCE_INTERRUPT_LATCHED + ? IRQTYPE_HIGH_EDGE : IRQTYPE_LOW_LEVEL); + + ++NumberOfIrq; + break; + } + + case CmResourceTypeDma: + { + (VOID)FindDmaDescriptor(LogDevice, Descriptor->u.Dma.Channel, &Index); + + WriteByte(ISAPNP_DMACHANNEL(Index), (UCHAR)Descriptor->u.Dma.Channel); + + ++NumberOfDma; + break; + } + + case CmResourceTypeMemory: + { + BOOLEAN Memory32; + UCHAR Information; + UCHAR MemoryControl = MEMORY_USE_8_BIT_DECODER; + + (VOID)FindMemoryDescriptor(LogDevice, + Descriptor->u.Memory.Start.LowPart, + Descriptor->u.Memory.Start.LowPart + + Descriptor->u.Memory.Length - 1, + &Memory32, + &Information, + &Index); + + if (!Memory32) + { + if (Information & MEMRANGE_16_BIT_MEMORY_MASK) + MemoryControl = MEMORY_USE_16_BIT_DECODER; + + WriteWord(ISAPNP_MEMBASE(Index), + (USHORT)(Descriptor->u.Memory.Start.LowPart >> 8)); + + if (ReadMemoryControl(ReadDataPort, Index) & MEMORY_UPPER_LIMIT) + { + WriteByte(ISAPNP_MEMCONTROL(Index), + MemoryControl | MEMORY_UPPER_LIMIT); + WriteWord(ISAPNP_MEMLIMIT(Index), + (USHORT)((Descriptor->u.Memory.Start.LowPart + + Descriptor->u.Memory.Length) >> 8)); + } + else + { + WriteByte(ISAPNP_MEMCONTROL(Index), MemoryControl); + WriteWord(ISAPNP_MEMLIMIT(Index), + (USHORT)(LENGTH_TO_RANGE_LENGTH(Descriptor-> + u.Memory.Length) >> 8)); + } + + ++NumberOfMemory; + } + else + { + WriteDoubleWord(ISAPNP_MEMBASE32(Index), + Descriptor->u.Memory.Start.LowPart); + + if ((Information & MEMRANGE_16_BIT_MEMORY_MASK) == MEMRANGE_32_BIT_MEMORY_ONLY) + MemoryControl = MEMORY_USE_32_BIT_DECODER; + else if (Information & MEMRANGE_16_BIT_MEMORY_MASK) + MemoryControl = MEMORY_USE_16_BIT_DECODER; + + if (ReadMemoryControl32(ReadDataPort, Index) & MEMORY_UPPER_LIMIT) + { + WriteByte(ISAPNP_MEMCONTROL32(Index), + MemoryControl | MEMORY_UPPER_LIMIT); + WriteDoubleWord(ISAPNP_MEMLIMIT32(Index), + Descriptor->u.Memory.Start.LowPart + + Descriptor->u.Memory.Length); + } + else + { + WriteByte(ISAPNP_MEMCONTROL32(Index), MemoryControl); + WriteDoubleWord(ISAPNP_MEMLIMIT32(Index), + LENGTH_TO_RANGE_LENGTH(Descriptor->u.Memory.Length)); + } + + ++NumberOfMemory32; + } + + break; + } + + default: + break; + } + } + + for (i = NumberOfIo; i < RTL_NUMBER_OF(LogDevice->Io); i++) + { + WriteWord(ISAPNP_IOBASE(i), 0); + } + for (i = NumberOfIrq; i < RTL_NUMBER_OF(LogDevice->Irq); i++) + { + WriteByte(ISAPNP_IRQNO(i), 0); + WriteByte(ISAPNP_IRQTYPE(i), 0); + } + for (i = NumberOfDma; i < RTL_NUMBER_OF(LogDevice->Dma); i++) + { + WriteByte(ISAPNP_DMACHANNEL(i), 4); + } + for (i = NumberOfMemory; i < RTL_NUMBER_OF(LogDevice->MemRange); i++) + { + WriteWord(ISAPNP_MEMBASE(i), 0); + WriteByte(ISAPNP_MEMCONTROL(i), 0); + WriteWord(ISAPNP_MEMLIMIT(i), 0); + } + for (i = NumberOfMemory32; i < RTL_NUMBER_OF(LogDevice->MemRange32); i++) + { + WriteDoubleWord(ISAPNP_MEMBASE32(i), 0); + WriteByte(ISAPNP_MEMCONTROL32(i), 0); + WriteDoubleWord(ISAPNP_MEMLIMIT32(i), 0); + } +} + CODE_SEG("PAGE") UCHAR IsaHwTryReadDataPort( @@ -1405,6 +1598,110 @@ Deactivate: return STATUS_SUCCESS; } +CODE_SEG("PAGE") +NTSTATUS +IsaHwConfigureDevice( + _In_ PISAPNP_FDO_EXTENSION FdoExt, + _In_ PISAPNP_LOGICAL_DEVICE LogicalDevice, + _In_ PCM_RESOURCE_LIST Resources) +{ + UCHAR i, + NumberOfIo = 0, + NumberOfIrq = 0, + NumberOfDma = 0, + NumberOfMemory = 0; + + PAGED_CODE(); + + if (!Resources) + return STATUS_INSUFFICIENT_RESOURCES; + + /* Validate the resource list */ + for (i = 0; i < Resources->List[0].PartialResourceList.Count; i++) + { + PCM_PARTIAL_RESOURCE_DESCRIPTOR Descriptor = + &Resources->List[0].PartialResourceList.PartialDescriptors[i]; + + switch (Descriptor->Type) + { + case CmResourceTypePort: + { + if (++NumberOfIo > RTL_NUMBER_OF(LogicalDevice->Io)) + return STATUS_INVALID_PARAMETER_1; + + if (!FindIoDescriptor(LogicalDevice, + 0, + Descriptor->u.Port.Start.LowPart, + Descriptor->u.Port.Start.LowPart + + Descriptor->u.Port.Length - 1, + NULL, + NULL, + NULL)) + { + return STATUS_RESOURCE_DATA_NOT_FOUND; + } + + break; + } + + case CmResourceTypeInterrupt: + { + if (++NumberOfIrq > RTL_NUMBER_OF(LogicalDevice->Irq)) + return STATUS_INVALID_PARAMETER_2; + + if (!FindIrqDescriptor(LogicalDevice, Descriptor->u.Interrupt.Level, NULL)) + return STATUS_RESOURCE_DATA_NOT_FOUND; + + break; + } + + case CmResourceTypeDma: + { + if (++NumberOfDma > RTL_NUMBER_OF(LogicalDevice->Dma)) + return STATUS_INVALID_PARAMETER_3; + + if (!FindDmaDescriptor(LogicalDevice, Descriptor->u.Dma.Channel, NULL)) + return STATUS_RESOURCE_DATA_NOT_FOUND; + + break; + } + + case CmResourceTypeMemory: + { + BOOLEAN Memory32; + + if (++NumberOfMemory > RTL_NUMBER_OF(LogicalDevice->MemRange)) + return STATUS_INVALID_PARAMETER_4; + + if (!FindMemoryDescriptor(LogicalDevice, + Descriptor->u.Memory.Start.LowPart, + Descriptor->u.Memory.Start.LowPart + + Descriptor->u.Memory.Length - 1, + &Memory32, + NULL, + NULL)) + { + return STATUS_RESOURCE_DATA_NOT_FOUND; + } + + if (!Memory32 && (Descriptor->u.Memory.Start.LowPart & 0xFF)) + return STATUS_INVALID_PARAMETER; + + break; + } + + default: + break; + } + } + + WriteResources(FdoExt->ReadDataPort, LogicalDevice, &Resources->List[0].PartialResourceList); + + KeStallExecutionProcessor(10000); + + return STATUS_SUCCESS; +} + _IRQL_requires_max_(DISPATCH_LEVEL) VOID IsaHwWakeDevice( diff --git a/drivers/bus/isapnp/isapnp.h b/drivers/bus/isapnp/isapnp.h index 19702f36274..ad48008251f 100644 --- a/drivers/bus/isapnp/isapnp.h +++ b/drivers/bus/isapnp/isapnp.h @@ -375,6 +375,13 @@ NTSTATUS IsaHwFillDeviceList( _In_ PISAPNP_FDO_EXTENSION FdoExt); +CODE_SEG("PAGE") +NTSTATUS +IsaHwConfigureDevice( + _In_ PISAPNP_FDO_EXTENSION FdoExt, + _In_ PISAPNP_LOGICAL_DEVICE LogicalDevice, + _In_ PCM_RESOURCE_LIST Resources); + _IRQL_requires_max_(DISPATCH_LEVEL) VOID IsaHwWakeDevice( diff --git a/drivers/bus/isapnp/isapnphw.h b/drivers/bus/isapnp/isapnphw.h index c41d6d1b7be..0023aac4fdf 100644 --- a/drivers/bus/isapnp/isapnphw.h +++ b/drivers/bus/isapnp/isapnphw.h @@ -31,10 +31,15 @@ extern "C" { #define ISAPNP_MEMBASE(n) (0x40 + ((n) * 8)) #define ISAPNP_MEMCONTROL(n) (0x42 + ((n) * 8)) #define MEMORY_UPPER_LIMIT 0x01 +#define MEMORY_USE_8_BIT_DECODER 0x00 +#define MEMORY_USE_16_BIT_DECODER 0x02 +#define MEMORY_USE_32_BIT_DECODER 0x06 #define ISAPNP_MEMLIMIT(n) (0x43 + ((n) * 8)) #define ISAPNP_IOBASE(n) (0x60 + ((n)*2)) #define ISAPNP_IRQNO(n) (0x70 + ((n)*2)) #define ISAPNP_IRQTYPE(n) (0x71 + ((n) * 2)) +#define IRQTYPE_LOW_LEVEL 0x01 +#define IRQTYPE_HIGH_EDGE 0x02 #define ISAPNP_DMACHANNEL(n) (0x74 + (n)) #define ISAPNP_MEMBASE32(n) ((n) == 0 ? 0x76 : (0x70 + (n) * 16)) #define ISAPNP_MEMCONTROL32(n) ((n) == 0 ? 0x7A : (0x74 + (n) * 16)) @@ -63,6 +68,8 @@ extern "C" { #define ISAPNP_IS_LARGE_TAG(t) (((t) & 0x80)) #define ISAPNP_LARGE_TAG_NAME(t) (t) #define ISAPNP_TAG_MEMRANGE 0x81 +#define MEMRANGE_16_BIT_MEMORY_MASK (0x10 | 0x08) +#define MEMRANGE_32_BIT_MEMORY_ONLY 0x18 #define ISAPNP_TAG_ANSISTR 0x82 #define ISAPNP_TAG_UNICODESTR 0x83 #define ISAPNP_TAG_MEM32RANGE 0x85 diff --git a/drivers/bus/isapnp/pdo.c b/drivers/bus/isapnp/pdo.c index 1ee0e51b7ea..f2014ffbc90 100644 --- a/drivers/bus/isapnp/pdo.c +++ b/drivers/bus/isapnp/pdo.c @@ -897,9 +897,19 @@ IsaPdoPnp( { IsaHwWakeDevice(PdoExt->IsaPnpDevice); - Status = STATUS_SUCCESS; + Status = IsaHwConfigureDevice(PdoExt->FdoExt, + PdoExt->IsaPnpDevice, + IrpSp->Parameters.StartDevice.AllocatedResources); + if (NT_SUCCESS(Status)) + { + IsaHwActivateDevice(PdoExt->FdoExt, PdoExt->IsaPnpDevice); + } + else + { + DPRINT1("Failed to configure CSN %u, LDN %u with status 0x%08lx\n", + PdoExt->IsaPnpDevice->CSN, PdoExt->IsaPnpDevice->LDN, Status); + } - IsaHwActivateDevice(PdoExt->FdoExt, PdoExt->IsaPnpDevice); IsaHwWaitForKey(); } else
3 years, 6 months
1
0
0
0
← Newer
1
...
6
7
8
9
10
11
12
...
23
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Results per page:
10
25
50
100
200