From 1ad137b6e5a762d3dc0ea0e0bd95f4e46e2dd329 Mon Sep 17 00:00:00 2001
From: JakobL-MSFT <110699333+JakobL-MSFT@users.noreply.github.com>
Date: Tue, 6 Feb 2024 18:01:44 -0800
Subject: [PATCH] Initial Support for WDK NuGet Experiment. Take 3 (#1102)

* Add parent directory file for NuGet import support

* fix directory.build.props file

* Checked in a comment with baseline. Also small fix to make sure we use GE InfVerif flags and Exclusions.csv

* Remove references to path which refer older vars

* Remove stale variable path from mincore.lib

* remove references to stale variale from vhidmimium

* remove stale reference from ddproxy

* remove stale reference in inspect.vcxproj

* Remove stale path reference in msnmntr.vcxproj

* Remove stale path reference to stmedit.vcxproj

* Remove stale path from echosrv.vcxproj

* remove stale path mscorelib SingleComponentSingleStateUm.vcxproj

* remove stale path

* Move GitHub check up front

* Replace correct value for the wpprecorderum

* Removed the stale references for the um libs

* correct the reference path for libs simplemedia

* Correct the reference path for vccomsup

* Correct the reference path for sdk lib path

* added reference to the kit shared inc path

* added reference to the kit shared inc path

* Build-SampleSet: Let determination of NuGet packages be based on a folder .\packages rather than the .\packages.config file

* added reference to the kit shared inc path

* Updated PACKAGERESTORE_README.md with results from Prashant's recent fixes.  Moves us 37 failures to 19 failures.

* Rewrite how to get NuGet packages via EEAP or MSFTNuGet

* Minor edits to Building-Locally.md

* added reference to the kit shared inc path

* Move forward to ge_release 26052.  This fixes samples .\prm

* added reference to the kit shared inc path

* Move forward to ge_release 26052.  This fixes samples .\prm.  Update to .\Building-Locally.md

* added reference to the kit shared inc path

* added reference to the kit shared inc path

* added reference to the kit shared inc path

* added reference to the kit shared inc path

* added reference to the kit shared inc path

* added reference to the kit shared inc path

* Update NuGet build instructions and PACKAGERESTORE_README.md

* Reset Building-Locally.md and remote PACKAGERESTORE_README.md

* Add reference to wdk um include path

* Add reference to wdk um include path

* Add reference to wdk um include path

* Provided full path to wmimofck.exe to correctly resolve

* Fix the path resolution for wmimofexe

* Correct the wmimfck path resolution

* Add NuGet arm64 support

---------

Co-authored-by: Prashant Chahar <pchahar@microsoft.com>
Co-authored-by: Jakob Lichtenberg <jakobl@ntdev.microsoft.com>
---
 Directory.Build.props                                    | 9 ++++-----
 packages.config                                          | 2 ++
 prm/PrmFunc/prmfuncsample.vcxproj                        | 3 ++-
 storage/class/classpnp/src/classpnp.vcxproj              | 2 +-
 storage/msdsm/src/SampleDSM.vcxproj                      | 4 ++--
 usb/UcmCxUcsi/UcmCxUcsi.vcxproj                          | 2 +-
 .../UcmUcsiAcpiSample/UcmUcsiAcpiSample.vcxproj          | 4 ++++
 video/KMDOD/Sample/SampleDisplay.vcxproj                 | 8 ++++----
 wmi/wmiacpi/acpimof.vcxproj                              | 2 +-
 wmi/wmisamp/WmiSamp.vcxproj                              | 1 +
 10 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/Directory.Build.props b/Directory.Build.props
index 19d85cd4b..2aab82667 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,8 +1,7 @@
 <Project>
-<Import Project="packages\Microsoft.Windows.WDK.x64.10.0.26052.1000-preview.ge-release\build\native\Microsoft.Windows.WDK.x64.props" Condition="Exists('packages\Microsoft.Windows.WDK.x64.10.0.26052.1000-preview.ge-release\build\native\Microsoft.Windows.WDK.x64.props')"/>
-<Import Project="packages\Microsoft.Windows.SDK.CPP.x64.10.0.26052.1000-preview.ge-release\build\native\Microsoft.Windows.SDK.cpp.x64.props" Condition="Exists('packages\Microsoft.Windows.SDK.CPP.x64.10.0.26052.1000-preview.ge-release\build\native\Microsoft.Windows.SDK.cpp.x64.props')"/>
+<Import Project="packages\Microsoft.Windows.WDK.x64.10.0.26052.1000-preview.ge-release\build\native\Microsoft.Windows.WDK.x64.props" Condition="Exists('packages\Microsoft.Windows.WDK.x64.10.0.26052.1000-preview.ge-release\build\native\Microsoft.Windows.WDK.x64.props') and '$(Platform)' == 'x64'"/>
+<Import Project="packages\Microsoft.Windows.WDK.arm64.10.0.26052.1000-preview.ge-release\build\native\Microsoft.Windows.WDK.arm64.props" Condition="Exists('packages\Microsoft.Windows.WDK.arm64.10.0.26052.1000-preview.ge-release\build\native\Microsoft.Windows.WDK.arm64.props') and '$(Platform)' == 'ARM64'"/>
+<Import Project="packages\Microsoft.Windows.SDK.CPP.x64.10.0.26052.1000-preview.ge-release\build\native\Microsoft.Windows.SDK.cpp.x64.props" Condition="Exists('packages\Microsoft.Windows.SDK.CPP.x64.10.0.26052.1000-preview.ge-release\build\native\Microsoft.Windows.SDK.cpp.x64.props') and '$(Platform)' == 'x64'"/>
+<Import Project="packages\Microsoft.Windows.SDK.CPP.arm64.10.0.26052.1000-preview.ge-release\build\native\Microsoft.Windows.SDK.cpp.arm64.props" Condition="Exists('packages\Microsoft.Windows.SDK.CPP.arm64.10.0.26052.1000-preview.ge-release\build\native\Microsoft.Windows.SDK.cpp.arm64.props') and '$(Platform)' == 'ARM64'"/>
 <Import Project="packages\Microsoft.Windows.SDK.CPP.10.0.26052.1000-preview.ge-release\build\native\Microsoft.Windows.SDK.cpp.props" Condition="Exists('packages\Microsoft.Windows.SDK.CPP.10.0.26052.1000-preview.ge-release\build\native\Microsoft.Windows.SDK.cpp.props')"/>
-<!-- <PropertyGroup>
-  <ForceImportBeforeCppProps>$(MsbuildThisFileDirectory)\MyProps.props</ForceImportBeforeCppProps>
-</PropertyGroup> -->
 </Project>
diff --git a/packages.config b/packages.config
index 55fd7b633..0976b9f01 100644
--- a/packages.config
+++ b/packages.config
@@ -2,5 +2,7 @@
 <packages>
   <package id="Microsoft.Windows.SDK.CPP" version="10.0.26052.1000-preview.ge-release" targetFramework="native" />
   <package id="Microsoft.Windows.SDK.CPP.x64" version="10.0.26052.1000-preview.ge-release" targetFramework="native" />
+  <package id="Microsoft.Windows.SDK.CPP.arm64" version="10.0.26052.1000-preview.ge-release" targetFramework="native" />
   <package id="Microsoft.Windows.WDK.x64" version="10.0.26052.1000-preview.ge-release" targetFramework="native" />
+  <package id="Microsoft.Windows.WDK.arm64" version="10.0.26052.1000-preview.ge-release" targetFramework="native" />
 </packages>
diff --git a/prm/PrmFunc/prmfuncsample.vcxproj b/prm/PrmFunc/prmfuncsample.vcxproj
index 3cc3181d8..55465018c 100644
--- a/prm/PrmFunc/prmfuncsample.vcxproj
+++ b/prm/PrmFunc/prmfuncsample.vcxproj
@@ -61,6 +61,7 @@
       <WarningLevel>Level4</WarningLevel>
       <ExceptionHandling>
       </ExceptionHandling>
+      <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(KIT_SHARED_INC_PATH_WDK)</AdditionalIncludeDirectories>
     </ClCompile>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -72,7 +73,7 @@
       <WarningLevel>Level4</WarningLevel>
       <ExceptionHandling>
       </ExceptionHandling>
-      <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(KIT_SHARED_INC_PATH_WDK)</AdditionalIncludeDirectories>
     </ClCompile>
   </ItemDefinitionGroup>
   <ItemGroup>
diff --git a/storage/class/classpnp/src/classpnp.vcxproj b/storage/class/classpnp/src/classpnp.vcxproj
index 4b092509b..3b4316b14 100644
--- a/storage/class/classpnp/src/classpnp.vcxproj
+++ b/storage/class/classpnp/src/classpnp.vcxproj
@@ -314,7 +314,7 @@
     </ItemGroup>
     <Exec Command="if not exist &quot;%(CustomBuildTarget0Input.Identity)&quot; copy  &quot;.\%(CustomBuildTarget0Input.Filename)%(CustomBuildTarget0Input.Extension)&quot; &quot;%(CustomBuildTarget0Input.Identity)&quot;" WorkingDirectory="$(MSBuildProjectDirectory)" />
     <Exec Command="mofcomp -Amendment:ms_409 -MFL:$(IntDir)\MFL.MFL -MOF:$(IntDir)\MOF.MOF &quot;%(CustomBuildTarget0Input.Identity)&quot;" WorkingDirectory="$(MSBuildProjectDirectory)" />
-    <Exec Command="wmimofck -y$(IntDir)\MOF.MOF -z$(IntDir)\MFL.MFL $(IntDir)\MOFMFL.MOF" WorkingDirectory="$(MSBuildProjectDirectory)" />
+    <Exec Command="&quot;$(WmimofckToolPath)\wmimofck.exe&quot; -y$(IntDir)\MOF.MOF -z$(IntDir)\MFL.MFL $(IntDir)\MOFMFL.MOF" WorkingDirectory="$(MSBuildProjectDirectory)" />
     <Exec Command="mofcomp -B:&quot;.\$(IntDir)\classlog.bmf&quot; $(IntDir)\MOFMFL.MOF" WorkingDirectory="$(MSBuildProjectDirectory)" />
   </Target>
   <ItemGroup>
diff --git a/storage/msdsm/src/SampleDSM.vcxproj b/storage/msdsm/src/SampleDSM.vcxproj
index 5387d218b..fe3104b88 100644
--- a/storage/msdsm/src/SampleDSM.vcxproj
+++ b/storage/msdsm/src/SampleDSM.vcxproj
@@ -285,7 +285,7 @@
     </ItemGroup>
     <Exec Command="if not exist &quot;%(CustomBuildTarget0Input.Identity)&quot; copy  &quot;.\%(CustomBuildTarget0Input.Filename)%(CustomBuildTarget0Input.Extension)&quot; &quot;%(CustomBuildTarget0Input.Identity)&quot;" WorkingDirectory="$(MSBuildProjectDirectory)" />
     <Exec Command="mofcomp -Amendment:ms_409 -MFL:$(IntDir)\MFL.MFL -MOF:$(IntDir)\MOF.MOF &quot;%(CustomBuildTarget0Input.Identity)&quot;" WorkingDirectory="$(MSBuildProjectDirectory)" />
-    <Exec Command="wmimofck -y$(IntDir)\MOF.MOF -z$(IntDir)\MFL.MFL $(IntDir)\MOFMFL.MOF" WorkingDirectory="$(MSBuildProjectDirectory)" />
+    <Exec Command="&quot;$(WmimofckToolPath)\wmimofck.exe&quot; -y$(IntDir)\MOF.MOF -z$(IntDir)\MFL.MFL $(IntDir)\MOFMFL.MOF" WorkingDirectory="$(MSBuildProjectDirectory)" />
     <Exec Command="mofcomp -B:&quot;.\$(IntDir)\msdsm.bmf&quot; $(IntDir)\MOFMFL.MOF" WorkingDirectory="$(MSBuildProjectDirectory)" />
   </Target>
   <Target Name="Custom Build Target 2" BeforeTargets="$(BuildGenerateSourcesTargets)">
@@ -294,7 +294,7 @@
     </ItemGroup>
     <Exec Command="if not exist &quot;%(CustomBuildTarget2Input.Identity)&quot; copy  &quot;.\%(CustomBuildTarget2Input.Filename)%(CustomBuildTarget2Input.Extension)&quot; &quot;%(CustomBuildTarget2Input.Identity)&quot;" WorkingDirectory="$(MSBuildProjectDirectory)" />
     <Exec Command="mofcomp -Amendment:ms_409 -MFL:$(IntDir)\MFL.MFL -MOF:$(IntDir)\MOF.MOF &quot;%(CustomBuildTarget2Input.Identity)&quot;" WorkingDirectory="$(MSBuildProjectDirectory)" />
-    <Exec Command="wmimofck -y$(IntDir)\MOF.MOF -z$(IntDir)\MFL.MFL $(IntDir)\MOFMFL.MOF" WorkingDirectory="$(MSBuildProjectDirectory)" />
+    <Exec Command="&quot;$(WmimofckToolPath)\wmimofck.exe&quot; -y$(IntDir)\MOF.MOF -z$(IntDir)\MFL.MFL $(IntDir)\MOFMFL.MOF" WorkingDirectory="$(MSBuildProjectDirectory)" />
     <Exec Command="mofcomp -B:&quot;.\$(IntDir)\msdsmdsm.bmf&quot; $(IntDir)\MOFMFL.MOF" WorkingDirectory="$(MSBuildProjectDirectory)" />
   </Target>
   <ItemGroup>
diff --git a/usb/UcmCxUcsi/UcmCxUcsi.vcxproj b/usb/UcmCxUcsi/UcmCxUcsi.vcxproj
index 66355942b..35b53adbc 100644
--- a/usb/UcmCxUcsi/UcmCxUcsi.vcxproj
+++ b/usb/UcmCxUcsi/UcmCxUcsi.vcxproj
@@ -90,7 +90,7 @@
   <ItemDefinitionGroup>
     <ClCompile>
       <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
-      <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;$(KIT_SHARED_INC_PATH_WDK)</AdditionalIncludeDirectories>
       <WppEnabled>true</WppEnabled>
       <WppRecorderEnabled>true</WppRecorderEnabled>
       <WppScanConfigurationData>trace.h</WppScanConfigurationData>
diff --git a/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/UcmUcsiAcpiSample.vcxproj b/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/UcmUcsiAcpiSample.vcxproj
index 136932e7f..610fcc443 100644
--- a/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/UcmUcsiAcpiSample.vcxproj
+++ b/usb/UcmUcsiAcpiSample/UcmUcsiAcpiSample/UcmUcsiAcpiSample.vcxproj
@@ -86,6 +86,7 @@
       <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
       <DisableSpecificWarnings>4100;4189;5208;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <SupportJustMyCode>false</SupportJustMyCode>
+      <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(KIT_SHARED_INC_PATH_WDK)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <AdditionalDependencies>$(DDK_LIB_PATH)\UcmUcsi\1.0\UcmUcsiCxStub.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -99,6 +100,7 @@
       <WppEnabled>true</WppEnabled>
       <DisableSpecificWarnings>4100;4189;5208;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <SupportJustMyCode>false</SupportJustMyCode>
+      <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(KIT_SHARED_INC_PATH_WDK)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <AdditionalDependencies>$(DDK_LIB_PATH)\UcmUcsi\1.0\UcmUcsiCxStub.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -111,6 +113,7 @@
     <ClCompile>
       <WppEnabled>true</WppEnabled>
       <DisableSpecificWarnings>4100;4189;5208;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(KIT_SHARED_INC_PATH_WDK)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <AdditionalDependencies>$(DDK_LIB_PATH)\UcmUcsi\1.0\UcmUcsiCxStub.lib;%(AdditionalDependencies)</AdditionalDependencies>
@@ -123,6 +126,7 @@
     <ClCompile>
       <WppEnabled>true</WppEnabled>
       <DisableSpecificWarnings>4100;4189;5208;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(KIT_SHARED_INC_PATH_WDK)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <AdditionalDependencies>$(DDK_LIB_PATH)\UcmUcsi\1.0\UcmUcsiCxStub.lib;%(AdditionalDependencies)</AdditionalDependencies>
diff --git a/video/KMDOD/Sample/SampleDisplay.vcxproj b/video/KMDOD/Sample/SampleDisplay.vcxproj
index 30a147c56..6dfa431c0 100644
--- a/video/KMDOD/Sample/SampleDisplay.vcxproj
+++ b/video/KMDOD/Sample/SampleDisplay.vcxproj
@@ -83,7 +83,7 @@
       <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)</AdditionalIncludeDirectories>
     </ResourceCompile>
     <ClCompile>
