mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 17:45:41 +00:00
Patch to correct multiple adapter bind from protocols. There were two
bugs here: 1) The loop in protocol.c was wrong and was rewritten by Andrew Munger with help from Thomas Weidenmueller 2) MiniLocateAdapter never zeroed Adapter if the adapter didn't match, and never actually ever matched a name. It always returned the last adapter in the list (spotted and fixed after the above fixes). svn path=/trunk/; revision=11730
This commit is contained in:
parent
30be599db3
commit
5fea7dac8b
3 changed files with 19 additions and 14 deletions
|
@ -546,6 +546,7 @@ MiniLocateDevice(
|
|||
KIRQL OldIrql;
|
||||
PLIST_ENTRY CurrentEntry;
|
||||
PLOGICAL_ADAPTER Adapter = 0;
|
||||
UNICODE_STRING ToCompare;
|
||||
|
||||
ASSERT(AdapterName);
|
||||
|
||||
|
@ -569,15 +570,19 @@ MiniLocateDevice(
|
|||
|
||||
ASSERT(Adapter);
|
||||
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("AdapterName = %wZ\n", &AdapterName));
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("AdapterName = %wZ\n", AdapterName));
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("DeviceName = %wZ\n", &Adapter->DeviceName));
|
||||
ToCompare = *AdapterName;
|
||||
if( ToCompare.Length > Adapter->DeviceName.Length )
|
||||
ToCompare.Length = Adapter->DeviceName.Length;
|
||||
|
||||
if (RtlCompareUnicodeString(AdapterName, &Adapter->DeviceName, TRUE) == 0)
|
||||
if (RtlCompareUnicodeString(&ToCompare, &Adapter->DeviceName, TRUE) == 0)
|
||||
{
|
||||
ReferenceObject(Adapter);
|
||||
break;
|
||||
}
|
||||
|
||||
Adapter = 0;
|
||||
CurrentEntry = CurrentEntry->Flink;
|
||||
}
|
||||
} while (0);
|
||||
|
|
|
@ -395,7 +395,7 @@ ProTransferData(
|
|||
IN NDIS_HANDLE MacReceiveContext,
|
||||
IN UINT ByteOffset,
|
||||
IN UINT BytesToTransfer,
|
||||
IN OUT PNDIS_PACKET Packet,
|
||||
IN OUT PNDIS_PACKET Packet,
|
||||
OUT PUINT BytesTransferred)
|
||||
/*
|
||||
* FUNCTION: Forwards a request to copy received data into a protocol-supplied packet
|
||||
|
@ -661,8 +661,8 @@ NdisRegisterProtocol(
|
|||
UINT MinSize;
|
||||
HANDLE DriverKeyHandle = NULL;
|
||||
PKEY_VALUE_PARTIAL_INFORMATION KeyInformation = NULL;
|
||||
UINT DataOffset = 0;
|
||||
|
||||
WCHAR *CurrentStr;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
/* first validate the PROTOCOL_CHARACTERISTICS */
|
||||
|
@ -807,8 +807,7 @@ NdisRegisterProtocol(
|
|||
}
|
||||
}
|
||||
|
||||
DataOffset = 0;
|
||||
while((KeyInformation->Data)[DataOffset])
|
||||
for(CurrentStr = (WCHAR*)&KeyInformation->Data[0]; *CurrentStr != '\0'; CurrentStr += wcslen(CurrentStr) + 1)
|
||||
{
|
||||
/* BindContext is for tracking pending binding operations */
|
||||
VOID *BindContext = 0;
|
||||
|
@ -817,7 +816,7 @@ NdisRegisterProtocol(
|
|||
WCHAR *RegistryPathStr = NULL;
|
||||
ULONG PathLength = 0;
|
||||
|
||||
RtlInitUnicodeString(&DeviceName, (WCHAR *)KeyInformation->Data); /* we know this is 0-term */
|
||||
RtlInitUnicodeString(&DeviceName, CurrentStr); /* we know this is 0-term */
|
||||
|
||||
/*
|
||||
* RegistryPath should be:
|
||||
|
@ -828,7 +827,7 @@ NdisRegisterProtocol(
|
|||
*/
|
||||
|
||||
PathLength = sizeof(SERVICES_KEY) + /* \Registry\Machine\System\CurrentControlSet\Services\ */
|
||||
wcslen( ((WCHAR *)KeyInformation->Data)+8 ) * sizeof(WCHAR) + /* Adapter1 (extracted from \Device\Adapter1) */
|
||||
wcslen( CurrentStr+8 ) * sizeof(WCHAR) + /* Adapter1 (extracted from \Device\Adapter1) */
|
||||
sizeof(PARAMETERS_KEY) + /* \Parameters\ */
|
||||
ProtocolCharacteristics->Name.Length; /* Tcpip */
|
||||
|
||||
|
@ -843,7 +842,7 @@ NdisRegisterProtocol(
|
|||
}
|
||||
|
||||
wcscpy(RegistryPathStr, SERVICES_KEY);
|
||||
wcscat(RegistryPathStr, (((WCHAR *)(KeyInformation->Data)) +8 ));
|
||||
wcscat(RegistryPathStr, CurrentStr +8 );
|
||||
wcscat(RegistryPathStr, PARAMETERS_KEY);
|
||||
wcsncat(RegistryPathStr, ProtocolCharacteristics->Name.Buffer, ProtocolCharacteristics->Name.Length / sizeof(WCHAR) );
|
||||
|
||||
|
@ -873,6 +872,7 @@ NdisRegisterProtocol(
|
|||
{
|
||||
/* Put protocol binding struct on global list */
|
||||
ExInterlockedInsertTailList(&ProtocolListHead, &Protocol->ListEntry, &ProtocolListLock);
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Added to global list.\n"));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -881,10 +881,8 @@ NdisRegisterProtocol(
|
|||
// what to do here?
|
||||
}
|
||||
*/
|
||||
|
||||
DataOffset += wcslen((WCHAR *)KeyInformation->Data);
|
||||
}
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Leaving..\n"));
|
||||
*Status = NDIS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -387,6 +387,8 @@ NDIS_STATUS STDCALL ProtocolReceive(
|
|||
{
|
||||
if (NdisStatus == NDIS_STATUS_SUCCESS)
|
||||
{
|
||||
ASSERT(PacketSize <= Adapter->MTU);
|
||||
|
||||
NdisTransferData(&NdisStatus, Adapter->NdisHandle,
|
||||
MacReceiveContext, 0, PacketSize,
|
||||
NdisPacket, &BytesTransferred);
|
||||
|
@ -470,7 +472,7 @@ VOID STDCALL ProtocolBindAdapter(
|
|||
{
|
||||
/* XXX confirm that this is still true, or re-word the following comment */
|
||||
/* we get to ignore BindContext because we will never pend an operation with NDIS */
|
||||
TI_DbgPrint(DEBUG_DATALINK, ("Called with registry path %wZ\n", SystemSpecific1));
|
||||
TI_DbgPrint(DEBUG_DATALINK, ("Called with registry path %wZ for %wZ\n", SystemSpecific1, DeviceName));
|
||||
*Status = LANRegisterAdapter(DeviceName, SystemSpecific1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue