Cannot Compile Windows MSR
Hey yall, no matter what I do, I cannot seem to get the windows MSR to compile from source. Here is the error, having followed the instructions exactly. Which were, download the source code, install the windows SDK and windows driver kit, then run this command : MSBuild.exe MSR.vcxproj -property:Configuration=Release -property:Platform=x64
I have tried updating the include path, but it only gives me more errors....
This is the error:
MSBuild version 17.11.9+a69bbaaf5 for .NET Framework
Build started 11/6/2024 23:06:47.
Project "C:\Users\suyda\OneDrive\Documents\Downloads\pcm-202409\pcm-202409\src\WinMSRDriver\MSR.vcxproj" on node 1 (def
ault targets).
PrepareForBuild:
Creating directory "MSR\x64\Release\".
Structured output is enabled. The formatting of compiler diagnostics will reflect the error hierarchy. See https://ak
a.ms/cpp/structured-output for more details.
Creating directory "C:\Users\suyda\OneDrive\Documents\Downloads\pcm-202409\pcm-202409\src\WinMSRDriver\x64\Release\".
Creating directory "MSR\x64\Release\MSR.tlog\".
InitializeBuildStatus:
Creating "MSR\x64\Release\MSR.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
Touching "MSR\x64\Release\MSR.tlog\unsuccessfulbuild".
ClCompile:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\HostX64\x64\CL.exe /c /Zi /nolo
go /W1 /WX- /diagnostics:column /O2 /Gm- /EHsc /MD /GS /Qspectre /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"MSR\x64\Rele
ase\\" /Fd"MSR\x64\Release\vc143.pdb" /external:W1 /Gd /TC /FC /errorReport:queue msrmain.c
msrmain.c
C:\Users\suyda\OneDrive\Documents\Downloads\pcm-202409\pcm-202409\src\WinMSRDriver\msr.h(12,10): error C1083: Cannot op
en include file: 'ntifs.h': No such file or directory [C:\Users\suyda\OneDrive\Documents\Downloads\pcm-202409\pcm-20240
9\src\WinMSRDriver\MSR.vcxproj]
(compiling source file 'msrmain.c')
Done Building Project "C:\Users\suyda\OneDrive\Documents\Downloads\pcm-202409\pcm-202409\src\WinMSRDriver\MSR.vcxproj"
(default targets) -- FAILED.
Build FAILED.
"C:\Users\suyda\OneDrive\Documents\Downloads\pcm-202409\pcm-202409\src\WinMSRDriver\MSR.vcxproj" (default target) (1) -
>
(ClCompile target) ->
C:\Users\suyda\OneDrive\Documents\Downloads\pcm-202409\pcm-202409\src\WinMSRDriver\msr.h(12,10): error C1083: Cannot
open include file: 'ntifs.h': No such file or directory [C:\Users\suyda\OneDrive\Documents\Downloads\pcm-202409\pcm-202
409\src\WinMSRDriver\MSR.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.68```
Update, after opening the vcxproj in visual studio and manually specifying the location of the WDK include files, and adding a preprocessor definition to specify the target architecture, it compiles, however, the msr.sys file is not generated. I know next to nothing about Windows Driver development.
Hi aaronsuydam! I have the exact same issue as you. May I ask if you’ve managed to resolve it? I’m also using Visual Studio, but my Visual Studio cannot find ‘ntifs.h’. I’m encountering the exact same error as you mentioned above. I would be very grateful if you could reply to me. Thank you so much!
I was able to build msr.sys by installing VS2022, and the latest WinSDK and WDK, then creating a new Visual Studio 2022 Sample KMDF driver project, and copying following files into it:
- msr.h
- msrstruct.h
- msrmain.c
And then manually disabling Spectre in the Release configuration settings under Code Generation. All attempts to follow instructions to install the Spectre mitigation libraries themselves failed.
Cannot tell you yet whether the compiled driver works.
Update, in the end I switched gears and downloaded the open driver from one of the 3rd party apps, and that worked. But then I just installed and used the latest Vtune to profile.