-      <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH);$(KIT_SHARED_INC_PATH_WDK)</AdditionalIncludeDirectories>
     </ClCompile>
     <Midl>
       <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)</AdditionalIncludeDirectories>
@@ -97,7 +97,7 @@
       <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)</AdditionalIncludeDirectories>
     </ResourceCompile>
     <ClCompile>
-      <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH);$(KIT_SHARED_INC_PATH_WDK)</AdditionalIncludeDirectories>
     </ClCompile>
     <Midl>
       <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)</AdditionalIncludeDirectories>
@@ -111,7 +111,7 @@
       <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)</AdditionalIncludeDirectories>
     </ResourceCompile>
     <ClCompile>
-      <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH);$(KIT_SHARED_INC_PATH_WDK)</AdditionalIncludeDirectories>
     </ClCompile>
     <Midl>
       <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)</AdditionalIncludeDirectories>
@@ -125,7 +125,7 @@
       <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)</AdditionalIncludeDirectories>
     </ResourceCompile>
     <ClCompile>
-      <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH);$(KIT_SHARED_INC_PATH_WDK)</AdditionalIncludeDirectories>
     </ClCompile>
     <Midl>
       <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH);$(SDK_INC_PATH)</AdditionalIncludeDirectories>
diff --git a/wmi/wmiacpi/acpimof.vcxproj b/wmi/wmiacpi/acpimof.vcxproj
index 15803d3ce..2d4225e28 100644
--- a/wmi/wmiacpi/acpimof.vcxproj
+++ b/wmi/wmiacpi/acpimof.vcxproj
@@ -181,7 +181,7 @@
     </ItemGroup>
     <Exec Command="if not exist &quot;%(CustomBuildTarget1Input.Identity)&quot; copy  &quot;.\%(CustomBuildTarget1Input.Filename)%(CustomBuildTarget1Input.Extension)&quot; &quot;%(CustomBuildTarget1Input.Identity)&quot;" WorkingDirectory="$(MSBuildProjectDirectory)" />
     <Exec Command="mofcomp -Amendment:ms_409 -MFL:$(IntDir)\MFL.MFL -MOF:$(IntDir)\MOF.MOF &quot;%(CustomBuildTarget1Input.Identity)&quot;" WorkingDirectory="$(MSBuildProjectDirectory)" />
