diff --git a/boot/bootdata/hivesys_i386.inf b/boot/bootdata/hivesys_i386.inf index 368733acfd9..97d40aeb7a1 100644 --- a/boot/bootdata/hivesys_i386.inf +++ b/boot/bootdata/hivesys_i386.inf @@ -1399,6 +1399,13 @@ HKLM,"SYSTEM\CurrentControlSet\Services\NMIDebug","ImagePath",0x00020000,"system HKLM,"SYSTEM\CurrentControlSet\Services\NMIDebug","Start",0x00010001,0x00000000 HKLM,"SYSTEM\CurrentControlSet\Services\NMIDebug","Type",0x00010001,0x00000001 +; NDIS User I/O driver (FIXME: Should be installed via INF and started on demand) +HKLM,"SYSTEM\CurrentControlSet\Services\Ndisuio","ErrorControl",0x00010001,0x00000001 +HKLM,"SYSTEM\CurrentControlSet\Services\Ndisuio","Group",0x00000000,"NDIS" +HKLM,"SYSTEM\CurrentControlSet\Services\Ndisuio","ImagePath",0x00020000,"system32\drivers\ndisuio.sys" +HKLM,"SYSTEM\CurrentControlSet\Services\Ndisuio","Start",0x00010001,0x00000001 +HKLM,"SYSTEM\CurrentControlSet\Services\Ndisuio","Type",0x00010001,0x00000001 + ; Packet driver HKLM,"SYSTEM\CurrentControlSet\Services\Packet","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\Packet","Group",0x00000000,"PNP_TDI" @@ -1629,7 +1636,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\WlanSvc","ErrorControl",0x00010001,0x000 HKLM,"SYSTEM\CurrentControlSet\Services\WlanSvc","Group",0x00000000,"TDI" HKLM,"SYSTEM\CurrentControlSet\Services\WlanSvc","ImagePath",0x00020000,"%SystemRoot%\system32\wlansvc.exe" HKLM,"SYSTEM\CurrentControlSet\Services\WlanSvc","ObjectName",0x00000000,"LocalSystem" -HKLM,"SYSTEM\CurrentControlSet\Services\WlanSvc","Start",0x00010001,0x00000003 +HKLM,"SYSTEM\CurrentControlSet\Services\WlanSvc","Start",0x00010001,0x00000002 HKLM,"SYSTEM\CurrentControlSet\Services\WlanSvc","Type",0x00010001,0x00000110 ; Simple TCP services diff --git a/drivers/network/ndisuio/createclose.c b/drivers/network/ndisuio/createclose.c index c1b0f82d268..d0fe7af9fb6 100644 --- a/drivers/network/ndisuio/createclose.c +++ b/drivers/network/ndisuio/createclose.c @@ -8,7 +8,7 @@ #include "ndisuio.h" -#define NDEBUG +//#define NDEBUG #include NTSTATUS @@ -19,6 +19,8 @@ NduDispatchCreate(PDEVICE_OBJECT DeviceObject, PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp); ASSERT(DeviceObject == GlobalDeviceObject); + + DPRINT("Created file object 0x%x\n", IrpSp->FileObject); /* This is associated with an adapter during IOCTL_NDISUIO_OPEN_(WRITE_)DEVICE */ IrpSp->FileObject->FsContext = NULL; @@ -43,11 +45,15 @@ NduDispatchClose(PDEVICE_OBJECT DeviceObject, PNDISUIO_OPEN_ENTRY OpenEntry = IrpSp->FileObject->FsContext2; ASSERT(DeviceObject == GlobalDeviceObject); + + DPRINT("Closing file object 0x%x\n", IrpSp->FileObject); /* Check if this handle was ever associated with an adapter */ if (AdapterContext != NULL) { ASSERT(OpenEntry != NULL); + + DPRINT("Removing binding to adapter %wZ\n", &AdapterContext->DeviceName); /* Call the our helper */ DereferenceAdapterContextWithOpenEntry(AdapterContext, OpenEntry); diff --git a/drivers/network/ndisuio/ioctl.c b/drivers/network/ndisuio/ioctl.c index 4ad6faa2eca..f2622084bd2 100644 --- a/drivers/network/ndisuio/ioctl.c +++ b/drivers/network/ndisuio/ioctl.c @@ -8,7 +8,7 @@ #include "ndisuio.h" -#define NDEBUG +//#define NDEBUG #include static @@ -57,6 +57,7 @@ QueryBinding(PIRP Irp, PIO_STACK_LOCATION IrpSp) if (i == QueryBinding->BindingIndex) { AdapterContext = CONTAINING_RECORD(CurrentEntry, NDISUIO_ADAPTER_CONTEXT, ListEntry); + DPRINT("Query binding for index %d is adapter %wZ\n", i, &AdapterContext->DeviceName); if (AdapterContext->DeviceName.Length <= QueryBinding->DeviceNameLength) { BytesCopied += AdapterContext->DeviceName.Length; @@ -156,6 +157,8 @@ SetAdapterOid(PIRP Irp, PIO_STACK_LOCATION IrpSp) Request.DATA.SET_INFORMATION.InformationBuffer = SetOidRequest->Data; Request.DATA.SET_INFORMATION.InformationBufferLength = RequestLength - sizeof(NDIS_OID); + DPRINT("Setting OID 0x%x on adapter %wZ\n", SetOidRequest->Oid, &AdapterContext->DeviceName); + /* Dispatch the request */ NdisRequest(&Status, AdapterContext->BindingHandle, @@ -210,6 +213,8 @@ QueryAdapterOid(PIRP Irp, PIO_STACK_LOCATION IrpSp) Request.DATA.QUERY_INFORMATION.InformationBuffer = QueryOidRequest->Data; Request.DATA.QUERY_INFORMATION.InformationBufferLength = RequestLength - sizeof(NDIS_OID); + DPRINT("Querying OID 0x%x on adapter %wZ\n", QueryOidRequest->Oid, &AdapterContext->DeviceName); + /* Dispatch the request */ NdisRequest(&Status, AdapterContext->BindingHandle, @@ -264,6 +269,8 @@ OpenDeviceReadWrite(PIRP Irp, PIO_STACK_LOCATION IrpSp) AdapterContext = FindAdapterContextByName(&DeviceName); if (AdapterContext != NULL) { + DPRINT("Binding file object 0x%x to device %wZ\n", FileObject, &AdapterContext->DeviceName); + /* Reference the adapter context */ KeAcquireSpinLock(&AdapterContext->Spinlock, &OldIrql); if (AdapterContext->OpenCount != 0) diff --git a/drivers/network/ndisuio/main.c b/drivers/network/ndisuio/main.c index 9b34926cd20..07567770240 100644 --- a/drivers/network/ndisuio/main.c +++ b/drivers/network/ndisuio/main.c @@ -8,7 +8,7 @@ #include "ndisuio.h" -#define NDEBUG +//#define NDEBUG #include PDEVICE_OBJECT GlobalDeviceObject; @@ -20,7 +20,7 @@ NDIS_STRING ProtocolName = RTL_CONSTANT_STRING(L"NDISUIO"); VOID NTAPI NduUnload(PDRIVER_OBJECT DriverObject) { - DPRINT1("NDISUIO: Unloaded\n"); + DPRINT("NDISUIO: Unloaded\n"); } NTSTATUS @@ -98,7 +98,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject, return Status; } - DPRINT1("NDISUIO: Loaded\n"); + DPRINT("NDISUIO: Loaded\n"); return STATUS_SUCCESS; } diff --git a/drivers/network/ndisuio/protocol.c b/drivers/network/ndisuio/protocol.c index 5910207221d..9fb5116153c 100644 --- a/drivers/network/ndisuio/protocol.c +++ b/drivers/network/ndisuio/protocol.c @@ -8,11 +8,9 @@ #include "ndisuio.h" -//#define NDEBUG +#define NDEBUG #include -PNDIS_MEDIUM SupportedMedia = {NdisMedium802_3}; - VOID NTAPI NduOpenAdapterComplete(NDIS_HANDLE ProtocolBindingContext, @@ -118,9 +116,7 @@ NduReceive(NDIS_HANDLE ProtocolBindingContext, PNDIS_PACKET Packet; NDIS_STATUS Status; UINT BytesTransferred; - - DPRINT("Received a %d byte packet on %wZ\n", PacketSize + HeaderBufferSize, &AdapterContext->DeviceName); - + /* Discard if nobody is waiting for it */ if (AdapterContext->OpenCount == 0) return NDIS_STATUS_NOT_ACCEPTED; @@ -171,8 +167,8 @@ NduReceive(NDIS_HANDLE ProtocolBindingContext, but not the pool because we still need it */ CleanupAndFreePacket(Packet, FALSE); - /* Allocate a packet entry from paged pool */ - PacketEntry = ExAllocatePool(PagedPool, sizeof(NDISUIO_PACKET_ENTRY) + BytesTransferred + HeaderBufferSize - 1); + /* Allocate a packet entry from pool */ + PacketEntry = ExAllocatePool(NonPagedPool, sizeof(NDISUIO_PACKET_ENTRY) + BytesTransferred + HeaderBufferSize - 1); if (!PacketEntry) { ExFreePool(PacketBuffer); @@ -183,7 +179,7 @@ NduReceive(NDIS_HANDLE ProtocolBindingContext, PacketEntry->PacketLength = BytesTransferred + HeaderBufferSize; RtlCopyMemory(&PacketEntry->PacketData[0], PacketBuffer, PacketEntry->PacketLength); - /* Free the old non-paged buffer */ + /* Free the old buffer */ ExFreePool(PacketBuffer); /* Insert the packet on the adapter's packet list */ @@ -313,11 +309,10 @@ BindAdapterByName(PNDIS_STRING DeviceName) { NDIS_STATUS OpenErrorStatus; PNDISUIO_ADAPTER_CONTEXT AdapterContext; + NDIS_MEDIUM SupportedMedia[1] = {NdisMedium802_3}; UINT SelectedMedium; NDIS_STATUS Status; - - DPRINT("Binding adapter %wZ\n", &AdapterContext->DeviceName); - + /* Allocate the adapter context */ AdapterContext = ExAllocatePool(NonPagedPool, sizeof(*AdapterContext)); if (!AdapterContext) @@ -345,6 +340,8 @@ BindAdapterByName(PNDIS_STRING DeviceName) /* Copy the device name into the adapter context */ RtlCopyMemory(AdapterContext->DeviceName.Buffer, DeviceName->Buffer, DeviceName->Length); + + DPRINT("Binding adapter %wZ\n", &AdapterContext->DeviceName); /* Create the buffer pool */ NdisAllocateBufferPool(&Status, @@ -377,7 +374,7 @@ BindAdapterByName(PNDIS_STRING DeviceName) &OpenErrorStatus, &AdapterContext->BindingHandle, &SelectedMedium, - &SupportedMedia[0], + SupportedMedia, 1, GlobalProtocolHandle, AdapterContext,