cezanne / usbip-win

USB/IP for Windows
GNU General Public License v3.0
1.94k stars 349 forks source link

build fails VS2019 Windows 7 #221

Open kdschlosser opened 3 years ago

kdschlosser commented 3 years ago

When compiling on Windows 7 x64 SPI I get a bunch of compilation errors. These errors are from the use of structures and preprocessor macros that are only available for Windows 8 and above.

I have not gone digging through the code to see how reliant the driver is on these structures and macros in order to work properly. I would have to do some research to see if there is a replacement that can be used or possibly defining the macros and structures

Build log (click to expand) ``` 1>------ Build started: Project: usbip_common, Configuration: Release x64 ------ 2>------ Build started: Project: libdrv, Configuration: Release x64 ------ 2>Building 'libdrv' with toolset 'WindowsKernelModeDriver10.0' and the 'Universal' target platform. 1>dbgcode.c 1>names.c 1>usbip_common.c 1>getopt.c 1>getopt_long.c 1>usbip_forward.c 2>dbgcode.c 1>usbip_pki_cat.c 1>usbip_pki_sign.c 1>usbip_setupdi.c 1>usbip_stub.c 2>dbgcommon.c 2>devconf.c 2>pdu.c 2>strutil.c 2>usb_util.c 1>usbip_util.c 2>usbd_helper.c 1>usbip_windows.c 1>usbip_network.c 2>libdrv.vcxproj -> \usbip-win-master\Release\x64\libdrv.lib 3>------ Build started: Project: usbip_vhci, Configuration: Release x64 ------ 4>------ Build started: Project: usbip_stub, Configuration: Release x64 ------ 5>------ Build started: Project: usbip_vhci_ude, Configuration: Release x64 ------ 5>Building 'usbip_vhci_ude' with toolset 'WindowsKernelModeDriver10.0' and the 'Universal' target platform. 5>Stamping \usbip-win-master\Release\x64\usbip_vhci_ude\usbip_vhci_ude.inf 5>Stamping [Version] section with DriverVer=01/26/2021,0.3.3.0 5>\usbip-win-master\driver\vhci_ude\usbip_vhci_ude.inf(5-5): warning 1324: [Version] section should specify PnpLockdown=1. 4>Building 'usbip_stub' with toolset 'WindowsKernelModeDriver10.0' and the 'Desktop' target platform. 4>stub_cspkt.c 4>stub_dbg.c 4>stub_dev.c 4>stub_devconf.c 4>stub_dispatch.c 4>stub_driver.c 1>usbip_common.vcxproj -> \usbip-win-master\Release\x64\usbip_common.lib 6>------ Build started: Project: usbip, Configuration: Release x64 ------ 7>------ Build started: Project: usbipd, Configuration: Release x64 ------ 3>Building 'usbip_vhci' with toolset 'WindowsKernelModeDriver10.0' and the 'Desktop' target platform. 3>Stamping \usbip-win-master\Release\x64\usbip_vhci\usbip_vhci.inf 3>Stamping [Version] section with DriverVer=01/26/2021,0.3.3.0 3>Stamping \usbip-win-master\Release\x64\usbip_vhci\usbip_root.inf 3>Stamping [Version] section with DriverVer=01/26/2021,0.3.3.0 3>\usbip-win-master\driver\vhci\usbip_vhci.inf(6-6): warning 1324: [Version] section should specify PnpLockdown=1. 3>\usbip-win-master\driver\vhci\usbip_root.inf(6-6): warning 1324: [Version] section should specify PnpLockdown=1. 3>vhci.c 3>vhci_dbg.c 3>vhci_dev.c 3>vhci_devconf.c 3>vhci_internal_ioctl.c 3>vhci_ioctl.c 3>vhci_ioctl_usrreq.c 3>vhci_ioctl_vhci.c 3>vhci_ioctl_vhub.c 3>vhci_irp.c 3>vhci_pnp_add.c 3>vhci_pnp_cap.c 3>vhci_pnp_devtext.c 3>vhci_pnp_id.c 3>vhci_pnp_intf.c 3>vhci_pnp_relations.c 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(17,87): error C2146: syntax error: missing ')' before identifier 'nodeconn' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(17,87): error C2081: 'PUSB_NODE_CONNECTION_INFORMATION_EX_V2': name in formal parameter list illegal 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(17,87): error C2061: syntax error: identifier 'nodeconn' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(17,87): error C2059: syntax error: ';' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(17,95): error C2059: syntax error: ',' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(17,111): error C2059: syntax error: ')' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(23,67): error C2146: syntax error: missing ')' before identifier 'pinfo' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(23,67): error C2081: 'PUSB_HUB_INFORMATION_EX': name in formal parameter list illegal 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(23,67): error C2061: syntax error: identifier 'pinfo' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(23,67): error C2059: syntax error: ';' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(23,72): error C2059: syntax error: ')' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(29,85): error C2146: syntax error: missing ')' before identifier 'pinfo' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(29,85): error C2081: 'PUSB_PORT_CONNECTOR_PROPERTIES': name in formal parameter list illegal 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(29,85): error C2061: syntax error: identifier 'pinfo' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(29,85): error C2059: syntax error: ';' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(29,90): error C2059: syntax error: ',' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(29,106): error C2059: syntax error: ')' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(97,41): error C2065: 'PUSB_NODE_CONNECTION_INFORMATION_EX_V2': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(97,41): error C2146: syntax error: missing ';' before identifier 'conninfo' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(97,50): error C2065: 'conninfo': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(97,91): error C2065: 'PUSB_NODE_CONNECTION_INFORMATION_EX_V2': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(97,92): error C2146: syntax error: missing ';' before identifier 'buffer' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(101,58): error C2065: 'USB_NODE_CONNECTION_INFORMATION_EX_V2': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(101,118): error C2065: 'USB_NODE_CONNECTION_INFORMATION_EX_V2': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(102,58): error C2065: 'USB_NODE_CONNECTION_INFORMATION_EX_V2': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(105,14): error C2065: 'conninfo': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(105,16): error C2223: left of '->ConnectionIndex' must point to struct/union 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(107,38): error C2065: 'conninfo': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(107,40): error C2223: left of '->ConnectionIndex' must point to struct/union 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(107,55): error C2198: 'vhub_find_vpdo': too few arguments for call 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(108,39): error C4013: 'vpdo_get_nodeconn_info_ex_v2' undefined; assuming extern returning int 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(108,54): error C2065: 'conninfo': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(138,26): error C2065: 'PUSB_HUB_INFORMATION_EX': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(138,26): error C2146: syntax error: missing ';' before identifier 'pinfo' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(138,32): error C2065: 'pinfo': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(138,58): error C2065: 'PUSB_HUB_INFORMATION_EX': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(138,59): error C2146: syntax error: missing ';' before identifier 'buffer' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(140,46): error C2065: 'USB_HUB_INFORMATION_EX': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(142,32): error C4013: 'vhub_get_information_ex' undefined; assuming extern returning int 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(142,44): error C2065: 'pinfo': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(158,33): error C2065: 'PUSB_PORT_CONNECTOR_PROPERTIES': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(158,33): error C2146: syntax error: missing ';' before identifier 'pinfo' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(158,39): error C2065: 'pinfo': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(158,72): error C2065: 'PUSB_PORT_CONNECTOR_PROPERTIES': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(158,73): error C2146: syntax error: missing ';' before identifier 'buffer' 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(160,50): error C2065: 'USB_PORT_CONNECTOR_PROPERTIES': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(161,50): error C2065: 'USB_PORT_CONNECTOR_PROPERTIES': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(164,43): error C4013: 'vhub_get_port_connector_properties' undefined; assuming extern returning int 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(164,55): error C2065: 'pinfo': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(226,54): error C2065: 'IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX_V2': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(232,39): error C2065: 'IOCTL_USB_GET_HUB_INFORMATION_EX': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(238,46): error C2065: 'IOCTL_USB_GET_PORT_CONNECTOR_PROPERTIES': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(226,1): error C2051: case expression not constant 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(232,1): error C2051: case expression not constant 3>\usbip-win-master\driver\vhci\vhci_ioctl_vhub.c(238,1): error C2051: case expression not constant 3>vhci_pnp_remove.c 3>vhci_pnp_resources.c 3>vhci_pnp_start.c 3>vhci_pnp_vpdo.c 3>vhci_vhub.c 3>vhci_vpdo.c 3>vhci_read.c 3>vhci_vpdo_dsc.c 3>vhci_write.c 3>\usbip-win-master\driver\vhci\vhci_vhub.c(83,67): error C2146: syntax error: missing ')' before identifier 'pinfo' 3>\usbip-win-master\driver\vhci\vhci_vhub.c(83,67): error C2081: 'PUSB_HUB_INFORMATION_EX': name in formal parameter list illegal 3>\usbip-win-master\driver\vhci\vhci_vhub.c(83,67): error C2061: syntax error: identifier 'pinfo' 3>\usbip-win-master\driver\vhci\vhci_vhub.c(83,67): error C2059: syntax error: ';' 3>\usbip-win-master\driver\vhci\vhci_vhub.c(83,72): error C2059: syntax error: ')' 3>\usbip-win-master\driver\vhci\vhci_vhub.c(84,1): error C2449: found '{' at file scope (missing function header?) 3>\usbip-win-master\driver\vhci\vhci_vhub.c(91,1): error C2059: syntax error: '}' 3>\usbip-win-master\driver\vhci\vhci_vhub.c(109,85): error C2146: syntax error: missing ')' before identifier 'pinfo' 3>\usbip-win-master\driver\vhci\vhci_vhub.c(109,85): error C2081: 'PUSB_PORT_CONNECTOR_PROPERTIES': name in formal parameter list illegal 3>\usbip-win-master\driver\vhci\vhci_vhub.c(109,85): error C2061: syntax error: identifier 'pinfo' 3>\usbip-win-master\driver\vhci\vhci_vhub.c(109,85): error C2059: syntax error: ';' 3>\usbip-win-master\driver\vhci\vhci_vhub.c(109,90): error C2059: syntax error: ',' 3>\usbip-win-master\driver\vhci\vhci_vhub.c(109,106): error C2059: syntax error: ')' 3>vhci_plugin.c 3>vhci_pnp.c 3>\usbip-win-master\driver\vhci\vhci_vpdo.c(178,87): error C2146: syntax error: missing ')' before identifier 'conninfo' 3>\usbip-win-master\driver\vhci\vhci_vpdo.c(178,87): error C2081: 'PUSB_NODE_CONNECTION_INFORMATION_EX_V2': name in formal parameter list illegal 3>\usbip-win-master\driver\vhci\vhci_vpdo.c(178,87): error C2061: syntax error: identifier 'conninfo' 3>\usbip-win-master\driver\vhci\vhci_vpdo.c(178,87): error C2059: syntax error: ';' 3>\usbip-win-master\driver\vhci\vhci_vpdo.c(178,95): error C2059: syntax error: ',' 3>\usbip-win-master\driver\vhci\vhci_vpdo.c(178,111): error C2059: syntax error: ')' 3>vhci_power.c 3>vhci_proto.c 3>\usbip-win-master\driver\vhci\vhci_plugin.c(57,37): error C4013: 'get_usb_speed' undefined; assuming extern returning int 3>\usbip-win-master\driver\vhci\vhci_plugin.c(66,30): error C2065: 'USB_SPEED_LOW': undeclared identifier 3>\usbip-win-master\driver\vhci\vhci_plugin.c(66,30): warning C4242: '=': conversion from 'int' to 'UCHAR', possible loss of data 3>usbreq.c 3>vhci_wmi.c 3>Done building project "usbip_vhci.vcxproj" -- FAILED. 5>vhci_dbg.c 5>vhci_ioctl.c 5>vhci_plugin.c 5>vhci_plugout.c 5>vhci_proto.c 5>vhci_read.c 5>vhci_urbr.c 5>vhci_urbr_fetch.c 5>vhci_urbr_fetch_bulk.c 5>vhci_urbr_fetch_control.c 5>vhci_urbr_fetch_dscr.c 5>vhci_urbr_fetch_iso.c 5>vhci_urbr_fetch_status.c 5>vhci_urbr_fetch_vendor.c 5>vhci_urbr_store.c 5>vhci_urbr_store_bulk.c 5>vhci_urbr_store_control.c 4>stub_ioctl.c 4>stub_irp.c 4>stub_pnp.c 4>stub_power.c 4>stub_read.c 4>stub_reg.c 4>stub_res.c 4>stub_usbd.c 4>stub_write.c 4>Building 'libdrv' with toolset 'WindowsKernelModeDriver10.0' and the 'Universal' target platform. 4>usbip_stub.vcxproj -> \usbip-win-master\Release\x64\usbip_stub.sys 4>Done Adding Additional Store 4>Successfully signed: \usbip-win-master\Release\x64\usbip_stub.sys 4> 4>Inf2Cat task was skipped as there were no inf files to process 6>usbip.c 6>usbip_attach.c 6>usbip_bind.c 6>usbip_detach.c 6>usbip_dscr.c 6>usbip_install.c 6>usbip_list.c 6>usbip_list_local.c 6>usbip_list_remote.c 6>usbip_port.c 6>usbip_unbind.c 6>usbip_vhci.c 7>usbipd.c 7>usbipd_accept.c 7>usbipd_import.c 7>usbipd_list.c 7>usbipd_sock.c 7>usbipd_stub.c 6>Generating code 6>Previous IPDB not found, fall back to full compilation. 5>vhci_urbr_store_dscr.c 6>All 201 functions were compiled because no usable IPDB/IOBJ from previous compilation was found. 6>Finished generating code 6>usbip.vcxproj -> \usbip-win-master\Release\x64\usbip.exe 5>vhci_urbr_store_iso.c 5>vhci_urbr_store_reset.c 5>Generating Code... 7>Generating code 7>Finished generating code 7>Previous IPDB not found, fall back to full compilation. 7>All 114 functions were compiled because no usable IPDB/IOBJ from previous compilation was found. 7>usbipd.vcxproj -> \usbip-win-master\Release\x64\usbipd.exe 5>Compiling... 5>vhci_urbr_store_select.c 5>vhci_hc.c 5>vhci_driver.c 5>vhci_queue_hc.c 5>vhci_ep.c 5>vhci_queue_ep.c 5>vhci_urbr_store_status.c 5>vhci_urbr_store_vendor.c 5>vhci_write.c 5>Generating Code... 5>usbip_vhci_ude.vcxproj -> \usbip-win-master\Release\x64\usbip_vhci_ude.sys 5>Done Adding Additional Store 5>Successfully signed: \usbip-win-master\Release\x64\usbip_vhci_ude.sys 5> 5>Driver is 'Universal'. 5>A subdirectory or file vhci_ude_cat already exists. 5> 1 file(s) copied. 5> 1 file(s) copied. 5>........................ 5>Signability test complete. 5> 5>Errors: 5>None 5> 5>Warnings: 5>None 5> 5>Catalog generation complete. 5>\usbip-win-master\Release\x64\vhci_ude_cat\usbip_vhci_ude.cat 5>Done Adding Additional Store 5>Successfully signed: usbip_vhci_ude.cat 5> 5> 1 file(s) copied. 5>Deleted file - \usbip-win-master\Release\x64\vhci_ude_cat\usbip_vhci_ude.cat 5>Deleted file - \usbip-win-master\Release\x64\vhci_ude_cat\usbip_vhci_ude.inf 5>Deleted file - \usbip-win-master\Release\x64\vhci_ude_cat\usbip_vhci_ude.sys 5>Done building project "usbip_vhci_ude.vcxproj". ========== Build: 6 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== ```
cezanne commented 3 years ago

@kdschlosser : The recent tag version which supports is v0.1.0. All upper versions do not support Win7 or 8 because usbip-win started to use kernel libraries of Win10.

kdschlosser commented 3 years ago

maybe a change to the README is needed then.

This is stated right in it.

For Windows 7 users, change usbip_stub and usbip_vhci projects' Target OS version to Windows 7.
Right-click on the project > Properties > Driver Settings > Target OS version > Windows 7
cezanne commented 3 years ago

@kdschlosser :

maybe a change to the README is needed then.

Thanks. README should be fixed. However, conditional build for Win7 or 8 would be more preferable even though those platforms does not support a certain functionalities.

kdschlosser commented 3 years ago

I would have to do some reading into those macro/functions in the windows API to see what they actually do and if there is a way to do the same thing they do but for windows 7/8 then it is just a matter of checking to see what OS is set. If there isn't anything that can be done to mimic those features then the functions that use them would have to return values that the core program would understand as a not available feature.