From 912e3d25aae65c6fe3334ce394166a1f6c000b06 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Sat, 9 Nov 2019 19:17:51 +0100 Subject: [PATCH] installer: Select Win7/8/8.1 vs. Win10 driver at runtime Rather than shipping separate installers for Windows 10 and pre Windows 10, pack all Windows driver and extend selection logic to install correct one. Signed-off-by: Simon Rozman --- installer/tap-windows6.nsi | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/installer/tap-windows6.nsi b/installer/tap-windows6.nsi index 470d554..e35da14 100755 --- a/installer/tap-windows6.nsi +++ b/installer/tap-windows6.nsi @@ -106,6 +106,11 @@ ReserveFile "install-whirl.bmp" Section /o "TAP Virtual Ethernet Adapter" SecTAP SetOverwrite on + ${If} ${IsWow64} + SetRegView 64 + ${EndIf} + + ReadRegDWORD $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "CurrentMajorVersionNumber" ${If} ${RunningX64} DetailPrint "We are running on an x86_64 64-bit system." @@ -114,9 +119,15 @@ Section /o "TAP Virtual Ethernet Adapter" SecTAP File "${DEVCON64}" SetOutPath "$INSTDIR\driver" - File "${IMAGE}\amd64\OemVista.inf" - File "${IMAGE}\amd64\${PRODUCT_TAP_WIN_COMPONENT_ID}.cat" - File "${IMAGE}\amd64\${PRODUCT_TAP_WIN_COMPONENT_ID}.sys" + ${If} $R0 == "" + File "${IMAGE}\amd64\OemVista.inf" + File "${IMAGE}\amd64\${PRODUCT_TAP_WIN_COMPONENT_ID}.cat" + File "${IMAGE}\amd64\${PRODUCT_TAP_WIN_COMPONENT_ID}.sys" + ${Else} + File "${IMAGE}\amd64-win10\OemVista.inf" + File "${IMAGE}\amd64-win10\${PRODUCT_TAP_WIN_COMPONENT_ID}.cat" + File "${IMAGE}\amd64-win10\${PRODUCT_TAP_WIN_COMPONENT_ID}.sys" + ${EndIf} ${ElseIf} ${RunningArm64} DetailPrint "We are running on an ARM64 64-bit system." @@ -134,9 +145,15 @@ Section /o "TAP Virtual Ethernet Adapter" SecTAP File "${DEVCON32}" SetOutPath "$INSTDIR\driver" - File "${IMAGE}\i386\OemVista.inf" - File "${IMAGE}\i386\${PRODUCT_TAP_WIN_COMPONENT_ID}.cat" - File "${IMAGE}\i386\${PRODUCT_TAP_WIN_COMPONENT_ID}.sys" + ${If} $R0 == "" + File "${IMAGE}\i386\OemVista.inf" + File "${IMAGE}\i386\${PRODUCT_TAP_WIN_COMPONENT_ID}.cat" + File "${IMAGE}\i386\${PRODUCT_TAP_WIN_COMPONENT_ID}.sys" + ${Else} + File "${IMAGE}\i386-win10\OemVista.inf" + File "${IMAGE}\i386-win10\${PRODUCT_TAP_WIN_COMPONENT_ID}.cat" + File "${IMAGE}\i386-win10\${PRODUCT_TAP_WIN_COMPONENT_ID}.sys" + ${EndIf} ${Else} DetailPrint "Native architecture not recognized!" ${EndIf}