3 modified files
reactos/drivers/net/ndis/ndis
diff -u -r1.8 -r1.9
--- config.c 9 Oct 2004 18:17:08 -0000 1.8
+++ config.c 16 Nov 2004 16:21:09 -0000 1.9
@@ -171,11 +171,11 @@
{
HANDLE KeyHandle;
PMINIPORT_CONFIGURATION_CONTEXT ConfigurationContext;
- HANDLE RootKeyHandle = (HANDLE)WrapperConfigurationContext;
+ PWRAPPER_CONTEXT WrapperContext = (PWRAPPER_CONTEXT)WrapperConfigurationContext;
NDIS_DbgPrint(MAX_TRACE, ("Called\n"));
- *Status = ZwDuplicateObject(NtCurrentProcess(), RootKeyHandle,
+ *Status = ZwDuplicateObject(NtCurrentProcess(), WrapperContext->DeviceKeyHandle,
NtCurrentProcess(), &KeyHandle, 0, FALSE,
DUPLICATE_SAME_ACCESS);
if(!NT_SUCCESS(*Status))
reactos/drivers/net/ndis/ndis
diff -u -r1.12 -r1.13
--- hardware.c 9 Oct 2004 18:17:08 -0000 1.12
+++ hardware.c 16 Nov 2004 16:21:09 -0000 1.13
@@ -9,9 +9,6 @@
* CSH 01/08-2000 Created
* 25 Aug 2003 Vizzini - NDIS4/5 and PnP additions
* 3 Oct 2003 Vizzini - formatting and minor bugfixes
- *
- * TODO:
- * - Fix HalGetBusDataByOffset() param 2 in most calls below
*/
#include <roscfg.h>
@@ -30,7 +27,9 @@
IN PVOID Buffer,
IN ULONG Length)
{
- return HalGetBusDataByOffset (PCIConfiguration, 0, SlotNumber, Buffer, Offset, Length);
+ PWRAPPER_CONTEXT WrapperContext = (PWRAPPER_CONTEXT)WrapperConfigurationContext;
+ return HalGetBusDataByOffset(PCIConfiguration, WrapperContext->BusNumber,
+ SlotNumber, Buffer, Offset, Length);
}
@@ -46,7 +45,9 @@
IN PVOID Buffer,
IN ULONG Length)
{
- return HalSetBusDataByOffset (PCIConfiguration, 0, SlotNumber, Buffer, Offset, Length);
+ PWRAPPER_CONTEXT WrapperContext = (PWRAPPER_CONTEXT)WrapperConfigurationContext;
+ return HalSetBusDataByOffset(PCIConfiguration, WrapperContext->BusNumber,
+ SlotNumber, Buffer, Offset, Length);
}
@@ -90,16 +91,6 @@
/*
- * @implemented
- */
-VOID
-EXPORT
-NdisMQueryAdapterResources(
- OUT PNDIS_STATUS Status,
- IN NDIS_HANDLE WrapperConfigurationContext,
- OUT PNDIS_RESOURCE_LIST ResourceList,
- IN OUT PUINT BufferSize)
-/*
* FUNCTION: returns a nic's hardware resources
* ARGUMENTS:
* Status: on return, contains the status of the operation
@@ -111,7 +102,16 @@
* - Must be called at IRQL = PASSIVE_LEVEL;
* BUGS:
* - Needs an implementation; for now i think we are waiting on pnp
+ *
+ * @unimplemented
*/
+VOID
+EXPORT
+NdisMQueryAdapterResources(
+ OUT PNDIS_STATUS Status,
+ IN NDIS_HANDLE WrapperConfigurationContext,
+ OUT PNDIS_RESOURCE_LIST ResourceList,
+ IN OUT PUINT BufferSize)
{
PAGED_CODE();
ASSERT(Status && ResourceList);
@@ -147,7 +147,7 @@
EXPORT
NdisReadEisaSlotInformation(
OUT PNDIS_STATUS Status,
- IN NDIS_HANDLE WrapperConfigurationContext,
+ IN NDIS_HANDLE WrapperConfigurationContext,
OUT PUINT SlotNumber,
OUT PNDIS_EISA_FUNCTION_INFORMATION EisaData)
{
@@ -186,8 +186,8 @@
PLOGICAL_ADAPTER AdapterObject = (PLOGICAL_ADAPTER)NdisAdapterHandle;
/* Slot number is ignored since W2K for all NDIS drivers. */
NDIS_DbgPrint(MAX_TRACE, ("Slot: %d\n", AdapterObject->SlotNumber));
- return HalGetBusDataByOffset (PCIConfiguration, 0, AdapterObject->SlotNumber,
- Buffer, Offset, Length);
+ return HalGetBusDataByOffset(PCIConfiguration, AdapterObject->BusNumber,
+ AdapterObject->SlotNumber, Buffer, Offset, Length);
}
@@ -206,8 +206,8 @@
PLOGICAL_ADAPTER AdapterObject = (PLOGICAL_ADAPTER)NdisAdapterHandle;
/* Slot number is ignored since W2K for all NDIS drivers. */
NDIS_DbgPrint(MAX_TRACE, ("Slot: %d\n", AdapterObject->SlotNumber));
- return HalSetBusDataByOffset (PCIConfiguration, 0, AdapterObject->SlotNumber,
- Buffer, Offset, Length);
+ return HalSetBusDataByOffset(PCIConfiguration, AdapterObject->BusNumber,
+ AdapterObject->SlotNumber, Buffer, Offset, Length);
}
/* EOF */
reactos/drivers/net/ndis/ndis
diff -u -r1.38 -r1.39
--- miniport.c 17 Oct 2004 10:15:07 -0000 1.38
+++ miniport.c 16 Nov 2004 16:21:09 -0000 1.39
@@ -1340,7 +1340,6 @@
* - break up this 250-line function
*/
{
- HANDLE RegKeyHandle;
NDIS_STATUS NdisStatus;
NDIS_STATUS OpenErrorStatus;
NTSTATUS Status;
@@ -1350,19 +1349,20 @@
BOOLEAN MemError = FALSE;
KIRQL OldIrql;
ULONG Size;
+ PWRAPPER_CONTEXT WrapperContext;
Adapter = ExAllocatePool(NonPagedPool, sizeof(LOGICAL_ADAPTER));
- if (!Adapter)
+ if (!Adapter)
{
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
- return;
+ return;
}
/* This is very important */
RtlZeroMemory(Adapter, sizeof(LOGICAL_ADAPTER));
Adapter->DeviceName.Buffer = ExAllocatePool(NonPagedPool, DeviceName->Length);
- if(!Adapter->DeviceName.Buffer)
+ if (!Adapter->DeviceName.Buffer)
{
NDIS_DbgPrint(MIN_TRACE,("Insufficient memory\n"));
ExFreePool(Adapter);
@@ -1371,6 +1371,16 @@
Adapter->DeviceName.MaximumLength = DeviceName->Length;
RtlCopyUnicodeString(&Adapter->DeviceName, DeviceName);
+ WrapperContext = ExAllocatePool(NonPagedPool, sizeof(WRAPPER_CONTEXT));
+ if (!WrapperContext)
+ {
+ NDIS_DbgPrint(MIN_TRACE,("Insufficient memory\n"));
+ ExFreePool(Adapter->DeviceName.Buffer);
+ ExFreePool(Adapter);
+ return;
+ }
+ WrapperContext->DeviceObject = PhysicalDeviceObject;
+
NDIS_DbgPrint(MAX_TRACE, ("creating device %wZ\n", DeviceName));
Status = IoCreateDevice(Miniport->DriverObject, 0, &Adapter->DeviceName, FILE_DEVICE_PHYSICAL_NETCARD,
@@ -1378,15 +1388,19 @@
if (!NT_SUCCESS(Status))
{
NDIS_DbgPrint(MIN_TRACE, ("Could not create device object.\n"));
+ ExFreePool(WrapperContext);
+ ExFreePool(Adapter->DeviceName.Buffer);
ExFreePool(Adapter);
return;
}
Status = IoOpenDeviceRegistryKey(PhysicalDeviceObject, PLUGPLAY_REGKEY_DRIVER,
- KEY_ALL_ACCESS, &RegKeyHandle);
+ KEY_ALL_ACCESS, &WrapperContext->DeviceKeyHandle);
if(Status != STATUS_SUCCESS)
{
NDIS_DbgPrint(MIN_TRACE,("failed to open adapter-specific reg key\n"));
+ ExFreePool(WrapperContext);
+ ExFreePool(Adapter->DeviceName.Buffer);
ExFreePool(Adapter);
return;
}
@@ -1407,6 +1421,7 @@
Size, &Adapter->BusNumber, &Size);
IoGetDeviceProperty(PhysicalDeviceObject, DevicePropertyAddress,
Size, &Adapter->SlotNumber, &Size);
+ WrapperContext->BusNumber = Adapter->BusNumber;
/* Set handlers (some NDIS macros require these) */
@@ -1429,9 +1444,10 @@
/* Call MiniportInitialize */
NDIS_DbgPrint(MID_TRACE, ("calling MiniportInitialize\n"));
NdisStatus = (*Miniport->Chars.InitializeHandler)( &OpenErrorStatus, &SelectedMediumIndex, &MediaArray[0],
- MEDIA_ARRAY_SIZE, Adapter, RegKeyHandle);
+ MEDIA_ARRAY_SIZE, Adapter, WrapperContext);
- ZwClose(RegKeyHandle);
+ ZwClose(WrapperContext->DeviceKeyHandle);
+ ExFreePool(WrapperContext);
if ((NdisStatus == NDIS_STATUS_SUCCESS) && (SelectedMediumIndex < MEDIA_ARRAY_SIZE))
{
CVSspam 0.2.8