mirror of
https://github.com/reactos/reactos.git
synced 2024-11-10 00:34:39 +00:00
Fix some logic in port management code.
svn path=/trunk/; revision=14143
This commit is contained in:
parent
d86736989a
commit
baefc0115b
1 changed files with 5 additions and 4 deletions
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue