From e1d32a01d06a9de3b49d53616fadf29bda0d1eb6 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 9 Jan 2012 03:17:23 +0000 Subject: [PATCH] [WLANCONF] - Use a different method for determining if an adapter supports 802.11 networks so it works on drivers that don't implement OID_GEN_PHYSICAL_MEDIUM svn path=/branches/wlan-bringup/; revision=54888 --- base/applications/network/wlanconf/wlanconf.c | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/base/applications/network/wlanconf/wlanconf.c b/base/applications/network/wlanconf/wlanconf.c index 104f0034162..df056523b1e 100644 --- a/base/applications/network/wlanconf/wlanconf.c +++ b/base/applications/network/wlanconf/wlanconf.c @@ -91,23 +91,30 @@ IsWlanAdapter(HANDLE hAdapter) { BOOL bSuccess; DWORD dwBytesReturned; - NDISUIO_QUERY_OID QueryOid; + PNDISUIO_QUERY_OID QueryOid; + DWORD QueryOidSize; + + QueryOidSize = sizeof(NDISUIO_QUERY_OID) + sizeof(NDIS_802_11_SSID); + QueryOid = HeapAlloc(GetProcessHeap(), 0, QueryOidSize); + if (!QueryOid) + return FALSE; - /* NDIS 5.1 WLAN drivers must support this OID */ - QueryOid.Oid = OID_GEN_PHYSICAL_MEDIUM; + /* We're just going to do a OID_802_11_SSID query. WLAN drivers should + * always succeed this query (returning SsidLength = 0 if not associated) */ + QueryOid->Oid = OID_802_11_SSID; bSuccess = DeviceIoControl(hAdapter, IOCTL_NDISUIO_QUERY_OID_VALUE, - &QueryOid, - sizeof(QueryOid), - &QueryOid, - sizeof(QueryOid), + QueryOid, + QueryOidSize, + QueryOid, + QueryOidSize, &dwBytesReturned, NULL); - if (!bSuccess || *(PULONG)QueryOid.Data != NdisPhysicalMediumWirelessLan) - return FALSE; - return TRUE; + HeapFree(GetProcessHeap(), 0, QueryOid); + + return bSuccess; } HANDLE -- 2.17.1