Index: trunk/src/VBox/Installer/win/Makefile.kmk
===================================================================
--- trunk/src/VBox/Installer/win/Makefile.kmk	(revision 72046)
+++ trunk/src/VBox/Installer/win/Makefile.kmk	(revision 72047)
@@ -1005,6 +1005,6 @@
 RePackScripts_INSTTYPE = stage
 RePackScripts_SOURCES = \
-	Scripts/PackDriversForSubmission.cmd \
 	Scripts/UnpackBlessedDrivers.cmd \
+	$(RePackScripts_0_OUTDIR)/PackDriversForSubmission.cmd \
 	$(RePackScripts_0_OUTDIR)/sign-dual.cmd \
 	$(RePackScripts_0_OUTDIR)/sign-sha1.cmd \
@@ -1013,11 +1013,22 @@
 if !defined(VBOX_WITH_COMBINED_PACKAGE) || "$(KBUILD_TARGET_ARCH)" == "x86"
  RePackScripts_SOURCES += \
- 	Scripts/RepackExtPack.cmd
+ 	$(RePackScripts_0_OUTDIR)/RepackExtPack.cmd
+endif
+if defined(VBOX_WITH_COMBINED_PACKAGE) && "$(KBUILD_TARGET_ARCH)" == "x86"
+ RePackScripts_SOURCES += \
+ 	$(RePackScripts_0_OUTDIR)/Combined-1-Prepare.cmd \
+ 	$(RePackScripts_0_OUTDIR)/Combined-3-Repack.cmd
 endif
 RePackScripts_CLEAN = \
+	$(RePackScripts_0_OUTDIR)/PackDriversForSubmission.cmd \
 	$(RePackScripts_0_OUTDIR)/sign-dual.cmd \
 	$(RePackScripts_0_OUTDIR)/sign-sha1.cmd \
 	$(RePackScripts_0_OUTDIR)/VMMR0.inf \
 	$(RePackScripts_0_OUTDIR)/VBoxExtPackPuel.inf
+
+$(call VBOX_EDIT_VERSION_AND_BUILD_RULE_FN,RePackScripts,Scripts/PackDriversForSubmission.cmd,PackDriversForSubmission.cmd)
+$(call VBOX_EDIT_VERSION_AND_BUILD_RULE_FN,RePackScripts,Scripts/RepackExtPack.cmd,RepackExtPack.cmd)
+$(call VBOX_EDIT_VERSION_AND_BUILD_RULE_FN,RePackScripts,Scripts/Combined-1-Prepare.cmd,Combined-1-Prepare.cmd)
+$(call VBOX_EDIT_VERSION_AND_BUILD_RULE_FN,RePackScripts,Scripts/Combined-3-Repack.cmd,Combined-3-Repack.cmd)
 
 $$(RePackScripts_0_OUTDIR)/sign-dual.cmd: | $$(dir $$@)
