Re: Re: Getting RAS_LINKS info from C#

Home Forums Discussions Support Portal Getting RAS_LINKS info from C# Re: Re: Getting RAS_LINKS info from C#

#6962

libzhark
Participant

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);