Index: /trunk/kBuild/sdks/WINSDK10-KM-WLH.kmk
===================================================================
--- /trunk/kBuild/sdks/WINSDK10-KM-WLH.kmk	(revision 3626)
+++ /trunk/kBuild/sdks/WINSDK10-KM-WLH.kmk	(revision 3626)
@@ -0,0 +1,54 @@
+# $Id$
+## @file
+# kBuild SDK - Derives from WINSDK10.kmk, kernel mode, Targeting Windows Vista (KBUILD_TARGET_ARCH).
+#
+# @note There are no Vista libraries shipping with the windows 10 WDK, so this
+#       is a bit hackish and uses the Windows 7 ones instead.
+#
+
+#
+# Copyright (c) 2006-2021 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
+#
+# This file is part of kBuild.
+#
+# kBuild is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# kBuild is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with kBuild; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+#
+# As a special exception you are granted permission to include this file, via
+# the kmk include directive, as you wish without this in itself causing the
+# resulting makefile, program or whatever to be covered by the GPL license.
+# This exception does not however invalidate any other reasons why the makefile,
+# program, whatever should not be covered the GPL.
+#
+#
+
+ifndef SDK_WINSDK10
+ include $(KBUILD_PATH)/sdks/WINSDK10-KM.kmk
+endif
+
+SDK_WINSDK10-KM-WLH               := The Microsoft Windows 10 SDK, kernel mode, Targeting Windows Vista (KBUILD_TARGET_ARCH) - using W7 libraries.
+SDK_WINSDK10-KM-WLH_EXTENDS       := WINSDK10-KM
+SDK_WINSDK10-KM-WLH_DEFS          ?= WIN32=100 _WIN32_WINNT=0x0600 WINVER=0x0600 _WIN32_IE=0x0700 NTDDI_VERSION=0x06000000 \
+	KMDF_MAJOR_VERSION=01 KMDF_MINOR_VERSION=007
+SDK_WINSDK10-KM-WLH_LIBPATH.x86   ?= $(PATH_SDK_WINSDK10_KM_LIB_W7.x86)
+SDK_WINSDK10-KM-WLH_LIBPATH.amd64 ?= $(PATH_SDK_WINSDK10_KM_LIB_W7.amd64)
+SDK_WINSDK10-KM-WLH_LIBPATH.arm32 ?= $(PATH_SDK_WINSDK10_KM_LIB_W7.arm32)
+
+# SDK Specific Properties.
+PATH_SDK_WINSDK10-KM-WLH_LIB.x86  ?= $(PATH_SDK_WINSDK10_KM_LIB_W7.x86)
+PATH_SDK_WINSDK10-KM-WLH_LIB.amd64?= $(PATH_SDK_WINSDK10_KM_LIB_W7.amd64)
+PATH_SDK_WINSDK10-KM-WLH_LIB.arm32?= $(PATH_SDK_WINSDK10_KM_LIB_W7.arm32)
+PATH_SDK_WINSDK10-KM-WLH_LIB      ?= $(PATH_SDK_WINSDK10-KM-WLH_LIB.$(KBUILD_TARGET_ARCH))
+
Index: /trunk/kBuild/sdks/WINSDK10.kmk
===================================================================
--- /trunk/kBuild/sdks/WINSDK10.kmk	(revision 3625)
+++ /trunk/kBuild/sdks/WINSDK10.kmk	(revision 3626)
@@ -44,17 +44,31 @@
 ## @def PATH_SDK_WINSDK10
 ## The base path of the Windows 10 SDK.
+
+## @def SDK_WINSDK10_MAX_VERSION
+## The maximum SDK version to use.
+ifndef SDK_WINSDK10_MAX_VERSION
+ SDK_WINSDK10_MAX_VERSION := 99.9.99999.9
+endif
+
 ## @def SDK_WINSDK10_VERSION
 ## The SDK version for subdirectories.
+if defined(SDK_WINSDK10_VERSION) &&  "$(SDK_WINSDK10_VERSION)" > "$(SDK_WINSDK10_MAX_VERSION)"
+ $(warning Dropping SDK_WINSDK10_VERSION=$(SDK_WINSDK10_VERSION) is it is later than SDK_WINSDK10_MAX_VERSION=$(SDK_WINSDK10_MAX_VERSION))
+ SDK_WINSDK10_VERSION :=
+endif
+
 ifndef PATH_SDK_WINSDK10
  ifndef SDK_WINSDK10_VERSION
