I'm currently playing around with the win32api and I encountered a tiny problem while I was defining the WLAN_BSS_ENTRY structure.
When I did a "SizeOf()" on it in purebasic, it returned 351 instead of 360, which I got in Visual Studio, and after a bit of digging I learned about alignement in structures. and fixed it with "_PADDING_x.x" fields.
Finally, I just wanted to ask if this is the right way to do it since the "Align" keyword didn't 'work' properly in this case, and if the win32api would work with this structure ?
My implementation:
Code: Select all
Structure WLAN_BSS_ENTRY
dot11Ssid.DOT11_SSID
uPhyId.ULONG
dot11Bssid.DOT11_MAC_ADDRESS
_PADDING1.u
dot11BssType.DOT11_BSS_TYPE
dot11BssPhyType.DOT11_PHY_TYPE
lRssi.LONG
uLinkQuality.ULONG
bInRegDomain.BOOLEAN
_PADDING_2.BOOLEAN
usBeaconPeriod.USHORT
_PADDING_3.ULONG
ullTimestamp.ULONGLONG
ullHostTimestamp.ULONGLONG
usCapabilityInformation.USHORT
_PADDING_4.u
ulChCenterFrequency.ULONG
wlanRateSet.WLAN_RATE_SET
ulIeOffset.ULONG
ulIeSize.ULONG
EndStructure
Macro PWLAN_BSS_ENTRY : WLAN_BSS_ENTRY : EndMacro
Code: Select all
typedef struct _WLAN_BSS_ENTRY {
DOT11_SSID dot11Ssid;
ULONG uPhyId;
DOT11_MAC_ADDRESS dot11Bssid;
DOT11_BSS_TYPE dot11BssType;
DOT11_PHY_TYPE dot11BssPhyType;
LONG lRssi;
ULONG uLinkQuality;
BOOLEAN bInRegDomain;
USHORT usBeaconPeriod;
ULONGLONG ullTimestamp;
ULONGLONG ullHostTimestamp;
USHORT usCapabilityInformation;
ULONG ulChCenterFrequency;
WLAN_RATE_SET wlanRateSet;
// the beginning of the IE blob
// the offset is w.r.t. the beginning of the entry
ULONG ulIeOffset;
// size of the IE blob
ULONG ulIeSize;
} WLAN_BSS_ENTRY, * PWLAN_BSS_ENTRY;

