Ejemplo n.º 1
0
        public RASDIALEXTENSIONS Build(RasDialContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var rasDialExtensions = structFactory.Create <RASDIALEXTENSIONS>();

            RasDialerOptions options;

            if ((options = context.Options) != null)
            {
                if (options.Owner != null)
                {
                    rasDialExtensions.hwndParent = options.Owner.Handle;
                }

                rasDialExtensions.dwfOptions = BuildOptions();
            }

            if (getEapUserData.TryUnsafeGetEapUserData(IntPtr.Zero, context.EntryName, context.PhoneBookPath, out var eapInfo))
            {
                rasDialExtensions.RasEapInfo = eapInfo;
            }

            return(rasDialExtensions);
        }
Ejemplo n.º 2
0
        private RASCREDENTIALS CreateStructure(RASCM mask)
        {
            var rasCredentials = structFactory.Create <RASCREDENTIALS>();

            rasCredentials.dwMask = mask;

            return(rasCredentials);
        }
        private RASCONNSTATUS GetConnectionStatusByHandle(IntPtr handle)
        {
            var rasConnStatus = structFactory.Create <RASCONNSTATUS>();

            var ret = api.RasGetConnectStatus(handle, ref rasConnStatus);

            if (ret != SUCCESS)
            {
                throw exceptionPolicy.Create(ret);
            }

            return(rasConnStatus);
        }
        private RAS_STATS GetConnectionStatisticsByHandle(IntPtr handle)
        {
            var statistics = structFactory.Create <RAS_STATS>();

            var ret = api.RasGetConnectionStatistics(handle, ref statistics);

            if (ret != SUCCESS)
            {
                throw exceptionPolicy.Create(ret);
            }

            return(statistics);
        }
Ejemplo n.º 5
0
        public RASDIALPARAMS Build(RasDialContext context)
        {
            var rasDialParams = structFactory.Create <RASDIALPARAMS>();

            rasDialParams.szEntryName = context.EntryName;

            var ret = api.RasGetEntryDialParams(context.PhoneBookPath, ref rasDialParams, out _);

            if (ret != SUCCESS)
            {
                throw exceptionPolicy.Create(ret);
            }

            ConfigureOptions(context.Options, ref rasDialParams);
            ConfigureCredentials(context.Credentials, ref rasDialParams);

            return(rasDialParams);
        }
Ejemplo n.º 6
0
        public RASDIALEXTENSIONS Build(RasDialContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var rasDialExtensions = structFactory.Create <RASDIALEXTENSIONS>();

            RasDialerOptions options;

            if ((options = context.Options) != null)
            {
                if (options.Owner != IntPtr.Zero)
                {
                    rasDialExtensions.hwndParent = options.Owner;
                }

                rasDialExtensions.dwfOptions = BuildOptions(options);
            }

            return(rasDialExtensions);
        }