If you would like some background please see the thread Static Driver Verifier and C++, but in essence when I compile my driver under Win7 x64
checked, the build is fine. But I cannot use OACR/PREfast as it gives me a funny error saying that size_t is being redefined to a bad size. When I
do enough digging I see that OACR is using for it’s config file:
Configuration: C:\WinDDK\7600.16385.1\bin\x86\oacr\oacr.ini
Which I believe is wrong. It should use the amd64. So when I look at what is going on when I actually open Win7 x64 checked I see that it’s a
shortcut with parameters to setenv.bat. After tracing through it I see the line that should be setting the configuration to amd64 for OACR:
:OACRInit64bit
if “%_AMD64bit%” NEQ “true” goto OACRInitEnd
But isn’t that line incorrect? All the others have a /I after the if, like:
rem Add OACR settings to x86 and x64 builds
if /I “%_RunOacr%” NEQ “true” goto OACRInitEnd
But I am no batch file expert. Is anyone? This is the relevant part of setenv.bat:
rem Do not run OACR for IA64 build environments
if /I “%_IA64bit%”==“true” echo OACR is not supported for IA64
if /I “%_IA64bit%”==“true” goto OACRInitEnd
:OACRInit32bit
if /I “%_IA32bit%” NEQ “true” goto OACRInit64bit
set SUBSTITUTE_386_CC=%BASEDIR%\Bin\x86\oacr\oacrcl
set SUBSTITUTE_AMD64_CC=%BASEDIR%\Bin\x86\oacr\oacrcl
set SUBSTITUTE_LINK=%BASEDIR%\Bin\x86\oacr\oacrlink
set SUBSTITUTE_CS_COMPILER_NAME=%BASEDIR%\BIN\x86\oacr\oacrcsc /nologo
set PATH=%BASEDIR%\bin\x86\oacr;%PATH%
set BUILD_OACR=1
If Not Exist %BASEDIR%\OACR%BUILD_ALT_DIR% MD %BASEDIR%\OACR%BUILD_ALT_DIR%
@rem Turn on checking to workaround incorrect definition of __in
set PREFAST_VALID_IMPLIES_NOTNULL=1
if Exist %BASEDIR%\bin\x86\oacr\oacr.bat call %BASEDIR%\bin\x86\oacr\oacr.bat monitor
goto OACRInitEnd
:OACRInit64bit
if “%_AMD64bit%” NEQ “true” goto OACRInitEnd
set SUBSTITUTE_AMD64_CC=%BASEDIR%\Bin\amd64\oacr\oacrcl
set SUBSTITUTE_CS_COMPILER_NAME=%BASEDIR%\Bin\amd64\oacr\oacrcsc /nologo
set SUBSTITUTE_LINK=%BASEDIR%\Bin\amd64\oacr\oacrlink
set PATH=%BASEDIR%\bin\amd64\oacr;%PATH%
set BUILD_OACR=1
If Not Exist %BASEDIR%\OACR%BUILD_ALT_DIR% MD %BASEDIR%\OACR%BUILD_ALT_DIR%