2

bssid を使用して wifi ネットワークに接続しようとしていますが、利用可能なすべてのリンク (managedwifi のコードプレックスを含む) を調べました。私のコードは次のエラーを返しています:

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at WifiExample.Program.WlanConnect(IntPtr clientHandle, Guid& interfaceGuid, WlanConnectionParameters& connectionParameters, IntPtr pReserved)

時々、SEHException もスローします。

コード スニペットは次のとおりです。

try             
{
  WlanConnect(clientHandle, ref guidd, ref cp, IntPtr.Zero); 
} catch(AccessViolationException e) {
  Console.WriteLine();
  Console.WriteLine(e.GetBaseException());
}

これが呼び出す関数です。呼び出し元と同じファイルで宣言されています。

[DllImport("wlanapi.dll")]

    public static extern int WlanConnect(

    [In] IntPtr clientHandle,

    [In] ref System.Guid interfaceGuid,

    [In] ref Wlan.WlanConnectionParameters connectionParameters,

    IntPtr pReserved);

私のコードはこれに基づいています。

どうすればこれを解決できますか? どんな助けでも素晴らしいでしょう!

4

0 に答える 0