Skip to content

pcap_findalldevs crashes - only when under Visual Studio debugger #393

@qortex

Description

@qortex

When building a simple test example and running it under Win10 inside Visual Studio debugger, I get a crash on calling "pcap_findalldevs" or "pcap_findalldevs_ex". When running outside Visual Studio debugger, no crash and works as expected.

Not related to dll load as I have no such crash when trying to call other functions from npcap (such as pcap_remoteact_cleanup or pcap_wsockinit priori to the call, just for testing purpose). Same behaviour with delay dll loading or loading at startup.

Exception thrown at 0xF5203C2A in ***.exe: 0xC0000008: An invalid handle was specified.

From stack trace and debug symbols, I understand it occurs on line 593 of AdInfo.cpp, where ppItems is null and is dereferenced - only when executed inside Visual Studio debugger.

ntdll.dll!_NtClose@4() Unknown
KernelBase.dll!RegCloseKey() Unknown
Packet.dll!PacketGetAddressesFromRegistry(const char * AdapterNameA, _NPF_IF_ADDRESS_ITEM * * ppItems) Line 593 C++
Packet.dll!PacketAddAdapterNPF(char * AdName, unsigned int flags) Line 1282 C++
Packet.dll!PacketGetAdaptersNPF() Line 1477 C++
Packet.dll!PacketPopulateAdaptersInfoList() Line 2265 C++
Packet.dll!PacketGetAdapterNames(char * pStr, unsigned long * BufferSize) Line 4606 C++
wpcap.dll!0fb78d86() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for wpcap.dll]
wpcap.dll!0fb791a4() Unknown
wpcap.dll!0fb74847() Unknown
[External Code]

Known issue? What debug info would be useful to fix?
VS2017 15.6.4 (latest)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions