Beispiel #1
0
        public static NETINFOSTRUCT Prepare()
        {
            NETINFOSTRUCT ret = new NETINFOSTRUCT();

            ret.cbStructureSize = Marshal.SizeOf(typeof(NETINFOSTRUCT));
            return(ret);
        }
Beispiel #2
0
        public static NETINFOSTRUCT GetNetworkInfo(string provider)
        {
            var ret = NETINFOSTRUCT.Prepare();
            var res = WinApiWNET.WNetGetNetworkInformation(provider, ref ret);

            if (res != WinApiWNET.NO_ERROR)
            {
                throw new Win32Exception(res);
            }
            return(ret);
        }
Beispiel #3
0
 public static extern int WNetGetNetworkInformation
     ([MarshalAs(UnmanagedType.LPTStr)]
     string lpProvider,
     ref NETINFOSTRUCT lpNetInfoStruct);