Exemplo n.º 1
0
        internal static IntPtr Dial(string entryName, string user, string pwd, Action <uint, RasConnectionState, uint, uint> action)
        {
            var radDialParams = new RASDIALPARAMS
            {
                size      = Marshal.SizeOf <RASDIALPARAMS>(),
                domain    = "",
                userName  = user,
                password  = pwd,
                entryName = entryName,
            };

            var rasDialExtensions = new RASDIALEXTENSIONS
            {
                size            = Marshal.SizeOf <RASDIALEXTENSIONS>(),
                devSpecificInfo = new RASDEVSPECIFICINFO
                {
                    size = Marshal.SizeOf <RASDEVSPECIFICINFO>(),
                }
            };
            var callback = new VpnNative.RasDialFunc2((a, b, c, messageId, connectionState, error, extendedError) =>
            {
                action(messageId, connectionState, error, extendedError);
                return(true);
            });

            PinCallback(callback);

            Checked("RasDial", VpnNative.RasDial(ref rasDialExtensions, null, ref radDialParams, 2, callback, out var handle));

            return(handle);
        }
Exemplo n.º 2
0
 public static extern uint RasDial(ref RASDIALEXTENSIONS lpRasDialExtensions, string lpszPhonebook, ref RASDIALPARAMS lpRasDialParams, int dwNotifierType, Delegate lpvNotifier, out IntPtr lphRasConn);