SDV from EWDK (preview build)

(https://community.osr.com/discussion/280988/enterprise-wdk-seems-like-its-usable-now)

Hi

I have VS2019 preview and can run SDV w/ a preview WDK. I also have an EWDK of the same preview version, but am unable to run the SDV.
My cmd
MSBuild Bus.VcxProj /p:Configuration=Release /p:platform=x64 /t:sdv /property:Inputs=“/clean”
MSBuild Bus.VcxProj /p:Configuration=Release /p:platform=x64 /t:sdv /property:Inputs=“/check:default.sdv” /p:Inputs=“/lib:BusLib.vcxproj”

Just running this as it is form EWDK cannot find staticdv (.exe). I can compile/CA though (/t:build etc).

         MSBuild  Bus.VcxProj /p:Configuration=Release /p:platform=x64 /t:sdv /property:Inputs="/clean"
         Microsoft (R) Build Engine version 16.0.461+g6ff56ef63c for .NET Framework
         Copyright (C) Microsoft Corporation. All rights reserved.
          
         Project "C:\srcs\Bus.VcxProj" on node 1 (sdv target(s)).
         sdv:
         staticdv /clean
          'staticdv' is not recognized as an internal or external command, operable program or batch file.
         F:\Program Files\Windows Kits\10\build\windowsdriver.Sdv.targets(136,9): error MSB3073: The command "staticdv /clean" exited with code 9009. [C:\srcs\Bus.VcxProj]
         Done Building Project "C:\srcs\Bus.VcxProj" (sdv target(s)) -- FAILED.


So in my batch file I added StaticDV.exe path to PATH env - set path=%path%;%WdkContentRoot%Tools\sdv\bin
     Directory of F:\Program Files\Windows Kits\10\Tools\sdv\smv\analysisplugins\sdv\bin
     05/14/2019  10:26 AM             2,632 **staticdv.cmd**
     Directory of F:\Program Files\Windows Kits\10\Tools\sdv\bin
     05/14/2019  10:22 AM           110,592 **staticdv.exe**

Not sure if I should, but I also invoked VS env like mentioned @ https://docs.microsoft.com/en-us/windows-hardware/drivers/develop/creating-a-log-file-for-static-driver-verifier

It finds staticdv now, but fails like below. Please let me know if I need to do anything else to invoke SDV from EWDK.
I also have (VS 2019,) same WDK/SDK version of WDK installed on my machine and I can SDV through my local install not thru EWDK.
But when I local mount same version EWDK.iso to test it out, I am not able to SDV.
call "F:\Program Files\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.0
** Copyright (c) 2019 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: ‘x64’

         MSBuild  Bus.VcxProj /p:Configuration=Release /p:platform=x64 /t:sdv /property:Inputs="/clean"
         Microsoft (R) Build Engine version 16.0.461+g6ff56ef63c for .NET Framework
         Copyright (C) Microsoft Corporation. All rights reserved.
         
         Build started 7/20/2019 7:08:42 PM.
         Project "C:\srcs\Bus.VcxProj" on node 1 (sdv target(s)).
         sdv:
           staticdv /clean
           ---------------------------------------------------------------------
           Microsoft (R) Windows (R) Static Driver Verifier Version 4.0.1902.1
           Copyright (C) Microsoft Corporation.  All rights reserved.
           ---------------------------------------------------------------------
            SDV does not support this build environment.
            SDV encountered an error trying to detect/set the environment. Please ensure that a complete WDK is installed on the system.
            SDV exit code: 24
          F:\Program Files\Windows Kits\10\build\windowsdriver.Sdv.targets(136,9): error MSB3073: The command "staticdv /clean" exited with code 24. [C:\srcs\Bus.VcxProj]
         Done Building Project "C:\srcs\Bus.VcxProj" (sdv target(s)) -- FAILED.
         Build FAILED.

EWDK env vars
ToolsPath=F:\Program Files\Windows Kits\10\tools
ToolsPathARCH=F:\Program Files\Windows Kits\10\tools\x86
UniversalCRTSdkDir=F:\Program Files\Windows Kits\10
UniversalCRTSdkDir_10=F:\Program Files\Windows Kits\10
VCIDEInstallDir=F:\Program Files\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\VC
VCINSTALLDIR=F:\Program Files\Microsoft Visual Studio\2019\BuildTools\VC
VCToolsInstallDir=F:\Program Files\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508
VCToolsRedistDir=F:\Program Files\Microsoft Visual Studio\2019\BuildTools\VC\Redist\MSVC\14.20.27508
VCToolsVersion=14.20.27508
Version_Number=10.0.18908.0
VisualStudioVersion=16.0
VS140COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools
VS160COMNTOOLS=F:\Program Files\Microsoft Visual Studio\2019\BuildTools\Common7\Tools
VSCMD_ARG_app_plat=Desktop
VSCMD_ARG_HOST_ARCH=x86
VSCMD_ARG_TGT_ARCH=x86
VSCMD_ARG_winsdk=none
VSCMD_VER=16.0
VSINSTALLDIR=F:\Program Files\Microsoft Visual Studio\2019\BuildTools
WDKBinRoot=F:\Program Files\Windows Kits\10\bin\10.0.18908.0\x86
WDKContentRoot=F:\Program Files\Windows Kits\10
WDK_CURRENT_KIT_VERSION=10
windir=C:\windows
WindowsSdkDir=F:\Program Files\Windows Kits\10
WindowsSdkVerBinPath=F:\Program Files\Windows Kits\10\bin\10.0.18908.0\x86
WindowsSDK_ExecutablePath_x64=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\x64
WindowsSDK_ExecutablePath_x86=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\

The first thing to do is move from the preview builds of everything to Release Builds.

Peter
(I can use only preview builds - support for my driver model is being introduced only starting current preview builds)

Anyways I scanned the SDV dirs and saw I was using the same name batch file var (SDV!) that SDV scripts were using. I renamed mine, at least I am past above issues now.

I still have issue running SDV on my driver (bus.sys) which links to buslib.lib.
I am only able to get the SDV on LIB going, but when scripts proceeds to SYS, it errs out on the /lib: part.
My bus.vcxproj is in c:\srcs\bus and busLib.vcxproj in c:\srcs\bus\lib

My cmds

        set flags_sdv=/p:Configuration=Release /p:platform=x64 /t:sdv
    	set sdv_rule=/p:Inputs="/check:Irql.sdv"
    
    <section 1>
    	cd c:\srcs\Bus\lib
            MSBuild  buslib.vcxproj %bflags_sdv% /p:Inputs="/clean"
            MSBuild  buslib.vcxproj %bflags_sdv% %sdv_rule% 
    </section1>
    
    	cd c:\srcs\Bus
    <LineX>     MSBuild  bus.vcxproj %bflags_sdv% /p:Inputs="/clean" </LineX>
            MSBuild  bus.vcxproj %bflags_sdv% %sdv_rule% /p:Inputs="/Lib:c:\srcs\bus\lib\buslib.vcxproj"

      	cd c:\srcs

[Q] Looks like when i run sdv on a vcxproj, I need to be in that dir where vcxproj is?

BusLib.vcxproj parts (clean, sdv) always success i.e section1.
But Bus.vcxproj part never success
F:\Program Files\Windows Kits\10\build\windowsdriver.Sdv.targets(136,9): error MSB3073: The command "staticdv /Lib:C:\srcs\bus\lib\buslib.VcxProj" exited with code -1.

  • /Lib part always fails irrespective of what I give there - “/Lib:lib\buslib.vcxproj” or “/Lib:c:\srcs\bus\lib\buslib.vcxproj” or \ or .\lib\buslib.vcxproj etc.
  • Commenting out Section1 and/or LineX has no effect, always errs out on** /Lib:** part.
  • Omitting /Lib part of course fails.

SDV from VS2019 GUI is success on all of above.

/lib
Processes the library in the current directory. SDV calls MSBuild.exe to compile and build the library for external use, and it generates the files that it needs to include the library in the driver verification.

Use this parameter before verifying drivers that require the library. Run the msbuild /t:sdv /p:Inputs=“/lib” command and specify the Visual Studio project file (*.vcxproj) for the library.

Looks like when i run sdv on a vcxproj, I need to be in that dir where vcxproj is?

That sounds right.

Using the pre-release kits is always complicated. Without working closely with the Kits team, it’s hard to know what’s supposed to work and what isn’t. Sometimes things just aren’t complete yet, right? That’s why it’s a pre-release, and why I usually try to steer folks away from doing serious work using such a kit. Testing and such, is fine… it really trying to get work done can be tough.

My only/best advice is to (have your OEM/IHV) work with their MSFT contacts and report/discuss these issues with the kits team. The team is very responsive to issues and questions reported to them, and Will often go to great lengths to be helpful. A few of the Team members monitor this forum (at least occasionally)… but you have to understand that there are strict limits as to what they can discuss about unreleased products in a public forum. So… use your contacts back to MSFT. That’ll be the best way.

Peter

Thanks Peter.
Agree, posted here (seeing very first link pasted in thread) to see if any encountered this.

Anyways above issues were due to syntax wrong, my mistake. It’s “/Lib l.vcxproj” not “/Lib**: **l.vcxproj”

My sequence of cmds, which seem to work for now.

set flags_sdv=/p:Configuration=Release /p:platform=x64 /t:sdv
set sdv_rule=/p:Inputs="/check:Irql.sdv"
         cd c:\srcs\Bus\lib
                    MSBuild  buslib.vcxproj %bflags_sdv% /p:Inputs="/clean"
         cd c:\srcs\Bus
                    MSBuild  buslib.vcxproj %bflags_sdv% /p:Inputs="/clean"
         cd c:\srcs\Bus\lib
                    MSBuild  buslib.vcxproj %bflags_sdv% %sdv_rule% 
         cd c:\srcs\Bus
                   MSBuild  bus.vcxproj %bflags_sdv% %sdv_rule% /p:Inputs="/Lib lib\buslib.vcxproj"

SDV lib as usual, use /lib only during driver.sys SDV.

In build order dependencies - bus depends on buslib, but doing clean of both, just in case.

Though it seems in my case, SDV /clean seems to be not working perfect, I have to still delete some SDV outputs from previous run, for the current run to to seemingly run perfect/full. Else, subsequent run keeps complaining like below on lib (both for /clean and /check). Maybe it has cached buslib results somewhere. Though I expected /clean should flush all those.

sdv:
  staticdv /clean
  SDV: F:\Program Files\Windows Kits\10\TOOLS\SDV
  SMV: F:\Program Files\Windows Kits\10\TOOLS\SDV\smv
  SDVAP: F:\Program Files\Windows Kits\10\TOOLS\SDV\smv\analysisplugins\sdv
  Build environment: msbuild
  [INFO] Cleaning ...
  [FATAL ERROR] Error while attempting to clean. Access to the path 'dynamicbus.fsm' is denied.
F:\Program Files\Windows Kits\10\build\windowsdriver.Sdv.targets(136,9): error MSB3073: The command "staticdv /clean" exited with code -1.