-  PATH_SDK_WINSDK10 := $(firstfile $(foreachfile toolsdir, \
-  	$(KBUILD_DEVTOOLS_BLD) $(KBUILD_DEVTOOLS_TRG) $(KBUILD_DEVTOOLS)/win.x86 $(KBUILD_DEVTOOLS)/win.amd64 \
-       , $(rsortfiles $(qwildcard ,$(toolsdir)/sdk/v10*/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]/10.0.*))))
+  PATH_SDK_WINSDK10 := $(firstfile $(foreachfile candidate, $(foreachfile toolsdir, \
+  	$(KBUILD_DEVTOOLS)/win $(KBUILD_DEVTOOLS_BLD) $(KBUILD_DEVTOOLS_TRG) $(KBUILD_DEVTOOLS)/win.x86 $(KBUILD_DEVTOOLS)/win.amd64 \
+       ,$(rsortfiles $(qwildcard ,$(toolsdir)/sdk/v10*/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]/10.0.*))) \
+	,$(if-expr "$(qnotdir ,$(candidate))" vle "$(SDK_WINSDK10_MAX_VERSION)",$(candidate),)))
   ifeq ($(PATH_SDK_WINSDK10),)
-   PATH_SDK_WINSDK10 := $(firstfile $(foreachfile progfilesdir,$(WINCMN_PROGRAM_FILES_LIST)\
-   	,$(rsortfiles $(qwildcard ,$(progfilesdir)/Windows\ Kits/10/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]/10.0.*)) ))
+   PATH_SDK_WINSDK10 := $(firstfile $(foreachfile candidate, $(foreachfile progfilesdir,$(WINCMN_PROGRAM_FILES_LIST)\
+   	,$(rsortfiles $(qwildcard ,$(progfilesdir)/Windows\ Kits/10/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]/10.0.*)) ) \
+	,$(if-expr "$(qnotdir ,$(candidate))" vle "$(SDK_WINSDK10_MAX_VERSION)",$(candidate),)))
    ifeq ($(PATH_SDK_WINSDK10),)
-    $(warning kBuild: PATH_SDK_WINSDK10 couldn't be determined!)
-    PATH_SDK_WINSDK10 := $(KBUILD_DEVTOOLS_BLD)/sdk/v10-not-found/Include/10.0.10240.0
+    $(warning kBuild: PATH_SDK_WINSDK10 could not be determined!)
+    PATH_SDK_WINSDK10 := $(KBUILD_DEVTOOLS)/win/sdk/v10-not-found/Include/10.0.10240.0
    endif
   endif
@@ -63,11 +77,11 @@
   PATH_SDK_WINSDK10 := $(firstfile $(foreachfile toolsdir, \
   	$(KBUILD_DEVTOOLS_BLD) $(KBUILD_DEVTOOLS_TRG) $(KBUILD_DEVTOOLS)/win.x86 $(KBUILD_DEVTOOLS)/win.amd64 \
-       , $(rsortfiles $(qwildcard ,$(toolsdir)/sdk/v10*/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]/$(SDK_WINSDK10_VERSION)))))
+       ,$(rsortfiles $(qwildcard ,$(toolsdir)/sdk/v10*/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]/$(SDK_WINSDK10_VERSION)))))
   ifeq ($(PATH_SDK_WINSDK10),)
    PATH_SDK_WINSDK10 := $(firstfile $(foreachfile progfilesdir,$(WINCMN_PROGRAM_FILES_LIST)\
    	,$(rsortfiles $(qwildcard ,$(progfilesdir)/Windows\ Kits/10/[Ii][Nn][Cc][Ll][Uu][Dd][Ee]/$(SDK_WINSDK10_VERSION))) ))
    ifeq ($(PATH_SDK_WINSDK10),)
-    $(warning kBuild: PATH_SDK_WINSDK10 couldn't be determined!)
-    PATH_SDK_WINSDK10 := $(KBUILD_DEVTOOLS_BLD)/sdk/v10-not-found/Include/$(SDK_WINSDK10_VERSION)
+    $(warning kBuild: PATH_SDK_WINSDK10 could not be determined!)
+    PATH_SDK_WINSDK10 := $(KBUILD_DEVTOOLS)/win/sdk/v10-not-found/Include/$(SDK_WINSDK10_VERSION)
    endif
   endif
