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

Home NTDEV

Before Posting...

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

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: https://www.osr.com/osr-learning-library/


error MSB6006: "link.exe" exited with code -1073740791. When run SDV (Static Driver Verifier)

mahendrashravanmahendrashravan Member Posts: 2

We migrated a KMDF USB project to Visual Studio Version 17.7.6 and SDK, WDK version 10.0.22621.2428.
Visual Studio Project is building successfully.

I have also ran Code Analysis on complete solution and it is also clean.

But When I run SDV(static driver verifier) from Visual Studio->Extensions->Driver->Launch Static Driver Verifier, it is failing at building stage.

Also, tried with Visual Studio developer command prompt, ran the command and it is failing at same stage.

D:\dev-area\workspace\baxter\WAUSB-31Oct23-SDV\Source\WaUsb>msbuild /t:sdv /p:Inputs="/check:*" "WaUsb.vcxproj" /p:Configuration=Release /p:Platform=x64
MSBuild version 17.7.2+d6990bcfa for .NET Framework
Build started 11/06/2023 7:03:58 PM.

Project "D:\dev-area\workspace\baxter\WAUSB-31Oct23-SDV\Source\WaUsb\WaUsb.vcxproj" on node 1 (sdv target(s)).
sdv:
  staticdv /check:*
  SDV: C:\Program Files (x86)\Windows Kits\10\TOOLS\SDV
  SMV: C:\Program Files (x86)\Windows Kits\10\TOOLS\SDV\smv
  SDVAP: C:\Program Files (x86)\Windows Kits\10\TOOLS\SDV\smv\analysisplugins\sdv
  Build environment: msbuild
  [INFO] Cleaning ...
  [INFO] Setting interceptor platform to x64
  [INFO] Setting platform to x86_amd64
  [INFO] Validating XML against schema: C:\Program Files (x86)\Windows Kits\10\TOOLS\SDV\smv\bin\Config.xsd
  [INFO] Running local scheduler with 12 threads
  [INFO] Driver type found: wdm
  [INFO] Currently reading and validating XML settings from C:\Program Files (x86)\Windows Kits\10\TOOLS\SDV\data\wdm\sdv-default.xml
  [INFO] Currently reading and validating XML settings from a user provided configuration in D:\dev-area\workspace\baxter\WAUSB-31Oct23-SDV\Source\WaUsb\sdv-default.xml

  [INFO] 1 of 2 jobs remaining. Avg(s): 13.00. Std.Dev(s): 0.00[FATAL ERROR] Unrecoverable error in InterceptedBuild stage.
C:\Program Files (x86)\Windows Kits\10\build\10.0.22621.0\windowsdriver.Sdv.targets(136,9): error MSB3073: The command "staticdv /check:*" exited with code -1. [D:\dev-area\workspace\baxter\WAUSB-31Oct23-SDV\So
urce\WaUsb\WaUsb.vcxproj]
Done Building Project "D:\dev-area\workspace\baxter\WAUSB-31Oct23-SDV\Source\WaUsb\WaUsb.vcxproj" (sdv target(s)) -- FAILED.


Build FAILED.

"D:\dev-area\workspace\baxter\WAUSB-31Oct23-SDV\Source\WaUsb\WaUsb.vcxproj" (sdv target) (1) ->
(sdv target) ->
  C:\Program Files (x86)\Windows Kits\10\build\10.0.22621.0\windowsdriver.Sdv.targets(136,9): error MSB3073: The command "staticdv /check:*" exited with code -1. [D:\dev-area\workspace\baxter\WAUSB-31Oct23-SDV\
Source\WaUsb\WaUsb.vcxproj]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:45.74

D:\dev-area\workspace\baxter\WAUSB-31Oct23-SDV\Source\WaUsb>

When analyzed smvbuild.log, I have found below link error.

