Skip to content

Static wpcap.dll import prevents Windows binaries from launching without `Npcap #396

Description

@GyulyVGC

On Windows, build.rs emits cargo:rustc-link-lib=wpcap, producing a non-delay-loaded PE import for wpcap.dll.
Any binary depending on pcap therefore fails to load on Windows machines without Npcap — the OS rejects the process before main() runs (The code execution cannot proceed because wpcap.dll was not found).

This blocks several real deployment paths, most concretely winget: the validation infra runs the installed .exe in a clean Windows Sandbox without Npcap, so submissions get rejected with Validation-Executable-Error (see microsoft/winget-pkgs#369720 for Sniffnet).
It also prevents apps from showing a "please install Npcap" dialog at first launch, since they never reach main().

Repro: build any pcap-dependent binary for x86_64-pc-windows-msvc, run on a clean Windows box → loader error.

Proposed direction: switch from a static link to runtime dynamic loading of the capture library, with a structured error returned when the library isn't available.
All public APIs already return Result, so existing consumer code (Device::list()?,.unwrap_or_default(), etc.) would degrade gracefully without changes — and binaries would launch on any Windows machine regardless of whether Npcap is installed.

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