示例#1
0
        /// <summary>
        /// Creates a new instance of a Native Wifi service client.
        /// </summary>
        public WlanClient()
        {
            try
            {
                Wlan.ThrowIfError(Wlan.WlanOpenHandle(Wlan.WLAN_CLIENT_VERSION_XP_SP2, IntPtr.Zero, out negotiatedVersion, out clientHandle));
            }
            catch
            {
                Wlan.WlanCloseHandle(clientHandle, IntPtr.Zero);
                throw;
            }

            try
            {
                Wlan.WlanNotificationSource prevSrc;
                wlanNotificationCallback = new Wlan.WlanNotificationCallbackDelegate(OnWlanNotification);
                Wlan.ThrowIfError(
                    Wlan.WlanRegisterNotification(clientHandle, Wlan.WlanNotificationSource.All, false, wlanNotificationCallback, IntPtr.Zero, IntPtr.Zero, out prevSrc));
            }
            catch
            {
                Wlan.WlanCloseHandle(clientHandle, IntPtr.Zero);
                throw;
            }
        }
示例#2
0
 public WlanClient()
 {
     Wlan.ThrowIfError(Wlan.WlanOpenHandle(1, IntPtr.Zero, out _negotiatedVersion, out _clientHandle));
     try
     {
         Wlan.WlanNotificationSource source;
         _wlanNotificationCallback = new Wlan.WlanNotificationCallbackDelegate(OnWlanNotification);
         Wlan.ThrowIfError(Wlan.WlanRegisterNotification(_clientHandle, Wlan.WlanNotificationSource.All, false, _wlanNotificationCallback, IntPtr.Zero, IntPtr.Zero, out source));
     }
     catch
     {
         Wlan.WlanCloseHandle(_clientHandle, IntPtr.Zero);
         throw;
     }
 }
示例#3
0
 /// <summary>
 /// Creates a new instance of a Native Wifi service client.
 /// </summary>
 public WlanClient()
 {
     Wlan.ThrowIfError(
         Wlan.WlanOpenHandle(Wlan.WLAN_CLIENT_VERSION_XP_SP2, IntPtr.Zero, out negotiatedVersion, out clientHandle));
     try {
         Wlan.WlanNotificationSource prevSrc;
         wlanNotificationCallback = new Wlan.WlanNotificationCallbackDelegate(OnWlanNotification);
         Wlan.ThrowIfError(Wlan.WlanRegisterVirtualStationNotification(clientHandle, true, IntPtr.Zero));
         Wlan.ThrowIfError(
             Wlan.WlanRegisterNotification(clientHandle, Wlan.WlanNotificationSource.All, false, wlanNotificationCallback, IntPtr.Zero, IntPtr.Zero, out prevSrc));
     } catch {
         Wlan.WlanCloseHandle(clientHandle, IntPtr.Zero);
         throw;
     }
 }
 public WlanClient()
 {
     Wlan.ThrowIfError(Wlan.WlanOpenHandle(1U, IntPtr.Zero, out this.negotiatedVersion, out this.clientHandle));
     try
     {
         this.wlanNotificationCallback = new Wlan.WlanNotificationCallbackDelegate(this.OnWlanNotification);
         Wlan.WlanNotificationSource prevNotifSource;
         Wlan.ThrowIfError(Wlan.WlanRegisterNotification(this.clientHandle, Wlan.WlanNotificationSource.All, false, this.wlanNotificationCallback, IntPtr.Zero, IntPtr.Zero, out prevNotifSource));
     }
     catch
     {
         this.Close();
         throw;
     }
 }
示例#5
0
 /// <summary>
 /// Creates a new instance of a Native Wifi service client.
 /// </summary>
 protected WlanClient()
 {
     Wlan.ThrowIfError(
         Wlan.WlanOpenHandle(Wlan.WLAN_CLIENT_VERSION_XP_SP2, IntPtr.Zero, out negotiatedVersion, out clientHandle));
     try
     {
         Wlan.WlanNotificationSource prevSrc;
         wlanNotificationCallback = OnWlanNotification;
         Wlan.ThrowIfError(
             Wlan.WlanRegisterNotification(clientHandle, Wlan.WlanNotificationSource.All, false, wlanNotificationCallback, IntPtr.Zero, IntPtr.Zero, out prevSrc));
     }
     catch
     {
         Close();
         throw;
     }
 }
示例#6
0
        public WlanClient()
        {
            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;
            }
        }
示例#7
0
 /// <summary>
 /// Creates a new instance of a Native Wifi service client.
 /// </summary>
 public WlanClient()
 {
     uint negotiatedVersion;
     Wlan.ThrowIfError(
         Wlan.WlanOpenHandle(Wlan.WlanClientVersionXpSp2, IntPtr.Zero, out negotiatedVersion, out _clientHandle));
     try
     {
         Wlan.WlanNotificationSource prevSrc;
         var wlanNotificationCallback = new Wlan.WlanNotificationCallbackDelegate(OnWlanNotification);
         Wlan.ThrowIfError(
             Wlan.WlanRegisterNotification(_clientHandle, Wlan.WlanNotificationSource.All, false, wlanNotificationCallback, IntPtr.Zero, IntPtr.Zero, out prevSrc));
     }
     catch
     {
         Wlan.WlanCloseHandle(_clientHandle, IntPtr.Zero);
         throw;
     }
 }
示例#8
0
        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;
            }
        }
 public static extern int WlanRegisterNotification([In] IntPtr clientHandle, [In] Wlan.WlanNotificationSource notifSource, [In] bool ignoreDuplicate, [In] Wlan.WlanNotificationCallbackDelegate funcCallback, [In] IntPtr callbackContext, [In] IntPtr reserved, out Wlan.WlanNotificationSource prevNotifSource);
示例#10
0
		/// <summary>
		/// Creates a new instance of a Native Wifi service client.
		/// </summary>
		protected WlanClient()
		{
			Wlan.ThrowIfError(
				Wlan.WlanOpenHandle(Wlan.WLAN_CLIENT_VERSION_XP_SP2, IntPtr.Zero, out negotiatedVersion, out clientHandle));
			try
			{
				Wlan.WlanNotificationSource prevSrc;
				wlanNotificationCallback = OnWlanNotification;
				Wlan.ThrowIfError(
					Wlan.WlanRegisterNotification(clientHandle, Wlan.WlanNotificationSource.All, false, wlanNotificationCallback, IntPtr.Zero, IntPtr.Zero, out prevSrc));
			}
			catch
			{
				Close();
				throw;
			}
		}