Index: trunk/src/VBox/Installer/win/Scripts/Combined-1-Prepare.cmd
===================================================================
--- trunk/src/VBox/Installer/win/Scripts/Combined-1-Prepare.cmd	(revision 72047)
+++ trunk/src/VBox/Installer/win/Scripts/Combined-1-Prepare.cmd	(revision 72047)
@@ -0,0 +1,242 @@
+@echo off
+rem $Id$
+rem rem @file
+rem Windows NT batch script for preparing both amd64 and x86 for signing submission.
+rem
+
+rem
+rem Copyright (C) 2018 Oracle Corporation
+rem
+rem This file is part of VirtualBox Open Source Edition (OSE), as
+rem available from http://www.virtualbox.org. This file is free software;
+rem you can redistribute it and/or modify it under the terms of the GNU
+rem General Public License (GPL) as published by the Free Software
+rem Foundation, in version 2 as it comes in the "COPYING" file of the
+rem VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+rem hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+rem
+
+
+setlocal ENABLEEXTENSIONS
+setlocal
+
+rem
+rem Globals and checks for required enviornment variables.
+rem
+if ".%KBUILD_DEVTOOLS%" == "." (echo KBUILD_DEVTOOLS is not set & goto end_failed)
+if ".%KBUILD_BIN_PATH%" == "." (echo KBUILD_BIN_PATH is not set & goto end_failed)
+set _MY_SCRIPT_DIR=%~dp0
+set _MY_SAVED_CD=%CD%
+set _MY_VER_REV=@VBOX_VERSION_STRING@r@VBOX_SVN_REV@
+
+rem
+rem Parse arguments.
+rem
+set _MY_OPT_UNTAR_DIR=%_MY_SCRIPT_DIR%\..\..\..\
+for %%i in (%_MY_OPT_UNTAR_DIR%) do set _MY_OPT_UNTAR_DIR=%%~fi
+set _MY_OPT_EXTPACK=%_MY_OPT_UNTAR_DIR%\Oracle_VM_VirtualBox_Extension_Pack-%_MY_VER_REV%.vbox-extpack
+set _MY_OPT_EXTPACK_ENTERPRISE=%_MY_OPT_UNTAR_DIR%\Oracle_VM_VirtualBox_Extension_Pack-%_MY_VER_REV%-ENTERPRISE.vbox-extpack
+set _MY_OPT_BUILD_TYPE=@KBUILD_TYPE@
+set _MY_OPT_OUTDIR=%_MY_OPT_UNTAR_DIR%\output
+
+:argument_loop
+if ".%1" == "."             goto no_more_arguments
+
+if ".%1" == ".-h"           goto opt_h
+if ".%1" == ".-?"           goto opt_h
+if ".%1" == "./h"           goto opt_h
+if ".%1" == "./H"           goto opt_h
+if ".%1" == "./?"           goto opt_h
+if ".%1" == ".-help"        goto opt_h
+if ".%1" == ".--help"       goto opt_h
+
+if ".%1" == ".-e"                   goto opt_e
+if ".%1" == ".--extpack"            goto opt_e
+if ".%1" == ".-o"                   goto opt_o
+if ".%1" == ".--outdir"             goto opt_o
+if ".%1" == ".-s"                   goto opt_s
+if ".%1" == ".--extpack-enterprise" goto opt_s
+if ".%1" == ".-t"                   goto opt_t
+if ".%1" == ".--build-type"         goto opt_t
+if ".%1" == ".-u"                   goto opt_u
+if ".%1" == ".--vboxall-untar-dir"  goto opt_u
+echo syntax error: Unknown option: %1
+echo               Try --help to list valid options.
+goto end_failed
+
+:argument_loop_next_with_value
+shift
+shift
+goto argument_loop
+
+:opt_e
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_EXTPACK=%~f2
+goto argument_loop_next_with_value
+
+:opt_h
+echo Toplevel combined package: Prepare both x86 and amd64 for submission.
+echo .
+echo Usage: Combined-1-Prepare.cmd [-o output-dir] [-e/--extpack puel.vbox-extpack]
+echo            [-s/--extpack-enterprise puel-enterprise.vbox-extpack]
+echo            [-u/--vboxall-dir unpacked-vboxall-dir] [-t build-type]
+echo .
+echo Default -e/--extpack value:            %_MY_OPT_EXTPACK%
+echo Default -s/--extpack-enterprise value: %_MY_OPT_EXTPACK_ENTERPRISE%
+echo Default -u/--vboxall-untar-dir value:  %_MY_OPT_UNTAR_DIR%
+echo Default -o/--outdir value:             %_MY_OPT_OUTDIR%
+echo Default -t/--build-type value:         %_MY_OPT_BUILD_TYPE%
+echo .
+goto end_failed
+
+:opt_o
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_OUTDIR=%~f2
+goto argument_loop_next_with_value
+
+:opt_s
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_EXTPACK_ENTERPRISE=%~f2
+goto argument_loop_next_with_value
+
+:opt_t
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_BUILD_TYPE=%~2
+goto argument_loop_next_with_value
+
+:opt_u
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_UNTAR_DIR=%~f2
+goto argument_loop_next_with_value
+
+
+:syntax_error_missing_value
+echo syntax error: missing or empty option value after %1
+goto end_failed
+
+
+:error_vboxall_untar_dir_not_found
+echo syntax error: The VBoxAll untar directory was not found: "%_MY_OPT_UNTAR_DIR%"
+goto end_failed
+
+:error_amd64_bindir_not_found
+echo syntax error: The AMD64 bin directory was not found: "%_MY_BINDIR_AMD64%"
+goto end_failed
+
+:error_x86_bindir_not_found
+echo syntax error: The AMD64 bin directory was not found: "%_MY_BINDIR_X86%"
+goto end_failed
+
+:error_amd64_repack_dir_not_found
+echo syntax error: The AMD64 bin directory was not found: "%_MY_REPACK_DIR_AMD64%"
+goto end_failed
+
+:error_x86_repack_dir_not_found
+echo syntax error: The AMD64 bin directory was not found: "%_MY_REPACK_DIR_X86%"
+goto end_failed
+
+:error_extpack_not_found
+echo syntax error: Specified extension pack not found: "%_MY_OPT_EXTPACK%"
+goto end_failed
+
+:error_enterprise_extpack_not_found
+echo syntax error: Specified enterprise extension pack not found: "%_MY_OPT_EXTPACK_ENTERPRISE%"
+goto end_failed
+
+
+
+:no_more_arguments
+rem
+rem Validate and adjust specified options.
+rem
+
+if not exist "%_MY_OPT_UNTAR_DIR%"      goto error_vboxall_untar_dir_not_found
+
+set _MY_BINDIR_AMD64=%_MY_OPT_UNTAR_DIR%\win.amd64\%_MY_OPT_BUILD_TYPE%\bin
+set _MY_BINDIR_X86=%_MY_OPT_UNTAR_DIR%\win.amd64\%_MY_OPT_BUILD_TYPE%\bin
+if not exist "%_MY_BINDIR_AMD64%"       goto error_amd64_bindir_not_found
+if not exist "%_MY_BINDIR_X86%"         goto error_x86_bindir_not_found
+
+set _MY_REPACK_DIR_AMD64=%_MY_OPT_UNTAR_DIR%\win.amd64\%_MY_OPT_BUILD_TYPE%\repack
+set _MY_REPACK_DIR_X86=%_MY_OPT_UNTAR_DIR%\win.x86\%_MY_OPT_BUILD_TYPE%\repack
+if not exist "%_MY_REPACK_DIR_AMD64%"   goto error_amd64_repack_dir_not_found
+if not exist "%_MY_REPACK_DIR_X86%"     goto error_x86_repack_dir_not_found
+
+if not exist "%_MY_OPT_EXTPACK%"        goto error_extpack_not_found
+if not ".%_MY_OPT_EXTPACK_ENTERPRISE%" == "." if not exist "%_MY_OPT_EXTPACK_ENTERPRISE%" goto error_enterprise_extpack_not_found
+
+
+rem Make sure the output dir exists.
+if not exist "%_MY_OPT_OUTDIR%"     (mkdir "%_MY_OPT_OUTDIR%" || goto end_failed)
+
+rem
+rem Install the extpack in the bin directories.
+rem Note! Not really necessary, but whatever.
+rem
+echo on
+copy /y "%_MY_OPT_EXTPACK%" "%_MY_BINDIR_AMD64%\Oracle_VM_VirtualBox_Extension_Pack.vbox-extpack" || goto end_failed
+copy /y "%_MY_OPT_EXTPACK%"   "%_MY_BINDIR_X86%\Oracle_VM_VirtualBox_Extension_Pack.vbox-extpack" || goto end_failed
+@echo off
+
+rem
+rem Do the packing.
+rem
+@echo **************************************************************************
+@echo Packing AMD64 drivers
+@echo **************************************************************************
+cd /d "%_MY_REPACK_DIR_AMD64%" || goto end_failed
+call "%_MY_REPACK_DIR_AMD64%\PackDriversForSubmission.cmd" -b "%_MY_BINDIR_AMD64%" -a amd64 -e "%_MY_OPT_EXTPACK%" ^
+    -o "%_MY_OPT_OUTDIR%\VBoxDrivers-%_MY_VER_REV%-amd64.cab" || goto end_failed
+@echo .
+@echo **************************************************************************
+@echo Packing X86 drivers
+@echo **************************************************************************
+cd /d "%_MY_REPACK_DIR_X86%" || goto end_failed
+call "%_MY_REPACK_DIR_X86%\PackDriversForSubmission.cmd" -b "%_MY_BINDIR_X86%" -a x86 -e "%_MY_OPT_EXTPACK%" ^
+    -o "%_MY_OPT_OUTDIR%\VBoxDrivers-%_MY_VER_REV%-x86.cab" || goto end_failed
+@echo off
+echo .
+cd /d "%_MY_SAVED_CD%"
+
+rem
+rem Generate script for taking the next step.
+rem
+set _MY_NEXT_SCRIPT=%_MY_OPT_OUTDIR%\Combined-3-Repack.cmd
+echo cd /d "%cd%" > "%_MY_NEXT_SCRIPT%"
+echo call "%_MY_SCRIPT_DIR%\Combined-3-Repack.cmd" --extpack "%_MY_OPT_EXTPACK%" ^
+    --extpack-enterprise "%_MY_OPT_EXTPACK_ENTERPRISE%" ^
+    --vboxall-untar-dir "%_MY_OPT_UNTAR_DIR%" ^
+    --outdir "%_MY_OPT_OUTDIR%" ^
+    --build-type "%_MY_OPT_BUILD_TYPE%" %%* >> "%_MY_NEXT_SCRIPT%"
+
+rem
+rem Instructions on what to do next.
+rem
+echo **************************************************************************
+echo * First step is done.
+echo *
+echo * Created:
+echo *     %_MY_OPT_OUTDIR%\VBoxDrivers-%_MY_VER_REV%-amd64.cab
+echo *     %_MY_OPT_OUTDIR%\VBoxDrivers-%_MY_VER_REV%-x86.cab
+echo *
+echo * Next steps:
+echo *   1. Sign the two files using the Oracle EV certificate.
+echo *   2. Submit the signed files to Microsoft for attestation signing.
+echo *   3. Download the signed result.
+echo *   4. "%_MY_NEXT_SCRIPT%" --signed-x86 {zip} --signed-amd64 {zip}
+
+goto end
+
+
+:end_failed
+@cd /d "%_MY_SAVED_CD%"
+@endlocal
+@endlocal
+@echo * Failed!
+@exit /b 1
+
+:end
+@cd /d "%_MY_SAVED_CD%"
+@endlocal
+@endlocal
+
Index: trunk/src/VBox/Installer/win/Scripts/Combined-3-Repack.cmd
===================================================================
--- trunk/src/VBox/Installer/win/Scripts/Combined-3-Repack.cmd	(revision 72047)
+++ trunk/src/VBox/Installer/win/Scripts/Combined-3-Repack.cmd	(revision 72047)
@@ -0,0 +1,314 @@
+@echo off
+rem $Id$
+rem rem @file
+rem Windows NT batch script for repacking signed amd64 and x86 drivers.
+rem
+
+rem
+rem Copyright (C) 2018 Oracle Corporation
+rem
+rem This file is part of VirtualBox Open Source Edition (OSE), as
+rem available from http://www.virtualbox.org. This file is free software;
+rem you can redistribute it and/or modify it under the terms of the GNU
+rem General Public License (GPL) as published by the Free Software
+rem Foundation, in version 2 as it comes in the "COPYING" file of the
+rem VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+rem hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+rem
+
+
+setlocal ENABLEEXTENSIONS
+setlocal
+
+rem
+rem Globals and checks for required enviornment variables.
+rem
+if ".%KBUILD_DEVTOOLS%" == "." (echo KBUILD_DEVTOOLS is not set & goto end_failed)
+if ".%KBUILD_BIN_PATH%" == "." (echo KBUILD_BIN_PATH is not set & goto end_failed)
+set _MY_SCRIPT_DIR=%~dp0
+set _MY_SAVED_CD=%CD%
+set _MY_VER_REV=@VBOX_VERSION_STRING@r@VBOX_SVN_REV@
+
+rem
+rem Parse arguments.
+rem
+set _MY_OPT_UNTAR_DIR=%_MY_SCRIPT_DIR%\..\..\..\
+for %i in (%_MY_OPT_UNTAR_DIR%) do set _MY_OPT_UNTAR_DIR=%~fi
+set _MY_OPT_EXTPACK=%_MY_OPT_UNTAR_DIR%\Oracle_VM_VirtualBox_Extension_Pack-%_MY_VER_REV%.vbox-extpack
+set _MY_OPT_EXTPACK_ENTERPRISE=%_MY_OPT_UNTAR_DIR%\Oracle_VM_VirtualBox_Extension_Pack-%_MY_VER_REV%-ENTERPRISE.vbox-extpack
+set _MY_OPT_BUILD_TYPE=@KBUILD_TYPE@
+set _MY_OPT_OUTDIR=%_MY_OPT_UNTAR_DIR%\output
+set _MY_OPT_SIGNED_AMD64=
+set _MY_OPT_SIGNED_X86=
+
+:argument_loop
+if ".%1" == "."             goto no_more_arguments
+
+if ".%1" == ".-h"           goto opt_h
+if ".%1" == ".-?"           goto opt_h
+if ".%1" == "./h"           goto opt_h
+if ".%1" == "./H"           goto opt_h
+if ".%1" == "./?"           goto opt_h
+if ".%1" == ".-help"        goto opt_h
+if ".%1" == ".--help"       goto opt_h
+
+if ".%1" == ".-e"                   goto opt_e
+if ".%1" == ".--extpack"            goto opt_e
+if ".%1" == ".-o"                   goto opt_o
+if ".%1" == ".--outdir"             goto opt_o
+if ".%1" == ".-s"                   goto opt_s
+if ".%1" == ".--extpack-enterprise" goto opt_s
+if ".%1" == ".--signed-amd64"       goto opt_signed_amd64
+if ".%1" == ".--signed-x86"         goto opt_signed_x86
+if ".%1" == ".-t"                   goto opt_t
+if ".%1" == ".--build-type"         goto opt_t
+if ".%1" == ".-u"                   goto opt_u
+if ".%1" == ".--vboxall-untar-dir"  goto opt_u
+echo syntax error: Unknown option: %1
+echo               Try --help to list valid options.
+goto end_failed
+
+:argument_loop_next_with_value
+shift
+shift
+goto argument_loop
+
+:opt_e
+if ".%~2" == "."             goto syntax_error_missing_value
+set _MY_OPT_EXTPACK=%~f2
+goto argument_loop_next_with_value
+
+:opt_h
+echo Toplevel combined package: Prepare both x86 and amd64 for submission.
+echo .
+echo Usage: Combined-1-Prepare.cmd [-o output-dir] [-e/--extpack puel.vbox-extpack]
+echo            [-s/--extpack-enterprise puel-enterprise.vbox-extpack]
+echo            [-u/--vboxall-dir unpacked-vboxall-dir] [-t build-type]
+echo
+echo .
+echo Default -e/--extpack value:            %_MY_OPT_EXTPACK%
+echo Default -s/--extpack-enterprise value: %_MY_OPT_EXTPACK_ENTERPRISE%
+echo Default -u/--vboxall-untar-dir value:  %_MY_OPT_UNTAR_DIR%
+echo Default -o/--outdir value:             %_MY_OPT_OUTDIR%
+echo Default -t/--build-type value:         %_MY_OPT_BUILD_TYPE%
+echo .
+goto end_failed
+
+:opt_o
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_OUTDIR=%~f2
+goto argument_loop_next_with_value
+
+:opt_s
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_EXTPACK_ENTERPRISE=%~f2
+goto argument_loop_next_with_value
+
+:opt_signed_amd64
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_SIGNED_AMD64=%~f2
+goto argument_loop_next_with_value
+
+:opt_signed_x86
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_SIGNED_X86=%~f2
+goto argument_loop_next_with_value
+
+:opt_t
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_BUILD_TYPE=%~2
+goto argument_loop_next_with_value
+
+:opt_u
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_UNTAR_DIR=%~f2
+goto argument_loop_next_with_value
+
+
+:syntax_error_missing_value
+echo syntax error: missing or empty option value after %1
+goto end_failed
+
+
+:error_vboxall_untar_dir_not_found
+echo syntax error: The VBoxAll untar directory was not found: "%_MY_OPT_UNTAR_DIR%"
+goto end_failed
+
+:error_amd64_bindir_not_found
+echo syntax error: The AMD64 bin directory was not found: "%_MY_BINDIR_AMD64%"
+goto end_failed
+
+:error_x86_bindir_not_found
+echo syntax error: The AMD64 bin directory was not found: "%_MY_BINDIR_X86%"
+goto end_failed
+
+:error_amd64_repack_dir_not_found
+echo syntax error: The AMD64 bin directory was not found: "%_MY_REPACK_DIR_AMD64%"
+goto end_failed
+
+:error_x86_repack_dir_not_found
+echo syntax error: The AMD64 bin directory was not found: "%_MY_REPACK_DIR_X86%"
+goto end_failed
+
+:error_extpack_not_found
+echo syntax error: Specified extension pack not found: "%_MY_OPT_EXTPACK%"
+goto end_failed
+
+:error_enterprise_extpack_not_found
+echo syntax error: Specified enterprise extension pack not found: "%_MY_OPT_EXTPACK_ENTERPRISE%"
+goto end_failed
+
+:error_signed_amd64_not_found
+echo syntax error: Zip with signed AMD64 drivers not found: "%_MY_OPT_SIGNED_AMD64%"
+goto end_failed
+
+:error_signed_x86_not_found
+echo syntax error: Zip with signed X86 drivers not found: "%_MY_OPT_SIGNED_X86%"
+goto end_failed
+
+
+:no_more_arguments
+rem
+rem Validate and adjust specified options.
+rem
+
+if not exist "%_MY_OPT_UNTAR_DIR%"      goto error_vboxall_untar_dir_not_found
+
+set _MY_BINDIR_AMD64=%_MY_OPT_UNTAR_DIR%\win.amd64\%_MY_OPT_BUILD_TYPE%\bin
+set _MY_BINDIR_X86=%_MY_OPT_UNTAR_DIR%\win.amd64\%_MY_OPT_BUILD_TYPE%\bin
+if not exist "%_MY_BINDIR_AMD64%"       goto error_amd64_bindir_not_found
+if not exist "%_MY_BINDIR_X86%"         goto error_x86_bindir_not_found
+
+set _MY_REPACK_DIR_AMD64=%_MY_OPT_UNTAR_DIR%\win.amd64\%_MY_OPT_BUILD_TYPE%\repack
+set _MY_REPACK_DIR_X86=%_MY_OPT_UNTAR_DIR%\win.x86\%_MY_OPT_BUILD_TYPE%\repack
+if not exist "%_MY_REPACK_DIR_AMD64%"   goto error_amd64_repack_dir_not_found
+if not exist "%_MY_REPACK_DIR_X86%"     goto error_x86_repack_dir_not_found
+
+if not exist "%_MY_OPT_EXTPACK%"        goto error_extpack_not_found
+if not ".%_MY_OPT_EXTPACK_ENTERPRISE" == "." if not exist "%_MY_OPT_EXTPACK_ENTERPRISE%" goto error_enterprise_extpack_not_found
+
+if not exist "%_MY_OPT_SIGNED_AMD64%"   goto error_signed_amd64_not_found
+if not exist "%_MY_OPT_SIGNED_X86%"     goto error_signed_x86_not_found
+
+rem Make sure the output dir exists.
+if not exist "%_MY_OPT_OUTDIR%"     (mkdir "%_MY_OPT_OUTDIR%" || goto end_failed)
+
+rem
+rem Unpacking the two driver zips.
+rem
+echo **************************************************************************
+echo * AMD64: Unpacking signed drivers...
+echo **************************************************************************
+cd /d "%_MY_REPACK_DIR_AMD64%" || goto end_failed
+call "%_MY_REPACK_DIR_AMD64%\UnpackBlessedDrivers.cmd" -b "%_MY_BINDIR_AMD64%" -i "%_MY_OPT_SIGNED_AMD64%" || goto end_failed
+echo .
+
+echo **************************************************************************
+echo * X86: Unpacking signed drivers...
+echo **************************************************************************
+cd /d "%_MY_REPACK_DIR_X86%" || goto end_failed
+call "%_MY_REPACK_DIR_X86%\UnpackBlessedDrivers.cmd" -b "%_MY_BINDIR_X86%" -i "%_MY_OPT_SIGNED_X86%" || goto end_failed
+echo .
+
+
+rem
+rem Do the AMD64 work.
+rem
+echo **************************************************************************
+echo * AMD64: Compiling WIX...
+echo **************************************************************************
+cd /d "%_MY_REPACK_DIR_AMD64%" || goto end_failed
+for %%i in (1-*.cmd) do (call %%i || goto end_failed)
+echo .
+
+echo * AMD64: Linking WIX...
+for %%i in (2-*.cmd) do (call %%i || goto end_failed)
+echo .
+
+echo * AMD64: Applying language patches to MSI...
+for %%i in (3-*.cmd) do (call %%i || goto end_failed)
+echo .
+
+
+rem
+rem Do the X86 work.
+rem
+echo **************************************************************************
+echo * X86: Compiling WIX...
+echo **************************************************************************
+cd /d "%_MY_REPACK_DIR_X86%" || goto end_failed
+for %%i in (1-*.cmd) do (call %%i || goto end_failed)
+echo .
+
+echo * X86: Linking WIX...
+for %%i in (2-*.cmd) do (call %%i || goto end_failed)
+echo .
+
+echo * X86: Applying language patches to MSI...
+for %%i in (3-*.cmd) do (call %%i || goto end_failed)
+echo .
+
+echo * X86: Creating multi arch installer...
+for %%i in (4-*.cmd) do (call %%i || goto end_failed)
+echo .
+
+set _MY_OUT_FILES=
+for %%i in (VirtualBox-*MultiArch*exe) do (
+    copy /y "%%i" "%_MY_OPT_OUTDIR%" || goto end_failed
+    set _MY_OUT_FILES=%%_MY_OUT_FILES%% %%i
+)
+
+
+rem
+rem Repack the extension packs.
+rem
+echo **************************************************************************
+echo * Repacking extension packs.
+echo **************************************************************************
+cd /d "%_MY_REPACK_DIR_X86%" || goto end_failed
+
+echo * Regular PUEL...
+set _MY_TMP_OUT=%_MY_OPT_EXTPACK%
+for %%i in (%_MY_TMP_OUT%) do (
+    set _MY_TMP_OUT=%_MY_OPT_OUTDIR%\%%~nxi
+    set _MY_OUT_FILES=%%_MY_OUT_FILES%% %%i
+)
+call "%_MY_REPACK_DIR_X86%\RepackExtPack.cmd" --bindir-amd64 "%_MY_BINDIR_AMD64%" --bindir-x86 "%_MY_BINDIR_X86%" ^
+    --input "%_MY_OPT_EXTPACK%" --output "%_MY_TMP_OUT%" || goto end_failed
+
+if ".%_MY_OPT_EXTPACK_ENTERPRISE%" == "." goto no_enterprise_repacking
+echo * Enterprise PUEL...
+set _MY_TMP_OUT=%_MY_OPT_EXTPACK_ENTERPRISE%
+for %%i in (%_MY_TMP_OUT%) do (
+    set _MY_TMP_OUT=%_MY_OPT_OUTDIR%\%%~nxi
+    set _MY_OUT_FILES=%%_MY_OUT_FILES%% %%i
+)
+call "%_MY_REPACK_DIR_X86%\RepackExtPack.cmd" --bindir-amd64 "%_MY_BINDIR_AMD64%" --bindir-x86 "%_MY_BINDIR_X86%" ^
+    --input "%_MY_OPT_EXTPACK_ENTERPRISE%" --output "%_MY_TMP_OUT%" || goto end_failed
+:no_enterprise_repacking
+@cd /d "%_MY_SAVED_CD%"
+
+rem
+rem That's that.
+rem
+echo **************************************************************************
+echo * The third and final step is done.
+echo *
+echo * Successfully created:
+for %%i in (%_MY_OUT_FILES%) do echo *    "%_MY_OPT_OUTDIR%\%%i"
+goto end
+
+
+:end_failed
+@cd /d "%_MY_SAVED_CD%"
+@endlocal
+@endlocal
+@echo * Failed!
+@exit /b 1
+
+:end
+@cd /d "%_MY_SAVED_CD%"
+@endlocal
+@endlocal
+
+
Index: trunk/src/VBox/Installer/win/Scripts/PackDriversForSubmission.cmd
===================================================================
--- trunk/src/VBox/Installer/win/Scripts/PackDriversForSubmission.cmd	(revision 72046)
+++ trunk/src/VBox/Installer/win/Scripts/PackDriversForSubmission.cmd	(revision 72047)
@@ -31,5 +31,5 @@
 set _MY_OPT_OUTPUT=
 set _MY_OPT_DDF_FILE=
