Author: cgutman
Date: Sun Jan 8 06:08:47 2012
New Revision: 54875
URL:
http://svn.reactos.org/svn/reactos?rev=54875&view=rev
Log:
[NDISUIO]
- Use the correct IOCTL input buffer
[WLANCONF]
- Fix parameters to IOCTL_NDISUIO_QUERY_BINDING
- Wlanconf is ready for testing with a real WLAN adapter (for anyone who wants to checkout
this branch and try it)
- Run "wlanconf -s <SSID>" to connect to an unencrypted wireless network
- Run "wlanconf -s <SSID> -w <WEP key>" to connect to a WEP
encrypted wireless network (WPA not supported)
Modified:
branches/wlan-bringup/base/applications/network/wlanconf/wlanconf.c
branches/wlan-bringup/drivers/network/ndisuio/ioctl.c
Modified: branches/wlan-bringup/base/applications/network/wlanconf/wlanconf.c
URL:
http://svn.reactos.org/svn/reactos/branches/wlan-bringup/base/applications/…
==============================================================================
--- branches/wlan-bringup/base/applications/network/wlanconf/wlanconf.c [iso-8859-1]
(original)
+++ branches/wlan-bringup/base/applications/network/wlanconf/wlanconf.c [iso-8859-1] Sun
Jan 8 06:08:47 2012
@@ -116,23 +116,31 @@
HANDLE hDriver;
BOOL bSuccess;
DWORD dwBytesReturned;
- char Buffer[1024];
- PNDISUIO_QUERY_BINDING QueryBinding = (PNDISUIO_QUERY_BINDING)Buffer;
+ DWORD QueryBindingSize = sizeof(NDISUIO_QUERY_BINDING) + (1024 * sizeof(WCHAR));
+ PNDISUIO_QUERY_BINDING QueryBinding;
/* Open the driver handle */
hDriver = OpenDriverHandle();
if (hDriver == INVALID_HANDLE_VALUE)
return INVALID_HANDLE_VALUE;
+
+ /* Allocate the binding struct */
+ QueryBinding = HeapAlloc(GetProcessHeap(), 0, QueryBindingSize);
+ if (!QueryBinding)
+ {
+ CloseHandle(hDriver);
+ return INVALID_HANDLE_VALUE;
+ }
/* Query for bindable adapters */
QueryBinding->BindingIndex = 0;
do {
bSuccess = DeviceIoControl(hDriver,
IOCTL_NDISUIO_QUERY_BINDING,
- NULL,
- 0,
- NULL,
- 0,
+ QueryBinding,
+ QueryBindingSize,
+ QueryBinding,
+ QueryBindingSize,
&dwBytesReturned,
NULL);
if (QueryBinding->BindingIndex == Index)
@@ -142,6 +150,7 @@
if (!bSuccess)
{
+ HeapFree(GetProcessHeap(), 0, QueryBinding);
CloseHandle(hDriver);
return INVALID_HANDLE_VALUE;
}
@@ -155,6 +164,8 @@
0,
&dwBytesReturned,
NULL);
+ HeapFree(GetProcessHeap(), 0, QueryBinding);
+
if (!bSuccess)
{
CloseHandle(hDriver);
Modified: branches/wlan-bringup/drivers/network/ndisuio/ioctl.c
URL:
http://svn.reactos.org/svn/reactos/branches/wlan-bringup/drivers/network/nd…
==============================================================================
--- branches/wlan-bringup/drivers/network/ndisuio/ioctl.c [iso-8859-1] (original)
+++ branches/wlan-bringup/drivers/network/ndisuio/ioctl.c [iso-8859-1] Sun Jan 8 06:08:47
2012
@@ -19,6 +19,7 @@
* no official documentation on it. I'm just implementing it as a no-op
* right now because I don't see any reason we need it. We handle an open
* and bind just fine with IRP_MJ_CREATE and IOCTL_NDISUIO_OPEN_DEVICE */
+ DPRINT("Wait for bind complete\n");
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
@@ -33,14 +34,14 @@
QueryBinding(PIRP Irp, PIO_STACK_LOCATION IrpSp)
{
PNDISUIO_ADAPTER_CONTEXT AdapterContext;
- PNDISUIO_QUERY_BINDING QueryBinding =
IrpSp->Parameters.DeviceIoControl.Type3InputBuffer;
+ PNDISUIO_QUERY_BINDING QueryBinding = Irp->AssociatedIrp.SystemBuffer;
ULONG BindingLength = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
NTSTATUS Status;
PLIST_ENTRY CurrentEntry;
KIRQL OldIrql;
ULONG i;
ULONG BytesCopied = 0;
-
+
if (QueryBinding && BindingLength >= sizeof(NDISUIO_QUERY_BINDING))
{
KeAcquireSpinLock(&GlobalAdapterListLock, &OldIrql);
@@ -58,15 +59,19 @@
{
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 = sizeof(NDISUIO_QUERY_BINDING);
+ if (AdapterContext->DeviceName.Length <= BindingLength - BytesCopied)
{
BytesCopied += AdapterContext->DeviceName.Length;
+
+ QueryBinding->DeviceNameOffset = BytesCopied;
+ QueryBinding->DeviceNameLength =
AdapterContext->DeviceName.Length;
RtlCopyMemory((PUCHAR)QueryBinding + QueryBinding->DeviceNameOffset,
AdapterContext->DeviceName.Buffer,
- BytesCopied);
- QueryBinding->DeviceNameLength =
AdapterContext->DeviceName.Length;
+ QueryBinding->DeviceNameLength);
/* FIXME: Copy description too */
+ QueryBinding->DeviceDescrOffset = BytesCopied;
QueryBinding->DeviceDescrLength = 0;
/* Successful */
@@ -147,7 +152,7 @@
Irp->IoStatus.Information = 0;
- SetOidRequest = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer;
+ SetOidRequest = Irp->AssociatedIrp.SystemBuffer;
RequestLength = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
if (SetOidRequest && RequestLength >= sizeof(NDIS_OID))
{
@@ -203,7 +208,7 @@
Irp->IoStatus.Information = 0;
- QueryOidRequest = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer;
+ QueryOidRequest = Irp->AssociatedIrp.SystemBuffer;
RequestLength = IrpSp->Parameters.DeviceIoControl.InputBufferLength;
if (QueryOidRequest && RequestLength >= sizeof(NDIS_OID))
{
@@ -263,7 +268,7 @@
if (NameLength != 0)
{
DeviceName.MaximumLength = DeviceName.Length = NameLength;
- DeviceName.Buffer = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer;
+ DeviceName.Buffer = Irp->AssociatedIrp.SystemBuffer;
/* Check if this already has a context */
AdapterContext = FindAdapterContextByName(&DeviceName);
@@ -357,7 +362,7 @@
if (NameLength != 0)
{
DeviceName.MaximumLength = DeviceName.Length = NameLength;
- DeviceName.Buffer = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer;
+ DeviceName.Buffer = Irp->AssociatedIrp.SystemBuffer;
/* Check if this already has a context */
AdapterContext = FindAdapterContextByName(&DeviceName);