예제 #1
0
        /// <summary>
        /// Sets the profile.
        /// </summary>
        /// <param name="flags">The flags to set on the profile.</param>
        /// <param name="profileXml">The XML representation of the profile. On Windows XP SP 2, special care should be taken to adhere to its limitations.</param>
        /// <param name="overwrite">If a profile by the given name already exists, then specifies whether to overwrite it (if <c>true</c>) or return an error (if <c>false</c>).</param>
        /// <returns>The resulting code indicating a success or the reason why the profile wasn't valid.</returns>
        public WlanReasonCode SetProfileXml(WlanProfileFlags flags, string profileXml, bool overwrite)
        {
            WlanReasonCode reasonCode;

            Util.ThrowIfError(
                NativeMethods.WlanSetProfile(client.clientHandle, Guid, flags, profileXml, null, overwrite, IntPtr.Zero, out reasonCode));
            return(reasonCode);
        }
예제 #2
0
        /// <summary>
        /// Sets the profile.
        /// </summary>
        /// <param name="flags">The flags to set on the profile.</param>
        /// <param name="profileXml">The XML representation of the profile. On Windows XP SP 2, special care should be taken to adhere to its limitations.</param>
        /// <param name="overwrite">If a profile by the given name already exists, then specifies whether to overwrite it (if <c>true</c>) or return an error (if <c>false</c>).</param>
        /// <returns>The resulting code indicating a success or the reason why the profile wasn't valid.</returns>
        public WlanReasonCode SetProfile(WlanProfileFlags flags, string profileXml, bool overwrite)
        {
            WlanReasonCode reasonCode;

            WlanInterop.ThrowIfError(WlanInterop.WlanSetProfile(client.clientHandle, info.interfaceGuid, flags, profileXml, null, overwrite, IntPtr.Zero, out reasonCode));

            return(reasonCode);
        }
예제 #3
0
파일: WirelessApi.cs 프로젝트: radtek/WCF
 public static extern int WlanGetProfile(
     [In] IntPtr clientHandle,
     [In, MarshalAs(UnmanagedType.LPStruct)] Guid interfaceGuid,
     [In, MarshalAs(UnmanagedType.LPWStr)] string profileName,
     [In] IntPtr pReserved,
     [Out] out IntPtr profileXml,
     [Out, Optional] out WlanProfileFlags flags,
     [Out, Optional] out WlanAccess grantedAccess);
예제 #4
0
            /// <summary>
            /// Adds a profile.
            /// </summary>
            /// <param name="flags">The flags to set on the profile.</param>
            /// <param name="profileXml">The XML representation of the profile.</param>
            /// <param name="overwrite">Overwrite if a profile of the same name exists?</param>
            /// <returns>Success (0) or an error, see native reason code identifiers (<c>WLAN_REASON_CODE_xxx</c> identifiers).
            public int SetProfile(WlanProfileFlags flags, string profileXml, bool overwrite)
            {
                int reasonCode;

                SystemInterface.WlanSetProfile(client.clientHandle, info.interfaceGuid, flags, profileXml, null,
                                               overwrite, IntPtr.Zero, out reasonCode);
                return(reasonCode);
            }
예제 #5
0
 internal static extern int WlanSaveTemporaryProfile(
     [In] IntPtr hClientHandle,
     [In, MarshalAs(UnmanagedType.LPStruct)] Guid interfaceGuid,
     [In, MarshalAs(UnmanagedType.LPWStr)] string strProfileName,
     [In, Optional, MarshalAs(UnmanagedType.LPWStr)] string strAllUserProfileSecurity,
     [In] WlanProfileFlags dwFlags,
     [In] bool bOverWrite,
     [In, Out] IntPtr pReserved
     );
예제 #6
0
 internal static extern int WlanGetProfile(
     [In] IntPtr hClientHandle,
     [In, MarshalAs(UnmanagedType.LPStruct)] Guid interfaceGuid,
     [In, MarshalAs(UnmanagedType.LPWStr)] string strProfileName,
     [In, Out] IntPtr pReserved,
     [Out] out IntPtr strProfileXml,
     [Out, Optional] out WlanProfileFlags dwFlags,
     [Out, Optional] out WlanAccess pdwGrantedAccess
     );