-set _MY_OPT_ARCH=
+set _MY_OPT_ARCH=@KBUILD_TARGET_ARCH@
 
 :argument_loop
@@ -70,22 +70,22 @@
 
 :opt_a
-if ".%2" == "."             goto syntax_error_missing_value
+if ".%~2" == "."            goto syntax_error_missing_value
 if not "%2" == "x86" if not "%2" == "amd64" goto syntax_error_unknown_arch
-set _MY_OPT_ARCH=%2
+set _MY_OPT_ARCH=%~2
 goto argument_loop_next_with_value
 
 :opt_b
-if ".%2" == "."             goto syntax_error_missing_value
-set _MY_OPT_BINDIR=%2
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_BINDIR=%~2
 goto argument_loop_next_with_value
 
 :opt_d
-if ".%2" == "."             goto syntax_error_missing_value
-set _MY_OPT_DDF_FILE=%2
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_DDF_FILE=%~2
 goto argument_loop_next_with_value
 
 :opt_e
-if ".%2" == "."             goto syntax_error_missing_value
-set _MY_OPT_EXTPACK=%2
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_EXTPACK=%~2
 goto argument_loop_next_with_value
 
@@ -106,11 +106,11 @@
 
 :opt_p
-if ".%2" == "."             goto syntax_error_missing_value
-set _MY_OPT_PDBDIR=%2
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_PDBDIR=%~2
 goto argument_loop_next_with_value
 
 :opt_o
