npcap icon indicating copy to clipboard operation
npcap copied to clipboard

Packet32.h should include <sal.h>

Open guyharris opened this issue 3 years ago • 1 comments

As of a22a54788a7cb8ad6ba984a076316f9961018e22, Packet32.h uses SAL annotations.

This caused MinGW-w32 builds in AppVeyor to fail for libpcap with the latest Npcap SDK, as the SAL annotations weren't defined:

C:/projects/libpcap/Win32/npcap-sdk-1.13/Include/Packet32.h:422:29: error: unknown type name '_Post_invalid_'
  VOID PacketFreePacket(_In_ _Post_invalid_ LPPACKET lpPacket);
                             ^~~~~~~~~~~~~~

I'm not sure why it didn't complain about _In_.

(Don't worry about the other warnings; that's some sort of MinGW-w32 issue - the compiler doesn't, for example, like "%z[doux]" formats for some reason. I'd say "the 20th century called, they want their C language back, but %z is, as I remember, in C99, so it's more like "1990 called, they want their C language back"....)

I don't know which version of MinGW-w32 added sal.h, but if you include it, that will at least cause the build to fail Really Fast if it's not going to work. If so, it may be necessary to try to test the version of MinGW-w32 and, if it's so old that it doesn't have sal.h, instead of including it just #define the relevant SAL annotations to an empty string...

...unless it's not worth the effort and just saying "not supported" for building with MinGW-w32 before the addition of sal.h.

guyharris avatar Jul 27 '22 11:07 guyharris

Thanks for the note, @guyharris. We're working hard on the upcoming Npcap release right now but are putting this on our roadmap to investigate for next SDK release.

fyodor avatar Aug 10 '22 18:08 fyodor