public static WlanHostedNetworkReason SetEnabled(bool enabled) { WlanHostedNetworkReason failReason; var settingsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(enabled)); Marshal.StructureToPtr(enabled, settingsPtr, false); Helper.ThrowExceptionForHR(WlanNativeMethods.WlanHostedNetworkSetProperty(wlanHandle, WlanHostedNetworkOpcode.Enable, (uint)Marshal.SizeOf(enabled), settingsPtr, out failReason, IntPtr.Zero)); return(failReason); }
public static WlanHostedNetworkReason SetConnectionSettings(string hostedNetworkSsid, int maxNumberOfPeers) { WlanHostedNetworkReason failReason; var settings = new WlanHostedNetworkConnectionSettings { HostedNetworkSSID = ToDOT11_SSID(hostedNetworkSsid), MaxNumberOfPeers = (uint)maxNumberOfPeers }; var settingsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(settings)); Marshal.StructureToPtr(settings, settingsPtr, false); Helper.ThrowExceptionForHR(WlanNativeMethods.WlanHostedNetworkSetProperty(wlanHandle, WlanHostedNetworkOpcode.ConnectionSettings, (uint)Marshal.SizeOf(settings), settingsPtr, out failReason, IntPtr.Zero)); return(failReason); }