Author: cgutman
Date: Sat Sep 6 17:21:56 2008
New Revision: 36010
URL:
http://svn.reactos.org/svn/reactos?rev=36010&view=rev
Log:
- Merge aicom-network-fixes up to r36009
Modified:
trunk/reactos/drivers/network/ndis/ndis/miniport.c
trunk/reactos/drivers/network/ndis/ndis/protocol.c
trunk/reactos/drivers/network/ndis/ndis/stubs.c
trunk/reactos/drivers/network/tcpip/include/ports.h
trunk/reactos/drivers/network/tcpip/tcpip/buffer.c
trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c
trunk/reactos/drivers/network/tcpip/tcpip/main.c
trunk/reactos/lib/drivers/ip/network/ports.c
trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c
trunk/reactos/lib/drivers/ip/transport/udp/udp.c
Modified: trunk/reactos/drivers/network/ndis/ndis/miniport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/miniport.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/miniport.c [iso-8859-1] Sat Sep 6 17:21:56
2008
@@ -1293,8 +1293,7 @@
* NdisMQueryAdapterResources.
*/
- if (Stack->Parameters.StartDevice.AllocatedResources != NULL &&
- Stack->Parameters.StartDevice.AllocatedResourcesTranslated != NULL)
+ if (Stack->Parameters.StartDevice.AllocatedResources != NULL)
{
ResourceCount = Stack->Parameters.StartDevice.AllocatedResources->List[0].
PartialResourceList.Count;
@@ -1310,24 +1309,31 @@
return STATUS_INSUFFICIENT_RESOURCES;
}
+ RtlCopyMemory(Adapter->NdisMiniportBlock.AllocatedResources,
+ Stack->Parameters.StartDevice.AllocatedResources,
+ ResourceListSize);
+ }
+
+ if (Stack->Parameters.StartDevice.AllocatedResourcesTranslated != NULL)
+ {
+ ResourceCount = Stack->Parameters.StartDevice.AllocatedResources->List[0].
+ PartialResourceList.Count;
+ ResourceListSize =
+ FIELD_OFFSET(CM_RESOURCE_LIST, List[0].PartialResourceList.
+ PartialDescriptors[ResourceCount]);
+
Adapter->NdisMiniportBlock.AllocatedResourcesTranslated =
ExAllocatePool(PagedPool, ResourceListSize);
if (Adapter->NdisMiniportBlock.AllocatedResourcesTranslated == NULL)
{
- ExFreePool(Adapter->NdisMiniportBlock.AllocatedResources);
- Adapter->NdisMiniportBlock.AllocatedResources = NULL;
ExInterlockedRemoveEntryList( &Adapter->ListEntry, &AdapterListLock );
return STATUS_INSUFFICIENT_RESOURCES;
}
- RtlCopyMemory(Adapter->NdisMiniportBlock.AllocatedResources,
- Stack->Parameters.StartDevice.AllocatedResources,
- ResourceListSize);
-
RtlCopyMemory(Adapter->NdisMiniportBlock.AllocatedResourcesTranslated,
Stack->Parameters.StartDevice.AllocatedResourcesTranslated,
ResourceListSize);
- }
+ }
/*
* Store the Bus Type, Bus Number and Slot information. It's used by
Modified: trunk/reactos/drivers/network/ndis/ndis/protocol.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/protocol.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/protocol.c [iso-8859-1] Sat Sep 6 17:21:56
2008
@@ -805,10 +805,11 @@
NtStatus = ZwQueryValueKey(DriverKeyHandle, &ValueName,
KeyValuePartialInformation, KeyInformation,
sizeof(KEY_VALUE_PARTIAL_INFORMATION) + ResultLength, &ResultLength);
+ ZwClose(DriverKeyHandle);
+
if(!NT_SUCCESS(NtStatus))
{
NDIS_DbgPrint(MIN_TRACE, ("Unable to query the Bind value\n"));
- ZwClose(DriverKeyHandle);
ExFreePool(KeyInformation);
ExFreePool(Protocol);
*Status = NDIS_STATUS_FAILURE;
@@ -893,7 +894,8 @@
*/
}
- *Status = NDIS_STATUS_SUCCESS;
+ ExFreePool(KeyInformation);
+ *Status = NDIS_STATUS_SUCCESS;
}
Modified: trunk/reactos/drivers/network/ndis/ndis/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/stubs.c [iso-8859-1] Sat Sep 6 17:21:56 2008
@@ -321,9 +321,6 @@
FILE_SYNCHRONOUS_IO_NONALERT, // ULONG CreateOptions
0, // PVOID EaBuffer
0 ); // ULONG EaLength
-
- //if ( !NT_SUCCESS(*Status) )
- // goto cleanup;
cleanup:
if ( FullFileName.Buffer != NULL )
Modified: trunk/reactos/drivers/network/tcpip/include/ports.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/incl…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/include/ports.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/include/ports.h [iso-8859-1] Sat Sep 6 17:21:56
2008
@@ -20,9 +20,9 @@
FAST_MUTEX Mutex;
} PORT_SET, *PPORT_SET;
-VOID PortsStartup( PPORT_SET PortSet,
- UINT StartingPort,
- UINT PortsToManage );
+NTSTATUS PortsStartup( PPORT_SET PortSet,
+ UINT StartingPort,
+ UINT PortsToManage );
VOID PortsShutdown( PPORT_SET PortSet );
VOID DeallocatePort( PPORT_SET PortSet, ULONG Port );
BOOLEAN AllocatePort( PPORT_SET PortSet, ULONG Port );
Modified: trunk/reactos/drivers/network/tcpip/tcpip/buffer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip/buffer.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip/buffer.c [iso-8859-1] Sat Sep 6 17:21:56
2008
@@ -319,11 +319,11 @@
if( Copy ) {
NewBuf = ExAllocatePool( NonPagedPool, Length );
- if( !NewBuf ) return STATUS_NO_MEMORY;
+ if( !NewBuf ) return NDIS_STATUS_RESOURCES;
RtlCopyMemory( NewBuf, Data, Length );
} else NewBuf = Data;
- NdisAllocateBuffer( &Status, &Buffer, GlobalBufferPool, Data, Length );
+ NdisAllocateBuffer( &Status, &Buffer, GlobalBufferPool, NewBuf, Length );
if( Status != NDIS_STATUS_SUCCESS ) return Status;
NdisChainBufferAtFront( Packet, Buffer );
@@ -351,7 +351,7 @@
PCHAR NewData;
NewData = ExAllocatePool( NonPagedPool, Len );
- if( !NewData ) return NDIS_STATUS_NOT_ACCEPTED; // XXX
+ if( !NewData ) return NDIS_STATUS_RESOURCES;
TrackWithTag(EXALLOC_TAG, NewData, File, Line);
if( Data ) RtlCopyMemory(NewData, Data, Len);
Modified: trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip/iinfo.c [iso-8859-1] Sat Sep 6 17:21:56
2008
@@ -29,7 +29,7 @@
(PIFENTRY)ExAllocatePool( NonPagedPool,
sizeof(IFENTRY) + MAX_IFDESCR_LEN );
- if( !OutData ) return TDI_INVALID_REQUEST; /* Out of memory */
+ if( !OutData ) return TDI_NO_RESOURCES; /* Out of memory */
RtlZeroMemory( OutData, sizeof(IFENTRY) + MAX_IFDESCR_LEN );
Modified: trunk/reactos/drivers/network/tcpip/tcpip/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/tcpi…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/tcpip/main.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/tcpip/main.c [iso-8859-1] Sat Sep 6 17:21:56
2008
@@ -711,8 +711,8 @@
/* Setup network layer and transport layer entities */
KeInitializeSpinLock(&EntityListLock);
EntityList = ExAllocatePool(NonPagedPool, sizeof(TDIEntityID) * MAX_TDI_ENTITIES );
- if (!NT_SUCCESS(Status)) {
- TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
+ if (!EntityList) {
+ TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
TiUnload(DriverObject);
return STATUS_INSUFFICIENT_RESOURCES;
}
@@ -760,9 +760,23 @@
IPStartup(RegistryPath);
/* Initialize transport level protocol subsystems */
- RawIPStartup();
- UDPStartup();
- TCPStartup();
+ Status = RawIPStartup();
+ if( !NT_SUCCESS(Status) ) {
+ TiUnload(DriverObject);
+ return Status;
+ }
+
+ Status = UDPStartup();
+ if( !NT_SUCCESS(Status) ) {
+ TiUnload(DriverObject);
+ return Status;
+ }
+
+ Status = TCPStartup();
+ if( !NT_SUCCESS(Status) ) {
+ TiUnload(DriverObject);
+ return Status;
+ }
/* Initialize the lan worker */
LANStartup();
Modified: trunk/reactos/lib/drivers/ip/network/ports.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/por…
==============================================================================
--- trunk/reactos/lib/drivers/ip/network/ports.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/network/ports.c [iso-8859-1] Sat Sep 6 17:21:56 2008
@@ -10,7 +10,7 @@
#include "precomp.h"
-VOID PortsStartup( PPORT_SET PortSet,
+NTSTATUS PortsStartup( PPORT_SET PortSet,
UINT StartingPort,
UINT PortsToManage ) {
PortSet->StartingPort = StartingPort;
@@ -19,11 +19,13 @@
PortSet->PortsToOversee - 1;
PortSet->ProtoBitBuffer =
PoolAllocateBuffer( (PortSet->PortsToOversee + 7) / 8 );
+ if(!PortSet->ProtoBitBuffer) return STATUS_INSUFFICIENT_RESOURCES;
RtlInitializeBitMap( &PortSet->ProtoBitmap,
PortSet->ProtoBitBuffer,
PortSet->PortsToOversee );
RtlClearAllBits( &PortSet->ProtoBitmap );
ExInitializeFastMutex( &PortSet->Mutex );
+ return STATUS_SUCCESS;
}
VOID PortsShutdown( PPORT_SET PortSet ) {
Modified: trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/t…
==============================================================================
--- trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Sat Sep 6 17:21:56
2008
@@ -455,7 +455,11 @@
return Status;
}
- PortsStartup( &TCPPorts, 1, 0xfffe );
+ Status = PortsStartup( &TCPPorts, 1, 0xfffe );
+ if( !NT_SUCCESS(Status) ) {
+ TCPMemShutdown();
+ return Status;
+ }
RegisterOskitTCPEventHandlers( &EventHandlers );
InitOskitTCP();
Modified: trunk/reactos/lib/drivers/ip/transport/udp/udp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/u…
==============================================================================
--- trunk/reactos/lib/drivers/ip/transport/udp/udp.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/transport/udp/udp.c [iso-8859-1] Sat Sep 6 17:21:56
2008
@@ -302,8 +302,12 @@
#ifdef __NTDRIVER__
RtlZeroMemory(&UDPStats, sizeof(UDP_STATISTICS));
#endif
-
- PortsStartup( &UDPPorts, 1, 0xfffe );
+
+ NTSTATUS Status;
+
+ Status = PortsStartup( &UDPPorts, 1, 0xfffe );
+
+ if( !NT_SUCCESS(Status) ) return Status;
/* Register this protocol with IP layer */
IPRegisterProtocol(IPPROTO_UDP, UDPReceive);