Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Mobile
  4. Active scan on a WiFi NIC, including flush of old scan results - how ?

Active scan on a WiFi NIC, including flush of old scan results - how ?

Scheduled Pinned Locked Moved Mobile
questionc++adobe
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amitalonm
    wrote on last edited by
    #1

    Hi, I wrote a program using VC++ that should scan for available wireless networks in the area. In my SW I use the commands OID_802_11_BSSID_LIST_SCAN and OID_802_11_BSSID_LIST. My questions are: 1. How can I Force the Wireless NIC to do ACTIVE SCAN (as contrary to PASSIVE scan) ? 2. According to tests that I did, the card does not flush the list between scans, i.e. I get for several scan a result of an AP that was on air during an old scan, but is no longer there, and new scans return's it's data as if it is still there. A code part that I used is attached - in order to illustrate which functions I am using.

    NDIS_802_11_BSSID_LIST* m_pBSSIDList;
    m_pBSSIDList = (NDIS_802_11_BSSID_LIST *) VirtualAlloc (NULL,
    sizeof (NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS,
    MEM_RESERVE | MEM_COMMIT,
    PAGE_READWRITE) ;

    memset (m_pBSSIDList, 0, sizeof (NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS);

    // Do Scan
    oidcode = OID_802_11_BSSID_LIST_SCAN;
    DeviceIoControl (m_handle,
    IOCTL_NDIS_QUERY_GLOBAL_STATS,
    &oidcode,
    sizeof(oidcode),
    (ULONG *) NULL,
    0,
    &bytesreturned,
    NULL);

    Sleep (6100); // According to the documentation the result of the scan should be valid after 6 seconds.
    // The original line was delay of 2000 mSec. find out why...
    //Sleep (2000);

    // Read scan results
    oidcode = OID_802_11_BSSID_LIST;
    if (DeviceIoControl( m_handle,
    IOCTL_NDIS_QUERY_GLOBAL_STATS,
    &oidcode,
    sizeof(oidcode),
    (ULONG *) m_pBSSIDList,
    sizeof(NDIS_802_11_BSSID_LIST) * NUMBEROF_BSSIDS,
    &bytesreturned,
    NULL) == 0)
    {
    // List failed
    return NULL;
    }
    else
    {
    return m_pBSSIDList;
    }

    If you have any idea of how can I solve my problems, or if you see that I forgot any important line- please let me know. I am open to hear about completely new ways to do this. only requirement is that I will use VC++. Thanks a lot, --Amit.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups