Index: trunk/Config.kmk
===================================================================
--- trunk/Config.kmk	(revision 93321)
+++ trunk/Config.kmk	(revision 93322)
@@ -2844,4 +2844,6 @@
  if "$(KBUILD_TARGET)" == "linux"
 VBOX_WITH_GCC_SANITIZER := 1
+ else if "$(KBUILD_TARGET)" == "win"
+VBOX_WITH_VCC_SANITIZER := 1
  else
 VBOX_WITH_EF_WRAPS := 1
@@ -2887,4 +2889,14 @@
   VBOX_GCC_SANITIZER_LDFLAGS += -lasan
  endif
+endif
+
+# The config for Visual C++ 2019 update 9 and later.
+ifdef VBOX_WITH_VCC_SANITIZER
+ VBOX_VCC_SANITIZER_FLAGS      := -fsanitize=address -fno-sanitize-address-vcasan-lib
+ # experimental: VBOX_VCC_SANITIZER_FLAGS += /fsanitize-address-use-after-return
+ VBOX_VCC_SANITIZER_LDFLAGS    :=
+else
+ VBOX_VCC_SANITIZER_FLAGS      :=
+ VBOX_VCC_SANITIZER_LDFLAGS    :=
 endif
 
@@ -5793,5 +5805,5 @@
  endif
  TEMPLATE_VBOXR3EXE_CXXFLAGS           = -Zi -Zl -GR- -EHsc -GF -MD$(VBOX_VCC_CRT_TYPE) -Zc:wchar_t- $(VBOX_VCC_OPT) $(VBOX_VCC_FP) \
- 	-Gy $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_WARN_ALL) $(VBOX_VCC_WERR)
+ 	-Gy $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS) $(VBOX_VCC_WARN_ALL) $(VBOX_VCC_WERR)
  if "$(VBOX_VCC_TOOL_STEM)" >= "VCC120"
   TEMPLATE_VBOXR3EXE_CXXFLAGS         += -Gw
@@ -5813,5 +5825,5 @@
  TEMPLATE_VBOXR3EXE_LDFLAGS            = -Ignore:4197 \
 	/NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LargeAddressAware /DynamicBase /NxCompat /Release /Debug /Opt:Ref /Opt:Icf \
-	$(VBOX_VCC_LD_GUARD_CF) \
+	$(VBOX_VCC_LD_GUARD_CF) $(VBOX_VCC_SANITIZER_LDFLAGS) \
 	/Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
 	/STUB:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com \
@@ -5841,4 +5853,12 @@
   	$(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.amd64)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
   	$(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.amd64)_LIB)/oldnames.lib
+  ifeq ($(KBUILD_TYPE),asan)
+   TEMPLATE_VBOXR3EXE_LIBS.x86         += \
+   	$(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.x86)_LIB)/clang_rt.asan_dynamic-i386.lib \
+   	$(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.x86)_LIB)/clang_rt.asan_dynamic_runtime_thunk-i386.lib
+   TEMPLATE_VBOXR3EXE_LIBS.amd64       += \
+   	$(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.amd64)_LIB)/clang_rt.asan_dynamic-x86_64.lib \
+   	$(PATH_TOOL_$(TEMPLATE_VBOXR3EXE_TOOL.win.amd64)_LIB)/clang_rt.asan_dynamic_runtime_thunk-x86_64.lib
+  endif
  else
   TEMPLATE_VBOXR3EXE_LIBS.x86           = \
@@ -6141,4 +6161,12 @@
   	$(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.amd64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib \
   	$(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.amd64)_LIB)/oldnames.lib
+  ifeq ($(KBUILD_TYPE),asan)
+   TEMPLATE_VBOXR3STATIC_LIBS.x86         += \
+   	$(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.x86)_LIB)/clang_rt.asan-i386.lib \
+   	$(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.x86)_LIB)/clang_rt.asan_cxx-i386.lib
+   TEMPLATE_VBOXR3STATIC_LIBS.amd64       += \
+   	$(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.amd64)_LIB)/clang_rt.asan-x86_64.lib \
+   	$(PATH_TOOL_$(TEMPLATE_VBOXR3STATIC_TOOL.win.amd64)_LIB)/clang_rt.asan_cxx-x86_64.lib
+  endif
  else
   TEMPLATE_VBOXR3STATIC_LIBS.x86           = \
@@ -6217,4 +6245,14 @@
   TEMPLATE_VBoxR3Static_LIBS       += kstat
  endif
+endif
+
+#
+# A DLL capable version of VBoxR3Static
+#
+TEMPLATE_VBoxR3StaticDll             = VBox Static Ring-3 DLL
+TEMPLATE_VBoxR3StaticDll_EXTENDS     = VBoxR3Static
+if "$(KBUILD_TARGET)" == "win" && "$(KBUILD_TYPE)" == "asan"
+ TEMPLATE_VBoxR3StaticDll_LIBS.x86   = $(patsubst %clang_rt.asan-i386.lib, %clang_rt.asan_dll_thunk-i386.lib, $(filter-out %clang_rt.asan_cxx-i386.lib,$(TEMPLATE_VBoxR3Static_LIBS.x86)))
+ TEMPLATE_VBoxR3StaticDll_LIBS.amd64 = $(patsubst %clang_rt.asan-x86_64.lib, %clang_rt.asan_dll_thunk-x86_64.lib, $(filter-out %clang_rt.asan_cxx-x86_64.lib,$(TEMPLATE_VBoxR3Static_LIBS.amd64)))
 endif
 
@@ -6259,9 +6297,9 @@
 	$(PATH_TOOL_$(TEMPLATE_VBoxR3StaticNoCrt_TOOL.win.x86)_LIB)/chkstk.obj
 TEMPLATE_VBoxR3StaticNoCrt_SDKS.win.x86   += VBOX_WIN_INT64
-TEMPLATE_VBoxR3StaticNoCrt_LDFLAGS         = $(filter-out $(VBOX_VCC_LD_GUARD_CF), $(TEMPLATE_VBoxR3Static_LDFLAGS))
+TEMPLATE_VBoxR3StaticNoCrt_LDFLAGS         = $(filter-out $(VBOX_VCC_LD_GUARD_CF) $(VBOX_VCC_SANITIZER_LDFLAGS), $(TEMPLATE_VBoxR3Static_LDFLAGS))
 TEMPLATE_VBoxR3StaticNoCrt_LDFLAGS.win.x86 = $(filter-out -Include%, $(TEMPLATE_VBoxR3Static_LDFLAGS.win.x86))
-TEMPLATE_VBoxR3StaticNoCrt_CFLAGS          = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF),$(TEMPLATE_VBoxR3Static_CFLAGS)) /GS- -EHs-
-TEMPLATE_VBoxR3StaticNoCrt_CXXFLAGS        = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF),$(TEMPLATE_VBoxR3Static_CXXFLAGS)) /GS- -EHs-
-TEMPLATE_VBoxR3StaticNoCrt_PCHFLAGS        = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF),$(TEMPLATE_VBoxR3Static_PCHFLAGS)) /GS- -EHs-
+TEMPLATE_VBoxR3StaticNoCrt_CFLAGS          = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxR3Static_CFLAGS)) /GS- -EHs-
+TEMPLATE_VBoxR3StaticNoCrt_CXXFLAGS        = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxR3Static_CXXFLAGS)) /GS- -EHs-
+TEMPLATE_VBoxR3StaticNoCrt_PCHFLAGS        = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxR3Static_PCHFLAGS)) /GS- -EHs-
 TEMPLATE_VBoxR3StaticNoCrt_CXXFLAGS.debug  = $(filter-out /RTC% -RTC%, $(TEMPLATE_VBoxR3Static_CXXFLAGS.debug))
 else
@@ -6831,5 +6869,5 @@
  endif
  TEMPLATE_VBOXMAINEXE_CXXFLAGS           = -Zi -Zl -GR -EHsc -GF -MD$(VBOX_VCC_CRT_TYPE) -Zc:wchar_t- \