-if ".%2" == "."             goto syntax_error_missing_value
-set _MY_OPT_OUTPUT=%2
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_OUTPUT=%~2
 goto argument_loop_next_with_value
 
@@ -162,8 +162,5 @@
 :no_extack_validation
 
-if ".%_MY_OPT_ARCH%" == "."         if exist "%_MY_OPT_BINDIR%\x86" set _MY_OPT_ARCH=amd64
-if ".%_MY_OPT_ARCH%" == "."         set _MY_OPT_ARCH=x86
-
-if ".%_MY_OPT_OUTPUT%" == "."       set _MY_OPT_OUTPUT=VBoxDrivers-%_MY_OPT_ARCH%.cab
+if ".%_MY_OPT_OUTPUT%" == "."       set _MY_OPT_OUTPUT=VBoxDrivers-@VBOX_VERSION_STRING@r@VBOX_SVN_REV@-%_MY_OPT_ARCH%.cab
 if exist "%_MY_OPT_OUTPUT%"         goto error_output_exists
 
Index: trunk/src/VBox/Installer/win/Scripts/RepackExtPack.cmd
===================================================================
--- trunk/src/VBox/Installer/win/Scripts/RepackExtPack.cmd	(revision 72046)
+++ trunk/src/VBox/Installer/win/Scripts/RepackExtPack.cmd	(revision 72047)
@@ -30,9 +30,10 @@
 rem Parse arguments.
 rem
