Compilation linking issue on Unit test application created for filter driver

pbvinoth 6 Reputation points
2021-10-25T17:20:25.813+00:00

We have filter driver framework which is working fine while using it on hardware. We want to create the unit testing for our filter driver using the application programming. So as a first step we are calling the DriverEntry function from our application program and following is the configuration we used while compiling the source code.

Driver code configurations are:

  1. Platform Toolset : WindowsKernelModeDriver10.0
  2. Windows SDK is latest version from MSDN.(22000)
  3. Calling convention: __stdcall(/Gz)
  4. Compile As: Compile as C++ Module Code (/interface )

Application code configurations are:
5. Windows SDK version: 10.0 (latest installed version)
6. Platform Toolset: Visual Studio 2019 (v142)
7. Calling convension: __cdecl (/Gd)
8. Compile as : Compile as C++ Module Code (/interface )

Error detail:
unresolved external symbol "long __cdecl DriverEntry(struct _DRIVER_OBJECT *,struct _UNICODE_STRING *)" (?DriverEntry@@YAJPAU_DRIVER_OBJECT@@Pau _UNICODE_STRING@@@Z) referenced in function "void __cdecl DriverEntry(void)" (?DriverEntry@@YAXXZ)

Sample Code:

Application_code.cpp
include "driver.h"
NTSTATUS DriverEntry(In PDRIVER_OBJECT DriverObject, In PUNICODE_STRING RegistryPath);

void DriverEntry()
{
DriverEntry(&g_DriverObject, &registryPath);
}

Driver code
driver.h
NTSTATUS DriverEntry(In PDRIVER_OBJECT DriverObject, In PUNICODE_STRING RegistryPath);

driver.c
include "driver.h"

NTSTATUS DriverEntry(In PDRIVER_OBJECT DriverObject, In PUNICODE_STRING RegistryPath)
{
// Print message
DoTrace(TRACE_LEVEL_VERBOSE, TFLAG_ENTRYEXIT, "%!FUNC! Entry");
}

Could some one help on this issue, anything missing?

Regards,
Vinoth P B

Windows 10 Compatibility
Windows 10 Compatibility
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Compatibility: The extent to which hardware or software adheres to an accepted standard.
457 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 39,391 Reputation points
    2021-10-26T07:46:31.383+00:00

    Hello Pbvinoth,

    The issue is that you cant' mix the headers from the SDK with the ones from the DDK.

    So uncheck the box for inheriting parent settings. May then you have to add other directories from the DDK.

    Also note that you also can't mix libraries from the DDK with the ones from the SDK. So you have to do there almost the same.


    --If the reply is helpful, please Upvote and Accept as answer--

    0 comments No comments