英文:
Driver compilation successful but no .sys file generated
问题
I'm attempting to compile a simple kernel driver in Visual Studio using the Windows Driver Kit. The compilation process completes without any errors, but I can't seem to find the expected .sys file in the output folder.
Here is the code snippet for the driver's entry point:
#include <ntddk.h>
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
{
UNREFERENCED_PARAMETER(DriverObject);
UNREFERENCED_PARAMETER(RegistryPath);
KdPrint("DriverEntry called\n");
return STATUS_SUCCESS;
}
When I build the project, this is what the output log shows:
Build started...
1>------ Build started: Project: fltdrv, Configuration: Debug x64 ------
1>entry.c
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Build started at 10:56 AM and took 00.781 seconds ==========
My output path is set as $(SolutionDir)$(Platform)\$(Configuration)\
which resolves to C:\Users\myuser\source\vscode\myproject\driver\x64\Debug
. However, no .sys file is generated in this directory.
I'm using the correct toolchain, and I have confirmed that my code is correct and there are no errors in the .inf file. I've also checked the project properties, and they seem to be in order.
I'm using Visual Studio 2022 with administrator privileges enabled.
英文:
I'm attempting to compile a simple kernel driver in Visual Studio using the Windows Driver Kit. The compilation process completes without any errors, but I can't seem to find the expected .sys file in the output folder.
Here is the code snippet for the driver's entry point:
#include <ntddk.h>
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
{
UNREFERENCED_PARAMETER(DriverObject);
UNREFERENCED_PARAMETER(RegistryPath);
KdPrint("DriverEntry called\n");
return STATUS_SUCCESS;
}
When I build the project, this is what the output log shows:
Build started...
1\>------ Build started: Project: fltdrv, Configuration: Debug x64 ------
1\>entry.c
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Build started at 10:56 AM and took 00.781 seconds ==========
My output path is set as $(SolutionDir)$(Platform)\$(Configuration)\
which resolves to C:\Users\myuser\source\vscode\myproject\driver\x64\Debug
. However, no .sys file is generated in this directory.
I'm using the correct toolchain, and I have confirmed that my code is correct and there are no errors in the .inf file. I've also checked the project properties and they seem to be in order.
I'm using Visual Studio 2022 with administrator privileges enabled.
What I tried:
- I have set the build configuration as Debug and x64. I expect this to produce a .sys file in the output directory but it doesn't.
- I have examined the build log closely. It shows that the entry.c file is being compiled without any errors or warnings, and the build is successful.
- I have checked the code, including the DriverEntry function and any other necessary functions. There are no syntax errors or other issues that should prevent the .sys file from being generated.
- I have confirmed that the output path is set to
$(SolutionDir)$(Platform)\$(Configuration)\
, which resolves to the correct output directory. - Alas, I tried to run Visual Studio as admin, to no avail.
Despite all these steps, the .sys file is not being generated in the output directory.
Any help or insights on why the .sys file isn't being generated would be greatly appreciated. Thank you in advance!
答案1
得分: 2
我已经修复了:显然我忘记安装所有必需的Spectre缓解库(包括ARM,我不使用)。如果您遇到相同的问题,请确保您已经通过Visual Studio Installer安装了以下库:
- MSVC v143 - VS 2022 C++ Arm构建工具(最新)
- MSVC v143 - VS 2022 C++ Arm Spectre缓解库(最新)
- MSVC v143 - VS 2022 C++ Arm64构建工具(最新)
- MSVC v143 - VS 2022 C++ Arm64 Spectre缓解库(最新)
- MSVC v143 - VS 2022 C++ x64/x86构建工具(最新)
- MSVC v143 - VS 2022 C++ x64/x86 Spectre缓解库(最新)
英文:
Fixed it: apparently I forgot to install all the required Spectre mitigated libraries (ARM included, which I do not use).
If you encounter the same issue, make sure that you have installed (via the Visual Studio Installer) the following libraries:
MSVC v143 - VS 2022 C++ Arm build tools (Latest)
MSVC v143 - VS 2022 C++ Arm Spectre-mitigated libs (Latest)
MSVC v143 - VS 2022 C++ Arm64 build tools (Latest)
MSVC v143 - VS 2022 C++ Arm64 Spectre-mitigated libs (Latest)
MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest)
MSVC v143 - VS 2022 C++ x64/x86 Spectre-mitigated libs (Latest)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论