-set _MY_OPT_BINDIR_X86=..\bin
-set _MY_OPT_BINDIR_AMD64=
+set _MY_OPT_BINDIR_X86=..\..\..\win.x86\@KBUILD_TYPE@\bin
+set _MY_OPT_BINDIR_AMD64=..\..\..\win.amd64\@KBUILD_TYPE@\bin
 set _MY_OPT_INPUT=
 set _MY_OPT_OUTPUT=
 set _MY_OPT_STAGE_DIR=.\repack-extpack-%RANDOM%
+for %%i in (%_MY_OPT_STAGE_DIR%) do set _MY_OPT_STAGE_DIR=%%~fi
 set _MY_OPT_SIGN_CAT=1
 
@@ -68,11 +69,11 @@
 
 :opt_a
-if ".%2" == "."             goto syntax_error_missing_value
-set _MY_OPT_BINDIR_AMD64=%2
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_BINDIR_AMD64=%~f2
 goto argument_loop_next_with_value
 
 :opt_b
-if ".%2" == "."             goto syntax_error_missing_value
-set _MY_OPT_BINDIR_X86=%2
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_BINDIR_X86=%~f2
 goto argument_loop_next_with_value
 
@@ -90,16 +91,16 @@
 
 :opt_i
-if ".%2" == "."             goto syntax_error_missing_value
-set _MY_OPT_INPUT=%2
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_INPUT=%~f2
 goto argument_loop_next_with_value
 
 :opt_o
