none
Changing wireless protocol from 802.11a to 802.11 b/g using C# RRS feed

  • Question

  • I would like to make a C# program that changes the wireless protocol from 802.11 a to 802.11 b/g. I can't figure out where to find the properties, so hopefully one of you can help.

    I've looked into WMI and looked into the following Win32 classes - without any luck.

    Win32_NetworkAdapterConfiguration
    Win32_NetworkAdapter
    Win32_NetworkClient
    Win32_NetworkConnection
    Win32_NetworkLoginProfile
    Win32_NetworkProtocol

    I have also tried the Native Wifi - no luck either.

     

    Any help on this matter?

    Friday, December 2, 2011 8:37 AM

Answers

  • Hi Casper,

    Welcome to MSDN forums!

    I think both WMI and Native Wifi APIs may not help here.  WMI provides default and basic settings for network adapters and the wireless mode is not among these settings, while native wifi APIs is mainly focused on wifi client and connection instead of the adapter.

    We may need to contact the certain wifi adapter manufacturer about the certain APIs to manage the adapter settings, since different adapter may have different settings and APIs.   Here I can only figure out a method to use C# to modify the registry key values related to the network adapter settings. 

    I used Process Monitor to check what registry keys are accessed when I opened the network adapter properties dialog:

    So then I used the regedit to check the registry key value: HKLM\System\CurrentControlSet\Control\CLASS\{4D36E972-E325-11CE-BFC1-08002BE10318}\0011 and there is a key named WirelessMode whose value is 34

    So we can change this key value WirelessMode to the value you want by C# registry related methods, http://www.codeproject.com/KB/system/modifyregistry.aspx.

    However, this method will also change when we use different adapters. 

    Hope it helps!

    Good day!


    Michael Sun [MSFT]
    MSDN Community Support | Feedback to us
    Tuesday, December 6, 2011 3:23 AM
    Moderator

All replies

  • Hi Casper,

    Welcome to the MSDN forum!

    I'm trying to involve some senior engineers on this issue. It will take some time and your patience will be greatly appreciated.

    Thank you for your understanding and have a nice day!

    Yoyo.


    Yoyo Jiang[MSFT]
    MSDN Community Support | Feedback to us
    Monday, December 5, 2011 3:05 PM
    Moderator
  • Hi Casper,

    Welcome to MSDN forums!

    I think both WMI and Native Wifi APIs may not help here.  WMI provides default and basic settings for network adapters and the wireless mode is not among these settings, while native wifi APIs is mainly focused on wifi client and connection instead of the adapter.

    We may need to contact the certain wifi adapter manufacturer about the certain APIs to manage the adapter settings, since different adapter may have different settings and APIs.   Here I can only figure out a method to use C# to modify the registry key values related to the network adapter settings. 

    I used Process Monitor to check what registry keys are accessed when I opened the network adapter properties dialog:

    So then I used the regedit to check the registry key value: HKLM\System\CurrentControlSet\Control\CLASS\{4D36E972-E325-11CE-BFC1-08002BE10318}\0011 and there is a key named WirelessMode whose value is 34

    So we can change this key value WirelessMode to the value you want by C# registry related methods, http://www.codeproject.com/KB/system/modifyregistry.aspx.

    However, this method will also change when we use different adapters. 

    Hope it helps!

    Good day!


    Michael Sun [MSFT]
    MSDN Community Support | Feedback to us
    Tuesday, December 6, 2011 3:23 AM
    Moderator
  • Hi Michael.

    Thank you very much for the answer.

    Unfortunately the images you posted are broken, can you post them again?

    I will look into this as soon as possible and post my findings here.


    Tuesday, December 6, 2011 9:03 PM
  • Hi Yoyo.

    Thank you

    Tuesday, December 6, 2011 9:03 PM
  • Hi Casper,

    The images are shown at my side, the problem might be caused by the forum site unstability recently.   I have uploaded the two images here,

    https://skydrive.live.com/#cid=70A15797AD6367F9&id=70A15797AD6367F9%21257

    https://skydrive.live.com/#cid=70A15797AD6367F9&id=70A15797AD6367F9%21256

    If you have any additional questions, please feel free to let me know.

    Good day!

    Thanks


    Michael Sun [MSFT]
    MSDN Community Support | Feedback to us
    Wednesday, December 7, 2011 2:49 AM
    Moderator
  • Hi Michael.

    Got a problem.

    During my test I have succesfully changed the value in HKLM\System\CurrentControlSet\Control\CLASS\{4D36E972-E325-11CE-BFC1-08002BE10318}\0011 

    This also changes the value in device manager, but the change does not happen. Even though device manager and regedit shows a new value, it does not change the wireless mode.

    Any idea why and how to fix?


    Wednesday, December 7, 2011 8:05 PM
  • Hi Casper,

    Oh, the wireless hardware part is not what I am familar with.   I am not sure every network adapter can be configured by this workaround.  Have you tried to restart the machine to let the network adapter to change the mode?   

    Also, I would recommend you also consult the network adapter manufacturer for some ideas. 

    Good day!

    Thanks


    Michael Sun [MSFT]
    MSDN Community Support | Feedback to us
    Thursday, December 8, 2011 1:54 AM
    Moderator
  • Hi Michael I will try this.
    Thank you for all your help. 
    Thursday, December 8, 2011 6:51 AM
  • By using the answer Michael gave me on registry (See the post marked as answer) and then using the WMI class NetworkAdapter to disable/enable networkAdapter i got it working.

    After setting the new wireless mode the networkadapter has to be reset. 

    Friday, December 9, 2011 10:03 AM
  • Hi Casper,

    Glad to hear it's working!

    Have a nice day!


    Michael Sun [MSFT]
    MSDN Community Support | Feedback to us
    Monday, December 12, 2011 2:08 AM
    Moderator