Activating a wireless card (DeviceioControl)

Discussion in 'General Software Discussion' started by RooJ, Nov 8, 2006.

  1. RooJ

    RooJ New Member

    Joined:
    Nov 8, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Not sure if this is the right place to ask but im wanting to communicate directly with a device driver from a vb6 application and need some guidance.

    Basically we (a school) have bought 35 laptops that have an annoying issue with them. When starting with the AC power adapter plugged in, the wireless card will activate itself on boot allowing people to login without problems. When running from the battery however the wireless card doesnt activate itself until you either hit a toggle switch at the front of the laptop or when a certain packaged software runs (after logon).
    As a school this isn't going to work and as the company we purchased them from wont take the laptops back, and the laptop manufacturers state that "this laptop doesnt have the ability to activate its wireless card automatically before logon unless running from mains" im left trying to fix the problem myself.

    What i want to do is create a windows service (which isnt a problem) that when ran does what the preinstalled software does, activates the wireless card.
    Ive searched the web and found some very interesting sites, i know now that to open a handle to a driver you use CreateFile() using the name of the device as filename. You use DeviceioControl() to send requests to the driver, but what i dont have much of a clue about is IOCTL codes. Is there any easy way to find out what the code would be to "activate wireless card"? Its an Atheros ARG5005G wireless card

    Thanks,

    Roo
     
  2. UberLord

    UberLord A Legend in Underwear

    Joined:
    May 8, 2002
    Messages:
    5,255
    Likes Received:
    4
    Trophy Points:
    0
    Why not just create a service to run the packaged software at boot?

    But that is just a load of BS really - I know for sure that atheros cards work fine without mains power when you run either Linux or FreeBSD ;)

    As to the ioctl codes - that would be specfic to the OS and the driver. Maybe you could email atheros directly and if they can supply any specs. Don't hold your breath though as they won't give them to the open source crowd either!
     
  3. RooJ

    RooJ New Member

    Joined:
    Nov 8, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    When running as a service the software doesn't activate the card (not sure why). Also we're trying to avoid using the software as much as possible, when a user logs on we dont really want the packaged software to be running.

    The card works fine when activated, but doesnt activate itself on boot. Ive tried reinstalling XP in hopes that it was just the built in software or drivers causing the issue but the exact same problem occured (with the latest version of the card drivers). Ive also found that the card wasn't activated when running from a linux live cd.

    Yeah i guessed from the complete lack of codes available online that it would be a pain to get them, doubt atheros would be able to help. Im thinking as a last resort that i might have to debug the driver or the preinstalled software that actually succeeds in starting the card. Maybe i can watch how their software does it and copy, i may even find a dll i can use thats responsible for communicating with the driver.

    If you have any tips on debugging drivers id love to hear from you, i have experience with debugging normal applications so im sure it wont be completely foreign to me. I know there might be legal issues with this but i have little choice.

    Thanks for the help

    Roo
     
  4. UberLord

    UberLord A Legend in Underwear

    Joined:
    May 8, 2002
    Messages:
    5,255
    Likes Received:
    4
    Trophy Points:
    0
    Depends on the livecd.
    Gentoo's LiveCD doesn't automatically activate the wireless, whereas once Gentoo is installed proper it will.

    This is mainly because no live cd ships with the binary firmwares required for the wireless driver as that goes against the binary firmware license. The only exception I know of is the rt2500 driver as that has no firmware :) With sucks as I know athereos requires one. Infact, OpenBSD are making an open firmware for the card - which according to reports sort of works.

    Only driver debugging I've ever done was in Linux as the source is easily to hand.

    NFC how to go about it in windows ....

    Good luck though! I think you'll need it.
     
  5. RooJ

    RooJ New Member

    Joined:
    Nov 8, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Ive been looking into programs such as devfilter and driverspNT which seem to work well, they hook the driver of your choice and monitor api's. Im not sure whether i should be hooking the driver "AR5211" or something relating to NDIS, Ndisuio etc but i feel im closing in on a solution (hopefully). The control codes im getting back from driverspy when monitoring the driver dont change whether i enable or disable the card, and without doing either the api is still called occasionally anyway. The only Control codes i recieve for IRP_MJ_DEVICE_CONTROL when monitoring the driver is 0x0017003E for example.

    Monitoring NDIS produces interesting results:

    Process Major ...|Function..........................|IOCTL
    svchost.exe:916 |IRP_MJ_CREATE
    svchost.exe:916 |IRP_MJ_DEVICE_CONTROL|0x170010
    svchost.exe:916 |IRP_MJ_CLEANUP
    svchost.exe:916 |IRP_MJ_CLOSE
    svchost.exe:916 |IRP_MJ_CREATE
    svchost.exe:916 |IRP_MJ_DEVICE_CONTROL|0x170008

    But once again these are repeated aslong as the card is activated, i think these might be related to holding a connection, checking SSID's etc.

    Anyway i guess its just a case of digging for more information + trial and error.
    Thanks for the help.

    Roo.
     
  6. pr0digal jenius

    pr0digal jenius Delete Me

    Joined:
    Mar 15, 2004
    Messages:
    14,526
    Likes Received:
    28
    Trophy Points:
    0
    in windows, if im not mistaken, you need the GUID for the driver, which is generated on the fly at isntall time, to accomplish much of any sort of low level control.


    It can be done though...sony laptops ship with a software "WiFi Switch", you may look that up and see if you can find anything helpful on it
     

Share This Page

visited