daynix / UsbDk

Usb Drivers Development Kit for Windows
Apache License 2.0
553 stars 142 forks source link

Failed to compile on new setup #112

Closed pcorbineau closed 2 years ago

pcorbineau commented 2 years ago

I tried to compile project on recent setup with Visual Studio 2022 and 2019 with WDK 10 installed but it failed.

I got some trouble about headers in stdafx.h like

#include <ntifs.h>
#include <wdf.h>

Project can't found those headers. If i add it manually to include directories, it failed later on redefinition of objects.

Did I miss something ?

I even try on other setup to install VS2015 but got some errors too.

YanVugenfirer commented 2 years ago

Hi,

USBDK wasn't adopted to VS2019 and up. Usually when MS switches to new version there are some adaptations needed in projects files.

Try to follow https://github.com/virtio-win/kvm-guest-drivers-windows/wiki/Building-the-drivers-using-Visual-Studio-2017#obsolete-building-windows-8-windows-2012-drivers-and-up while installing your environment. Please post errors that you will get.

Best regards, Yan.

pcorbineau commented 2 years ago

I think i have all sdk/wdk installed but still with an error :

C:\Users\pcorbineau\Documents\workspace\UsbDk>buildAll.bat

Microsoft Visual Studio 2015 Version 14.0.25420.1.
Copyright (C) Microsoft Corp. All rights reserved.

The license for Visual Studio expires in 23 days.
1>------ Rebuild All started: Project: UsbDkHelper, Configuration: Win7 Debug Win32 ------
2>------ Rebuild All started: Project: UsbDk, Configuration: Win7 Debug Win32 ------
1>  Driver.Initial.props: TargetVersion=Windows7 _NT_TARGET_VERSION=0x0601 SUBSYSTEM_NATVER=6.01 mismatch=
1>  Building 'UsbDkHelper' with toolset 'WindowsApplicationForDrivers10.0' and the 'Desktop' target platform.
2>  Driver.Initial.props: TargetVersion=Windows7 _NT_TARGET_VERSION=0x0601 SUBSYSTEM_NATVER=6.01 mismatch=
2>  Building 'UsbDk' with toolset 'WindowsKernelModeDriver10.0' and the 'Desktop' target platform.
1>  stdafx.cpp
2>  stdafx.cpp
2>c:\users\pcorbineau\documents\workspace\usbdk\usbdk\stdafx.h(14): fatal error C1083: Cannot open include file: 'ntifs.h': No such file or directory
1>  dllmain.cpp
1>  DriverAccess.cpp
1>  DriverFile.cpp
1>  Exception.cpp
1>  Installer.cpp
1>  RedirectorAccess.cpp
1>  RegAccess.cpp
1>  DeviceMgr.cpp
1>  RuleManager.cpp
1>  UsbDkHelper.cpp
1>  ServiceManager.cpp
1>  tstrings.cpp
1>  GuidGen.cpp
1>  Utils.cpp
1>  WdfCoinstaller.cpp
1>  Generating Code...
1>LINK : fatal error LNK1104: cannot open file 'C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\km\x86\\cfg_support_v1.lib'
3>------ Rebuild All started: Project: UsbDkController, Configuration: Win7 Debug Win32 ------
4>------ Rebuild All started: Project: UsbDkInstHelper, Configuration: Win7 Debug Win32 ------
3>  Driver.Initial.props: TargetVersion=Windows7 _NT_TARGET_VERSION=0x0601 SUBSYSTEM_NATVER=6.01 mismatch=
3>  Building 'UsbDkController' with toolset 'WindowsApplicationForDrivers10.0' and the 'Desktop' target platform.
4>  Driver.Initial.props: TargetVersion=Windows7 _NT_TARGET_VERSION=0x0601 SUBSYSTEM_NATVER=6.01 mismatch=
4>  Building 'UsbDkInstHelper' with toolset 'WindowsApplicationForDrivers10.0' and the 'Desktop' target platform.
3>  stdafx.cpp
4>  stdafx.cpp
4>  UsbDkInstHelper.cpp
3>  UsbDkController.cpp
4>LINK : fatal error LNK1104: cannot open file 'C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\km\x86\\cfg_support_v1.lib'
3>LINK : fatal error LNK1104: cannot open file 'C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\km\x86\\cfg_support_v1.lib'
5>------ Rebuild All started: Project: UsbDk_Package, Configuration: Win7 Debug Win32 ------
5>  Driver.Initial.props: TargetVersion=Windows7 _NT_TARGET_VERSION=0x0601 SUBSYSTEM_NATVER=6.01 mismatch=
5>  Building 'UsbDk_Package' with toolset 'WindowsKernelModeDriver10.0' and the 'Desktop' target platform.
5>  Un sous-répertoire ou un fichier C:\Users\pcorbineau\Documents\workspace\UsbDk\Install_Debug\x86\Win7Debug\UsbDk_Package existe déjà.
5>          1 fichier(s) copié(s).
5>C:\Program Files (x86)\Windows Kits\10\build\WindowsDriver.common.targets(1683,5): error MSB3030: Could not copy the file "C:\Users\pcorbineau\Documents\workspace\UsbDk\Install_Debug\x86\Win7Debug\UsbDk.sys" because it was not found.
5>C:\Program Files (x86)\Windows Kits\10\build\WindowsDriver.common.targets(1683,5): error MSB3030: Could not copy the file "C:\Users\pcorbineau\Documents\workspace\UsbDk\Install_Debug\x86\Win7Debug\UsbDkController.exe" because it was not found.
5>C:\Program Files (x86)\Windows Kits\10\build\WindowsDriver.common.targets(1683,5): error MSB3030: Could not copy the file "C:\Users\pcorbineau\Documents\workspace\UsbDk\Install_Debug\x86\Win7Debug\UsbDkInstHelper.exe" because it was not found.
5>C:\Program Files (x86)\Windows Kits\10\build\WindowsDriver.common.targets(1683,5): error MSB3030: Could not copy the file "C:\Users\pcorbineau\Documents\workspace\UsbDk\Install_Debug\x86\Win7Debug\UsbDkHelper.dll" because it was not found.
========== Rebuild All: 0 succeeded, 5 failed, 0 skipped ==========

Build with Visual Studio FAILED

Did I miss something ?

YanVugenfirer commented 2 years ago

https://stackoverflow.com/questions/39601108/fatal-link-error-and-can-not-find-cfg-support-v1-lib

I think it is a question of SDK\DDK compatibility. Just in case, recreate development env and follow also order of the instructions while installing the components.

pcorbineau commented 2 years ago

Ok after uninstalling all SDK/WDK on my pc, then reinstalling SDK10 and WDK10 it works. I am now be able to work on it. I am investigating this issue (https://github.com/daynix/UsbDk/issues/99 & https://github.com/daynix/UsbDk/issues/107) that cause many problems for our customers. If you have any tips for it 🙏

YanVugenfirer commented 2 years ago

Try to get the logs (#107 has instructions how to gather installation logs)

YanVugenfirer commented 2 years ago

Ok after uninstalling all SDK/WDK on my pc, then reinstalling SDK10 and WDK10 it works. I am now be able to work on it. I am investigating this issue (#99 & #107) that cause many problems for our customers. If you have any tips for it 🙏

Closing based on this comment