my operation system is win10 1903 x64,i uninstall npcap-0.9982,then install npcap-0.991, if i use the flowing p/invoke code, call the pcap_findalldevs function is in the class named SafeNativeMethods
result = SafeNativeMethods.pcap_findalldevs(ref devicePtr,
errorBuffer);
the return devicePtr alway be IntPtr.Zero,this makes a error
then i move SafeNativeMethods.pcap_findalldev function method to the same class where i call that,like this following code
[DllImport(SafeNativeMethods.PCAP_DLL, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
private static extern int pcap_findalldevs(ref IntPtr devicelist,
StringBuilder errbuf);
private static List<WinPcapDevice> Devices(string rpcapString,
RemoteAuthentication remoteAuthentication)
{
var retval = new List<WinPcapDevice>();
IntPtr devicePtr=IntPtr.Zero ;
StringBuilder errorBuffer = new StringBuilder(Pcap.PCAP_ERRBUF_SIZE);
int result = pcap_findalldevs(ref devicePtr,
errorBuffer);
}
it works allright with no error,and devicePtr return is not IntPtr.Zero ,this flowing code run successfully
but i still caught a error when i start the same exe in iis like this
the exe in run in no gui window ,till in run to this code pcap_findalldevs , this devicePtr return is IntPtr.Zero agin
i do not known is there some thing error with p/invoke or iis config or wpcap.dll
my operation system is win10 1903 x64,i uninstall npcap-0.9982,then install npcap-0.991, if i use the flowing p/invoke code, call the pcap_findalldevs function is in the class named SafeNativeMethods
the return devicePtr alway be IntPtr.Zero,this makes a error then i move SafeNativeMethods.pcap_findalldev function method to the same class where i call that,like this following code
it works allright with no error,and devicePtr return is not IntPtr.Zero ,this flowing code run successfully but i still caught a error when i start the same exe in iis like this
the exe in run in no gui window ,till in run to this code pcap_findalldevs , this devicePtr return is IntPtr.Zero agin i do not known is there some thing error with p/invoke or iis config or wpcap.dll