Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3634200
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:44:58+00:00 2026-05-19T00:44:58+00:00

I am currently trying to retrieve the signal strength from a wireless access point

  • 0

I am currently trying to retrieve the signal strength from a wireless access point using the wlanapi.dll WlanQueryInterface call.

Here is my api declaration

    [DllImport("wlanapi.dll", SetLastError = true)]
private static extern UInt32 WlanQueryInterface(IntPtr hClientHandle, ref Guid pInterfaceGuid, WLAN_INTF_OPCODE OpCode, IntPtr pReserved, out Int32 pdwDataSize, ref IntPtr ppData, IntPtr pWlanOpCodeValueType);

The problem is when I look at the wlanSignalStrength entry in the WLAN_ASSOCIATION_ATTRIBUTES structure it is set to 5400. Microsoft API documentation says that it should be a value between 0 – 100.

Here is my structure declaration:

    /// <summary>
/// Structure contains association attributes for a connection.
/// </summary>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
private struct WLAN_ASSOCIATION_ATTRIBUTES
{
    /// <summary>
    /// A DOT11_SSID structure that contains the SSID of the association.
    /// </summary>
    public DOT11_SSID dot11Ssid;
    /// <summary>
    /// A DOT11_BSS_TYPE value that specifies whether the network is infrastructure or ad hoc.
    /// </summary>
    public DOT11_BSS_TYPE dot11BssType;
    /// <summary>
    /// A DOT11_MAC_ADDRESS that contains the BSSID of the association.
    /// </summary>
    public DOT11_MAC_ADDRESS dot11Bssid;
    /// <summary>
    /// A DOT11_PHY_TYPE value that indicates the physical type of the association
    /// </summary>
    public DOT11_PHY_TYPE dot11PhyType;
    /// <summary>
    /// The position of the DOT11_PHY_TYPE value in the structure containing the list of PHY types.
    /// </summary>
    public ulong uDot11PhyIndex;
    /// <summary>
    /// A percentage value that represents the signal quality of the network.
    /// </summary>
    public Int32 wlanSignalQuality;
    /// <summary>
    /// Contains the receiving rate of the association.
    /// </summary>
    public ulong ulRxRate;
    /// <summary>
    /// Contains the transmission rate of the association.
    /// </summary>
    public ulong ulTxRate;
}

Here is my call to WlanQueryInterface:

    Int32 iDataSize;
    IntPtr ppData = IntPtr.Zero;
    WLAN_CONNECTION_ATTRIBUTES wcaAttributes = new WLAN_CONNECTION_ATTRIBUTES();
    String[] sReturn = new String[4];

    if (WlanQueryInterface(pClientHandle, ref gInterfaceGUID, WLAN_INTF_OPCODE.wlan_intf_opcode_current_connection, IntPtr.Zero, out iDataSize, ref ppData, IntPtr.Zero) == ERROR_SUCCESS)
    {
        wcaAttributes = (WLAN_CONNECTION_ATTRIBUTES)Marshal.PtrToStructure(ppData, typeof(WLAN_CONNECTION_ATTRIBUTES));

        sReturn[0] = wcaAttributes.wlanAssociationAttributes.dot11Ssid.ucSSID;
        sReturn[1] = wcaAttributes.strProfileName;
        sReturn[2] = String.Format("{0:X2}-{1:X2}-{2:X2}-{3:X2}-{4:X2}-{5:X2}", wcaAttributes.wlanAssociationAttributes.dot11Bssid.bOne, wcaAttributes.wlanAssociationAttributes.dot11Bssid.bTwo, wcaAttributes.wlanAssociationAttributes.dot11Bssid.bThree, wcaAttributes.wlanAssociationAttributes.dot11Bssid.bFour, wcaAttributes.wlanAssociationAttributes.dot11Bssid.bFive, wcaAttributes.wlanAssociationAttributes.dot11Bssid.bSix);
        sReturn[3] = wcaAttributes.wlanAssociationAttributes.wlanSignalQuality.ToString(); //This returns 5400 when the actual strength is ~99

        WlanFreeMemory(ppData);

        return sReturn;
    }
    else
    {
        throw new Exception("Unable to get interface connected SSID.");
    }

Does anyone see what I am doing wrong? Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T00:44:59+00:00Added an answer on May 19, 2026 at 12:44 am

    I finally got it fixed. I had to set the LayoutKind for the WLAN_ASSOCIATION_ATTRIBUTES to Explicit and set the charset to Unicode.

        [StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)]
    private struct WLAN_ASSOCIATION_ATTRIBUTES
    {
        /// <summary>
        /// A DOT11_SSID structure that contains the SSID of the association.
        /// </summary>
        [FieldOffset(0)]
        public DOT11_SSID dot11Ssid;
        /// <summary>
        /// A DOT11_BSS_TYPE value that specifies whether the network is infrastructure or ad hoc.
        /// </summary>
        [FieldOffset(0x24)]
        public DOT11_BSS_TYPE dot11BssType;
        /// <summary>
        /// A DOT11_MAC_ADDRESS that contains the BSSID of the association.
        /// </summary>
        [FieldOffset(40)]
        public DOT11_MAC_ADDRESS dot11Bssid;
        /// <summary>
        /// A DOT11_PHY_TYPE value that indicates the physical type of the association
        /// </summary>
        [FieldOffset(0x30)]
        public DOT11_PHY_TYPE dot11PhyType;
        /// <summary>
        /// The position of the DOT11_PHY_TYPE value in the structure containing the list of PHY types.
        /// </summary>
        [FieldOffset(0x34)]
        public ulong uDot11PhyIndex;
        /// <summary>
        /// A percentage value that represents the signal quality of the network.
        /// </summary>
        [FieldOffset(0x38)]
        public Int32 wlanSignalQuality;
        /// <summary>
        /// Contains the receiving rate of the association.
        /// </summary>
        [FieldOffset(60)]
        public ulong ulRxRate;
        /// <summary>
        /// Contains the transmission rate of the association.
        /// </summary>
        [FieldOffset(0x40)]
        public ulong ulTxRate;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to retrieve a stock quote from Yahoo! finance using Flex. I
I'm trying to retrieve the access level (admin/member/guest) for the currently logged in user
I am currently using phonegap and trying to display results from a sqlite table
I'm currently trying to retrieve the coordinates of the cursor using function getCursor(event) {
I am currently trying to build a little widget that will retrieve a list
Im currently trying to downlaod a audio track from a WCF, i need some
I'm currently trying to port an app from asp.net to php, however I just
I am currently trying to create a webservice in a winform application using WCF,
I'am currently playing around with MongoDB using its C# driver, trying each method in
I am currently using NSURLConnection to download some date from a database through a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.