/// <summary> /// Sets a parameter of the interface whose data type is <see cref="int"/>. /// </summary> /// <param name="opCode">The opcode of the parameter.</param> /// <param name="value">The value to set.</param> private void SetInterfaceInt(Wlan.WlanIntfOpcode opCode, int value) { IntPtr valuePtr = Marshal.AllocHGlobal(sizeof(int)); Marshal.WriteInt32(valuePtr, value); try { Wlan.ThrowIfError( Wlan.WlanSetInterface(client.clientHandle, info.interfaceGuid, opCode, sizeof(int), valuePtr, IntPtr.Zero)); } finally { Marshal.FreeHGlobal(valuePtr); } }
/// <summary> /// Gets a parameter of the interface whose data type is <see cref="int"/>. /// </summary> /// <param name="opCode">The opcode of the parameter.</param> /// <returns>The integer value.</returns> private int GetInterfaceInt(Wlan.WlanIntfOpcode opCode) { IntPtr valuePtr; int valueSize; Wlan.WlanOpcodeValueType opcodeValueType; Wlan.ThrowIfError( Wlan.WlanQueryInterface(client.clientHandle, info.interfaceGuid, opCode, IntPtr.Zero, out valueSize, out valuePtr, out opcodeValueType)); try { return(Marshal.ReadInt32(valuePtr)); } finally { Wlan.WlanFreeMemory(valuePtr); } }
private void SetInterfaceInt(Wlan.WlanIntfOpcode opCode, int value) { IntPtr num = Marshal.AllocHGlobal(4); Marshal.WriteInt32(num, value); try { Wlan.ThrowIfError(Wlan.WlanSetInterface(this.client.clientHandle, this.info.interfaceGuid, opCode, 4U, num, IntPtr.Zero)); } finally { Marshal.FreeHGlobal(num); } }
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); } }
private int GetInterfaceInt(Wlan.WlanIntfOpcode opCode) { int dataSize; IntPtr ppData; Wlan.WlanOpcodeValueType wlanOpcodeValueType; Wlan.ThrowIfError(Wlan.WlanQueryInterface(this.client.clientHandle, this.info.interfaceGuid, opCode, IntPtr.Zero, out dataSize, out ppData, out wlanOpcodeValueType)); try { return(Marshal.ReadInt32(ppData)); } finally { Wlan.WlanFreeMemory(ppData); } }
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 static extern int WlanSetInterface([In] IntPtr clientHandle, [MarshalAs(UnmanagedType.LPStruct), In] Guid interfaceGuid, [In] Wlan.WlanIntfOpcode opCode, [In] uint dataSize, [In] IntPtr pData, [In, Out] IntPtr pReserved);
public static extern int WlanQueryInterface([In] IntPtr clientHandle, [MarshalAs(UnmanagedType.LPStruct), In] Guid interfaceGuid, [In] Wlan.WlanIntfOpcode opCode, [In, Out] IntPtr pReserved, out int dataSize, out IntPtr ppData, out Wlan.WlanOpcodeValueType wlanOpcodeValueType);