/// <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); }
/// <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); }
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);
/// <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); }
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 );
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 );
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);
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 );
/// <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)); }
/// <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); } }
/// <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); } }
/// <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; }