[HIVESYS]
authorCameron Gutman <aicommander@gmail.com>
Sat, 7 Jan 2012 05:54:14 +0000 (05:54 +0000)
committerCameron Gutman <aicommander@gmail.com>
Sat, 7 Jan 2012 05:54:14 +0000 (05:54 +0000)
- Add an entry for ndisuio (temporary until INF install works)
- Autostart WZC service
[NDISUIO]
- Fix crash during binding and receive
- Add more debugging

svn path=/branches/wlan-bringup/; revision=54857

boot/bootdata/hivesys_i386.inf
drivers/network/ndisuio/createclose.c
drivers/network/ndisuio/ioctl.c
drivers/network/ndisuio/main.c
drivers/network/ndisuio/protocol.c

index 368733a..97d40ae 100644 (file)
@@ -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
index c1b0f82..d0fe7af 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "ndisuio.h"
 
-#define NDEBUG
+//#define NDEBUG
 #include <debug.h>
 
 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);
index 4ad6faa..f262208 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "ndisuio.h"
 
-#define NDEBUG
+//#define NDEBUG
 #include <debug.h>
 
 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)
index 9b34926..0756777 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "ndisuio.h"
 
-#define NDEBUG
+//#define NDEBUG
 #include <debug.h>
 
 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;
 }
index 5910207..9fb5116 100644 (file)
@@ -8,11 +8,9 @@
 
 #include "ndisuio.h"
 
-//#define NDEBUG
+#define NDEBUG
 #include <debug.h>
 
-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,