Author: cgutman
Date: Wed Mar 11 00:43:21 2009
New Revision: 39941
URL:
http://svn.reactos.org/svn/reactos?rev=39941&view=rev
Log:
- Fix NdisReadNetworkAddress
- This should increase compatibility with third-party NIC drivers
Modified:
branches/aicom-network-fixes/drivers/network/ndis/ndis/config.c
Modified: branches/aicom-network-fixes/drivers/network/ndis/ndis/config.c
URL:
http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/drivers/net…
==============================================================================
--- branches/aicom-network-fixes/drivers/network/ndis/ndis/config.c [iso-8859-1]
(original)
+++ branches/aicom-network-fixes/drivers/network/ndis/ndis/config.c [iso-8859-1] Wed Mar
11 00:43:21 2009
@@ -699,16 +699,7 @@
PNDIS_CONFIGURATION_PARAMETER ParameterValue = NULL;
NDIS_STRING Keyword;
UINT *IntArray = 0;
- int i;
-
- /* FIXME - We don't quite support this yet due to buggy code below */
- {
- *Status = NDIS_STATUS_FAILURE;
- return;
- }
-
- *NetworkAddress = NULL;
- *NetworkAddressLength = 6;/* XXX magic constant */
+ UINT i,j = 0;
NdisInitUnicodeString(&Keyword, L"NetworkAddress");
NdisReadConfiguration(Status, &ParameterValue, ConfigurationHandle, &Keyword,
NdisParameterString);
@@ -718,8 +709,11 @@
return;
}
- /* 6 bytes for ethernet, tokenring, fddi, everything else? */
- IntArray = ExAllocatePool(PagedPool, 6*sizeof(UINT));
+ while (ParameterValue->ParameterData.StringData.Buffer[j] != '\0') j++;
+
+ *NetworkAddressLength = (UINT)((j/2)+0.5);
+
+ IntArray = ExAllocatePool(PagedPool, (*NetworkAddressLength)*sizeof(UINT));
if(!IntArray)
{
NDIS_DbgPrint(MIN_TRACE,("Insufficient resources.\n"));
@@ -742,7 +736,7 @@
ExInterlockedInsertTailList(&ConfigurationContext->ResourceListHead,
&MiniportResource->ListEntry, &ConfigurationContext->ResourceLock);
/* convert from string to bytes */
- for(i=0; i<6; i++)
+ for(i=0; i<(*NetworkAddressLength); i++)
{
IntArray[i] =
(UnicodeToHexByte((ParameterValue->ParameterData.StringData.Buffer)[2*i]) << 4)
+
UnicodeToHexByte((ParameterValue->ParameterData.StringData.Buffer)[2*i+1]);