Search code examples
cwindowslinker-errorswindows-kernelwfp

Windows Filtering Platform - Unresolved External Symbols


I have writing a Windows Filtering Platform (WFP) kernel driver and I am trying to add some callouts.

I am using some FWPM_LAYER GUIDs, such as

FWPM_LAYER_OUTBOUND_TRANSPORT_V4
FWPM_LAYER_OUTBOUND_TRANSPORT_V6
FWPM_LAYER_ALE_AUTH_CONNECT_V4
FWPM_LAYER_ALE_AUTH_CONNECT_V6

However I am getting unresolved external symbols when using these.

Error   LNK2001 unresolved external symbol _FWPM_LAYER_OUTBOUND_TRANSPORT_V4
Error   LNK2001 unresolved external symbol _FWPM_LAYER_OUTBOUND_TRANSPORT_V6
Error   LNK2001 unresolved external symbol _FWPM_LAYER_ALE_AUTH_CONNECT_V4
Error   LNK2001 unresolved external symbol _FWPM_LAYER_ALE_AUTH_CONNECT_V6

I am using the following headers

#define NDIS61 1

#include <ntifs.h>
#include <ntddk.h>
#include <wdf.h>

#pragma warning(push)
#pragma warning(disable: 4201)
#include <fwpsk.h>
#pragma warning(pop)

#include <fwpmk.h>
#include <fwpvi.h>
#include <guiddef.h>
#include <initguid.h>
#include <devguid.h>

And I am linking against the following additional dependencies.

$(DDK_LIB_PATH)wdmsec.lib
$(DDK_LIB_PATH)fwpkclnt.lib

I am unable to find what I am missing, it appears that those GUIDs are located within fwmpk.h which is in the Fwpkclnt.lib library, which I am building against.


Solution

  • As answered by RbMm in the comments, the solution was to move the #include <initguid.h> statement before the include <fwmpk.h> statement.

    #define NDIS61 1
    
    #include <ntifs.h>
    #include <ntddk.h>
    #include <wdf.h>
    
    #include <guiddef.h>
    #include <initguid.h>
    #include <devguid.h>
    
    #pragma warning(push)
    #pragma warning(disable: 4201)
    #include <fwpsk.h>
    #pragma warning(pop)
    
    #include <fwpmk.h>
    #include <fwpvi.h>