-if ".%2" == "."             goto syntax_error_missing_value
-set _MY_OPT_OUTPUT=%2
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_OUTPUT=%~f2
 goto argument_loop_next_with_value
 
 :opt_s
-if ".%2" == "."             goto syntax_error_missing_value
-set _MY_OPT_STAGE_DIR=%2
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_STAGE_DIR=%~f2
 goto argument_loop_next_with_value
 
@@ -125,8 +126,8 @@
 
 :no_more_arguments
-rem validate specified options
-if not exist "%_MY_OPT_BINDIR_X86%" goto error_bindir_x86_does_not_exist
-
-if ".%_MY_OPT_BINDIR_AMD64%" == "." set _MY_OPT_BINDIR_AMD64=%_MY_OPT_BINDIR_X86%\..\..\..\win.amd64\release\bin
+rem
+rem Validate and adjust specified options.
+rem
+if not exist "%_MY_OPT_BINDIR_X86%"   goto error_bindir_x86_does_not_exist
 if not exist "%_MY_OPT_BINDIR_AMD64%" goto error_bindir_amd64_does_not_exist
 
@@ -134,8 +135,7 @@
 if not exist "%_MY_OPT_INPUT%"      goto error_input_not_found
 
-if ".%_MY_OPT_OUTPUT%" == "."       set _MY_OPT_OUTPUT=Oracle_VM_VirtualBox_Extension_Pack.vbox-extpack
+if ".%_MY_OPT_OUTPUT%" == "."       for %%i in ("%_MY_OPT_INPUT%") do set _MY_OPT_OUTPUT=.\%%~nxi
 
 rem Make _MY_OPT_STAGE_DIR absolute.
