Exemplo n.º 1
0
		private static void SetOpCode(Nic nic, WlanInternOpcode opCode, int value, out int errorCode)
		{
			IntPtr valuePtr = Marshal.AllocHGlobal(sizeof (int));
			Marshal.WriteInt32(valuePtr, value);
			try
			{
				errorCode = WlanInterop.SetInterface(_handle, Guid.Parse(nic.Raw.NetworkInterface.Id), opCode, sizeof (int), valuePtr, IntPtr.Zero);
			}
			finally
			{
				Marshal.FreeHGlobal(valuePtr);
			}
		}
Exemplo n.º 2
0
		private static int GetOpCode(Nic nic, WlanInternOpcode opCode, out int errorCode)
		{
			IntPtr valuePtr;
			int valueSize;
			WlanInternOpcodeValueType opcodeValueType;
			if ((errorCode = WlanInterop.QueryInterface(_handle, nic.Hardware.Id, opCode, IntPtr.Zero, out valueSize, out valuePtr, out opcodeValueType)) != 0)
				return 0;
			try
			{
				return Marshal.ReadInt32(valuePtr);
			}
			finally
			{
				WlanInterop.FreeMemory(valuePtr);
			}
		}
Exemplo n.º 3
0
		/// <summary>Gets a parameter of the interface whose data type is <see cref="int" />.</summary>
		internal static int TryGetOpCode(Nic nic, WlanInternOpcode opCode)
		{
			int error;
			var result = GetOpCode(nic, opCode, out error);
			return result;
		}
Exemplo n.º 4
0
		/// <summary>Sets a parameter of the interface whose data type is <see cref="int" />.</summary>
		internal static void TrySetOpCode(Nic nic, WlanInternOpcode opCode, int value)
		{
			int error;
			SetOpCode(nic, opCode, value, out error);
		}
Exemplo n.º 5
0
		/// <summary>Sets a parameter of the interface whose data type is <see cref="int" />.</summary>
		internal static void SetOpCode(Nic nic, WlanInternOpcode opCode, int value)
		{
			int error;
			SetOpCode(nic, opCode, value, out error);
			ThrowIfError(error);
		}