Fix some logic in port management code.

svn path=/trunk/; revision=14143
This commit is contained in:
Filip Navara 2005-03-16 21:03:51 +00:00
parent d86736989a
commit baefc0115b

View file

@ -20,8 +20,7 @@ VOID PortsStartup( PPORT_SET PortSet,
RtlInitializeBitMap( &PortSet->ProtoBitmap,
PortSet->ProtoBitBuffer,
PortSet->PortsToOversee );
RtlClearBits( &PortSet->ProtoBitmap,
PortSet->StartingPort, PortsToManage );
RtlClearAllBits( &PortSet->ProtoBitmap );
ExInitializeFastMutex( &PortSet->Mutex );
}
@ -31,14 +30,16 @@ VOID PortsShutdown( PPORT_SET PortSet ) {
VOID DeallocatePort( PPORT_SET PortSet, ULONG Port ) {
Port = htons(Port);
RtlClearBits( &PortSet->ProtoBitmap,
PortSet->StartingPort + Port, 1 );
ASSERT(Port >= PortSet->StartingPort);
ASSERT(Port < PortSet->StartingPort + PortSet->PortsToOversee);
RtlClearBits( &PortSet->ProtoBitmap, Port - PortSet->StartingPort, 1 );
}
BOOLEAN AllocatePort( PPORT_SET PortSet, ULONG Port ) {
BOOLEAN Clear;
Port = htons(Port);
ASSERT(Port >= PortSet->StartingPort);
Port -= PortSet->StartingPort;
ExAcquireFastMutex( &PortSet->Mutex );