WlanQueryInterface data enumeration
-
Hi! I want to get
wlan_intf_opcode_bss_type
usingWlanQueryInterface
function.My code:
PDOT11_BSS_TYPE wlanInterfaceState = NULL; DWORD wlanInterfaceStateSize = sizeof(wlanInterfaceState); DWORD interfaceStateResult; interfaceStateResult = WlanQueryInterface(hClient, &pIfInfo->InterfaceGuid, wlan_intf_opcode_bss_type, NULL, &wlanInterfaceStateSize, (PVOID *)&wlanInterfaceState, NULL); if (interfaceStateResult != ERROR_SUCCESS) { qDebug() << "Error"; } else { qDebug() << wlanInterfaceState; }
I get hexadecimal values. When I use
switch
to enumerate onwlanInterfaceState
I get error:error: C2450: switch expression of type 'PDOT11_BSS_TYPE' is illegal
DOT11_BSS_TYPE
enumeration syntax from MSDN:typedef enum _DOT11_BSS_TYPE { dot11_BSS_type_infrastructure = 1, dot11_BSS_type_independent = 2, dot11_BSS_type_any = 3 } DOT11_BSS_TYPE, *PDOT11_BSS_TYPE;
How to use these enumerations on
wlanInterfaceState
? Thanks. -
Hi! This forum is for Qt-specific stuff. For Microsoft's APIs, please see Microsoft's Documentation or your thread on stackoverflow.
-
Hi! I want to get
wlan_intf_opcode_bss_type
usingWlanQueryInterface
function.My code:
PDOT11_BSS_TYPE wlanInterfaceState = NULL; DWORD wlanInterfaceStateSize = sizeof(wlanInterfaceState); DWORD interfaceStateResult; interfaceStateResult = WlanQueryInterface(hClient, &pIfInfo->InterfaceGuid, wlan_intf_opcode_bss_type, NULL, &wlanInterfaceStateSize, (PVOID *)&wlanInterfaceState, NULL); if (interfaceStateResult != ERROR_SUCCESS) { qDebug() << "Error"; } else { qDebug() << wlanInterfaceState; }
I get hexadecimal values. When I use
switch
to enumerate onwlanInterfaceState
I get error:error: C2450: switch expression of type 'PDOT11_BSS_TYPE' is illegal
DOT11_BSS_TYPE
enumeration syntax from MSDN:typedef enum _DOT11_BSS_TYPE { dot11_BSS_type_infrastructure = 1, dot11_BSS_type_independent = 2, dot11_BSS_type_any = 3 } DOT11_BSS_TYPE, *PDOT11_BSS_TYPE;
How to use these enumerations on
wlanInterfaceState
? Thanks.@Cobra91151 said in WlanQueryInterface data enumeration:
typedef enum _DOT11_BSS_TYPE {
dot11_BSS_type_infrastructure = 1,
dot11_BSS_type_independent = 2,
dot11_BSS_type_any = 3
} DOT11_BSS_TYPE, *PDOT11_BSS_TYPE;Hi
You are using the pointer version for wlanInterfaceState
So using it in switch is considered illegal as it's not considered correct expressionattr(optional) switch ( condition ) statement
condition - any expression of integral or enumeration type, or of a class type contextually implicitly convertible to an integral or enumeration type, or a declaration of a single non-array variable of such type with a brace-or-equals initializer.
Since it points to enum, then you might need to dereference it
void MainWindow::on_pushButton_released() { PDOT11_BSS_TYPE t = NULL; // nullptr switch (*t) { // note the * case dot11_BSS_type_infrastructure: break; default: break; } } Ps. Need ofc to point to something valid besides NULL.
-
@Cobra91151 said in WlanQueryInterface data enumeration:
typedef enum _DOT11_BSS_TYPE {
dot11_BSS_type_infrastructure = 1,
dot11_BSS_type_independent = 2,
dot11_BSS_type_any = 3
} DOT11_BSS_TYPE, *PDOT11_BSS_TYPE;Hi
You are using the pointer version for wlanInterfaceState
So using it in switch is considered illegal as it's not considered correct expressionattr(optional) switch ( condition ) statement
condition - any expression of integral or enumeration type, or of a class type contextually implicitly convertible to an integral or enumeration type, or a declaration of a single non-array variable of such type with a brace-or-equals initializer.
Since it points to enum, then you might need to dereference it
void MainWindow::on_pushButton_released() { PDOT11_BSS_TYPE t = NULL; // nullptr switch (*t) { // note the * case dot11_BSS_type_infrastructure: break; default: break; } } Ps. Need ofc to point to something valid besides NULL.
Now it's working. Thank you very much.
-
Now it's working. Thank you very much.
@Cobra91151
Np. Please mark as Solved :)