private void SetInterfaceInt(Wlan.WlanIntfOpcode opCode, int value) { IntPtr ptr = Marshal.AllocHGlobal(4); Marshal.WriteInt32(ptr, value); try { Wlan.ThrowIfError(Wlan.WlanSetInterface(_client.ItsClientHandle, _info.interfaceGuid, opCode, 4, ptr, IntPtr.Zero)); } finally { Marshal.FreeHGlobal(ptr); } }
public IEnumerable <Wlan.WlanBssEntryN> GetNetworkBssList() { IntPtr ptr; Wlan.WlanBssEntryN[] entryArray; Wlan.ThrowIfError(Wlan.WlanGetNetworkBssList(_client.ItsClientHandle, _info.interfaceGuid, IntPtr.Zero, Wlan.Dot11BssType.Any, false, IntPtr.Zero, out ptr)); try { entryArray = ConvertBssListPtr(ptr); } finally { Wlan.WlanFreeMemory(ptr); } return(entryArray); }
public IEnumerable <Wlan.WlanAvailableNetwork> GetAvailableNetworkList(Wlan.WlanGetAvailableNetworkFlags flags) { IntPtr ptr; Wlan.WlanAvailableNetwork[] networkArray; Wlan.ThrowIfError(Wlan.WlanGetAvailableNetworkList(_client.ItsClientHandle, _info.interfaceGuid, flags, IntPtr.Zero, out ptr)); try { networkArray = ConvertAvailableNetworkListPtr(ptr); } finally { Wlan.WlanFreeMemory(ptr); } return(networkArray); }
public WlanClient() { ItsLogger = new Logger(this); try { Wlan.ThrowIfError(Wlan.WlanOpenHandle(1, IntPtr.Zero, out _negotiatedVersion, out _clientHandle)); WlanNotificationCallback = new Wlan.WlanNotificationCallbackDelegate(OnWlanNotification); Wlan.WlanNotificationSource source; Wlan.ThrowIfError(Wlan.WlanRegisterNotification(_clientHandle, Wlan.WlanNotificationSource.All, false, WlanNotificationCallback, IntPtr.Zero, IntPtr.Zero, out source)); } catch (Win32Exception ex) { Wlan.WlanCloseHandle(_clientHandle, IntPtr.Zero); ItsLogger.Warn(ex.Message); throw; } }
private int GetInterfaceInt(Wlan.WlanIntfOpcode opCode) { IntPtr ptr; int num; Wlan.WlanOpcodeValueType type; int num2; Wlan.ThrowIfError(Wlan.WlanQueryInterface(_client.ItsClientHandle, _info.interfaceGuid, opCode, IntPtr.Zero, out num, out ptr, out type)); try { num2 = Marshal.ReadInt32(ptr); } finally { Wlan.WlanFreeMemory(ptr); } return(num2); }
public string GetProfileXml(string profileName) { IntPtr ptr; Wlan.WlanProfileFlags flags; Wlan.WlanAccess access; string str; Wlan.ThrowIfError(Wlan.WlanGetProfile(_client.ItsClientHandle, _info.interfaceGuid, profileName, IntPtr.Zero, out ptr, out flags, out access)); try { str = Marshal.PtrToStringUni(ptr); } finally { Wlan.WlanFreeMemory(ptr); } return(str); }
private void Connect(Wlan.WlanConnectionParameters connectionParams) { Wlan.ThrowIfError(Wlan.WlanConnect(_client.ItsClientHandle, _info.interfaceGuid, ref connectionParams, IntPtr.Zero)); }
public Wlan.WlanReasonCode SetProfile(Wlan.WlanProfileFlags flags, string profileXml, bool overwrite) { Wlan.WlanReasonCode code; Wlan.ThrowIfError(Wlan.WlanSetProfile(_client.ItsClientHandle, _info.interfaceGuid, flags, profileXml, null, overwrite, IntPtr.Zero, out code)); return(code); }
public void Scan() { Wlan.ThrowIfError(Wlan.WlanScan(_client.ItsClientHandle, _info.interfaceGuid, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero)); }
public void DeleteProfile(string profileName) { Wlan.ThrowIfError(Wlan.WlanDeleteProfile(_client.ItsClientHandle, _info.interfaceGuid, profileName, IntPtr.Zero)); }