예제 #1
0
 internal static extern int WlanSetAutoConfigParameter(
     [In] IntPtr hClientHandle,
     [In] WlanAutoConfOpcode OpCode,
     [In] uint dwDataSize,
     [In] IntPtr pData,
     [In, Out] IntPtr pReserved
     );
예제 #2
0
            private void SetAutoConfigParameter(WlanAutoConfOpcode opcode, object value)
            {
                int    dataSize = Marshal.SizeOf(value);
                IntPtr data     = Marshal.AllocHGlobal(dataSize);

                try {
                    switch (opcode)
                    {
                    case WlanAutoConfOpcode.ShowDeniedNetworks:
                    case WlanAutoConfOpcode.OnlyUseGroupProfilesForAllowedNetworks:
                    case WlanAutoConfOpcode.AllowExplicitCredentials:
                    case WlanAutoConfOpcode.AllowVirtualStationExtensibility:
                        if (!(value is bool))
                        {
                            throw new ArgumentException();
                        }
                        Marshal.WriteInt32(data, Convert.ToInt32(value));
                        break;

                    case WlanAutoConfOpcode.BlockPeriod:
                        if (!(value is uint))
                        {
                            throw new ArgumentException();
                        }
                        Marshal.WriteInt32(data, Convert.ToInt32(value));
                        break;

                    default:
                        throw new ArgumentException();
                    }
                    Util.ThrowIfError(NativeMethods.WlanSetAutoConfigParameter(client.clientHandle, opcode, (uint)dataSize, data, IntPtr.Zero));
                } finally {
                    Marshal.FreeHGlobal(data);
                }
            }
예제 #3
0
            private ValueType QueryAutoConfigParameter(WlanAutoConfOpcode opcode)
            {
                uint   dataSize;
                IntPtr data;
                WlanOpcodeValueType valueType;

                Util.ThrowIfError(NativeMethods.WlanQueryAutoConfigParameter(client.clientHandle, opcode, IntPtr.Zero, out dataSize, out data, out valueType));
                ValueType value = null;

                switch (opcode)
                {
                case WlanAutoConfOpcode.ShowDeniedNetworks:
                case WlanAutoConfOpcode.OnlyUseGroupProfilesForAllowedNetworks:
                case WlanAutoConfOpcode.AllowExplicitCredentials:
                case WlanAutoConfOpcode.AllowVirtualStationExtensibility:
                    value = Convert.ToBoolean(Marshal.ReadInt32(data));
                    break;

                case WlanAutoConfOpcode.BlockPeriod:
                    value = Convert.ToUInt32(Marshal.ReadInt32(data));
                    break;

                case WlanAutoConfOpcode.PowerSetting:
                    value = (WlanPowerSetting)Marshal.PtrToStructure(data, typeof(WlanPowerSetting));
                    break;

                default:
                    value = Marshal.ReadInt32(data);
                    break;
                }
                return(value);
            }
예제 #4
0
 internal static extern int WlanQueryAutoConfigParameter(
     [In] IntPtr hClientHandle,
     [In] WlanAutoConfOpcode OpCode,
     [In, Out] IntPtr pReserved,
     [Out] out uint pdwDataSize,
     [Out] out IntPtr ppData,
     [Out, Optional] out WlanOpcodeValueType pWlanOpodeValueType
     );