I'm trying to use GetIpAddrTable
(https://learn.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-getipaddrtable) to gather the interface addresses but I'm struggling to understand the response for dwBCastAddr
.
For my network the broadcast address for the interface should be 192.168.1.255
but all that dwBCastAddr
returns is 1
and I have no idea what I'm supposed to do with that.
The documentation for the data structure (https://learn.microsoft.com/en-us/windows/win32/api/ipmib/ns-ipmib-mib_ipaddrrow_w2k) says the following:
dwBCastAddr
Type: DWORD
The broadcast address in network byte order. A broadcast address is typically >the IPv4 address with the host portion set to either all zeros or all ones.
The proper value for this member is not returned by the GetIpAddrTable function.
What are they trying to say here?
This is the line used to get the broadcast address:
IPAddr.S_un.S_addr = (u_long)pIPAddrTable->table[i].dwBCastAddr;
I'm just trying to figure out how to get 192.168.1.255 out of this.
Any help would be appreciated.