WLANAPI and OpCodes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Toby Webb

    WLANAPI and OpCodes

    How can I convert the following code (from MSDN) to work in VB.NET
    (the opcodes are raising errors):

    Public Enum WLAN_INTF_OPCOD E
    wlan_intf_opcod e_autoconf_star t = 0x000000000
    wlan_intf_opcod e_autoconf_enab led = 0x0fffffff
    wlan_intf_opcod e_background_sc an_enabled = 0x0fffffff
    wlan_intf_opcod e_media_streami ng_mode = 0x0fffffff
    wlan_intf_opcod e_radio_state = 0x0fffffff
    wlan_intf_opcod e_bss_type = 0x0fffffff
    wlan_intf_opcod e_interface_sta te = 0x0fffffff
    wlan_intf_opcod e_current_conne ction = 0x0fffffff
    wlan_intf_opcod e_channel_numbe r = 0x0fffffff
    wlan_intf_opcod e_supported_inf rastructure_aut h_cipher_pairs =
    0x0fffffff
    wlan_intf_opcod e_supported_adh oc_auth_cipher_ pairs =
    0x0fffffff
    wlan_intf_opcod e_supported_cou ntry_or_region_ string_list =
    0x0fffffff
    wlan_intf_opcod e_current_opera tion_mode = 0x0fffffff
    wlan_intf_opcod e_supported_saf e_mode = 0x0fffffff
    wlan_intf_opcod e_certified_saf e_mode = 0x0fffffff
    wlan_intf_opcod e_autoconf_end = 0x0fffffff
    wlan_intf_opcod e_msm_start = 0x10000100
    wlan_intf_opcod e_statistics = 0x1fffffff
    wlan_intf_opcod e_rssi = 0x1fffffff
    wlan_intf_opcod e_msm_end = 0x1fffffff
    wlan_intf_opcod e_security_star t = 0x20010000
    wlan_intf_opcod e_security_end = 0x2fffffff
    wlan_intf_opcod e_ihv_start = 0x30000000
    wlan_intf_opcod e_ihv_end = 0x3fffffff
    End Enum


    Thanks in advance,

    Toby.
  • Alex Clark

    #2
    Re: WLANAPI and OpCodes

    Replace all "0x" with "&H" should do the trick, at least as far as I can
    tell.


    "Toby Webb" <toby.k.webb@go oglemail.comwro te in message
    news:8921c449-e5a7-4fa0-919e-56598b8b0474@t5 4g2000hsg.googl egroups.com...
    How can I convert the following code (from MSDN) to work in VB.NET
    (the opcodes are raising errors):
    >
    Public Enum WLAN_INTF_OPCOD E
    wlan_intf_opcod e_autoconf_star t = 0x000000000
    wlan_intf_opcod e_autoconf_enab led = 0x0fffffff
    wlan_intf_opcod e_background_sc an_enabled = 0x0fffffff
    wlan_intf_opcod e_media_streami ng_mode = 0x0fffffff
    wlan_intf_opcod e_radio_state = 0x0fffffff
    wlan_intf_opcod e_bss_type = 0x0fffffff
    wlan_intf_opcod e_interface_sta te = 0x0fffffff
    wlan_intf_opcod e_current_conne ction = 0x0fffffff
    wlan_intf_opcod e_channel_numbe r = 0x0fffffff
    wlan_intf_opcod e_supported_inf rastructure_aut h_cipher_pairs =
    0x0fffffff
    wlan_intf_opcod e_supported_adh oc_auth_cipher_ pairs =
    0x0fffffff
    wlan_intf_opcod e_supported_cou ntry_or_region_ string_list =
    0x0fffffff
    wlan_intf_opcod e_current_opera tion_mode = 0x0fffffff
    wlan_intf_opcod e_supported_saf e_mode = 0x0fffffff
    wlan_intf_opcod e_certified_saf e_mode = 0x0fffffff
    wlan_intf_opcod e_autoconf_end = 0x0fffffff
    wlan_intf_opcod e_msm_start = 0x10000100
    wlan_intf_opcod e_statistics = 0x1fffffff
    wlan_intf_opcod e_rssi = 0x1fffffff
    wlan_intf_opcod e_msm_end = 0x1fffffff
    wlan_intf_opcod e_security_star t = 0x20010000
    wlan_intf_opcod e_security_end = 0x2fffffff
    wlan_intf_opcod e_ihv_start = 0x30000000
    wlan_intf_opcod e_ihv_end = 0x3fffffff
    End Enum
    >
    >
    Thanks in advance,
    >
    Toby.

    Comment

    • Toby Webb

      #3
      Re: WLANAPI and OpCodes

      On 16 Sep, 02:32, "Alex Clark" <qua...@noemail .noemailwrote:
      Replace all "0x" with "&H" should do the trick, at least as far as I can
      tell.
      >
      "Toby Webb" <toby.k.w...@go oglemail.comwro te in message
      >
      news:8921c449-e5a7-4fa0-919e-56598b8b0474@t5 4g2000hsg.googl egroups.com...
      >
      >
      >
      How can I convert the following code (from MSDN) to work in VB.NET
      (the opcodes are raising errors):
      >
      Public Enum WLAN_INTF_OPCOD E
             wlan_intf_opcod e_autoconf_star t = 0x000000000
             wlan_intf_opcod e_autoconf_enab led = 0x0fffffff
             wlan_intf_opcod e_background_sc an_enabled = 0x0fffffff
             wlan_intf_opcod e_media_streami ng_mode = 0x0fffffff
             wlan_intf_opcod e_radio_state = 0x0fffffff
             wlan_intf_opcod e_bss_type = 0x0fffffff
             wlan_intf_opcod e_interface_sta te = 0x0fffffff
             wlan_intf_opcod e_current_conne ction = 0x0fffffff
             wlan_intf_opcod e_channel_numbe r = 0x0fffffff
             wlan_intf_opcod e_supported_inf rastructure_aut h_cipher_pairs =
      0x0fffffff
             wlan_intf_opcod e_supported_adh oc_auth_cipher_ pairs =
      0x0fffffff
             wlan_intf_opcod e_supported_cou ntry_or_region_ string_list=
      0x0fffffff
             wlan_intf_opcod e_current_opera tion_mode = 0x0fffffff
             wlan_intf_opcod e_supported_saf e_mode = 0x0fffffff
             wlan_intf_opcod e_certified_saf e_mode = 0x0fffffff
             wlan_intf_opcod e_autoconf_end = 0x0fffffff
             wlan_intf_opcod e_msm_start = 0x10000100
             wlan_intf_opcod e_statistics = 0x1fffffff
             wlan_intf_opcod e_rssi = 0x1fffffff
             wlan_intf_opcod e_msm_end = 0x1fffffff
             wlan_intf_opcod e_security_star t = 0x20010000
             wlan_intf_opcod e_security_end = 0x2fffffff
             wlan_intf_opcod e_ihv_start = 0x30000000
             wlan_intf_opcod e_ihv_end = 0x3fffffff
         End Enum
      >
      Thanks in advance,
      >
      Toby.- Hide quoted text -
      >
      - Show quoted text -
      Ah, thanks for that, works a charm.

      I don't suppose anyone has the code for using WlanQueryInterf ace
      (WLANAPI) in VB.NET??

      Comment

      • Bill McCarthy

        #4
        Re: WLANAPI and OpCodes

        Hi Tony,

        Those values you have there are wrong I beleive. I would make the values as
        :

        Enum WLAN_INTF_OPCOD E
        autoconf_start = &H0
        autoconf_enable d
        background_scan _enabled
        media_streaming _mode
        radio_state
        bss_type
        interface_state
        current_connect ion
        channel_number
        supported_infra structure_auth_ cipher_pairs
        supported_adhoc _auth_cipher_pa irs
        supported_count ry_or_region_st ring_list
        current_operati on_mode
        autoconf_end = &HFFFFFFF
        msm_start = &H10000100
        statistics
        rssi
        msm_end = &H1FFFFFFF
        security_start = &H20010000
        security_end = &H2FFFFFFF
        ihv_start = &H30000000
        ihv_end = &H3FFFFFFF
        End Enum






        "Toby Webb" <toby.k.webb@go oglemail.comwro te in message
        news:8921c449-e5a7-4fa0-919e-56598b8b0474@t5 4g2000hsg.googl egroups.com...
        How can I convert the following code (from MSDN) to work in VB.NET
        (the opcodes are raising errors):
        >
        Public Enum WLAN_INTF_OPCOD E
        wlan_intf_opcod e_autoconf_star t = 0x000000000
        wlan_intf_opcod e_autoconf_enab led = 0x0fffffff
        wlan_intf_opcod e_background_sc an_enabled = 0x0fffffff
        wlan_intf_opcod e_media_streami ng_mode = 0x0fffffff
        wlan_intf_opcod e_radio_state = 0x0fffffff
        wlan_intf_opcod e_bss_type = 0x0fffffff
        wlan_intf_opcod e_interface_sta te = 0x0fffffff
        wlan_intf_opcod e_current_conne ction = 0x0fffffff
        wlan_intf_opcod e_channel_numbe r = 0x0fffffff
        wlan_intf_opcod e_supported_inf rastructure_aut h_cipher_pairs =
        0x0fffffff
        wlan_intf_opcod e_supported_adh oc_auth_cipher_ pairs =
        0x0fffffff
        wlan_intf_opcod e_supported_cou ntry_or_region_ string_list =
        0x0fffffff
        wlan_intf_opcod e_current_opera tion_mode = 0x0fffffff
        wlan_intf_opcod e_supported_saf e_mode = 0x0fffffff
        wlan_intf_opcod e_certified_saf e_mode = 0x0fffffff
        wlan_intf_opcod e_autoconf_end = 0x0fffffff
        wlan_intf_opcod e_msm_start = 0x10000100
        wlan_intf_opcod e_statistics = 0x1fffffff
        wlan_intf_opcod e_rssi = 0x1fffffff
        wlan_intf_opcod e_msm_end = 0x1fffffff
        wlan_intf_opcod e_security_star t = 0x20010000
        wlan_intf_opcod e_security_end = 0x2fffffff
        wlan_intf_opcod e_ihv_start = 0x30000000
        wlan_intf_opcod e_ihv_end = 0x3fffffff
        End Enum
        >
        >
        Thanks in advance,
        >
        Toby.
        >

        Comment

        • Toby Webb

          #5
          Re: WLANAPI and OpCodes

          On 16 Sep, 14:20, "Bill McCarthy" <B...@localhost .comwrote:
          Hi Tony,
          >
          Those values you have there are wrong I beleive.  I would make the values as
          :
          >
          Enum WLAN_INTF_OPCOD E
             autoconf_start = &H0
             autoconf_enable d
             background_scan _enabled
             media_streaming _mode
             radio_state
             bss_type
             interface_state
             current_connect ion
             channel_number
             supported_infra structure_auth_ cipher_pairs
             supported_adhoc _auth_cipher_pa irs
             supported_count ry_or_region_st ring_list
             current_operati on_mode
             autoconf_end = &HFFFFFFF
             msm_start = &H10000100
             statistics
             rssi
             msm_end = &H1FFFFFFF
             security_start = &H20010000
             security_end = &H2FFFFFFF
             ihv_start = &H30000000
             ihv_end = &H3FFFFFFF
          End Enum
          >
          "Toby Webb" <toby.k.w...@go oglemail.comwro te in message
          >
          news:8921c449-e5a7-4fa0-919e-56598b8b0474@t5 4g2000hsg.googl egroups.com...
          >
          >
          >
          How can I convert the following code (from MSDN) to work in VB.NET
          (the opcodes are raising errors):
          >
          Public Enum WLAN_INTF_OPCOD E
                 wlan_intf_opcod e_autoconf_star t = 0x000000000
                 wlan_intf_opcod e_autoconf_enab led = 0x0fffffff
                 wlan_intf_opcod e_background_sc an_enabled = 0x0fffffff
                 wlan_intf_opcod e_media_streami ng_mode = 0x0fffffff
                 wlan_intf_opcod e_radio_state = 0x0fffffff
                 wlan_intf_opcod e_bss_type = 0x0fffffff
                 wlan_intf_opcod e_interface_sta te = 0x0fffffff
                 wlan_intf_opcod e_current_conne ction = 0x0fffffff
                 wlan_intf_opcod e_channel_numbe r = 0x0fffffff
                 wlan_intf_opcod e_supported_inf rastructure_aut h_cipher_pairs =
          0x0fffffff
                 wlan_intf_opcod e_supported_adh oc_auth_cipher_ pairs =
          0x0fffffff
                 wlan_intf_opcod e_supported_cou ntry_or_region_ string_list=
          0x0fffffff
                 wlan_intf_opcod e_current_opera tion_mode = 0x0fffffff
                 wlan_intf_opcod e_supported_saf e_mode = 0x0fffffff
                 wlan_intf_opcod e_certified_saf e_mode = 0x0fffffff
                 wlan_intf_opcod e_autoconf_end = 0x0fffffff
                 wlan_intf_opcod e_msm_start = 0x10000100
                 wlan_intf_opcod e_statistics = 0x1fffffff
                 wlan_intf_opcod e_rssi = 0x1fffffff
                 wlan_intf_opcod e_msm_end = 0x1fffffff
                 wlan_intf_opcod e_security_star t = 0x20010000
                 wlan_intf_opcod e_security_end = 0x2fffffff
                 wlan_intf_opcod e_ihv_start = 0x30000000
                 wlan_intf_opcod e_ihv_end = 0x3fffffff
             End Enum
          >
          Thanks in advance,
          >
          Toby.- Hide quoted text -
          >
          - Show quoted text -
          Thanks Bill, do you know how the import code should read? I currently
          have:

          <DllImport("wla napi", setlasterror:=T rue)>_
          Public Shared Function WlanQueryInterf ace(_
          ByVal clientHandle As IntPtr,_
          ByVal pInterfaceGuid As Guid,_
          ByVal OpCode As WLAN_INTF_OPCOD E,_
          ByVal pReserved As IntPtr,_
          ByRef pdwDataSize As IntPtr,_
          ByRef ppData As IntPtr)_
          As UInteger
          End Function

          Comment

          • Bill McCarthy

            #6
            Re: WLANAPI and OpCodes


            "Toby Webb" <toby.k.webb@go oglemail.comwro te in message
            news:8405b13a-4598-4bd4-850c-eec5b78a51c5@34 g2000hsh.google groups.com...
            >
            >Thanks Bill, do you know how the import code should read? I currently
            >have:

            I make it as :


            ' DWORD WINAPI
            ' WlanQueryInterf ace(
            ' __in HANDLE hClientHandle,
            ' __in CONST GUID *pInterfaceGuid ,
            ' __in WLAN_INTF_OPCOD E OpCode,
            ' __reserved PVOID pReserved,
            ' __out PDWORD pdwDataSize,
            ' __deref_out_bco unt(*pdwDataSiz e) PVOID *ppData,
            ' __out_opt PWLAN_OPCODE_VA LUE_TYPE pWlanOpcodeValu eType
            ');



            Declare Function WlanQueryInterf ace Lib "wlanapi" ( _
            ByVal clientHandle As IntPtr, _
            ByRef pInterfaceGuid As Guid, _
            ByVal OpCode As WLAN_INTF_OPCOD E, _
            ByVal pReserved As IntPtr, _
            ByRef pdwDataSize As Int32, _
            ByRef ppData As IntPtr, _
            ByRef pWlanOpcodeValu eType As Int32) _
            As UInt32


            Note the second parameter pInterfaceGuid I think needs to be a pointer to
            the GUID, hence I changed it to ByRef, and you didn't have the last
            parameter, pWlanOpcodeValu eType





            Comment

            Working...