Skip to content

Commit

Permalink
Fix build errors for MS Visual Studio Community 2019 16.10.3
Browse files Browse the repository at this point in the history
Signed-off-by: vadimgrn <[email protected]>
  • Loading branch information
vadimgrn committed Jul 14, 2021
1 parent 243d75c commit ab77ab2
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 16 deletions.
6 changes: 5 additions & 1 deletion driver/lib/libdrv.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
<WppKernelMode>true</WppKernelMode>
<AdditionalIncludeDirectories>..\..\include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>_NO_CRT_STDIO_INLINE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)wdmsec.lib;$(DDK_LIB_PATH)ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -134,6 +135,7 @@
<WppKernelMode>true</WppKernelMode>
<AdditionalIncludeDirectories>..\..\include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>_NO_CRT_STDIO_INLINE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)wdmsec.lib;$(DDK_LIB_PATH)ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -150,6 +152,7 @@
<WppKernelMode>true</WppKernelMode>
<AdditionalIncludeDirectories>..\..\include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>_NO_CRT_STDIO_INLINE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)wdmsec.lib;$(DDK_LIB_PATH)ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -166,6 +169,7 @@
<WppKernelMode>true</WppKernelMode>
<AdditionalIncludeDirectories>..\..\include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>_NO_CRT_STDIO_INLINE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)wdmsec.lib;$(DDK_LIB_PATH)ntstrsafe.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -190,4 +194,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
31 changes: 21 additions & 10 deletions driver/lib/usbd_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
#include <usb.h>
#include <usbdi.h>

#define EPIPE 32
#define EOVERFLOW 75
#define EREMOTEIO 121
/*
* Linux error codes.
* See: include/uapi/asm-generic/errno-base.h, include/uapi/asm-generic/errno.h
*/
enum {
EPIPE_LINUX = 32,
EOVERFLOW_LINUX = 75,
EREMOTEIO_LINUX = 121
};

USBD_STATUS
to_usbd_status(int usbip_status)
Expand All @@ -14,11 +20,11 @@ to_usbd_status(int usbip_status)
case 0:
return USBD_STATUS_SUCCESS;
/* I guess it */
case -EPIPE:
case -EPIPE_LINUX:
return USBD_STATUS_STALL_PID;
case -EOVERFLOW:
case -EOVERFLOW_LINUX:
return USBD_STATUS_DATA_OVERRUN;
case -EREMOTEIO:
case -EREMOTEIO_LINUX:
return USBD_STATUS_ERROR_SHORT_TRANSFER;
default:
return USBD_STATUS_ERROR;
Expand All @@ -38,14 +44,19 @@ to_usbip_status(USBD_STATUS status)
}
}

#define URB_SHORT_NOT_OK 0x0001
#define URB_ISO_ASAP 0x0002
#define URB_DIR_IN 0x0200
/*
* include/linux/usb.h
*/
enum {
URB_SHORT_NOT_OK = 0x0001,
URB_ISO_ASAP = 0x0002,
URB_DIR_IN = 0x0200
};

ULONG
to_usbd_flags(int flags)
{
ULONG usbd_flags = 0;
ULONG usbd_flags = 0;

if (flags & URB_SHORT_NOT_OK)
usbd_flags |= USBD_SHORT_TRANSFER_OK;
Expand Down
4 changes: 4 additions & 0 deletions driver/stub/usbip_stub.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
<WppKernelMode>true</WppKernelMode>
<AdditionalIncludeDirectories>..\..\include;..\lib;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>_NO_CRT_STDIO_INLINE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)wdmsec.lib;$(DDK_LIB_PATH)ntstrsafe.lib;$(DDK_LIB_PATH)usbd.lib;$(DDK_LIB_PATH)usbdex.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -154,6 +155,7 @@
<WppKernelMode>true</WppKernelMode>
<AdditionalIncludeDirectories>..\..\include;..\lib;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>_NO_CRT_STDIO_INLINE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)wdmsec.lib;$(DDK_LIB_PATH)ntstrsafe.lib;$(DDK_LIB_PATH)usbd.lib;$(DDK_LIB_PATH)usbdex.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -170,6 +172,7 @@
<WppKernelMode>true</WppKernelMode>
<AdditionalIncludeDirectories>..\..\include;..\lib;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>_NO_CRT_STDIO_INLINE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)wdmsec.lib;$(DDK_LIB_PATH)ntstrsafe.lib;$(DDK_LIB_PATH)usbd.lib;$(DDK_LIB_PATH)usbdex.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -190,6 +193,7 @@
<AdditionalIncludeDirectories>..\..\include;..\lib;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>_NO_CRT_STDIO_INLINE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)wdmsec.lib;$(DDK_LIB_PATH)ntstrsafe.lib;$(DDK_LIB_PATH)usbd.lib;$(DDK_LIB_PATH)usbdex.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand Down
2 changes: 2 additions & 0 deletions driver/vhci/usbip_root.inf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ ClassGuid={4D36E97D-E325-11CE-BFC1-08002BE10318}
Provider=%Provider%
CatalogFile=usbip_vhci.cat