- 	$(VBOX_VCC_OPT) $(VBOX_VCC_FP) $(VBOX_VCC_CC_GUARD_CF)
+ 	$(VBOX_VCC_OPT) $(VBOX_VCC_FP) $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS)
  #    -wd4625: 'DisplaySourceBitmap' : copy constructor could not be generated because a base class copy constructor is inaccessible
  #    -wd4626: 'DisplaySourceBitmap' : assignment operator could not be generated because a base class assignment operator is inaccessible
@@ -6857,5 +6895,5 @@
  TEMPLATE_VBOXMAINEXE_LDFLAGS            = -Ignore:4197 \
 	/NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LargeAddressAware /DynamicBase /NxCompat /Release /Debug /Opt:Ref /Opt:Icf \
-	$(VBOX_VCC_LD_GUARD_CF) \
+	$(VBOX_VCC_LD_GUARD_CF) $(VBOX_VCC_SANITIZER_LDFLAGS) \
 	/Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
 	/STUB:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com \
@@ -6892,4 +6930,12 @@
   	$(PATH_TOOL_$(TEMPLATE_VBOXMAINEXE_TOOL.win.amd64)_LIB)/msvcprt$(VBOX_VCC_CRT_TYPE).lib \
   	$(PATH_TOOL_$(TEMPLATE_VBOXMAINEXE_TOOL.win.amd64)_LIB)/oldnames.lib
+  ifeq ($(KBUILD_TYPE),asan)
+   TEMPLATE_VBOXMAINEXE_LIBS.x86         += \
+   	$(PATH_TOOL_$(TEMPLATE_VBOXMAINEXE_TOOL.win.x86)_LIB)/clang_rt.asan_dynamic-i386.lib \
+   	$(PATH_TOOL_$(TEMPLATE_VBOXMAINEXE_TOOL.win.x86)_LIB)/clang_rt.asan_dynamic_runtime_thunk-i386.lib
+   TEMPLATE_VBOXMAINEXE_LIBS.amd64       += \
+   	$(PATH_TOOL_$(TEMPLATE_VBOXMAINEXE_TOOL.win.amd64)_LIB)/clang_rt.asan_dynamic-x86_64.lib \
+   	$(PATH_TOOL_$(TEMPLATE_VBOXMAINEXE_TOOL.win.amd64)_LIB)/clang_rt.asan_dynamic_runtime_thunk-x86_64.lib
+  endif
  else
   TEMPLATE_VBOXMAINEXE_LIBS.x86           = \
@@ -7480,5 +7526,5 @@
      QT_DLL _CRT_SECURE_NO_DEPRECATE \
      $(QMAKE_PRL_DEFINES)
-  TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = -nologo -Zm200 -MD -Zi -EHsc -Zc:wchar_t- $(VBOX_VCC_CC_GUARD_CF)
+  TEMPLATE_VBOXQTGUIEXE_CXXFLAGS = -nologo -Zm200 -MD -Zi -EHsc -Zc:wchar_t- $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS)
   #    -wd4481: nonstandard extension used: override specifier 'override'
   #    -wd4625: 'QRubberBand' : copy constructor could not be generated because a base class copy constructor is inaccessible
@@ -7523,5 +7569,5 @@
   TEMPLATE_VBOXQTGUIEXE_LDFLAGS = -Ignore:4197 \
 	/NOD /INCREMENTAL:NO /MAPINFO:EXPORTS /LargeAddressAware /DynamicBase /NxCompat /Release /Debug /Opt:Ref /Opt:Icf \
-	$(VBOX_VCC_LD_GUARD_CF) \
+	$(VBOX_VCC_LD_GUARD_CF)  $(VBOX_VCC_SANITIZER_LDFLAGS) \
 	/Version:$(VBOX_VERSION_MAJOR)0$(VBOX_VERSION_MINOR).$(VBOX_VERSION_BUILD) \
 	/STUB:$(PATH_ROOT)/src/VBox/HostDrivers/Support/win/winstub.com
@@ -7542,4 +7588,9 @@
    	$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
    	$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib
+  ifeq ($(KBUILD_TYPE),asan)
+   TEMPLATE_VBOXQTGUIEXE_LIBS += \
+   	$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/clang_rt.asan_dynamic-x86_64.lib \
+   	$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/clang_rt.asan_dynamic_runtime_thunk-x86_64.lib
+  endif
   else
    TEMPLATE_VBOXQTGUIEXE_LIBS = \
@@ -8067,4 +8118,12 @@
   	$(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.amd64)_LIB)/libcpmt$(VBOX_VCC_CRT_TYPE).lib \
   	$(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.amd64)_LIB)/oldnames.lib
+  ifeq ($(KBUILD_TYPE),asan)
+   TEMPLATE_VBOXGUESTR3EXE_LIBS.x86         += \
+   	$(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.x86)_LIB)/clang_rt.asan-i386.lib \
+   	$(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.x86)_LIB)/clang_rt.asan_cxx-i386.lib
+   TEMPLATE_VBOXGUESTR3EXE_LIBS.amd64       += \
+   	$(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.amd64)_LIB)/clang_rt.asan-x86_64.lib \
+   	$(PATH_TOOL_$(TEMPLATE_VBOXGUESTR3EXE_TOOL.win.amd64)_LIB)/clang_rt.asan_cxx-x86_64.lib
+  endif
  else
   TEMPLATE_VBOXGUESTR3EXE_LIBS.x86           = \
@@ -8175,5 +8234,10 @@
 TEMPLATE_VBOXGUESTR3DLL_EXTENDS   = VBOXGUESTR3EXE
 ## @todo add a INSTFUN that separates dlls and libs.
-ifn1of ($(KBUILD_TARGET), darwin os2 win)
+ifeq ($(KBUILD_TARGET),win)
+ ifeq ($(KBUILD_TYPE),asan)
+  TEMPLATE_VBOXGUESTR3DLL_LIBS.x86   = $(patsubst %clang_rt.asan-i386.lib, %clang_rt.asan_dll_thunk-i386.lib, $(filter-out %clang_rt.asan_cxx-i386.lib,$(TEMPLATE_VBOXGUESTR3EXE_LIBS.x86)))
+  TEMPLATE_VBOXGUESTR3DLL_LIBS.amd64 = $(patsubst %clang_rt.asan-x86_64.lib, %clang_rt.asan_dll_thunk-x86_64.lib, $(filter-out %clang_rt.asan_cxx-x86_64.lib,$(TEMPLATE_VBOXGUESTR3EXE_LIBS.amd64)))
+ endif
+else ifn1of ($(KBUILD_TARGET), darwin os2 win)
  TEMPLATE_VBOXGUESTR3DLL_DEFS     = $(TEMPLATE_VBOXGUESTR3EXE_DEFS) PIC
  TEMPLATE_VBOXGUESTR3DLL_CFLAGS   = $(TEMPLATE_VBOXGUESTR3EXE_CFLAGS) -fPIC
@@ -8319,10 +8383,10 @@
 	$(PATH_TOOL_$(TEMPLATE_VBoxGuestR3NoCrtExe_TOOL.win.x86)_LIB)/chkstk.obj
 TEMPLATE_VBoxGuestR3NoCrtExe_SDKS.win.x86    = VBOX_WIN_INT64
-TEMPLATE_VBoxGuestR3NoCrtExe_LDFLAGS         = $(filter-out $(VBOX_VCC_LD_GUARD_CF), $(TEMPLATE_VBoxGuestR3Exe_LDFLAGS))
+TEMPLATE_VBoxGuestR3NoCrtExe_LDFLAGS         = $(filter-out $(VBOX_VCC_LD_GUARD_CF) $(VBOX_VCC_SANITIZER_LDFLAGS), $(TEMPLATE_VBoxGuestR3Exe_LDFLAGS))
 TEMPLATE_VBoxGuestR3NoCrtExe_LDFLAGS.win.x86 = $(filter-out -Include%, $(TEMPLATE_VBoxGuestR3Exe_LDFLAGS.win.x86))
 TEMPLATE_VBoxGuestR3NoCrtExe_LDFLAGS.win     = $(TEMPLATE_VBoxGuestR3Exe_LDFLAGS.win) /entry:CustomMainEntrypoint /subsystem:console
