Home › Forums › Discussions › Support › Getting RAS_LINKS info from C# › Re: Re: Getting RAS_LINKS info from C#
July 8, 2010 at 1:30 am
#6962
Ok, got it working. Need to change the declaration of GetRasLinks to:
[DllImport("ndisapi.dll")]
public static extern bool GetRasLinks(IntPtr hOpen, IntPtr hAdapter, IntPtr pLinks);
And then you can call it via:
IntPtr data = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(RAS_LINKS)));
Ndisapi.GetRasLinks(hNdisapi, AdList.m_nAdapterHandle, data);
RAS_LINKS RasLinks = (RAS_LINKS)Marshal.PtrToStructure(data, typeof(RAS_LINKS));
Console.WriteLine("RAS_LINKS:" + RasLinks.nNumberOfLinks);