PnpLockDown=1

[Manufacturer]
%StdMfg%=Standard,NT$ARCH$

Expand Down
2 changes: 2 additions & 0 deletions driver/vhci/usbip_vhci.inf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ ClassGuid={36FC9E60-C465-11CF-8056-444553540000}
Provider=%Provider%
CatalogFile=usbip_vhci.cat

PnpLockDown=1

[Manufacturer]
%StdMfg%=Standard,NT$ARCH$

Expand Down
6 changes: 5 additions & 1 deletion driver/vhci/usbip_vhci.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
<WppKernelMode>true</WppKernelMode>
<AdditionalIncludeDirectories>..\..\include;..\lib;$(UM_IncludePath);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>_NO_CRT_STDIO_INLINE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)wdmsec.lib;$(DDK_LIB_PATH)ntstrsafe.lib;usbd.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -184,6 +185,7 @@
<WppKernelMode>true</WppKernelMode>
<AdditionalIncludeDirectories>..\..\include;..\lib;$(UM_IncludePath);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>_NO_CRT_STDIO_INLINE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)wdmsec.lib;$(DDK_LIB_PATH)ntstrsafe.lib;usbd.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -205,6 +207,7 @@
<AdditionalIncludeDirectories>..\..\include;..\lib;$(UM_IncludePath);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<Inf2CatAdditionalOptions>/driver:aaaa\temp\</Inf2CatAdditionalOptions>
<PreprocessorDefinitions>_NO_CRT_STDIO_INLINE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)wdmsec.lib;$(DDK_LIB_PATH)ntstrsafe.lib;usbd.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -229,6 +232,7 @@
<AdditionalIncludeDirectories>..\..\include;..\lib;$(UM_IncludePath);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>_NO_CRT_STDIO_INLINE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)wdmsec.lib;$(DDK_LIB_PATH)ntstrsafe.lib;usbd.lib;%(AdditionalDependencies)</AdditionalDependencies>
Expand All @@ -255,4 +259,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
1 change: 1 addition & 0 deletions driver/vhci_ude/usbip_vhci_ude.inf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ClassGuid={36FC9E60-C465-11CF-8056-444553540000}
Provider=%ManufacturerName%
CatalogFile=usbip_vhci_ude.cat
DriverVer=
PnpLockDown=1

[DestinationDirs]
DefaultDestDir = 12
Expand Down
20 changes: 16 additions & 4 deletions userspace/lib/usbip_common.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>HAVE_CONFIG_H</PreprocessorDefinitions>
<PreprocessorDefinitions>HAVE_CONFIG_H;_NO_CRT_STDIO_INLINE</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
Expand All @@ -102,13 +102,16 @@
<Command>
</Command>
</PreBuildEvent>
<Lib>
<AdditionalDependencies>legacy_stdio_definitions.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>HAVE_CONFIG_H</PreprocessorDefinitions>
<PreprocessorDefinitions>HAVE_CONFIG_H;_NO_CRT_STDIO_INLINE</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
Expand All @@ -119,6 +122,9 @@
<Command>
</Command>
</PreBuildEvent>
<Lib>
<AdditionalDependencies>legacy_stdio_definitions.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
Expand All @@ -129,13 +135,16 @@
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>HAVE_CONFIG_H</PreprocessorDefinitions>
<PreprocessorDefinitions>HAVE_CONFIG_H;_NO_CRT_STDIO_INLINE</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<AdditionalDependencies>legacy_stdio_definitions.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
Expand All @@ -145,14 +154,17 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>..\..\include</AdditionalIncludeDirectories>
<PreprocessorDefinitions>HAVE_CONFIG_H</PreprocessorDefinitions>
<PreprocessorDefinitions>HAVE_CONFIG_H;_NO_CRT_STDIO_INLINE</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<AdditionalDependencies>legacy_stdio_definitions.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="dbgcode.c" />
Expand Down

0 comments on commit ab77ab2

Please sign in to comment.