Skip to contentSkip to conversation

windows: independent fixes

PATCH Applied Dmitry Kozlyuk 3 participants 7 messages Oct 2, 2021 – Jan 11, 2022

lore
Share & tools
lore
#0 lore raw

cover windows: independent fixes

Fixes for building with Windows Development Kit 22000.1 and some build configuration cleanup.

Dmitry Kozlyuk (4):
windows: specify signature hash algorithm windows/virt2phys: support only x86 configurations windows/virt2phys: change setup class GUID to custom windows/virt2phys: add PnpLockdown directive

 windows/netuio/netuio.vcxproj       |   6 ++
 windows/virt2phys/virt2phys.inf     |   3 +-
 windows/virt2phys/virt2phys.vcxproj | 146 ++--------------------------
 3 files changed, 15 insertions(+), 140 deletions(-)
Signature · 1 line
2.29.3
#1 lore raw

PATCH 1/4 windows: specify signature hash algorithm

Windows Driver Kit version 22000.1 requires the signature hash algorithm to be specified, otherwise an error occurs:

SIGNTASK : SignTool error : No file digest algorithm specified.

Specify "certHash" to match the algorithm of any certificate used.

---
 windows/netuio/netuio.vcxproj       | 6 ++++++
 windows/virt2phys/virt2phys.vcxproj | 6 ++++++
 2 files changed, 12 insertions(+)
windows/netuio/netuio.vcxproj +6 -0
index 87c8b94..2ab761e 100644
@@ -70,6 +70,9 @@
     <Inf>
       <TimeStamp>0.6.1</TimeStamp>
     </Inf>
+    <DriverSign>
+      <FileDigestAlgorithm>certHash</FileDigestAlgorithm>
+    </DriverSign>
     <Link>
       <AdditionalDependencies>%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib;$(KMDF_LIB_PATH)$(KMDF_VER_PATH)\WdfLdr.lib;$(KMDF_LIB_PATH)$(KMDF_VER_PATH)\WdfDriverEntry.lib;$(DDK_LIB_PATH)\wdmsec.lib</AdditionalDependencies>
     </Link>
@@ -85,6 +88,9 @@
     <Inf>
       <TimeStamp>0.6.1</TimeStamp>
     </Inf>
+    <DriverSign>
+      <FileDigestAlgorithm>certHash</FileDigestAlgorithm>
+    </DriverSign>
     <Link>
       <AdditionalDependencies>%(AdditionalDependencies);$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib;$(KMDF_LIB_PATH)$(KMDF_VER_PATH)\WdfLdr.lib;$(KMDF_LIB_PATH)$(KMDF_VER_PATH)\WdfDriverEntry.lib;$(DDK_LIB_PATH)\wdmsec.lib</AdditionalDependencies>
     </Link>
windows/virt2phys/virt2phys.vcxproj +6 -0
index c86cc9b..66462bc 100644
@@ -178,6 +178,9 @@
     <Inf>
       <TimeStamp>0.1</TimeStamp>
     </Inf>
+    <DriverSign>
+      <FileDigestAlgorithm>certHash</FileDigestAlgorithm>
+    </DriverSign>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <ClCompile>
@@ -186,6 +189,9 @@
       <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
       <WppKernelMode>true</WppKernelMode>
     </ClCompile>
+    <DriverSign>
+      <FileDigestAlgorithm>certHash</FileDigestAlgorithm>
+    </DriverSign>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
     <ClCompile>
Signature · 1 line
2.29.3
#2 lore raw

PATCH 2/4 windows/virt2phys: support only x86 configurations

In reply to Dmitry Kozlyuk

While non inherently limited to one platform, virt2phys is only developed on x86 and tested for it. Arm configurations were created by the driver template project and were never maintained. Remove them to reduce the burden of keeping all configurations in sync.

The template also enabled tracing for x86 Release configuration, but the file needed for it is missing. Disable it to fix the build.

Fixes e15f53c36512 (windows/virt2phys: virtual to physical address translator)
---
 windows/virt2phys/virt2phys.vcxproj | 140 +---------------------------
 1 file changed, 1 insertion(+), 139 deletions(-)