Task "Link"
  C:\Program Files (x86)\Windows Kits\10\TOOLS\SDV\smv\bin\link.exe /ERRORREPORT:QUEUE /OUT:"D:\WAUSB\Sourcex64\Release\WaUsb.sys" /VERSION:"10.0" /INCREMENTAL:NO /NOLOGO /WX /SECTION:"INIT,d" USBD.lib "C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\km\x64\BufferOverflowFastFailK.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\km\x64\ntoskrnl.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\km\x64\hal.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\km\x64\wmilib.lib" /NODEFAULTLIB /MANIFEST:NO /DEBUG /PDB:"D:\WAUSB\Sourcex64\Release\WaUsb.pdb" /SUBSYSTEM:NATIVE,"10.00" /Driver /OPT:REF /OPT:ICF /ENTRY:"GsDriverEntry" /RELEASE /IMPLIB:"D:\WAUSB\Sourcex64\Release\WaUsb.lib" /MERGE:"_TEXT=.text;_PAGE=PAGE" /MACHINE:X64 /PROFILE /guard:cf /kernel /IGNORE:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221,4108,4088,4218,4218,4235 /osversion:10.0 /pdbcompress /debugtype:pdata x64\Release\WaUsb.res
  x64\Release\WAUsb.obj
  x64\Release\WAUSBCP2102.obj
  x64\Release\WAUSBCsq.obj
  x64\Release\WAUsbMsg.obj
  x64\Release\WAUsbPnp.obj
  x64\Release\WAUsbPwr.obj
  x64\Release\WAUsbUtils.obj

C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(1134,5): error MSB6006: "link.exe" exited with code -1073740791. [D:\WAUSB\Source\WaUsb\WaUsb.vcxproj]
Done executing task "Link" -- FAILED.
Done building target "Link" in project "WaUsb.vcxproj" -- FAILED.
Done Building Project "D:\WAUSB\Source\WaUsb\WaUsb.vcxproj" (rebuild target(s)) -- FAILED.

Build FAILED.

"D:\WAUSB\Source\WaUsb\WaUsb.vcxproj" (rebuild target) (1) ->
(Link target) -> 
  C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(1134,5): error MSB6006: "link.exe" exited with code -1073740791. [D:\WAUSB\Source\WaUsb\WaUsb.vcxproj]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:09.48

In additional, when running the link.exe from VS developer command prompt with the same cmd, it is showing below error:

D:\WAUSB\Source\WaUsb>"C:\Program Files (x86)\Windows Kits\10\TOOLS\SDV\smv\bin\link.exe" /ERRORREPORT:QUEUE /OUT:"D:\WAUSB\Sourcex64\Release\WaUsb.sys" /VERSION:"10.0" /INCREMENTAL:NO /NOLOGO /WX /SECTION:"INIT,d" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\km\x64\USBD.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\km\x64\BufferOverflowFastFailK.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\km\x64\ntoskrnl.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\km\x64\hal.lib" "C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\km\x64\wmilib.lib" /NODEFAULTLIB /MANIFEST:NO /DEBUG /PDB:"D:\WAUSB\Sourcex64\Release\WaUsb.pdb" /SUBSYSTEM:NATIVE,"10.00" /Driver /OPT:REF /OPT:ICF /ENTRY:"GsDriverEntry" /RELEASE /IMPLIB:"D:\WAUSB\Sourcex64\Release\WaUsb.lib" /MERGE:"_TEXT=.text;_PAGE=PAGE" /MACHINE:X64 /PROFILE /guard:cf /kernel /IGNORE:4198,4010,4037,4039,4065,4070,4078,4087,4089,4221,4108,4088,4218,4218,4235 /osversion:10.0 /pdbcompress /debugtype:pdata x64\Release\WaUsb.res
Failed to load Intercept.XML:
Could not find file 'c:\program files (x86)\windows kits\10\tools\sdv\smv\bin\%BE%-Intercept.xml'.
BufferOverflowFastFailK.lib(gs_driverentry.obj) : error LNK2019: unresolved external symbol DriverEntry referenced in function GsDriverEntry
D:\WAUSB\Sourcex64\Release\WaUsb.sys : fatal error LNK1120: 1 unresolved externals

I have followed the suggestions mentioned in link:
and is not helpful.

Can anyone help me on this?

