Author: cgutman
Date: Fri Jan 15 22:00:50 2010
New Revision: 45090
URL:
http://svn.reactos.org/svn/reactos?rev=45090&view=rev
Log:
- Fix a bug with our tei_instance selection (we could end up with the same tei_instance
value on different entities of the same type if an entity of our type in the middle of the
list was deleted previously)
Modified:
branches/aicom-network-branch/drivers/network/tcpip/tcpip/info.c
Modified: branches/aicom-network-branch/drivers/network/tcpip/tcpip/info.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-branch/drivers/ne…
==============================================================================
--- branches/aicom-network-branch/drivers/network/tcpip/tcpip/info.c [iso-8859-1]
(original)
+++ branches/aicom-network-branch/drivers/network/tcpip/tcpip/info.c [iso-8859-1] Fri Jan
15 22:00:50 2010
@@ -15,16 +15,27 @@
VOID AddEntity(ULONG EntityType, PVOID Context, ULONG Flags)
{
KIRQL OldIrql;
- ULONG i, Count = 0;
+ ULONG i, Instance = 0;
+ BOOLEAN ChoseIndex = FALSE;
TcpipAcquireSpinLock(&EntityListLock, &OldIrql);
- for (i = 0; i < EntityCount; i++)
- if (EntityList[i].tei_entity == EntityType)
- Count++;
+ while (!ChoseIndex)
+ {
+ ChoseIndex = TRUE;
+ for (i = 0; i < EntityCount; i++)
+ {
+ if (EntityList[i].tei_entity == EntityType &&
+ EntityList[i].tei_instance == Instance)
+ {
+ Instance++;
+ ChoseIndex = FALSE;
+ }
+ }
+ }
EntityList[EntityCount].tei_entity = EntityType;
- EntityList[EntityCount].tei_instance = Count;
+ EntityList[EntityCount].tei_instance = Instance;
EntityList[EntityCount].context = Context;
EntityList[EntityCount].flags = Flags;
EntityCount++;