mirror of
https://github.com/reactos/reactos.git
synced 2024-11-09 08:08:38 +00:00
- Make PortsStartup return NTSTATUS so we can make sure memory allocated succeeded
- Change the callers to check the return status svn path=/branches/aicom-network-fixes/; revision=36006
This commit is contained in:
parent
4c942b62d6
commit
2044568591
3 changed files with 13 additions and 3 deletions
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
VOID PortsStartup( PPORT_SET PortSet,
|
NTSTATUS PortsStartup( PPORT_SET PortSet,
|
||||||
UINT StartingPort,
|
UINT StartingPort,
|
||||||
UINT PortsToManage ) {
|
UINT PortsToManage ) {
|
||||||
PortSet->StartingPort = StartingPort;
|
PortSet->StartingPort = StartingPort;
|
||||||
|
@ -19,11 +19,13 @@ VOID PortsStartup( PPORT_SET PortSet,
|
||||||
PortSet->PortsToOversee - 1;
|
PortSet->PortsToOversee - 1;
|
||||||
PortSet->ProtoBitBuffer =
|
PortSet->ProtoBitBuffer =
|
||||||
PoolAllocateBuffer( (PortSet->PortsToOversee + 7) / 8 );
|
PoolAllocateBuffer( (PortSet->PortsToOversee + 7) / 8 );
|
||||||
|
if(!PortSet->ProtoBitBuffer) return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
RtlInitializeBitMap( &PortSet->ProtoBitmap,
|
RtlInitializeBitMap( &PortSet->ProtoBitmap,
|
||||||
PortSet->ProtoBitBuffer,
|
PortSet->ProtoBitBuffer,
|
||||||
PortSet->PortsToOversee );
|
PortSet->PortsToOversee );
|
||||||
RtlClearAllBits( &PortSet->ProtoBitmap );
|
RtlClearAllBits( &PortSet->ProtoBitmap );
|
||||||
ExInitializeFastMutex( &PortSet->Mutex );
|
ExInitializeFastMutex( &PortSet->Mutex );
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID PortsShutdown( PPORT_SET PortSet ) {
|
VOID PortsShutdown( PPORT_SET PortSet ) {
|
||||||
|
|
|
@ -455,7 +455,11 @@ NTSTATUS TCPStartup(VOID)
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
PortsStartup( &TCPPorts, 1, 0xfffe );
|
Status = PortsStartup( &TCPPorts, 1, 0xfffe );
|
||||||
|
if( !NT_SUCCESS(Status) ) {
|
||||||
|
TCPMemShutdown();
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
RegisterOskitTCPEventHandlers( &EventHandlers );
|
RegisterOskitTCPEventHandlers( &EventHandlers );
|
||||||
InitOskitTCP();
|
InitOskitTCP();
|
||||||
|
|
|
@ -303,7 +303,11 @@ NTSTATUS UDPStartup(
|
||||||
RtlZeroMemory(&UDPStats, sizeof(UDP_STATISTICS));
|
RtlZeroMemory(&UDPStats, sizeof(UDP_STATISTICS));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PortsStartup( &UDPPorts, 1, 0xfffe );
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
Status = PortsStartup( &UDPPorts, 1, 0xfffe );
|
||||||
|
|
||||||
|
if( !NT_SUCCESS(Status) ) return Status;
|
||||||
|
|
||||||
/* Register this protocol with IP layer */
|
/* Register this protocol with IP layer */
|
||||||
IPRegisterProtocol(IPPROTO_UDP, UDPReceive);
|
IPRegisterProtocol(IPPROTO_UDP, UDPReceive);
|
||||||
|
|
Loading…
Reference in a new issue