Managed Native WiFi를 사용하여 구현 된 코드가 있습니다. 화면에 표시하기 위해 연결된 네트워크의 프로필 정보를 얻는 데 사용됩니다. ThrowIfErrorVista/7에서 연결된 네트워크의 프로파일을 얻을 수 없습니다.
: 이 코드는 비스타/윈도우 7에서 실행되고 네트워크가 프로파일을 저장하지 않고 연결 때마다
// Start the wireless configuration service if it is stopped
startservice();
WlanClient client = new WlanClient();
bHasWiFi = false;
string strConnectionStatus = Constants.BlankString;
// Enumerate all interfaces
foreach (WlanClient.WlanInterface wlanIface in client.Interfaces)
{
bHasWiFi = true;
strConnectionStatus = wlanIface.InterfaceState.ToString();
// Check whether disconnected
if (strConnectionStatus == Constants.Disconnected)
{
IsConnected = false;
continue; //iterate to next interface if any
}
else
{
string strProfileName = wlanIface.CurrentConnection.profileName.ToString();
ErrorLog.WriteLogMsg("Connected Profile : " + strProfileName);
strDefaultNetwork = wlanIface.CurrentConnection.wlanAssociationAttributes.dot11BssType.ToString();
ErrorLog.WriteLogMsg("Connected Network Type : " + strDefaultNetwork);
if (strProfileName.Length != 0)
{
// Obtain Profile XML
string strXmlProfile = wlanIface.GetProfileXml(strProfileName);
// Read channel information if OS not Windows XP
if(strCurOS != Constants.WindowsXP)
intChannel = wlanIface.Channel;
// Extract profile information
GetNetworkProfileXML(ref IsConnected, ref strDefaultAuth, ref strDefaultSSID, ref strDefaultEnc, ref strDefaultKey, wlanIface, ref strXmlProfile);
// Process and store the profile data
GetDatfromProfiles(strDefaultNetwork, strDefaultAuth, strDefaultSSID, strDefaultEnc, strDefaultKey, strCurOS, intChannel);
}
else
{
ErrorLog.WriteLogMsg("Blank profile name");
IsConnected = false; // Set error flag
}
break;
}
}
// Error cases
if (!IsConnected || !bHasWiFi)
{
if (!bHasWiFi)
throw new Exception("Unable to enumerate the wireless interfaces");
else if (!IsConnected)
throw new Exception("WiFi is not configured or is disconnected");
}
}
는 방법은 GetProfileXMl 오류를
1시 18분 12초 방법을 던졌습니다
1시 18분 12초 로그 메시지는 : 요소
1시 18분 12초 스택 추적을 찾을 수 없습니다 NativeWifi.Wlan.ThrowIfError (INT32 win32ErrorCode) 에 NativeWifi.WlanClient.WlanI에서 nterface.GetProfileXml (문자열 프로파일 이름)
그리고는 사용자가 "자동 연결"을 선택하지 않는 경우 Vista 및 Windows 7에서, 프로파일 기반 시설에 대한 연결 중에 저장되지 않습니다 것으로 관찰되었다. 또한이 옵션은 연결 중에 사용자에게 제공되지 않으므로 임시 프로필은 저장되지 않습니다.
연결된 프로필이 저장되지 않은 경우에도 XML/세부 정보를 읽는 방법을 아는 사람이 있습니까? 미리 감사드립니다. 연결이 시작되기 전에 알림을 등록하면
정보 주셔서 감사합니다. 그러나 나는 그 회사에서 더 이상 일하지 않는다. 그러므로 나는 그곳에있는 누군가에게 당신이 준이 해결책을 연구하려고 노력할 것이다. :) – Vivek