-TEMPLATE_VBoxGuestR3NoCrtExe_CFLAGS          = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF),$(TEMPLATE_VBoxGuestR3Exe_CFLAGS)) /GS- -EHs-
-TEMPLATE_VBoxGuestR3NoCrtExe_CXXFLAGS        = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF),$(TEMPLATE_VBoxGuestR3Exe_CXXFLAGS)) /GS- -EHs-
-TEMPLATE_VBoxGuestR3NoCrtExe_PCHFLAGS        = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF),$(TEMPLATE_VBoxGuestR3Exe_PCHFLAGS)) /GS- -EHs-
+TEMPLATE_VBoxGuestR3NoCrtExe_CFLAGS          = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxGuestR3Exe_CFLAGS)) /GS- -EHs-
+TEMPLATE_VBoxGuestR3NoCrtExe_CXXFLAGS        = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxGuestR3Exe_CXXFLAGS)) /GS- -EHs-
+TEMPLATE_VBoxGuestR3NoCrtExe_PCHFLAGS        = $(filter-out -EH% -GS $(VBOX_VCC_CC_GUARD_CF) $(VBOX_VCC_SANITIZER_FLAGS),$(TEMPLATE_VBoxGuestR3Exe_PCHFLAGS)) /GS- -EHs-
 TEMPLATE_VBoxGuestR3NoCrtExe_CXXFLAGS.debug  = $(filter-out /RTC% -RTC%, $(TEMPLATE_VBoxGuestR3Exe_CXXFLAGS.debug))
 else
Index: trunk/Makefile.kmk
===================================================================
--- trunk/Makefile.kmk	(revision 93321)
+++ trunk/Makefile.kmk	(revision 93322)
@@ -142,4 +142,32 @@
 		$(addsuffix d.dll,$(basename $(TOOL_$(VBOX_VCC_TOOL_STEM)X86_REDIST_CRT_DLLS) $(TOOL_$(VBOX_VCC_TOOL_STEM)X86_REDIST_CPP_DLLS)))) \
 	,$(call VBOX_RE_SIGN_DLL_FN,InstallExternalLibs,$(redistdll),x86)=>x86/$(qnotdir ,$(redistdll)))
+   endif
+  endif
+  ifeq ($(KBUILD_TYPE),asan)
+   ifeq ($(KBUILD_TARGET_ARCH),amd64)
+InstallExternalLibs_SOURCES += \
+    	$(call VBOX_RE_SIGN_DLL_FN,InstallExternalLibs,$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_BIN)/clang_rt.asan_dynamic-x86_64.dll) \
+    	$(call VBOX_RE_SIGN_DLL_FN,InstallExternalLibs,$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_BIN)/clang_rt.asan_dynamic-x86_64.dll)=>testcase/clang_rt.asan_dynamic-x86_64.dll
+    ifeq ($(VBOX_VCC_CRT_TYPE),d)
+InstallExternalLibs_SOURCES += \
+    	$(call VBOX_RE_SIGN_DLL_FN,InstallExternalLibs,$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_BIN)/clang_rt.asan_dbg_dynamic-x86_64.dll) \
+    	$(call VBOX_RE_SIGN_DLL_FN,InstallExternalLibs,$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)AMD64_BIN)/clang_rt.asan_dbg_dynamic-x86_64.dll)=>testcase/clang_rt.asan_dbg_dynamic-x86_64.dll
+    endif
+   endif
+   ifeq ($(KBUILD_TARGET_ARCH),x86)
+InstallExternalLibs_SOURCES += \
+    	$(call VBOX_RE_SIGN_DLL_FN,InstallExternalLibs,$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_BIN)/clang_rt.asan_dynamic-i386.dll) \
+    	$(call VBOX_RE_SIGN_DLL_FN,InstallExternalLibs,$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_BIN)/clang_rt.asan_dynamic-i386.dll)=>testcase/clang_rt.asan_dynamic-i386.dll
+    ifeq ($(VBOX_VCC_CRT_TYPE),d)
+InstallExternalLibs_SOURCES += \
+    	$(call VBOX_RE_SIGN_DLL_FN,InstallExternalLibs,$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_BIN)/clang_rt.asan_dbg_dynamic-i386.dll) \
+    	$(call VBOX_RE_SIGN_DLL_FN,InstallExternalLibs,$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_BIN)/clang_rt.asan_dbg_dynamic-i386.dll)=>testcase/clang_rt.asan_dbg_dynamic-i386.dll
+    endif
+   endif
+   ifdef VBOX_WITH_32_ON_64_MAIN_API
+InstallExternalLibs_SOURCES += $(call VBOX_RE_SIGN_DLL_FN,InstallExternalLibs,$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_BIN)/clang_rt.asan_dynamic-i386.dll,x86)=>x86/clang_rt.asan_dynamic-i386.dll
+    ifeq ($(VBOX_VCC_CRT_TYPE),d)
+InstallExternalLibs_SOURCES += $(call VBOX_RE_SIGN_DLL_FN,InstallExternalLibs,$(PATH_TOOL_$(VBOX_VCC_TOOL_STEM)X86_BIN)/clang_rt.asan_dbg_dynamic-i386.dll,x86)=>x86/clang_rt.asan_dbg_dynamic-i386.dll
+    endif
    endif
   endif
