I’m trying to extend the C# listadapters example to display information on WAN links, but the RAS_LINKS structure returned by GetRasLinks always has nNumberOfLinks of 0. I’m adding the following code inside the adapter loop, after it prints the adapter mode.
RAS_LINKS pLinks = new RAS_LINKS();
GCHandle.Alloc(pLinks);
Ndisapi.GetRasLinks(hNdisapi, AdList.m_nAdapterHandle, ref pLinks);
Console.WriteLine("RAS_LINKS:" + pLinks.nNumberOfLinks);
The C++ example returns the proper information on links when i plug in a 3g card, but from C# it always tells me nothing is there. To get this to run, I did have to change RAS_LINKS_MAX to 32 so that the runtime would stop complaining about too large a data structure to marshal, so maybe that has something to do with it?