According to the "MiniSpy" sample driver project's .inf file:
It is possible to decorate the [DefaultInstall] section with both the architecture and the OS version. This is ostensibly being done to handle how the registry entries for "Instances" needs to be nested under "Parameters" on newer builds of Windows (Windows 11 22H2 & newer), while it is nested directly under the service's registry key in down-level builds of Windows.
These are the operative parts of the .inf file:
[DefaultInstall.NT$ARCH$.10.0...25952]
OptionDesc = %ServiceDescription%
CopyFiles = Minispy.Files,
[DefaultInstall.NT$ARCH$.10.0...25952.Services]
AddService = %ServiceName%,,Minispy.Service
[DefaultInstall.NT$ARCH$]
OptionDesc = %ServiceDescription%
CopyFiles = MinispyDownlevel.CopyDriverFiles
[DefaultInstall.NT$ARCH$.Services]
AddService = %ServiceName%,,MinispyDownlevel.Service
[DefaultUninstall.NT$ARCH$]
LegacyUninstall = 1
DelFiles = MinispyDownlevel.DelDriverFiles
If I use "NT$ARCH$" as the architecture decoration instead of "NTAMD64" and "NTARM64", the .inf file in my driver project doesn't pass the Inf Verify tests during a build in VS2022.
If I do use "NTAMD64" and "NTARM64" with the desired OS version information as the decoration suffix, then it passes the verification during build but when the driver installs, the OS version decoration appears to be ignored and the "downlevel" sections with architecture but without OS version seem to be what's being used based on the registry entries being created. Snippets from my .inf file are as follows:
[DefaultInstall.NTAMD64.10.0...22621]
CopyFiles = MiniFilter.Files
[DefaultInstall.NTAMD64.10.0...22621.Services]
AddService = %Service.Name%,,MiniFilter.Service
[DefaultInstall.NTARM64.10.0...22621]
CopyFiles = MiniFilter.Files
[DefaultInstall.NTARM64.10.0...22621.Services]
AddService = %Service.Name%,,MiniFilter.Service
[DefaultInstall.NTAMD64]
CopyFiles = MiniFilterPre22621.Files
[DefaultUninstall.NTAMD64]
LegacyUninstall = 1
[DefaultInstall.NTAMD64.Services]
AddService = %Service.Name%,,MiniFilterPre22621.Service
[DefaultInstall.NTARM64]
CopyFiles = MiniFilterPre22621.Files
[DefaultUninstall.NTARM64]
LegacyUninstall = 1
[DefaultInstall.NTARM64.Services]
AddService = %Service.Name%,,MiniFilterPre22621.Service
Windows 10.0.22621 is the build number for Windows 11 22H2, which is where the difference in registry key usage is documented by Microsoft, per the following:
Based on that documentation, I have one section which sets up the registry values as follows for 10.0.22621 & newer:
HKR,"Parameters","SupportedFeatures",0x00010001,%Driver.SupportedFeatures%
HKR,"Parameters\Instances","DefaultInstance",0x00000000,"%Driver.DefaultInstance.Name%"
HKR,"Parameters\Instances%Driver.DefaultInstance.Name%","Altitude",0x00000000,"%Driver.DefaultInstance.Altitude%"
HKR,"Parameters\Instances%Driver.DefaultInstance.Name%","Flags",0x00010001,%Driver.DefaultInstance.Flags%
And then for downlevel systems prior to 10.0.22621, I have the following section:
HKR,,"SupportedFeatures",0x00010001,%Driver.SupportedFeatures%
HKR,"Instances","DefaultInstance",0x00000000,"%Driver.DefaultInstance.Name%"
HKR,"Instances%Driver.DefaultInstance.Name%","Altitude",0x00000000,"%Driver.DefaultInstance.Altitude%"
HKR,"Instances%Driver.DefaultInstance.Name%","Flags",0x00010001,%Driver.DefaultInstance.Flags%
I've tested the installation using the .inf file on Windows 11 23H2 & 24H2, and in both cases, despite the OS build being greater than 10.0.22621, the OS version decoration is ignored during installation and the downlevel sections are used. I've verified that all of the relevant "AddReg" directives and the section names they refer to are correct.
I'm at a loss to explain why this isn't working as expected/documented, but I suspect there may be something very subtle missing/wrong. Also, the apparent "macro" substitution of "$ARCH$" doesn't appear to be working, either, and documentation regarding it is minimal.