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
February 2019
----- 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
23 participants
208 discussions
Start a n
N
ew thread
[reactos] 05/09: [HDAUDBUS] Use IoForwardIrpSynchronously instead of HDA_SyncForwardIrp.
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b05e5b034062303c4646a…
commit b05e5b034062303c4646aa3bbd38c68ecb087f60 Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Sun Feb 24 12:23:45 2019 +0100 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Tue Feb 26 09:50:50 2019 +0100 [HDAUDBUS] Use IoForwardIrpSynchronously instead of HDA_SyncForwardIrp. --- drivers/wdm/audio/hdaudbus/fdo.cpp | 7 ++++- drivers/wdm/audio/hdaudbus/hdaudbus.cpp | 54 --------------------------------- drivers/wdm/audio/hdaudbus/hdaudbus.h | 9 ------ 3 files changed, 6 insertions(+), 64 deletions(-) diff --git a/drivers/wdm/audio/hdaudbus/fdo.cpp b/drivers/wdm/audio/hdaudbus/fdo.cpp index 6bbadf3746..3df33c907b 100644 --- a/drivers/wdm/audio/hdaudbus/fdo.cpp +++ b/drivers/wdm/audio/hdaudbus/fdo.cpp @@ -540,7 +540,12 @@ HDA_FDOStartDevice( ASSERT(DeviceExtension->IsFDO == TRUE); /* forward irp to lower device */ - Status = HDA_SyncForwardIrp(DeviceExtension->LowerDevice, Irp); + if (!IoForwardIrpSynchronously(DeviceExtension->LowerDevice, Irp)) + { + ASSERT(FALSE); + return STATUS_INVALID_DEVICE_REQUEST; + } + Status = Irp->IoStatus.Status; if (!NT_SUCCESS(Status)) { // failed to start diff --git a/drivers/wdm/audio/hdaudbus/hdaudbus.cpp b/drivers/wdm/audio/hdaudbus/hdaudbus.cpp index b8eacba435..440d75ae58 100644 --- a/drivers/wdm/audio/hdaudbus/hdaudbus.cpp +++ b/drivers/wdm/audio/hdaudbus/hdaudbus.cpp @@ -31,60 +31,6 @@ FreeItem( ExFreePool(Item); } -NTSTATUS -NTAPI -HDA_SyncForwardIrpCompletionRoutine( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp, - IN PVOID Context) -{ - if (Irp->PendingReturned) - { - KeSetEvent((PKEVENT)Context, IO_NO_INCREMENT, FALSE); - } - return STATUS_MORE_PROCESSING_REQUIRED; -} - -NTSTATUS -NTAPI -HDA_SyncForwardIrp( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp) -{ - KEVENT Event; - NTSTATUS Status; - - /* Initialize event */ - KeInitializeEvent(&Event, NotificationEvent, FALSE); - - /* Copy irp stack location */ - IoCopyCurrentIrpStackLocationToNext(Irp); - - /* Set completion routine */ - IoSetCompletionRoutine(Irp, - HDA_SyncForwardIrpCompletionRoutine, - &Event, - TRUE, - TRUE, - TRUE); - - /* Call driver */ - Status = IoCallDriver(DeviceObject, Irp); - - /* Check if pending */ - if (Status == STATUS_PENDING) - { - /* Wait for the request to finish */ - KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); - - /* Copy status code */ - Status = Irp->IoStatus.Status; - } - - /* Done */ - return Status; -} - NTSTATUS HDA_FdoPnp( _In_ PDEVICE_OBJECT DeviceObject, diff --git a/drivers/wdm/audio/hdaudbus/hdaudbus.h b/drivers/wdm/audio/hdaudbus/hdaudbus.h index 1496f6de24..fa7f04a70a 100644 --- a/drivers/wdm/audio/hdaudbus/hdaudbus.h +++ b/drivers/wdm/audio/hdaudbus/hdaudbus.h @@ -170,12 +170,3 @@ NTSTATUS HDA_PDOHandleQueryInterface( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp); - -/* hdaudbus.cpp*/ - -NTSTATUS -NTAPI -HDA_SyncForwardIrp( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp); -
5 years, 10 months
1
0
0
0
[reactos] 04/09: [HDAUDBUS] Forward FDO requests instead of completing them.
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=789cfd3ddc6cd15d80db1…
commit 789cfd3ddc6cd15d80db120d0ddcc1e7616ce85d Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Mon Feb 25 12:48:54 2019 +0100 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Tue Feb 26 09:20:47 2019 +0100 [HDAUDBUS] Forward FDO requests instead of completing them. --- drivers/wdm/audio/hdaudbus/hdaudbus.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/wdm/audio/hdaudbus/hdaudbus.cpp b/drivers/wdm/audio/hdaudbus/hdaudbus.cpp index 2c82a9a4f7..b8eacba435 100644 --- a/drivers/wdm/audio/hdaudbus/hdaudbus.cpp +++ b/drivers/wdm/audio/hdaudbus/hdaudbus.cpp @@ -101,28 +101,26 @@ HDA_FdoPnp( { case IRP_MN_START_DEVICE: Status = HDA_FDOStartDevice(DeviceObject, Irp); - break; + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return Status; case IRP_MN_QUERY_DEVICE_RELATIONS: /* handle bus device relations */ if (IoStack->Parameters.QueryDeviceRelations.Type == BusRelations) { Status = HDA_FDOQueryBusRelations(DeviceObject, Irp); + Irp->IoStatus.Status = Status; + if (!NT_SUCCESS(Status)) + { + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return Status; + } } - else - { - Status = Irp->IoStatus.Status; - } - break; - default: - /* get default status */ - Status = Irp->IoStatus.Status; break; } - Irp->IoStatus.Status = Status; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - return Status; + IoSkipCurrentIrpStackLocation(Irp); + return IoCallDriver(FDODeviceExtension->LowerDevice, Irp); } NTSTATUS
5 years, 10 months
1
0
0
0
[reactos] 03/09: [HDAUDBUS] Use a switch for minor function codes.
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ce6960b3f559e0c283d95…
commit ce6960b3f559e0c283d95c6e72c66a0698945a83 Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Sat Feb 23 21:52:21 2019 +0100 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Tue Feb 26 09:20:43 2019 +0100 [HDAUDBUS] Use a switch for minor function codes. --- drivers/wdm/audio/hdaudbus/hdaudbus.cpp | 68 +++++++++++++++------------------ 1 file changed, 30 insertions(+), 38 deletions(-) diff --git a/drivers/wdm/audio/hdaudbus/hdaudbus.cpp b/drivers/wdm/audio/hdaudbus/hdaudbus.cpp index 350ec71231..2c82a9a4f7 100644 --- a/drivers/wdm/audio/hdaudbus/hdaudbus.cpp +++ b/drivers/wdm/audio/hdaudbus/hdaudbus.cpp @@ -97,12 +97,12 @@ HDA_FdoPnp( FDODeviceExtension = static_cast<PHDA_FDO_DEVICE_EXTENSION>(DeviceObject->DeviceExtension); IoStack = IoGetCurrentIrpStackLocation(Irp); - if (IoStack->MinorFunction == IRP_MN_START_DEVICE) + switch (IoStack->MinorFunction) { + case IRP_MN_START_DEVICE: Status = HDA_FDOStartDevice(DeviceObject, Irp); - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_DEVICE_RELATIONS) - { + break; + case IRP_MN_QUERY_DEVICE_RELATIONS: /* handle bus device relations */ if (IoStack->Parameters.QueryDeviceRelations.Type == BusRelations) { @@ -112,11 +112,11 @@ HDA_FdoPnp( { Status = Irp->IoStatus.Status; } - } - else - { + break; + default: /* get default status */ Status = Irp->IoStatus.Status; + break; } Irp->IoStatus.Status = Status; @@ -136,23 +136,21 @@ HDA_PdoPnp( IoStack = IoGetCurrentIrpStackLocation(Irp); - if (IoStack->MinorFunction == IRP_MN_START_DEVICE) + switch (IoStack->MinorFunction) { + case IRP_MN_START_DEVICE: /* no op for pdo */ Status = STATUS_SUCCESS; - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_BUS_INFORMATION) - { + break; + case IRP_MN_QUERY_BUS_INFORMATION: /* query bus information */ Status = HDA_PDOQueryBusInformation(Irp); - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_PNP_DEVICE_STATE) - { + break; + case IRP_MN_QUERY_PNP_DEVICE_STATE: /* query pnp state */ Status = HDA_PDOQueryBusDevicePnpState(Irp); - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_DEVICE_RELATIONS) - { + break; + case IRP_MN_QUERY_DEVICE_RELATIONS: if (IoStack->Parameters.QueryDeviceRelations.Type == TargetDeviceRelation) { /* handle target device relations */ @@ -181,38 +179,32 @@ HDA_PdoPnp( Status = STATUS_INSUFFICIENT_RESOURCES; } } - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_CAPABILITIES) - { + break; + case IRP_MN_QUERY_CAPABILITIES: /* query capabilities */ Status = HDA_PDOQueryBusDeviceCapabilities(Irp); - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_RESOURCE_REQUIREMENTS) - { + break; + case IRP_MN_QUERY_RESOURCE_REQUIREMENTS: /* no op */ Status = STATUS_SUCCESS; - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_RESOURCES) - { + break; + case IRP_MN_QUERY_RESOURCES: /* no op */ Status = STATUS_SUCCESS; - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_ID) - { + break; + case IRP_MN_QUERY_ID: Status = HDA_PDOQueryId(DeviceObject, Irp); - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_DEVICE_TEXT) - { + break; + case IRP_MN_QUERY_DEVICE_TEXT: Status = HDA_PDOHandleQueryDeviceText(Irp); - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_INTERFACE) - { + break; + case IRP_MN_QUERY_INTERFACE: Status = HDA_PDOHandleQueryInterface(DeviceObject, Irp); - } - else - { + break; + default: /* get default status */ Status = Irp->IoStatus.Status; + break; } Irp->IoStatus.Status = Status;
5 years, 10 months
1
0
0
0
[reactos] 02/09: [HDAUDBUS] Split FDO/PDO PNP handling into separate functions.
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9c7c2deff9fc44010b922…
commit 9c7c2deff9fc44010b9223dfde19ce37b31afb68 Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Sat Feb 23 21:50:05 2019 +0100 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Tue Feb 26 09:20:37 2019 +0100 [HDAUDBUS] Split FDO/PDO PNP handling into separate functions. --- drivers/wdm/audio/hdaudbus/hdaudbus.cpp | 225 ++++++++++++++++++-------------- 1 file changed, 127 insertions(+), 98 deletions(-) diff --git a/drivers/wdm/audio/hdaudbus/hdaudbus.cpp b/drivers/wdm/audio/hdaudbus/hdaudbus.cpp index bacc854ab1..350ec71231 100644 --- a/drivers/wdm/audio/hdaudbus/hdaudbus.cpp +++ b/drivers/wdm/audio/hdaudbus/hdaudbus.cpp @@ -86,125 +86,133 @@ HDA_SyncForwardIrp( } NTSTATUS -NTAPI -HDA_Pnp( +HDA_FdoPnp( _In_ PDEVICE_OBJECT DeviceObject, _Inout_ PIRP Irp) { - NTSTATUS Status = STATUS_NOT_SUPPORTED; + NTSTATUS Status; PIO_STACK_LOCATION IoStack; - PDEVICE_RELATIONS DeviceRelation; PHDA_FDO_DEVICE_EXTENSION FDODeviceExtension; - //PHDA_PDO_DEVICE_EXTENSION ChildDeviceExtension; - - FDODeviceExtension = (PHDA_FDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; - //ChildDeviceExtension = (PHDA_PDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + FDODeviceExtension = static_cast<PHDA_FDO_DEVICE_EXTENSION>(DeviceObject->DeviceExtension); IoStack = IoGetCurrentIrpStackLocation(Irp); - if (FDODeviceExtension->IsFDO) + + if (IoStack->MinorFunction == IRP_MN_START_DEVICE) { - if (IoStack->MinorFunction == IRP_MN_START_DEVICE) + Status = HDA_FDOStartDevice(DeviceObject, Irp); + } + else if (IoStack->MinorFunction == IRP_MN_QUERY_DEVICE_RELATIONS) + { + /* handle bus device relations */ + if (IoStack->Parameters.QueryDeviceRelations.Type == BusRelations) { - Status = HDA_FDOStartDevice(DeviceObject, Irp); + Status = HDA_FDOQueryBusRelations(DeviceObject, Irp); } - else if (IoStack->MinorFunction == IRP_MN_QUERY_DEVICE_RELATIONS) - { - /* handle bus device relations */ - if (IoStack->Parameters.QueryDeviceRelations.Type == BusRelations) - { - Status = HDA_FDOQueryBusRelations(DeviceObject, Irp); - } - else - { - Status = Irp->IoStatus.Status; - } - } else { - /* get default status */ Status = Irp->IoStatus.Status; } } else { - if (IoStack->MinorFunction == IRP_MN_START_DEVICE) - { - /* no op for pdo */ - Status = STATUS_SUCCESS; - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_BUS_INFORMATION) - { - /* query bus information */ - Status = HDA_PDOQueryBusInformation(Irp); - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_PNP_DEVICE_STATE) - { - /* query pnp state */ - Status = HDA_PDOQueryBusDevicePnpState(Irp); - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_DEVICE_RELATIONS) + /* get default status */ + Status = Irp->IoStatus.Status; + } + + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + + return Status; +} + +NTSTATUS +HDA_PdoPnp( + _In_ PDEVICE_OBJECT DeviceObject, + _Inout_ PIRP Irp) +{ + NTSTATUS Status; + PIO_STACK_LOCATION IoStack; + PDEVICE_RELATIONS DeviceRelation; + + IoStack = IoGetCurrentIrpStackLocation(Irp); + + if (IoStack->MinorFunction == IRP_MN_START_DEVICE) + { + /* no op for pdo */ + Status = STATUS_SUCCESS; + } + else if (IoStack->MinorFunction == IRP_MN_QUERY_BUS_INFORMATION) + { + /* query bus information */ + Status = HDA_PDOQueryBusInformation(Irp); + } + else if (IoStack->MinorFunction == IRP_MN_QUERY_PNP_DEVICE_STATE) + { + /* query pnp state */ + Status = HDA_PDOQueryBusDevicePnpState(Irp); + } + else if (IoStack->MinorFunction == IRP_MN_QUERY_DEVICE_RELATIONS) + { + if (IoStack->Parameters.QueryDeviceRelations.Type == TargetDeviceRelation) { - if (IoStack->Parameters.QueryDeviceRelations.Type == TargetDeviceRelation) + /* handle target device relations */ + ASSERT(IoStack->Parameters.QueryDeviceRelations.Type == TargetDeviceRelation); + ASSERT(Irp->IoStatus.Information == 0); + + /* allocate device relation */ + DeviceRelation = (PDEVICE_RELATIONS)AllocateItem(PagedPool, sizeof(DEVICE_RELATIONS)); + if (DeviceRelation) { - /* handle target device relations */ - ASSERT(IoStack->Parameters.QueryDeviceRelations.Type == TargetDeviceRelation); - ASSERT(Irp->IoStatus.Information == 0); - - /* allocate device relation */ - DeviceRelation = (PDEVICE_RELATIONS)AllocateItem(PagedPool, sizeof(DEVICE_RELATIONS)); - if (DeviceRelation) - { - DeviceRelation->Count = 1; - DeviceRelation->Objects[0] = DeviceObject; - - /* reference self */ - ObReferenceObject(DeviceObject); - - /* store result */ - Irp->IoStatus.Information = (ULONG_PTR)DeviceRelation; - - /* done */ - Status = STATUS_SUCCESS; - } - else - { - /* no memory */ - Status = STATUS_INSUFFICIENT_RESOURCES; - } + DeviceRelation->Count = 1; + DeviceRelation->Objects[0] = DeviceObject; + + /* reference self */ + ObReferenceObject(DeviceObject); + + /* store result */ + Irp->IoStatus.Information = (ULONG_PTR)DeviceRelation; + + /* done */ + Status = STATUS_SUCCESS; + } + else + { + /* no memory */ + Status = STATUS_INSUFFICIENT_RESOURCES; } } - else if (IoStack->MinorFunction == IRP_MN_QUERY_CAPABILITIES) - { - /* query capabilities */ - Status = HDA_PDOQueryBusDeviceCapabilities(Irp); - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_RESOURCE_REQUIREMENTS) - { - /* no op */ - Status = STATUS_SUCCESS; - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_RESOURCES) - { - /* no op */ - Status = STATUS_SUCCESS; - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_ID) - { - Status = HDA_PDOQueryId(DeviceObject, Irp); - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_DEVICE_TEXT) - { - Status = HDA_PDOHandleQueryDeviceText(Irp); - } - else if (IoStack->MinorFunction == IRP_MN_QUERY_INTERFACE) - { - Status = HDA_PDOHandleQueryInterface(DeviceObject, Irp); - } - else - { - /* get default status */ - Status = Irp->IoStatus.Status; - } + } + else if (IoStack->MinorFunction == IRP_MN_QUERY_CAPABILITIES) + { + /* query capabilities */ + Status = HDA_PDOQueryBusDeviceCapabilities(Irp); + } + else if (IoStack->MinorFunction == IRP_MN_QUERY_RESOURCE_REQUIREMENTS) + { + /* no op */ + Status = STATUS_SUCCESS; + } + else if (IoStack->MinorFunction == IRP_MN_QUERY_RESOURCES) + { + /* no op */ + Status = STATUS_SUCCESS; + } + else if (IoStack->MinorFunction == IRP_MN_QUERY_ID) + { + Status = HDA_PDOQueryId(DeviceObject, Irp); + } + else if (IoStack->MinorFunction == IRP_MN_QUERY_DEVICE_TEXT) + { + Status = HDA_PDOHandleQueryDeviceText(Irp); + } + else if (IoStack->MinorFunction == IRP_MN_QUERY_INTERFACE) + { + Status = HDA_PDOHandleQueryInterface(DeviceObject, Irp); + } + else + { + /* get default status */ + Status = Irp->IoStatus.Status; } Irp->IoStatus.Status = Status; @@ -213,6 +221,27 @@ HDA_Pnp( return Status; } +NTSTATUS +NTAPI +HDA_Pnp( + _In_ PDEVICE_OBJECT DeviceObject, + _Inout_ PIRP Irp) +{ + PHDA_FDO_DEVICE_EXTENSION FDODeviceExtension; + + FDODeviceExtension = static_cast<PHDA_FDO_DEVICE_EXTENSION>(DeviceObject->DeviceExtension); + + if (FDODeviceExtension->IsFDO) + { + return HDA_FdoPnp(DeviceObject, Irp); + } + else + { + return HDA_PdoPnp(DeviceObject, Irp); + } +} + + NTSTATUS NTAPI HDA_AddDevice(
5 years, 10 months
1
0
0
0
[reactos] 01/09: [HDAUDBUS] Minor fixes: * Add some forward-declarations * Add some annotations * Improve a DPRINT
by Thomas Faber
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b65ec6ffba3ed99cfa24c…
commit b65ec6ffba3ed99cfa24c40cb96d9b501fb108df Author: Thomas Faber <thomas.faber(a)reactos.org> AuthorDate: Sat Feb 23 09:55:57 2019 +0100 Commit: Thomas Faber <thomas.faber(a)reactos.org> CommitDate: Tue Feb 26 09:18:41 2019 +0100 [HDAUDBUS] Minor fixes: * Add some forward-declarations * Add some annotations * Improve a DPRINT --- drivers/wdm/audio/hdaudbus/fdo.cpp | 2 +- drivers/wdm/audio/hdaudbus/hdaudbus.cpp | 27 +++++++++++++-------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/wdm/audio/hdaudbus/fdo.cpp b/drivers/wdm/audio/hdaudbus/fdo.cpp index b032073eb9..6bbadf3746 100644 --- a/drivers/wdm/audio/hdaudbus/fdo.cpp +++ b/drivers/wdm/audio/hdaudbus/fdo.cpp @@ -581,7 +581,7 @@ HDA_FDOStartDevice( FALSE); if (!NT_SUCCESS(Status)) { - DPRINT1("[HDAB] Failed to connect interrupt\n"); + DPRINT1("[HDAB] Failed to connect interrupt. Status=%lx\n", Status); break; } diff --git a/drivers/wdm/audio/hdaudbus/hdaudbus.cpp b/drivers/wdm/audio/hdaudbus/hdaudbus.cpp index 9239354c12..bacc854ab1 100644 --- a/drivers/wdm/audio/hdaudbus/hdaudbus.cpp +++ b/drivers/wdm/audio/hdaudbus/hdaudbus.cpp @@ -7,11 +7,14 @@ */ #include "hdaudbus.h" +DRIVER_DISPATCH HDA_Pnp; +DRIVER_ADD_DEVICE HDA_AddDevice; +extern "C" DRIVER_INITIALIZE DriverEntry; PVOID AllocateItem( - IN POOL_TYPE PoolType, - IN SIZE_T NumberOfBytes) + _In_ POOL_TYPE PoolType, + _In_ SIZE_T NumberOfBytes) { PVOID Item = ExAllocatePoolWithTag(PoolType, NumberOfBytes, TAG_HDA); if (!Item) @@ -23,7 +26,7 @@ AllocateItem( VOID FreeItem( - IN PVOID Item) + __drv_freesMem(Mem) PVOID Item) { ExFreePool(Item); } @@ -85,8 +88,8 @@ HDA_SyncForwardIrp( NTSTATUS NTAPI HDA_Pnp( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp) + _In_ PDEVICE_OBJECT DeviceObject, + _Inout_ PIRP Irp) { NTSTATUS Status = STATUS_NOT_SUPPORTED; PIO_STACK_LOCATION IoStack; @@ -207,18 +210,14 @@ HDA_Pnp( Irp->IoStatus.Status = Status; IoCompleteRequest(Irp, IO_NO_INCREMENT); - return Status; } - -//PDRIVER_ADD_DEVICE HDA_AddDevice; - NTSTATUS NTAPI HDA_AddDevice( -IN PDRIVER_OBJECT DriverObject, -IN PDEVICE_OBJECT PhysicalDeviceObject) + _In_ PDRIVER_OBJECT DriverObject, + _In_ PDEVICE_OBJECT PhysicalDeviceObject) { PDEVICE_OBJECT DeviceObject; PHDA_FDO_DEVICE_EXTENSION DeviceExtension; @@ -250,8 +249,8 @@ extern "C" NTSTATUS NTAPI DriverEntry( - IN PDRIVER_OBJECT DriverObject, - IN PUNICODE_STRING RegistryPathName) + _In_ PDRIVER_OBJECT DriverObject, + _In_ PUNICODE_STRING RegistryPathName) { DriverObject->DriverExtension->AddDevice = HDA_AddDevice; DriverObject->MajorFunction[IRP_MJ_PNP] = HDA_Pnp; @@ -259,4 +258,4 @@ DriverEntry( return STATUS_SUCCESS; } -} \ No newline at end of file +}
5 years, 10 months
1
0
0
0
[reactos] 05/05: [MSAFD] Don't leak event while querying/setting socket options
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6ee2f9882c9cf1ff32f60…
commit 6ee2f9882c9cf1ff32f60fb3786b154e1eef94f0 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Mon Feb 25 22:33:31 2019 +0100 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Mon Feb 25 22:34:29 2019 +0100 [MSAFD] Don't leak event while querying/setting socket options --- dll/win32/msafd/misc/dllmain.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dll/win32/msafd/misc/dllmain.c b/dll/win32/msafd/misc/dllmain.c index 520cf1a3ce..abb184f8e3 100644 --- a/dll/win32/msafd/misc/dllmain.c +++ b/dll/win32/msafd/misc/dllmain.c @@ -3298,6 +3298,7 @@ GetSocketInformation(PSOCKET_INFORMATION Socket, if ((Socket->SharedData->CreateFlags & SO_SYNCHRONOUS_NONALERT) != 0) { TRACE("Opened without flag WSA_FLAG_OVERLAPPED. Do nothing.\n"); + NtClose( SockEvent ); return 0; } if (CompletionRoutine == NULL) @@ -3315,6 +3316,7 @@ GetSocketInformation(PSOCKET_INFORMATION Socket, if (!APCContext) { ERR("Not enough memory for APC Context\n"); + NtClose( SockEvent ); return WSAEFAULT; } APCContext->lpCompletionRoutine = CompletionRoutine; @@ -3346,6 +3348,8 @@ GetSocketInformation(PSOCKET_INFORMATION Socket, Status = IOSB->Status; } + NtClose( SockEvent ); + TRACE("Status %x Information %d\n", Status, IOSB->Information); if (Status == STATUS_PENDING) @@ -3371,8 +3375,6 @@ GetSocketInformation(PSOCKET_INFORMATION Socket, *Boolean = InfoData.Information.Boolean; } - NtClose( SockEvent ); - return NO_ERROR; } @@ -3437,6 +3439,7 @@ SetSocketInformation(PSOCKET_INFORMATION Socket, if ((Socket->SharedData->CreateFlags & SO_SYNCHRONOUS_NONALERT) != 0) { TRACE("Opened without flag WSA_FLAG_OVERLAPPED. Do nothing.\n"); + NtClose( SockEvent ); return 0; } if (CompletionRoutine == NULL) @@ -3454,6 +3457,7 @@ SetSocketInformation(PSOCKET_INFORMATION Socket, if (!APCContext) { ERR("Not enough memory for APC Context\n"); + NtClose( SockEvent ); return WSAEFAULT; } APCContext->lpCompletionRoutine = CompletionRoutine;
5 years, 10 months
1
0
0
0
[reactos] 04/05: [MSAFD] Implement socket options SO_SNDBUF and SO_RCVBUF
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6bc61f63f1e0ad20ab09f…
commit 6bc61f63f1e0ad20ab09f881d6968558eba9a8e6 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Mon Feb 25 22:30:01 2019 +0100 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Mon Feb 25 22:34:29 2019 +0100 [MSAFD] Implement socket options SO_SNDBUF and SO_RCVBUF --- dll/win32/msafd/misc/dllmain.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/dll/win32/msafd/misc/dllmain.c b/dll/win32/msafd/misc/dllmain.c index c761cff13e..520cf1a3ce 100644 --- a/dll/win32/msafd/misc/dllmain.c +++ b/dll/win32/msafd/misc/dllmain.c @@ -2866,8 +2866,21 @@ WSPSetSockOpt( return SOCKET_ERROR; } - /* TODO: The total per-socket buffer space reserved for sends */ - ERR("Setting send buf to %x is not implemented yet\n", optval); + SetSocketInformation(Socket, + AFD_INFO_SEND_WINDOW_SIZE, + NULL, + (PULONG)optval, + NULL, + NULL, + NULL); + GetSocketInformation(Socket, + AFD_INFO_SEND_WINDOW_SIZE, + NULL, + &Socket->SharedData->SizeOfSendBuffer, + NULL, + NULL, + NULL); + return NO_ERROR; case SO_RCVBUF: @@ -2877,8 +2890,21 @@ WSPSetSockOpt( return SOCKET_ERROR; } - /* TODO: The total per-socket buffer space reserved for receives */ - ERR("Setting receive buf to %x is not implemented yet\n", optval); + SetSocketInformation(Socket, + AFD_INFO_RECEIVE_WINDOW_SIZE, + NULL, + (PULONG)optval, + NULL, + NULL, + NULL); + GetSocketInformation(Socket, + AFD_INFO_RECEIVE_WINDOW_SIZE, + NULL, + &Socket->SharedData->SizeOfSendBuffer, + NULL, + NULL, + NULL); + return NO_ERROR; case SO_ERROR:
5 years, 10 months
1
0
0
0
[reactos] 03/05: [AFD_APITEST] Add apitest for AFD window size options
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6bf5a8a43dca1672a84a8…
commit 6bf5a8a43dca1672a84a8e519edc2ba7d4c354e6 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Mon Feb 25 22:28:18 2019 +0100 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Mon Feb 25 22:34:28 2019 +0100 [AFD_APITEST] Add apitest for AFD window size options --- modules/rostests/apitests/afd/AfdHelpers.c | 124 +++++++++++ modules/rostests/apitests/afd/AfdHelpers.h | 17 ++ modules/rostests/apitests/afd/CMakeLists.txt | 1 + modules/rostests/apitests/afd/testlist.c | 2 + modules/rostests/apitests/afd/windowsize.c | 306 +++++++++++++++++++++++++++ 5 files changed, 450 insertions(+) diff --git a/modules/rostests/apitests/afd/AfdHelpers.c b/modules/rostests/apitests/afd/AfdHelpers.c index ad7793efd7..702a8f0cfb 100644 --- a/modules/rostests/apitests/afd/AfdHelpers.c +++ b/modules/rostests/apitests/afd/AfdHelpers.c @@ -3,6 +3,7 @@ * LICENSE: LGPL-2.1+ (
https://spdx.org/licenses/LGPL-2.1+
) * PURPOSE: Utility function definitions for calling AFD * COPYRIGHT: Copyright 2015-2018 Thomas Faber (thomas.faber(a)reactos.org) + * Copyright 2019 Pierre Schweitzer (pierre(a)reactos.org) */ #include "precomp.h" @@ -382,3 +383,126 @@ AfdSendTo( return Status; } + +NTSTATUS +AfdSetInformation( + _In_ HANDLE SocketHandle, + _In_ ULONG InformationClass, + _In_opt_ PBOOLEAN Boolean, + _In_opt_ PULONG Ulong, + _In_opt_ PLARGE_INTEGER LargeInteger) +{ + NTSTATUS Status; + IO_STATUS_BLOCK IoStatus; + AFD_INFO InfoData; + HANDLE Event; + + Status = NtCreateEvent(&Event, + EVENT_ALL_ACCESS, + NULL, + NotificationEvent, + FALSE); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + InfoData.InformationClass = InformationClass; + + if (Ulong != NULL) + { + InfoData.Information.Ulong = *Ulong; + } + if (LargeInteger != NULL) + { + InfoData.Information.LargeInteger = *LargeInteger; + } + if (Boolean != NULL) + { + InfoData.Information.Boolean = *Boolean; + } + + Status = NtDeviceIoControlFile(SocketHandle, + Event, + NULL, + NULL, + &IoStatus, + IOCTL_AFD_SET_INFO, + &InfoData, + sizeof(InfoData), + NULL, + 0); + if (Status == STATUS_PENDING) + { + NtWaitForSingleObject(Event, FALSE, NULL); + Status = IoStatus.Status; + } + + NtClose(Event); + + return Status; +} + +NTSTATUS +AfdGetInformation( + _In_ HANDLE SocketHandle, + _In_ ULONG InformationClass, + _In_opt_ PBOOLEAN Boolean, + _In_opt_ PULONG Ulong, + _In_opt_ PLARGE_INTEGER LargeInteger) +{ + NTSTATUS Status; + IO_STATUS_BLOCK IoStatus; + AFD_INFO InfoData; + HANDLE Event; + + Status = NtCreateEvent(&Event, + EVENT_ALL_ACCESS, + NULL, + NotificationEvent, + FALSE); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + InfoData.InformationClass = InformationClass; + + Status = NtDeviceIoControlFile(SocketHandle, + Event, + NULL, + NULL, + &IoStatus, + IOCTL_AFD_GET_INFO, + &InfoData, + sizeof(InfoData), + &InfoData, + sizeof(InfoData)); + if (Status == STATUS_PENDING) + { + NtWaitForSingleObject(Event, FALSE, NULL); + Status = IoStatus.Status; + } + + NtClose(Event); + + if (Status != STATUS_SUCCESS) + { + return Status; + } + + if (Ulong != NULL) + { + *Ulong = InfoData.Information.Ulong; + } + if (LargeInteger != NULL) + { + *LargeInteger = InfoData.Information.LargeInteger; + } + if (Boolean != NULL) + { + *Boolean = InfoData.Information.Boolean; + } + + return Status; +} diff --git a/modules/rostests/apitests/afd/AfdHelpers.h b/modules/rostests/apitests/afd/AfdHelpers.h index fadd03d563..0afcef5231 100644 --- a/modules/rostests/apitests/afd/AfdHelpers.h +++ b/modules/rostests/apitests/afd/AfdHelpers.h @@ -3,6 +3,7 @@ * LICENSE: LGPL-2.1+ (
https://spdx.org/licenses/LGPL-2.1+
) * PURPOSE: Utility function declarations for calling AFD * COPYRIGHT: Copyright 2015 Thomas Faber (thomas.faber(a)reactos.org) + * Copyright 2019 Pierre Schweitzer (pierre(a)reactos.org) */ #pragma once @@ -39,3 +40,19 @@ AfdSendTo( _In_ ULONG BufferLength, _In_ const struct sockaddr *Address, _In_ ULONG AddressLength); + +NTSTATUS +AfdSetInformation( + _In_ HANDLE SocketHandle, + _In_ ULONG InformationClass, + _In_opt_ PBOOLEAN Boolean, + _In_opt_ PULONG Ulong, + _In_opt_ PLARGE_INTEGER LargeInteger); + +NTSTATUS +AfdGetInformation( + _In_ HANDLE SocketHandle, + _In_ ULONG InformationClass, + _In_opt_ PBOOLEAN Boolean, + _In_opt_ PULONG Ulong, + _In_opt_ PLARGE_INTEGER LargeInteger); diff --git a/modules/rostests/apitests/afd/CMakeLists.txt b/modules/rostests/apitests/afd/CMakeLists.txt index 412c27e177..d4b30b254c 100644 --- a/modules/rostests/apitests/afd/CMakeLists.txt +++ b/modules/rostests/apitests/afd/CMakeLists.txt @@ -5,6 +5,7 @@ include_directories( list(APPEND SOURCE AfdHelpers.c send.c + windowsize.c precomp.h) add_executable(afd_apitest ${SOURCE} testlist.c) diff --git a/modules/rostests/apitests/afd/testlist.c b/modules/rostests/apitests/afd/testlist.c index 17c82b9f0b..565e7db552 100644 --- a/modules/rostests/apitests/afd/testlist.c +++ b/modules/rostests/apitests/afd/testlist.c @@ -2,9 +2,11 @@ #include <apitest.h> extern void func_send(void); +extern void func_windowsize(void); const struct test winetest_testlist[] = { { "send", func_send }, + { "windowsize", func_windowsize }, { 0, 0 } }; diff --git a/modules/rostests/apitests/afd/windowsize.c b/modules/rostests/apitests/afd/windowsize.c new file mode 100644 index 0000000000..1ebb945781 --- /dev/null +++ b/modules/rostests/apitests/afd/windowsize.c @@ -0,0 +1,306 @@ +/* + * PROJECT: ReactOS API Tests + * LICENSE: LGPL-2.1+ (
https://spdx.org/licenses/LGPL-2.1+
) + * PURPOSE: Test for AFD_INFO_RECEIVE_WINDOW_SIZE/AFD_INFO_SEND_WINDOW_SIZE + * COPYRIGHT: Copyright 2019 Pierre Schweitzer (pierre(a)reactos.org) + */ + +#include "precomp.h" + +static +void +TestTcp(void) +{ + NTSTATUS Status; + HANDLE SocketHandle; + struct sockaddr_in addr; + ULONG OrigReceiveSize, OrigSendSize, ReceiveSize, SendSize; + + Status = AfdCreateSocket(&SocketHandle, AF_INET, SOCK_STREAM, IPPROTO_TCP); + ok(Status == STATUS_SUCCESS, "AfdCreateSocket failed with %lx\n", Status); + + Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &OrigReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(OrigReceiveSize == 0x1000 || OrigReceiveSize == 0x2000, "Invalid size: %lu\n", OrigReceiveSize); + Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &OrigSendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(OrigSendSize == 0x1000 || OrigSendSize == 0x2000, "Invalid size: %lu\n", OrigSendSize); + + ReceiveSize = 0; + Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status); + SendSize = 0; + Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status); + + ReceiveSize = (ULONG)-1L; + Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status); + SendSize = (ULONG)-1L; + Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status); + + Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize); + Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize); + + ReceiveSize = OrigReceiveSize; + Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status); + SendSize = OrigSendSize; + Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status); + + memset(&addr, 0, sizeof(addr)); + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = inet_addr("0.0.0.0"); + addr.sin_port = htons(0); + + Status = AfdBind(SocketHandle, (const struct sockaddr *)&addr, sizeof(addr)); + ok(Status == STATUS_SUCCESS, "AfdBind failed with %lx\n", Status); + + Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize); + Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize); + + ReceiveSize = 0; + Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status); + SendSize = 0; + Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status); + + ReceiveSize = (ULONG)-1L; + Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status); + SendSize = (ULONG)-1L; + Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status); + + Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize); + Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize); + + ReceiveSize = OrigReceiveSize; + Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status); + SendSize = OrigSendSize; + Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_INVALID_PARAMETER, "AfdSetInformation failed with %lx\n", Status); + + memset(&addr, 0, sizeof(addr)); + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = inet_addr("8.8.8.8"); + addr.sin_port = htons(53); + + Status = AfdConnect(SocketHandle, (const struct sockaddr *)&addr, sizeof(addr)); + ok(Status == STATUS_SUCCESS, "AfdConnect failed with %lx\n", Status); + + Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize); + Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize); + + ReceiveSize = 0; + Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + SendSize = 0; + Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + + Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize); + Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize); + + ReceiveSize = (ULONG)-1L; + Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + SendSize = (ULONG)-1L; + Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + + Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize); + Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize); + + ReceiveSize = OrigReceiveSize + 1; + Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + SendSize = OrigSendSize + 1; + Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + + Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize); + Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize); + + ReceiveSize = OrigReceiveSize - 1; + Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + SendSize = OrigSendSize - 1; + Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + + Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize); + Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize); + + NtClose(SocketHandle); +} + +static +void +TestUdp(void) +{ + NTSTATUS Status; + HANDLE SocketHandle; + struct sockaddr_in addr; + ULONG OrigReceiveSize, OrigSendSize, ReceiveSize, SendSize; + + Status = AfdCreateSocket(&SocketHandle, AF_INET, SOCK_DGRAM, IPPROTO_UDP); + ok(Status == STATUS_SUCCESS, "AfdCreateSocket failed with %lx\n", Status); + + Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &OrigReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(OrigReceiveSize == 0x1000 || OrigReceiveSize == 0x2000, "Invalid size: %lu\n", OrigReceiveSize); + Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &OrigSendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(OrigSendSize == 0x1000 || OrigSendSize == 0x2000, "Invalid size: %lu\n", OrigSendSize); + + ReceiveSize = 0; + Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + SendSize = 0; + Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + + Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize); + Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize); + + ReceiveSize = (ULONG)-1L; + Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + SendSize = (ULONG)-1L; + Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + + Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize); + Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize); + + ReceiveSize = OrigReceiveSize; + Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + SendSize = OrigSendSize; + Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + + memset(&addr, 0, sizeof(addr)); + addr.sin_family = AF_INET; + addr.sin_addr.s_addr = inet_addr("0.0.0.0"); + addr.sin_port = htons(0); + + Status = AfdBind(SocketHandle, (const struct sockaddr *)&addr, sizeof(addr)); + ok(Status == STATUS_SUCCESS, "AfdBind failed with %lx\n", Status); + + Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize); + Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize); + + ReceiveSize = 0; + Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + SendSize = 0; + Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + + Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize); + Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize); + + ReceiveSize = (ULONG)-1L; + Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + SendSize = (ULONG)-1L; + Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + + Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize); + Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize); + + ReceiveSize = OrigReceiveSize + 1; + Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + SendSize = OrigSendSize + 1; + Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + + Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize); + Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize); + + ReceiveSize = OrigReceiveSize - 1; + Status = AfdSetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + SendSize = OrigSendSize - 1; + Status = AfdSetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdSetInformation failed with %lx\n", Status); + + Status = AfdGetInformation(SocketHandle, AFD_INFO_RECEIVE_WINDOW_SIZE, NULL, &ReceiveSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(ReceiveSize == OrigReceiveSize, "Invalid size: %lu %lu\n", ReceiveSize, OrigReceiveSize); + Status = AfdGetInformation(SocketHandle, AFD_INFO_SEND_WINDOW_SIZE, NULL, &SendSize, NULL); + ok(Status == STATUS_SUCCESS, "AfdGetInformation failed with %lx\n", Status); + ok(SendSize == OrigSendSize, "Invalid size: %lu %lu\n", SendSize, OrigSendSize); + + NtClose(SocketHandle); +} + +START_TEST(windowsize) +{ + TestTcp(); + TestUdp(); +}
5 years, 10 months
1
0
0
0
[reactos] 02/05: [AFD] Don't allow caller to set broken values to window sizes
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=86483d6e222e42f3faefe…
commit 86483d6e222e42f3faefeac280f988cf8437736d Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Mon Feb 25 22:27:00 2019 +0100 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Mon Feb 25 22:34:28 2019 +0100 [AFD] Don't allow caller to set broken values to window sizes This will avoid 0-sized allocations, or -1-sized allocations. So far, it's maxed by hard value stored in TCPIP.sys. I believe this is not right and would deserve a true fix --- drivers/network/afd/afd/info.c | 111 ++++++++++++++++++++++++++--------------- 1 file changed, 71 insertions(+), 40 deletions(-) diff --git a/drivers/network/afd/afd/info.c b/drivers/network/afd/afd/info.c index 1c05842e4e..c780eb86a2 100644 --- a/drivers/network/afd/afd/info.c +++ b/drivers/network/afd/afd/info.c @@ -124,61 +124,92 @@ AfdSetInfo( PDEVICE_OBJECT DeviceObject, PIRP Irp, FCB->OobInline = InfoReq->Information.Boolean; break; case AFD_INFO_RECEIVE_WINDOW_SIZE: - NewBuffer = ExAllocatePoolWithTag(PagedPool, - InfoReq->Information.Ulong, - TAG_AFD_DATA_BUFFER); - - if (NewBuffer) + if (FCB->State == SOCKET_STATE_CONNECTED || + FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS) { - if (FCB->Recv.Content > InfoReq->Information.Ulong) - FCB->Recv.Content = InfoReq->Information.Ulong; - - if (FCB->Recv.Window) + /* FIXME: likely not right, check tcpip.sys for TDI_QUERY_MAX_DATAGRAM_INFO */ + if (InfoReq->Information.Ulong > 0 && InfoReq->Information.Ulong < 0xFFFF) { - RtlCopyMemory(NewBuffer, - FCB->Recv.Window, - FCB->Recv.Content); - - ExFreePoolWithTag(FCB->Recv.Window, TAG_AFD_DATA_BUFFER); + NewBuffer = ExAllocatePoolWithTag(PagedPool, + InfoReq->Information.Ulong, + TAG_AFD_DATA_BUFFER); + + if (NewBuffer) + { + if (FCB->Recv.Content > InfoReq->Information.Ulong) + FCB->Recv.Content = InfoReq->Information.Ulong; + + if (FCB->Recv.Window) + { + RtlCopyMemory(NewBuffer, + FCB->Recv.Window, + FCB->Recv.Content); + + ExFreePoolWithTag(FCB->Recv.Window, TAG_AFD_DATA_BUFFER); + } + + FCB->Recv.Size = InfoReq->Information.Ulong; + FCB->Recv.Window = NewBuffer; + + Status = STATUS_SUCCESS; + } + else + { + Status = STATUS_NO_MEMORY; + } + } + else + { + Status = STATUS_SUCCESS; } - - FCB->Recv.Size = InfoReq->Information.Ulong; - FCB->Recv.Window = NewBuffer; - - Status = STATUS_SUCCESS; } else { - Status = STATUS_NO_MEMORY; + Status = STATUS_INVALID_PARAMETER; } break; case AFD_INFO_SEND_WINDOW_SIZE: - NewBuffer = ExAllocatePoolWithTag(PagedPool, - InfoReq->Information.Ulong, - TAG_AFD_DATA_BUFFER); - - if (NewBuffer) + if (FCB->State == SOCKET_STATE_CONNECTED || + FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS) { - if (FCB->Send.BytesUsed > InfoReq->Information.Ulong) - FCB->Send.BytesUsed = InfoReq->Information.Ulong; - - if (FCB->Send.Window) + if (InfoReq->Information.Ulong > 0 && InfoReq->Information.Ulong < 0xFFFF) { - RtlCopyMemory(NewBuffer, - FCB->Send.Window, - FCB->Send.BytesUsed); - - ExFreePoolWithTag(FCB->Send.Window, TAG_AFD_DATA_BUFFER); + NewBuffer = ExAllocatePoolWithTag(PagedPool, + InfoReq->Information.Ulong, + TAG_AFD_DATA_BUFFER); + + if (NewBuffer) + { + if (FCB->Send.BytesUsed > InfoReq->Information.Ulong) + FCB->Send.BytesUsed = InfoReq->Information.Ulong; + + if (FCB->Send.Window) + { + RtlCopyMemory(NewBuffer, + FCB->Send.Window, + FCB->Send.BytesUsed); + + ExFreePoolWithTag(FCB->Send.Window, TAG_AFD_DATA_BUFFER); + } + + FCB->Send.Size = InfoReq->Information.Ulong; + FCB->Send.Window = NewBuffer; + + Status = STATUS_SUCCESS; + } + else + { + Status = STATUS_NO_MEMORY; + } + } + else + { + Status = STATUS_SUCCESS; } - - FCB->Send.Size = InfoReq->Information.Ulong; - FCB->Send.Window = NewBuffer; - - Status = STATUS_SUCCESS; } else { - Status = STATUS_NO_MEMORY; + Status = STATUS_INVALID_PARAMETER; } break; default:
5 years, 10 months
1
0
0
0
[reactos] 01/05: [AFD] Add default window sizes on socket creation
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bb9eec753791dabefdade…
commit bb9eec753791dabefdadee7969741687eb405ff8 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Mon Feb 25 22:25:03 2019 +0100 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Mon Feb 25 22:34:28 2019 +0100 [AFD] Add default window sizes on socket creation --- drivers/network/afd/afd/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/network/afd/afd/main.c b/drivers/network/afd/afd/main.c index 04e28652c6..db01703534 100644 --- a/drivers/network/afd/afd/main.c +++ b/drivers/network/afd/afd/main.c @@ -22,6 +22,10 @@ DWORD DebugTraceLevel = MIN_TRACE; #endif /* DBG */ +/* FIXME: should depend on SystemSize */ +ULONG AfdReceiveWindowSize = 0x2000; +ULONG AfdSendWindowSize = 0x2000; + void OskitDumpBuffer( PCHAR Data, UINT Len ) { unsigned int i; @@ -352,6 +356,8 @@ AfdCreateSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp, FCB->DeviceExt = DeviceExt; FCB->AddressFile.Handle = INVALID_HANDLE_VALUE; FCB->Connection.Handle = INVALID_HANDLE_VALUE; + FCB->Recv.Size = AfdReceiveWindowSize; + FCB->Send.Size = AfdSendWindowSize; KeInitializeMutex( &FCB->Mutex, 0 );
5 years, 10 months
1
0
0
0
← Newer
1
2
3
4
5
...
21
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
Results per page:
10
25
50
100
200