windows/virt2phys/virt2phys.vcxproj +1 -139
index 66462bc..6794452 100644
@@ -1,14 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
-    <ProjectConfiguration Include="Debug|Win32">
-      <Configuration>Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|Win32">
-      <Configuration>Release</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
     <ProjectConfiguration Include="Debug|x64">
       <Configuration>Debug</Configuration>
       <Platform>x64</Platform>
@@ -17,22 +9,6 @@
       <Configuration>Release</Configuration>
       <Platform>x64</Platform>
     </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|ARM">
-      <Configuration>Debug</Configuration>
-      <Platform>ARM</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|ARM">
-      <Configuration>Release</Configuration>
-      <Platform>ARM</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Debug|ARM64">
-      <Configuration>Debug</Configuration>
-      <Platform>ARM64</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Release|ARM64">
-      <Configuration>Release</Configuration>
-      <Platform>ARM64</Platform>
-    </ProjectConfiguration>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="virt2phys.c" />
@@ -53,22 +29,6 @@
     <RootNamespace>virt2phys</RootNamespace>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
-    <TargetVersion>Windows10</TargetVersion>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
-    <ConfigurationType>Driver</ConfigurationType>
-    <DriverType>KMDF</DriverType>
-    <DriverTargetPlatform>Universal</DriverTargetPlatform>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
-    <TargetVersion>Windows10</TargetVersion>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
-    <ConfigurationType>Driver</ConfigurationType>
-    <DriverType>KMDF</DriverType>
-    <DriverTargetPlatform>Universal</DriverTargetPlatform>
-  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <TargetVersion>Windows10</TargetVersion>
     <UseDebugLibraries>true</UseDebugLibraries>
@@ -85,38 +45,6 @@
     <DriverType>KMDF</DriverType>
     <DriverTargetPlatform>Universal</DriverTargetPlatform>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
-    <TargetVersion>Windows10</TargetVersion>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
-    <ConfigurationType>Driver</ConfigurationType>
-    <DriverType>KMDF</DriverType>
-    <DriverTargetPlatform>Universal</DriverTargetPlatform>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
-    <TargetVersion>Windows10</TargetVersion>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
-    <ConfigurationType>Driver</ConfigurationType>
-    <DriverType>KMDF</DriverType>
-    <DriverTargetPlatform>Universal</DriverTargetPlatform>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
-    <TargetVersion>Windows10</TargetVersion>
-    <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
-    <ConfigurationType>Driver</ConfigurationType>
-    <DriverType>KMDF</DriverType>
-    <DriverTargetPlatform>Universal</DriverTargetPlatform>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
-    <TargetVersion>Windows10</TargetVersion>
-    <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset>
-    <ConfigurationType>Driver</ConfigurationType>
-    <DriverType>KMDF</DriverType>
-    <DriverTargetPlatform>Universal</DriverTargetPlatform>
-  </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
   </ImportGroup>
@@ -125,46 +53,12 @@
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
-  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
-    <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
-    <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
-    <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
-  </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
-    <DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
-  </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <ClCompile>
-      <WppEnabled>true</WppEnabled>
-      <WppRecorderEnabled>true</WppRecorderEnabled>
-      <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
-      <WppKernelMode>true</WppKernelMode>
-    </ClCompile>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <WppEnabled>true</WppEnabled>
-      <WppRecorderEnabled>true</WppRecorderEnabled>
-      <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
-      <WppKernelMode>true</WppKernelMode>
-    </ClCompile>
-  </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <ClCompile>
       <WppEnabled>false</WppEnabled>
@@ -184,7 +78,7 @@
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <ClCompile>
-      <WppEnabled>true</WppEnabled>
+      <WppEnabled>false</WppEnabled>
       <WppRecorderEnabled>true</WppRecorderEnabled>
       <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
       <WppKernelMode>true</WppKernelMode>
@@ -193,38 +87,6 @@
       <FileDigestAlgorithm>certHash</FileDigestAlgorithm>
     </DriverSign>
   </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