Comments

  • Mark_RoddyMark_Roddy Member - All Emails Posts: 4,708

    Yes it is busted. No there doesn't appear to be a work around using the latest VS2022 and WDK . However the latest EWDK SDV does work. I'd suggest using that for now. By latest EWDK I mean 'Version co_release.22000.1' as that is the one I tested.

  • mahendrashravanmahendrashravan Member Posts: 2

    I have tried with latest EWDK version and tried running the msbuild command with sdv, I see below error.

    `

    D:\dev-area\workspace\baxter\WAUSB-31Oct23-SDV\Source\WaUsb>msbuild /t:sdv /p:Inputs="/check:* /debug" "WaUsb.vcxproj" /p:Configuration=Release /p:Platform=x64
    Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET Framework
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    Build started 11/09/2023 11:01:20 AM.
    Project "D:\dev-area\workspace\baxter\WAUSB-31Oct23-SDV\Source\WaUsb\WaUsb.vcxproj" on node 1 (sdv target(s)).
    sdv:
      staticdv /check:* /debug
      SDV: E:\Program Files\Windows Kits\10\TOOLS\SDV
      SMV: E:\Program Files\Windows Kits\10\TOOLS\SDV\smv
      SDVAP: E:\Program Files\Windows Kits\10\TOOLS\SDV\smv\analysisplugins\sdv
      Build environment: msbuild
    
      Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'file:///E:\Program Files\Windows Kits\10\TOOLS\SDV\smv\analysisplugins\sdv\bin\smvsdv.dll' or one of its dependencies. Operat
      ion is not supported. (Exception from HRESULT: 0x80131515) ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandbox
      ed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, pl
      ease enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
         --- End of inner exception stack trace ---
         at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throw
      OnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
         at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwO
      nFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
         at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean th
      rowOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
         at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecuri
      tyChecks, StackCrawlMark& stackMark)
         at System.Reflection.Assembly.LoadFrom(String assemblyFile)
         at SmvSkeleton.Program.ProcessArgs(String[] args)
         at SmvSkeleton.Program.Main(String[] args)
    E:\Program Files\Windows Kits\10\build\10.0.22621.0\windowsdriver.Sdv.targets(136,9): error MSB3073: The command "staticdv /check:* /debug" exited with code -532462766. [D:\dev-area\workspace\baxter\WAUSB-31Oct
    23-SDV\Source\WaUsb\WaUsb.vcxproj]
    Done Building Project "D:\dev-area\workspace\baxter\WAUSB-31Oct23-SDV\Source\WaUsb\WaUsb.vcxproj" (sdv target(s)) -- FAILED.
    
    
    Build FAILED.
    
    "D:\dev-area\workspace\baxter\WAUSB-31Oct23-SDV\Source\WaUsb\WaUsb.vcxproj" (sdv target) (1) ->
    (sdv target) ->
      E:\Program Files\Windows Kits\10\build\10.0.22621.0\windowsdriver.Sdv.targets(136,9): error MSB3073: The command "staticdv /check:* /debug" exited with code -532462766. [D:\dev-area\workspace\baxter\WAUSB-31O
    ct23-SDV\Source\WaUsb\WaUsb.vcxproj]
    
        0 Warning(s)
        1 Error(s)
    
    Time Elapsed 00:00:05.46
    

    `

  • Mark_RoddyMark_Roddy Member - All Emails Posts: 4,708

    Yeah you are running the very latest EWDK and it is also broken. It seems a new EDWK was released at the end of October.

    As I said earlier: "By latest EWDK I mean 'Version co_release.22000.1' as that is the one I tested." This EWDK release is the 'Windows 11, version 22H2 (updated May 2023) EWDK' here: https://learn.microsoft.com/en-us/legal/windows/hardware/enterprise-wdk-license-2022

    The latest EWDK (Download EWDK 10.0.22621.2428 (released October 24, 2023) with Visual Studio Build Tools) is VS2022 based the prior version is VS2019 based.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 13-17 May 2024 Live, Online
Developing Minifilters 1-5 Apr 2024 Live, Online
Internals & Software Drivers 11-15 Mar 2024 Live, Online
Writing WDF Drivers 26 Feb - 1 Mar 2024 Live, Online