Disabling WiFi Infrastructure Access in XP

I have an application that should disable access to the infrastructure and then turn it back on (please do not ask why. I am under the NDA, and it would be difficult to explain why without breaking this). I am doing this with p / Invoke in C #.

To disable it, I create an INTF_ENTRY structure by setting guid guid, then setting dwCtlFlags to 0 and calling

uint outFlags;
WZCSAPI.INTF_ENTRY intf = new WZCSAPI.INTF_ENTRY();
intf.wszGuid = adapterGuid;
intf.dwCtlFlags = 0;
WZCSetInterface(null, (uint)INTF_FLAGS.INTF_CM_MASK, ref intf, out outFlags)

This works great and does what I expect. My XP settings in the section “Wireless Network Connection Properties / Wireless Networks / Advanced” switch from “Any Available Network (Preferred Access Point)” to “Computer Only (ad hoc).” This is exactly what I need for this. ..

Before doing this, I get the initial settings for CM_MASK.

So, later, I try to do the same to restore it (in this case, origCMMask = 2):

uint outFlags;
WZCSAPI.INTF_ENTRY intf = new WZCSAPI.INTF_ENTRY();
intf.wszGuid = adapterGuid;
intf.dwCtlFlags = origCMMask;
WZCSetInterface(null, (uint)INTF_FLAGS.INTF_CM_MASK, ref intf, out outFlags)

But the "Any available network" parameter is not restored in the settings dialog box, and HKLM \ SOFTWARE \ Microsoft \ WZCSVC \ Parameters \ Interface {guid} \ ControlFlags agrees that the CM mask is NOT set to 2, but all still set to 0 (the actual value is 0x07918000, instead of the usual 0x07818002).

Is there any step that I am missing?

+3
source share
2 answers

You can try the WlanSetInterface Function if you have Windows XP Service Pack 3 (SP3), passing wlan_intf_opcode_bss_typeas OpCode.

NETSH WLAN , , .

+2
  • ( devcon.exe)
  • regedit HKLM\SOFTWARE\Microsoft\WZCSVC\Parameters\Interface {guid}\ControlFlags
  • ( devcon.exe)
0

All Articles