public WLAN_HOSTED_NETWORK_REASON SetConnectionSettings(string hostedNetworkSSID, int maxNumberOfPeers) { WLAN_HOSTED_NETWORK_REASON failReason; WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS settings = new WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS(); settings.hostedNetworkSSID = WlanUtils.ConvertStringToDOT11_SSID(hostedNetworkSSID); settings.dwMaxNumberOfPeers = (uint)maxNumberOfPeers; IntPtr settingsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(settings)); Marshal.StructureToPtr(settings, settingsPtr, false); WlanUtils.Throw_On_Win32_Error( wlanapi.WlanHostedNetworkSetProperty( this._WlanHandle, WLAN_HOSTED_NETWORK_OPCODE.wlan_hosted_network_opcode_connection_settings, (uint)Marshal.SizeOf(settings), settingsPtr, out failReason, IntPtr.Zero ) ); return(failReason); }
public WLAN_HOSTED_NETWORK_REASON SetConnectionSettings(string hostedNetworkSSID, int maxNumberOfPeers) { WLAN_HOSTED_NETWORK_REASON failReason; WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS settings = new WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS(); settings.hostedNetworkSSID = WlanUtils.ConvertStringToDOT11_SSID(hostedNetworkSSID); settings.dwMaxNumberOfPeers = (uint)maxNumberOfPeers; IntPtr settingsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(settings)); Marshal.StructureToPtr(settings, settingsPtr, false); WlanUtils.Throw_On_Win32_Error( wlanapi.WlanHostedNetworkSetProperty( this._WlanHandle, WLAN_HOSTED_NETWORK_OPCODE.wlan_hosted_network_opcode_connection_settings, (uint)Marshal.SizeOf(settings), settingsPtr, out failReason, IntPtr.Zero ) ); return failReason; }