public string GetProfileXml(string profileName) { IntPtr profileXml; Wlan.WlanProfileFlags flags; Wlan.WlanAccess grantedAccess; Wlan.ThrowIfError(Wlan.WlanGetProfile(this.client.clientHandle, this.info.interfaceGuid, profileName, IntPtr.Zero, out profileXml, out flags, out grantedAccess)); try { return(Marshal.PtrToStringUni(profileXml)); } finally { Wlan.WlanFreeMemory(profileXml); } }