Index: trunk/src/VBox/Additions/WINNT/Graphics/Video/Makefile.kmk
===================================================================
--- trunk/src/VBox/Additions/WINNT/Graphics/Video/Makefile.kmk	(revision 93321)
+++ trunk/src/VBox/Additions/WINNT/Graphics/Video/Makefile.kmk	(revision 93322)
@@ -128,11 +128,11 @@
  ifdef VBOX_WITH_MESA3D
   $(PATH_TARGET)/VBoxWddmCat.dir/VBoxNine.dll: $$(VBoxNine_1_TARGET) | $$(dir $$@)
-	$(INSTALL) -m 644 $< $(@D)
+	$(INSTALL) -m 644 "$<" "$(@D)"
   $(PATH_TARGET)/VBoxWddmCat.dir/VBoxSVGA.dll: $$(VBoxSVGA_1_TARGET) | $$(dir $$@)
-	$(INSTALL) -m 644 $< $(@D)
+	$(INSTALL) -m 644 "$<" "$(@D)"
   $(PATH_TARGET)/VBoxWddmCat.dir/VBoxICD.dll: $$(VBoxICD_1_TARGET) | $$(dir $$@)
-	$(INSTALL) -m 644 $< $(@D)
+	$(INSTALL) -m 644 "$<" "$(@D)"
   $(PATH_TARGET)/VBoxWddmCat.dir/VBoxGL.dll: $$(VBoxGL_1_TARGET) | $$(dir $$@)
-	$(INSTALL) -m 644 $< $(@D)
+	$(INSTALL) -m 644 "$<" "$(@D)"
 
   ifeq ($(KBUILD_TARGET_ARCH),amd64)
Index: trunk/src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk
===================================================================
--- trunk/src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk	(revision 93321)
+++ trunk/src/VBox/HostDrivers/VBoxNetFlt/Makefile.kmk	(revision 93322)
@@ -325,5 +325,5 @@
  #
  DLLS.win += VBoxNetFltNobj
- VBoxNetFltNobj_TEMPLATE   = VBoxR3Static
+ VBoxNetFltNobj_TEMPLATE   = VBoxR3StaticDll
  if defined(VBOX_SIGNING_MODE)
   VBoxNetFltNobj_INSTTYPE  = none
Index: trunk/src/VBox/Installer/win/InstallHelper/Makefile.kmk
===================================================================
--- trunk/src/VBox/Installer/win/InstallHelper/Makefile.kmk	(revision 93321)
+++ trunk/src/VBox/Installer/win/InstallHelper/Makefile.kmk	(revision 93322)
@@ -20,5 +20,5 @@
 
 DLLS += VBoxInstallHelper
-VBoxInstallHelper_TEMPLATE = VBoxR3Static
+VBoxInstallHelper_TEMPLATE = VBoxR3StaticDll
 VBoxInstallHelper_DEFS     = _WIN32_WINNT=0x0501 _UNICODE UNICODE
 VBoxInstallHelper_DEFS    += VBOX_SVN_REV=$(VBOX_SVN_REV)
