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"
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
#include "ndisuio.h"
-#define NDEBUG
+//#define NDEBUG
#include <debug.h>
NTSTATUS
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;
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);
#include "ndisuio.h"
-#define NDEBUG
+//#define NDEBUG
#include <debug.h>
static
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;
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,
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,
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)
#include "ndisuio.h"
-#define NDEBUG
+//#define NDEBUG
#include <debug.h>
PDEVICE_OBJECT GlobalDeviceObject;
VOID NTAPI NduUnload(PDRIVER_OBJECT DriverObject)
{
- DPRINT1("NDISUIO: Unloaded\n");
+ DPRINT("NDISUIO: Unloaded\n");
}
NTSTATUS
return Status;
}
- DPRINT1("NDISUIO: Loaded\n");
+ DPRINT("NDISUIO: Loaded\n");
return STATUS_SUCCESS;
}
#include "ndisuio.h"
-//#define NDEBUG
+#define NDEBUG
#include <debug.h>
-PNDIS_MEDIUM SupportedMedia = {NdisMedium802_3};
-
VOID
NTAPI
NduOpenAdapterComplete(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;
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);
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 */
{
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)
/* 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,
&OpenErrorStatus,
&AdapterContext->BindingHandle,
&SelectedMedium,
- &SupportedMedia[0],
+ SupportedMedia,
1,
GlobalProtocolHandle,
AdapterContext,