Am 24.05.2017 um 13:37 schrieb Bruno Jesus 00cpxxx@gmail.com:
Hi, this seems to be the ASCII version of GetAdapterIndex, can't you call getInterfaceIndexByName and avoid the new #include?
I’m not sure what you mean by "ASCII version“. getInterfaceIndexByName also accepts a const char * rather than a WCHAR *. It seems to be the non-Microsoft version of getInterfaceIndexByName though.
getInterfaceIndexByName is just a wrapper around if_nametoindex. If I wrap IPHLP_if_nametoindex to getInterfaceByName I’d simply undo all the work getInterfaceByName does (or well, the part where it returns ERROR_INVALID_DATA instead of 0. I’m not sure if avoiding the #include is worth that. I’ll send a version that does that in a bit, you can then sign off on the one you prefer :-)