Ejemplo n.º 1
0
            /// <summary>
            /// Gets the profile's XML specification.
            /// </summary>
            /// <param name="profileName">The name of the profile.</param>
            /// <param name="unencryptedPassword">Whether the password should be unencrypted in the returned XML. By default this is false and the password is left encrypted.</param>
            /// <returns>The XML document.</returns>
            public string GetProfileXml(string profileName, bool unencryptedPassword = true)
            {
                var flags = unencryptedPassword ? WlanProfileFlags.GetPlaintextKey : WlanProfileFlags.None;

                Wlan.ThrowIfError(
                    WlanApi.WlanGetProfile(
                        client.clientHandle, info.interfaceGuid, profileName, IntPtr.Zero, out var profileXmlPtr, out flags, out _));

                try
                {
                    return(Marshal.PtrToStringUni(profileXmlPtr));
                }
                finally
                {
                    WlanApi.WlanFreeMemory(profileXmlPtr);
                }
            }