-    <ClCompile>
-      <WppEnabled>true</WppEnabled>
-      <WppRecorderEnabled>true</WppRecorderEnabled>
-      <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
-      <WppKernelMode>true</WppKernelMode>
-    </ClCompile>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
-    <ClCompile>
-      <WppEnabled>true</WppEnabled>
-      <WppRecorderEnabled>true</WppRecorderEnabled>
-      <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
-      <WppKernelMode>true</WppKernelMode>
-    </ClCompile>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
-    <ClCompile>
-      <WppEnabled>true</WppEnabled>
-      <WppRecorderEnabled>true</WppRecorderEnabled>
-      <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
-      <WppKernelMode>true</WppKernelMode>
-    </ClCompile>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
-    <ClCompile>
-      <WppEnabled>true</WppEnabled>
-      <WppRecorderEnabled>true</WppRecorderEnabled>
-      <WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
-      <WppKernelMode>true</WppKernelMode>
-    </ClCompile>
-  </ItemDefinitionGroup>
   <ItemGroup>
     <FilesToPackage Include="$(TargetPath)" />
   </ItemGroup>
Signature · 1 line
2.29.3
#3 lore raw

PATCH 3/4 windows/virt2phys: change setup class GUID to custom

In reply to Dmitry Kozlyuk

virt2phys was using the setup class GUID of sample drivers with class name "kernel bypass". Windows Driver Kit version 22000.1 recognizes this GUID and emits an error:

error 1280: Class name and ClassGuid mismatch, expecting Class "Sample" for ClassGuid "{78A1C341-4539-11d3-B88D-00C04FAD5171}".

Generate and use a new GUID for "Kernel bypass" device class.

---
 windows/virt2phys/virt2phys.inf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
windows/virt2phys/virt2phys.inf +1 -1
index e35765e..c1ea8d9 100644
@@ -4,7 +4,7 @@
 [Version]
 Signature = "$WINDOWS NT$"
 Class = %ClassName%
-ClassGuid = {78A1C341-4539-11d3-B88D-00C04FAD5171}
+ClassGuid = {6d53d3f7-734b-44ec-a6a9-4e369dc121a4}
 Provider = %ManufacturerName%
 CatalogFile = virt2phys.cat
 DriverVer =
Signature · 1 line
2.29.3
#4 lore raw

PATCH 4/4 windows/virt2phys: add PnpLockdown directive

In reply to Dmitry Kozlyuk

WDK for Windows 10, version 2004 emits a warning suggesting to add PnpLockdown directive to INI [1]. Add it since virt2phys has no potential use-cases that require modifications to driver files.

[1]: https://docs.microsoft.com/en-us/windows-hardware/drivers/install/inf-version-section

---
 windows/virt2phys/virt2phys.inf | 1 +
 1 file changed, 1 insertion(+)
windows/virt2phys/virt2phys.inf +1 -0
index c1ea8d9..5af77d2 100644
@@ -8,6 +8,7 @@ ClassGuid = {6d53d3f7-734b-44ec-a6a9-4e369dc121a4}
 Provider = %ManufacturerName%
 CatalogFile = virt2phys.cat
 DriverVer =
+PnpLockdown = 1
 
 [DestinationDirs]
 DefaultDestDir = 12
Signature · 1 line
2.29.3
Acked-by on the v1 series
#5 lore raw
In reply to Dmitry Kozlyuk
Quoted 9 lines · Dmitry Kozlyuk

Fixes for building with Windows Development Kit 22000.1 and some build configuration cleanup.

Dmitry Kozlyuk (4):
windows: specify signature hash algorithm windows/virt2phys: support only x86 configurations windows/virt2phys: change setup class GUID to custom windows/virt2phys: add PnpLockdown directive

Quoted 4 lines
  windows/netuio/netuio.vcxproj       |   6 ++
  windows/virt2phys/virt2phys.inf     |   3 +-
  windows/virt2phys/virt2phys.vcxproj | 146 ++--------------------------
  3 files changed, 15 insertions(+), 140 deletions(-)
#6 lore raw

08/10/2021 04:06, Menon, Ranjit:

Quoted 10 lines · Dmitry Kozlyuk
Quoted 9 lines

Fixes for building with Windows Development Kit 22000.1 and some build configuration cleanup.

Dmitry Kozlyuk (4):
windows: specify signature hash algorithm windows/virt2phys: support only x86 configurations windows/virt2phys: change setup class GUID to custom windows/virt2phys: add PnpLockdown directive

Quoted 6 lines
Quoted 4 lines
  windows/netuio/netuio.vcxproj       |   6 ++
  windows/virt2phys/virt2phys.inf     |   3 +-
  windows/virt2phys/virt2phys.vcxproj | 146 ++--------------------------
  3 files changed, 15 insertions(+), 140 deletions(-)

Applied, thanks.