예제 #7
0
파일: WirelessApi.cs 프로젝트: radtek/WCF
 public static extern int WlanSetProfile(
     [In] IntPtr clientHandle,
     [In, MarshalAs(UnmanagedType.LPStruct)] Guid interfaceGuid,
     [In] WlanProfileFlags flags,
     [In, MarshalAs(UnmanagedType.LPWStr)] string profileXml,
     [In, Optional, MarshalAs(UnmanagedType.LPWStr)] string allUserProfileSecurity,
     [In] bool overwrite,
     [In] IntPtr pReserved,
     [Out] out WlanReasonCode reasonCode);
예제 #8
0
 internal static extern int WlanSetProfile(
     [In] IntPtr hClientHandle,
     [In, MarshalAs(UnmanagedType.LPStruct)] Guid interfaceGuid,
     [In] WlanProfileFlags dwFlags,
     [In, MarshalAs(UnmanagedType.LPWStr)] string strProfileXml,
     [In, MarshalAs(UnmanagedType.LPWStr)] string strAllUserProfileSecurity,
     [In] bool bOverwrite,
     [In, Out] IntPtr pReserved,
     [Out] out WlanReasonCode dwReasonCode
     );
예제 #9
0
            /// <summary>XML specification of an existing profile</summary>
            /// <param name="profileName">The name of the profile.</param>
            /// <returns>The XML document.</returns>
            public string GetProfileXml(string profileName)
            {
                IntPtr           profileXmlPtr;
                WlanProfileFlags flags = WlanProfileFlags.GetPlaintextKey;
                int grantedAccess;

                SystemInterface.WlanGetProfile(client.clientHandle, info.interfaceGuid, profileName, IntPtr.Zero,
                                               out profileXmlPtr, out flags, out grantedAccess);

                return(Marshal.PtrToStringUni(profileXmlPtr));
            }
예제 #10
0
        /// <summary>
        /// Gets the profile's XML specification. Request Key unencrypted in plaintext.
        /// </summary>
        /// <param name="profileName">The name of the profile.</param>
        /// <returns>The XML document.</returns>
        public string GetProfileXmlUnencrypted(string profileName)
        {
            IntPtr           profileXmlPtr;
            WlanProfileFlags flags  = WlanProfileFlags.GetPlaintextKey;           // | WlanProfileFlags.User;
            WlanAccess       access = WlanAccess.ReadAccess;

            WlanInterop.ThrowIfError(WlanInterop.WlanGetProfile(client.clientHandle, info.interfaceGuid, profileName, IntPtr.Zero, out profileXmlPtr, out flags, out access));
            try
            {
                return(Marshal.PtrToStringUni(profileXmlPtr));
            }
            finally
            {
                WlanInterop.WlanFreeMemory(profileXmlPtr);
            }
        }
예제 #11
0
        /// <summary>
        /// Gets the profile's XML specification.
        /// </summary>
        /// <param name="profileName">The name of the profile.</param>
        /// <param name="isProtected">If True KeyMaterial Will show crypted(It can be use after windows 7)</param>
        /// <returns>The XML document.</returns>
        public string GetProfileXml(string profileName, bool isProtected)
        {
            IntPtr profileXmlPtr;
            //It Only Work After Windows 7 (GetPlaintextKey)
            WlanProfileFlags flags = isProtected ? WlanProfileFlags.AllUser : WlanProfileFlags.GetPlaintextKey;
            WlanAccess       access;

            WlanInterop.ThrowIfError(WlanInterop.WlanGetProfile(_client.ClientHandle, _info.interfaceGuid, profileName, IntPtr.Zero, out profileXmlPtr, ref flags, out access));

            try
            {
                return(Marshal.PtrToStringUni(profileXmlPtr));
            }
            finally
            {
                WlanInterop.WlanFreeMemory(profileXmlPtr);
            }
        }
예제 #12
0
		/// <summary>
		/// Sets the profile.
		/// </summary>
		/// <param name="flags">The flags to set on the profile.</param>
		/// <param name="profileXml">The XML representation of the profile. On Windows XP SP 2, special care should be taken to adhere to its limitations.</param>
		/// <param name="overwrite">If a profile by the given name already exists, then specifies whether to overwrite it (if <c>true</c>) or return an error (if <c>false</c>).</param>
		/// <returns>The resulting code indicating a success or the reason why the profile wasn't valid.</returns>
		public WlanReasonCode SetProfile(WlanProfileFlags flags, string profileXml, bool overwrite)
		{
			WlanReasonCode reasonCode;

			WlanInterop.ThrowIfError(WlanInterop.WlanSetProfile(client.clientHandle, info.interfaceGuid, flags, profileXml, null, overwrite, IntPtr.Zero, out reasonCode));

			return reasonCode;
		}