-    <Exec Command="wmimofck -y$(IntDir)\MOF.MOF -z$(IntDir)\MFL.MFL $(IntDir)\MOFMFL.MOF" WorkingDirectory="$(MSBuildProjectDirectory)" />
+    <Exec Command="&quot;$(WmimofckToolPath)\wmimofck.exe&quot; -y$(IntDir)\MOF.MOF -z$(IntDir)\MFL.MFL $(IntDir)\MOFMFL.MOF" WorkingDirectory="$(MSBuildProjectDirectory)" />
     <Exec Command="mofcomp -B:&quot;.\$(IntDir)\acpimof.bmf&quot; $(IntDir)\MOFMFL.MOF" WorkingDirectory="$(MSBuildProjectDirectory)" />
   </Target>
   <ItemGroup>
diff --git a/wmi/wmisamp/WmiSamp.vcxproj b/wmi/wmisamp/WmiSamp.vcxproj
index a0ae2b2aa..d4b3ff348 100644
--- a/wmi/wmisamp/WmiSamp.vcxproj
+++ b/wmi/wmisamp/WmiSamp.vcxproj
@@ -87,6 +87,7 @@
       <HexdumpOutputFile>.\$(IntDir)\wmisamp.x</HexdumpOutputFile>
       <HtmlOutputDirectory>.\$(IntDir)\htm</HtmlOutputDirectory>
       <HtmlUIOutputDirectory>true</HtmlUIOutputDirectory>
+	  <ToolPath>$(WmimofckToolPath)</ToolPath>
     </Wmimofck>
   </ItemGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">