-for %%i in (%_MY_OPT_STAGE_DIR%) do set _MY_OPT_STAGE_DIR=%%~fi
 if exist "%_MY_OPT_STAGE_DIR%"      goto error_stage_dir_exists
 
Index: trunk/src/VBox/Installer/win/Scripts/UnpackBlessedDrivers.cmd
===================================================================
--- trunk/src/VBox/Installer/win/Scripts/UnpackBlessedDrivers.cmd	(revision 72046)
+++ trunk/src/VBox/Installer/win/Scripts/UnpackBlessedDrivers.cmd	(revision 72047)
@@ -22,7 +22,11 @@
 
 rem
-rem Check for environment variables we need.
+rem Globals and Check for environment variables we need.
 rem
 if ".%KBUILD_DEVTOOLS%" == "." (echo KBUILD_DEVTOOLS is not set & goto end_failed)
+set _MY_DRIVER_BASE_NAMES=VBoxDrv VBoxNetAdp6 VBoxNetLwf VBoxUSB VBoxUSBMon
+set _MY_DRIVER_BASE_NAMES=VBoxDrv VBoxNetAdp6 VBoxNetLwf VBoxUSB VBoxUSBMon
+set _MY_UNZIP=%KBUILD_DEVTOOLS%\win.x86\bin\unzip.exe
+if not exist "%_MY_UNZIP%" (echo "%_MY_UNZIP%" does not exist & goto end_failed)
 
 rem