Index: trunk/src/VBox/Installer/win/Makefile.kmk
===================================================================
--- trunk/src/VBox/Installer/win/Makefile.kmk	(revision 93321)
+++ trunk/src/VBox/Installer/win/Makefile.kmk	(revision 93322)
@@ -986,4 +986,5 @@
 		  ,$(if-expr "$(VBOX_VCC_TOOL_STEM)"=="VCC110",msvcr110.dll msvcp110.dll \
                    ,$(TOOL_$(VBOX_VCC_TOOL)_REDIST_CRT_DLLS) $(TOOL_$(VBOX_VCC_TOOL)_REDIST_CPP_DLLS))) \
+        	 $(if-expr "$(KBUILD_TYPE)"=="asan",clang_rt.asan_dynamic-x86_64.dll,) \
                ,'  <File Id="file_$(dll)" Name="$(dll)" Source="$$(env.PATH_OUT)\bin\$(dll)" />') \
 		'</Include>'
@@ -1004,4 +1005,5 @@
 		  ,$(if-expr "$(VBOX_VCC_TOOL_STEM)"=="VCC110",msvcr110.dll msvcp110.dll \
                    ,$(TOOL_$(VBOX_VCC_TOOL_STEM)X86_REDIST_CRT_DLLS) $(TOOL_$(VBOX_VCC_TOOL_STEM)X86_REDIST_CPP_DLLS))) \
+        	 $(if-expr "$(KBUILD_TYPE)"=="asan",clang_rt.asan_dynamic-i386.dll,) \
                ,'  <File Id="file_$(dll)_x86" Name="$(dll)" Source="$$(env.PATH_OUT)\bin\x86\$(dll)" DiskId="$$(var.Property_DiskIdCommon)" />') \
 		'</Include>'
Index: trunk/src/VBox/Installer/win/Stub/Makefile.kmk
===================================================================
--- trunk/src/VBox/Installer/win/Stub/Makefile.kmk	(revision 93321)
+++ trunk/src/VBox/Installer/win/Stub/Makefile.kmk	(revision 93322)
@@ -50,4 +50,7 @@
 	-DelayLoad:comctl32.dll
 VBoxStub_POST_CMDS = $(VBOX_CHECK_IMPORTS) --image $(out) ntdll.dll kernel32.dll
+ifeq ($(KBUILD_TYPE),asan)
+ VBoxStub_POST_CMDS += advapi32.dll
+endif
 VBoxStub_LNK_DEPS  = $(VBOX_CHECK_IMPORTS)
 
Index: trunk/tools/kBuildUnits/vboximportchecker.kmk
===================================================================
--- trunk/tools/kBuildUnits/vboximportchecker.kmk	(revision 93321)
+++ trunk/tools/kBuildUnits/vboximportchecker.kmk	(revision 93322)
@@ -31,10 +31,14 @@
 
 define def_unit_vboximportchecker_target_pre
+# Do not apply to ASAN builds as it requires newere DLLs.
+ifneq ($(KBUILD_TYPE),asan)
 
 # Set pass 2 variable (simpler) and act on it.
-$(target)_2_VBOX_IMPORT_CHECKER := $(evalcall def_fn_prop_get_first_defined,VBOX_IMPORT_CHECKER)
-ifdef $(target)_2_VBOX_IMPORT_CHECKER
- $(target)_LNK_ORDERDEPS += $(VBOX_RTLDRCHECKIMPORTS)
- $(eval $(def_unit_vboximportchecker_internal_expand_twice))
+ $(target)_2_VBOX_IMPORT_CHECKER := $(evalcall def_fn_prop_get_first_defined,VBOX_IMPORT_CHECKER)
+ ifdef $(target)_2_VBOX_IMPORT_CHECKER
+  $(target)_LNK_ORDERDEPS += $(VBOX_RTLDRCHECKIMPORTS)
+  $(eval $(def_unit_vboximportchecker_internal_expand_twice))
+ endif
+
 endif
 
