ULONG ParameterType;
ULONG DataSize;
PVOID Data;
- WCHAR Buff[25];
+ WCHAR Buff[11];
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
ParameterValue->ParameterData.IntegerData,
(ParameterValue->ParameterType == NdisParameterInteger) ? 10 : 16, &Str)))
{
+ NDIS_DbgPrint(MIN_TRACE, ("RtlIntegerToUnicodeString failed (%x)\n", *Status));
*Status = NDIS_STATUS_FAILURE;
return;
}
{
PMINIPORT_CONFIGURATION_CONTEXT ConfigurationContext = (PMINIPORT_CONFIGURATION_CONTEXT)ConfigurationHandle;
PMINIPORT_RESOURCE Resource;
+ PNDIS_CONFIGURATION_PARAMETER ParameterValue;
+ PLIST_ENTRY CurrentEntry;
- while(!IsListEmpty(&ConfigurationContext->ResourceListHead))
+ while((CurrentEntry = ExInterlockedRemoveHeadList(&ConfigurationContext->ResourceListHead,
+ &ConfigurationContext->ResourceLock)) != NULL)
{
- Resource = (PMINIPORT_RESOURCE)ExInterlockedRemoveHeadList(&ConfigurationContext->ResourceListHead, &ConfigurationContext->ResourceLock);
- if(Resource->ResourceType == MINIPORT_RESOURCE_TYPE_MEMORY)
+ Resource = CONTAINING_RECORD(CurrentEntry, MINIPORT_RESOURCE, ListEntry);
+ switch(Resource->ResourceType)
{
+ case MINIPORT_RESOURCE_TYPE_REGISTRY_DATA:
+ ParameterValue = Resource->Resource;
+
+ switch (ParameterValue->ParameterType)
+ {
+ case NdisParameterBinary:
+ ExFreePool(ParameterValue->ParameterData.BinaryData.Buffer);
+ break;
+
+ case NdisParameterString:
+ case NdisParameterMultiString:
+ ExFreePool(ParameterValue->ParameterData.StringData.Buffer);
+ break;
+
+ default:
+ break;
+ }
+
+ /* Fall through to free NDIS_CONFIGURATION_PARAMETER struct */
+
+ case MINIPORT_RESOURCE_TYPE_MEMORY:
NDIS_DbgPrint(MAX_TRACE,("freeing 0x%x\n", Resource->Resource));
ExFreePool(Resource->Resource);
+ break;
+
+ default:
+ NDIS_DbgPrint(MIN_TRACE,("Unknown resource type: %d\n", Resource->ResourceType));
+ break;
}
ExFreePool(Resource);
return;
}
- MiniportResource->ResourceType = 0;
+ MiniportResource->ResourceType = MINIPORT_RESOURCE_TYPE_REGISTRY_DATA;
MiniportResource->Resource = *ParameterValue;
NDIS_DbgPrint(MID_TRACE,("inserting 0x%x into the resource list\n",
return;
}
- MiniportResource->ResourceType = 0;
+ MiniportResource->ResourceType = MINIPORT_RESOURCE_TYPE_REGISTRY_DATA;
MiniportResource->Resource = *ParameterValue;
NDIS_DbgPrint(MID_TRACE,("inserting 0x%x into the resource list\n", MiniportResource->Resource));
ExInterlockedInsertTailList(&ConfigurationContext->ResourceListHead,
return;
}
- MiniportResource->ResourceType = 0;
+ MiniportResource->ResourceType = MINIPORT_RESOURCE_TYPE_REGISTRY_DATA;
MiniportResource->Resource = *ParameterValue;
NDIS_DbgPrint(MID_TRACE,("inserting 0x%x into the resource list\n", MiniportResource->Resource));
ExInterlockedInsertTailList(&ConfigurationContext->ResourceListHead,
}
}
- MiniportResource->ResourceType = MINIPORT_RESOURCE_TYPE_MEMORY;
+ MiniportResource->ResourceType = MINIPORT_RESOURCE_TYPE_REGISTRY_DATA;
MiniportResource->Resource = *ParameterValue;
ExInterlockedInsertTailList(&ConfigurationContext->ResourceListHead, &MiniportResource->ListEntry, &ConfigurationContext->ResourceLock);
if (ParameterValue->ParameterType == NdisParameterInteger)
{
- WCHAR Buff[25];
+ WCHAR Buff[11];
NDIS_DbgPrint(MAX_TRACE, ("Read integer data %lx\n",
ParameterValue->ParameterData.IntegerData));
str = ParameterValue->ParameterData.StringData;
}
- while (str.Buffer[j] != '\0') j++;
-
- *NetworkAddressLength = (UINT)((j/2)+0.5);
+ while (j < str.Length && str.Buffer[j] != '\0') j++;
+
+ *NetworkAddressLength = (j+1) >> 1;
if ((*NetworkAddressLength) == 0)
{
return;
}
- MiniportResource->ResourceType = 0;
+ MiniportResource->ResourceType = MINIPORT_RESOURCE_TYPE_MEMORY;
MiniportResource->Resource = IntArray;
NDIS_DbgPrint(MID_TRACE,("inserting 0x%x into the resource list\n", MiniportResource->Resource));
ExInterlockedInsertTailList(&ConfigurationContext->ResourceListHead, &MiniportResource->ListEntry, &ConfigurationContext->ResourceLock);