Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results


More Info on Driver Writing and Debugging

The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.

Check out The OSR Learning Library at:

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

Driver link errors:linker appears to be looking for symbols with a prefix of "_" and suffix of "@8"

pjn4pjn4 Member Posts: 6

Why can't I find the correct symbols?

Sample Errors:
[email protected]
Hint on symbols that are defined and could potentially match:
mx.obj : error LNK2001: unresolved external symbol _NdisMSetMiniportAttributes

It seems that the linker wants a prefix of "_" and suffix of "@8" for all of the symbols when
using x86 it doesn't add either when using x64

mx.c ( driver file )
DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath){...}

cl is hashed (/cygdrive/d/Program Files/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29333/bin/Hostx86/x86/cl)

link is /cygdrive/d/Program Files/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29333/bin/Hostx86/x86/link

Everything is "c" there is no "c++"

Symbols in x86 Library
dumpbin -linkermember "D:/Program Files/Windows Kits/10//lib/10.0.20313.0/km/x86/ndis.lib" | grep NdisMSetMiniportAttributes
1E5D2 [email protected]
1E5D2 [email protected]
13D [email protected]
13D [email protected]
Symbols in x64 Library
dumpbin -linkermember "D:/Program Files/Windows Kits/10//lib/10.0.20313.0/km/x64/ndis.lib" | grep NdisMSetMiniportAttributes
1C51C NdisMSetMiniportAttibutes
1C51C __imp_NdisMSetMiniportAttributes
13D NdisMSetMiniportAttributes
13D __imp_NdisMSetMiniportAttributes

Compile Line
cl /FC /c /Zc:wchar_t- /Zp8 /Gy /W3 /EHs-c- /GR- /GF /GS /Zi /GL /Zi /wd4018 /wd4101 /wd4102 /wd4146 /wo4133 /wo4244 /wo4267 /Oxs -cbstring -I"D:/Program Files/Windows Kits/10//include/10.0.20313.0/km" -I"D:/Program Files/Windows Kits/10//include/10.0.20313.0/km/crt" -I"D:/Program Files/Windows Kits/10//include/10.0.20313.0/shared" -I../../common -I../../mcp/10g/zekit/fapi -I../../driver/common -I../../common -I../../mcp/10g -I. -DMAL_KERNEL -DMX_THREAD_SAFE=1 -DPOOL_NX_OPTIN=1 -I./../zlib -D_WIN32 -D_X86_ -DCONDITION_HANDLING=1 -DNT_INST=0 -DWIN32=100 -D_NT1X_=100 -DWINNT=1 -D_WIN32_WINNT=0x0601 -DWINVER=0x0601 -D_WIN32_IE=0x0700 -DWIN32_LEAN_AND_MEAN=1 -DDEVL=1 -D__BUILDMACHINE__=WinDDK -DNTDDI_VERSION=0x06020000 -DNDEBUG -DNDIS_MINIPORT_DRIVER -DBUILD_W2K=0 -DNDIS60_MINIPORT=1 -Dinline=_inline -DMYRI_DRIVER=myri_mva -I. -D__func__=FUNCTION -DNDIS_MINIPORT_DRIVER=1 -DNDIS60_MINIPORT=1 /c mx.c /Fomx.obj
Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29333 for x86

Linker Line
link /machine:i386 /MERGE:_PAGE=PAGE /MERGE:_TEXT=.text /SECTION:INIT,d /OPT:REF /OPT:ICF /IGNORE:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221,4108,4088,4218,4235 /INCREMENTAL:NO /FULLBUILD /release /debug /debugtype:cv /version:6.0 /osversion:6.0 /debug /ltcg /STACK:0x40000,0x1000 /driver /subsystem:native,6.00 /entry:GsDriverEntry "D:/Program Files/Windows Kits/10//lib/10.0.20313.0/km/x86/hal.lib" "D:/Program Files/Windows Kits/10//lib/10.0.20313.0/km/x86/ntoskrnl.lib" "D:/Program Files/Windows Kits/10//lib/10.0.20313.0/km/x86/BufferOverflowK.lib" "D:/Program Files/Windows Kits/10//lib/10.0.20313.0/km/x86/ntstrsafe.lib" "D:/Program Files/Windows Kits/10//lib/10.0.20313.0/km/x86/libcntpr.lib" "D:/Program Files/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29333/lib/x86/libcmt.lib" "D:/Program Files/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29333/lib/x86/oldnames.lib" "D:/Program Files/Windows Kits/10//lib/10.0.20313.0/km/x86/ndis.lib" -out:myri_mva.sys mx.obj mx_ntddk.obj mx_common.obj mx_instance.obj mx_lanai_command.obj kraw.obj mcp_wrapper_common.obj mx_lx.obj mx_lz.obj myri_ptp_common.obj myri_raw_ops.obj myri_mva_ops.obj mx_ether_common.obj adler32.obj crc32.obj infblock.obj infcodes.obj inffast.obj inflate.obj inftrees.obj infutil.obj trees.obj uncompr.obj zutil.obj in_cksum.obj myri_mva.RES
Microsoft (R) Incremental Linker Version 14.28.29333.0


  • Doron_HolanDoron_Holan Member - All Emails Posts: 10,598

    You have a mix of calling conventions, @N is appended for stdcall. You need to compile the entire code base and (any other libraries) with a consistent calling convection (cdecl is the default IIRC)

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 13,965

    Did you create the project file yourself? When compiling drivers, you want "stdcall" to be the default ("/Gz"), and I don't see that on the command line.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

  • pjn4pjn4 Member Posts: 6

    Thanks for the input, most of my project is compiled with /Gd but as you pointed out the ndis libraries required /Gz after making that change I'm all set. Thanks for your help.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!