@@ -60,6 +64,6 @@
 
 :opt_b
-if ".%2" == "."             goto syntax_error_missing_value
-set _MY_OPT_BINDIR=%2
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_BINDIR=%~2
 goto argument_loop_next_with_value
 
@@ -75,6 +79,6 @@
 
 :opt_i
-if ".%2" == "."             goto syntax_error_missing_value
-set _MY_OPT_INPUT=%2
+if ".%~2" == "."            goto syntax_error_missing_value
+set _MY_OPT_INPUT=%~2
 goto argument_loop_next_with_value
 
@@ -106,14 +110,33 @@
 rem
 rem Unpack the stuff.
+rem We ignore error level 1 here as that is what unzip returns on warning (slashes).
 rem
-%KBUILD_DEVTOOLS%\win.x86\bin\unzip.exe -o -j "%_MY_OPT_INPUT%" -d "%_MY_OPT_BINDIR%" || goto end_failed
+"%_MY_UNZIP%" -o -j "%_MY_OPT_INPUT%" -d "%_MY_OPT_BINDIR%" && goto unzip_okay
+if NOT ERRORLEVEL 1 goto end_failed
+:unzip_okay
+
+rem
+rem Verify it against the PreW10 catalog files we saved.
+rem
+set _MY_SIGNTOOL=%KBUILD_DEVTOOLS%\win.x86\sdk\v8.1\bin\x86\signtool.exe
+if not exist "%_MY_SIGNTOOL%" set _MY_SIGNTOOL=%KBUILD_DEVTOOLS%\win.x86\selfsign\r3\signtool.exe
+
+for %%d in (%_MY_DRIVER_BASE_NAMES%) do (
+    @echo * Verifying %%d against %%d.cat...
+    "%_MY_SIGNTOOL%" verify /kp /c "%_MY_OPT_BINDIR%\%%d.cat"        "%_MY_OPT_BINDIR%\%%d.inf" || goto end_failed
+    "%_MY_SIGNTOOL%" verify /kp /c "%_MY_OPT_BINDIR%\%%d.cat"        "%_MY_OPT_BINDIR%\%%d.sys" || goto end_failed
+    @echo * Verifying %%d against %%d-PreW10.cat...
+    "%_MY_SIGNTOOL%" verify /kp /c "%_MY_OPT_BINDIR%\%%d-PreW10.cat" "%_MY_OPT_BINDIR%\%%d.inf" || goto end_failed
+    "%_MY_SIGNTOOL%" verify /kp /c "%_MY_OPT_BINDIR%\%%d-PreW10.cat" "%_MY_OPT_BINDIR%\%%d.sys" || goto end_failed
+)
+
 
 rem
 rem Modify the catalog signatures.
 rem
-for %%cat in (VBoxDrv.cat VBoxNetAdp6.cat VBoxNetLwf.cat VBoxUSB.cat VBoxUSBMon.cat) do (
-    copy /y "%_MY_OPT_BINDIR%\%cat%" "%_MY_OPT_BINDIR%\%cat%.ms" || goto end_failed
-    call sign-dual.cmd "%_MY_OPT_BINDIR%\%cat%" || goto end_failed
-    "%_MY_OPT_BINDIR%\tools\RTSignTool.exe"  add-nested-exe-signature -v "%_MY_OPT_BINDIR%\%cat%" "%_MY_OPT_BINDIR%\%cat%.ms" || goto end_failed
+for %%d in (%_MY_DRIVER_BASE_NAMES%) do (
+    copy /y "%_MY_OPT_BINDIR%\%%d.cat" "%_MY_OPT_BINDIR%\%%d.cat.ms" || goto end_failed
+    call sign-dual.cmd "%_MY_OPT_BINDIR%\%%d.cat" || goto end_failed
+    "%_MY_OPT_BINDIR%\tools\RTSignTool.exe"  add-nested-exe-signature -v "%_MY_OPT_BINDIR%\%%d.cat" "%_MY_OPT_BINDIR%\%%d.cat.ms" || goto end_failed
 )
 
@@ -121,4 +144,5 @@
 
 :end_failed
+@echo failed (%ERRORLEVEL%)
 @endlocal
 @endlocal
