VirtualBox

Changeset 96428 in vbox


Ignore:
Timestamp:
Aug 23, 2022 7:27:21 AM (2 years ago)
Author:
vboxsync
Message:

Installer/win: Added new build define VBOX_WITH_CRT_PACKING, which leaves out packing the MSCRT with the Windows installer and also checks if the MSCRT 2019 Redistributable Package is installed on the system as a prerequisite (via a custom action). bugref:10284

Location:
trunk
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/Config.kmk

    r96424 r96428  
    387387# Include additions in the package
    388388VBOX_WITH_ADDITIONS_PACKING = 1
     389# Don't include any CRTs.
     390## @todo For now we need to include the (MS)CRT, needs tweaking the testcases first!
     391VBOX_WITH_CRT_PACKING = 1
    389392# Only build the additions (for the additions build server).
    390393#VBOX_ONLY_ADDITIONS = 1
  • trunk/src/VBox/Installer/win/InstallHelper/VBoxCommon.cpp

    r96407 r96428  
    5555#endif
    5656
    57 UINT VBoxGetMsiProp(MSIHANDLE hMsi, WCHAR *pwszName, WCHAR *pwszValue, DWORD dwSize)
     57UINT VBoxGetMsiProp(MSIHANDLE hMsi, const WCHAR *pwszName, WCHAR *pwszValue, DWORD dwSize)
    5858{
    5959    DWORD dwBuffer = 0;
     
    105105#endif
    106106
    107 UINT VBoxSetMsiProp(MSIHANDLE hMsi, WCHAR *pwszName, WCHAR *pwszValue)
     107UINT VBoxSetMsiProp(MSIHANDLE hMsi, const WCHAR *pwszName, const WCHAR *pwszValue)
    108108{
    109109    return MsiSetPropertyW(hMsi, pwszName, pwszValue);
    110110}
    111111
     112UINT VBoxSetMsiPropDWORD(MSIHANDLE hMsi, const WCHAR *pwszName, DWORD dwVal)
     113{
     114    wchar_t wszTemp[32];
     115    swprintf(wszTemp, sizeof(wszTemp) / sizeof(wchar_t), L"%ld", dwVal);
     116    return VBoxSetMsiProp(hMsi, pwszName, wszTemp);
     117}
     118
  • trunk/src/VBox/Installer/win/InstallHelper/VBoxCommon.h

    r96407 r96428  
    3636#endif
    3737
    38 UINT VBoxGetMsiProp(MSIHANDLE hMsi, WCHAR *pwszName, WCHAR *pwszValue, DWORD dwSize);
     38UINT VBoxGetMsiProp(MSIHANDLE hMsi, const WCHAR *pwszName, WCHAR *pwszValue, DWORD dwSize);
    3939int  VBoxGetMsiPropUtf8(MSIHANDLE hMsi, const char *pcszName, char **ppszValue);
    40 UINT VBoxSetMsiProp(MSIHANDLE hMsi, WCHAR *pwszName, WCHAR *pwszValue);
     40UINT VBoxSetMsiProp(MSIHANDLE hMsi, const WCHAR *pwszName, const WCHAR *pwszValue);
     41UINT VBoxSetMsiPropDWORD(MSIHANDLE hMsi, const WCHAR *pwszName, DWORD dwVal);
    4142
    4243#endif /* !VBOX_INCLUDED_SRC_InstallHelper_VBoxCommon_h */
  • trunk/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp

    r96407 r96428  
    441441
    442442    VBoxSetMsiProp(hModule, L"VBOX_PYTHON_DEPS_INSTALLED", dwErr == ERROR_SUCCESS ? L"1" : L"0");
     443    return ERROR_SUCCESS; /* Never return failure. */
     444}
     445
     446/**
     447 * Checks if all required MS CRTs (Visual Studio Redistributable Package) are installed on the system.
     448 *
     449 * Called from the MSI installer as custom action.
     450 *
     451 * @returns Always ERROR_SUCCESS.
     452 *          Sets public property VBOX_MSCRT_INSTALLED to "" (false, to use "NOT" in WiX) or "1" (success).
     453 *
     454 *          Also exposes public properties VBOX_MSCRT_VER_MIN + VBOX_MSCRT_VER_MAJ strings
     455 *          with the most recent MSCRT version detected.
     456 *
     457 * @param   hModule             Windows installer module handle.
     458 *
     459 * @sa      https://docs.microsoft.com/en-us/cpp/windows/redistributing-visual-cpp-files?view=msvc-170
     460 */
     461UINT __stdcall IsMSCRTInstalled(MSIHANDLE hModule)
     462{
     463    HKEY hKeyVS = NULL;
     464    LSTATUS dwErr = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
     465                                  L"SOFTWARE\\Microsoft\\VisualStudio\\14.0\\VC\\Runtimes\\X64",
     466                                  0, KEY_READ, &hKeyVS);
     467    if (dwErr == ERROR_SUCCESS)
     468    {
     469        DWORD dwVal = 0;
     470        DWORD cbVal = sizeof(dwVal);
     471        DWORD dwValueType = REG_DWORD;
     472
     473        dwErr = RegQueryValueExW(hKeyVS, L"Installed", NULL, &dwValueType, (LPBYTE)&dwVal, &cbVal);
     474        if (dwErr == ERROR_SUCCESS)
     475        {
     476            if (dwVal >= 1)
     477            {
     478                DWORD dwMin, dwMaj;
     479                dwErr = RegQueryValueExW(hKeyVS, L"Major", NULL, &dwValueType, (LPBYTE)&dwMaj, &cbVal);
     480                if (dwErr == ERROR_SUCCESS)
     481                {
     482                    VBoxSetMsiPropDWORD(hModule, L"VBOX_MSCRT_VER_MAJ", dwMaj);
     483
     484                    dwErr = RegQueryValueExW(hKeyVS, L"Minor", NULL, &dwValueType, (LPBYTE)&dwMin, &cbVal);
     485                    if (dwErr == ERROR_SUCCESS)
     486                    {
     487                        VBoxSetMsiPropDWORD(hModule, L"VBOX_MSCRT_VER_MIN", dwMin);
     488
     489                        logStringF(hModule, L"IsMSCRTInstalled: Found v%ld.%ld\n", dwMaj, dwMin);
     490
     491                        /* Check for at least 2019. */
     492                        if (dwMaj >= 14 && dwMin >= 20)
     493                            VBoxSetMsiProp(hModule, L"VBOX_MSCRT_INSTALLED", L"1");
     494                    }
     495                    else
     496                        logStringF(hModule, L"IsMSCRTInstalled: Found, but 'Minor' key not present");
     497                }
     498                else
     499                    logStringF(hModule, L"IsMSCRTInstalled: Found, but 'Major' key not present");
     500            }
     501            else
     502            {
     503                logStringF(hModule, L"IsMSCRTInstalled: Found, but not marked as installed");
     504                dwErr = ERROR_NOT_INSTALLED;
     505            }
     506        }
     507        else
     508            logStringF(hModule, L"IsMSCRTInstalled: Found, but 'Installed' key not present");
     509    }
     510
     511    if (dwErr != ERROR_SUCCESS)
     512        logStringF(hModule, L"IsMSCRTInstalled: Failed with dwErr=%ld", dwErr);
     513
    443514    return ERROR_SUCCESS; /* Never return failure. */
    444515}
  • trunk/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.def

    r96407 r96428  
    3030    IsSerialCheckNeeded
    3131    CheckSerial
     32    IsMSCRTInstalled
    3233    IsPythonInstalled
    3334    IsWindows10
  • trunk/src/VBox/Installer/win/Makefile.kmk

    r96407 r96428  
    644644                                $(if $(VBOX_WITH_32_ON_64_MAIN_API),$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib_x86.wxi,) \
    645645                                $(VBOX_WIN_INST_OUT_DIR)/VBoxKey.wxi \
    646                                 $(VBOX_WIN_INST_OUT_DIR)/VBoxCrtDlls.wxi \
    647                                 $(VBOX_WIN_INST_OUT_DIR)/VBoxCrtDlls32.wxi \
     646                                $(if $(VBOX_WITH_CRT_PACKING),$(VBOX_WIN_INST_OUT_DIR)/VBoxCrtDlls.wxi,) \
     647                                $(if $(VBOX_WITH_CRT_PACKING),$(VBOX_WIN_INST_OUT_DIR)/VBoxCrtDlls32.wxi,) \
    648648                                $(VBOX_WIN_INST_OUT_DIR)/VBoxUnattendedTemplateComponent.wxi \
    649649                                $(if $(VBOX_WITH_QTGUI),$(VBOX_WIN_INST_OUT_DIR)/VBoxGuiNLS.wxi) \
     
    686686                -E 'VBOX_WITH_ADDITIONS_PACKING=$(if $(VBOX_WITH_ADDITIONS_PACKING),yes,no)' \
    687687                -E 'VBOX_WITH_COMBINED_PACKAGE=$(if-expr defined(VBOX_WITH_COMBINED_PACKAGE),yes,no)' \
     688                -E 'VBOX_WITH_CRT_PACKING=$(if-expr defined(VBOX_WITH_CRT_PACKING),yes,no)' \
    688689                -E 'VBOX_WITH_DEBUGGER_GUI=$(if-expr defined(VBOX_WITH_DEBUGGER_GUI) && defined(VBOX_WITH_QTGUI),yes,no)' \
    689690                -E 'VBOX_WITH_DOCS_PACKING=$(if $(VBOX_WITH_DOCS_PACKING),yes,no)' \
     
    809810                $(if $(VBOX_WITH_32_ON_64_MAIN_API),$(VBOX_WIN_INST_OUT_DIR)/VirtualBox_TypeLib_x86.wxi,) \
    810811                $(VBOX_WIN_INST_OUT_DIR)/VBoxKey.wxi \
    811                 $(VBOX_WIN_INST_OUT_DIR)/VBoxCrtDlls.wxi \
    812                 $(VBOX_WIN_INST_OUT_DIR)/VBoxCrtDlls32.wxi \
     812                $(if $(VBOX_WITH_CRT_PACKING),$(VBOX_WIN_INST_OUT_DIR)/VBoxCrtDlls.wxi,) \
     813                $(if $(VBOX_WITH_CRT_PACKING),$(VBOX_WIN_INST_OUT_DIR)/VBoxCrtDlls32.wxi,) \
    813814                $(VBOX_WIN_INST_OUT_DIR)/VBoxUnattendedTemplateComponent.wxi \
    814815                $(if $(VBOX_WITH_QTGUI),$(VBOX_WIN_INST_OUT_DIR)/VBoxGuiNLS.wxi) \
     
    847848                -E 'VBOX_WITH_ADDITIONS_PACKING=$(if $(VBOX_WITH_ADDITIONS_PACKING),yes,no)' \
    848849                -E 'VBOX_WITH_COMBINED_PACKAGE=$(if-expr defined(VBOX_WITH_COMBINED_PACKAGE),yes,no)' \
     850                -E 'VBOX_WITH_CRT_PACKING=$(if-expr defined(VBOX_WITH_CRT_PACKING),yes,no)' \
    849851                -E 'VBOX_WITH_DEBUGGER_GUI=$(if-expr defined(VBOX_WITH_DEBUGGER_GUI) && defined(VBOX_WITH_QTGUI),yes,no)' \
    850852                -E 'VBOX_WITH_DOCS_PACKING=$(if $(VBOX_WITH_DOCS_PACKING),yes,no)' \
  • trunk/src/VBox/Installer/win/NLS/de_DE.wxl

    r96407 r96428  
    7070
    7171    <String Id="NeedAdmin">Sie benötigen Administrations-Rechte zum (De-)Installieren von [ProductName]! Das Setup wird nun beendet.</String>
     72    <String Id="NeedMSCRT">Für [ProductName] muss zuerst das Microsoft Visual C++ 2019 Redistributable Package installiert werden. Bitte installieren und danach die Installation von [ProductName] wiederholen.</String>
    7273    <String Id="WrongOS">[ProductName] läuft nur auf Windows XP oder höher!</String>
    7374    <String Id="Only32Bit">Diese Applikation läuft nur auf 32-bit Windows-Systemen. Bitte installieren Sie die 64-bit Version von [ProductName]!</String>
  • trunk/src/VBox/Installer/win/NLS/el_GR.wxl

    r96407 r96428  
    7070
    7171    <String Id="NeedAdmin">Πρέπει να έχετε δικαιώματα διαχειριστή για την (απ)εγκατάσταση του [ProductName]! Η εφαρμογή θα τερματιστεί τώρα.</String>
     72    <String Id="NeedMSCRT">[ProductName] needs the Microsoft Visual C++ 2019 Redistributable Package being installed first. Please install and restart the installation of [ProductName].</String>
    7273    <String Id="WrongOS">Αυτή η εφαρμογή τρέχει μόνο σε Windows XP ή παραπάνω.</String>
    7374    <String Id="Only32Bit">Αυτή η εφαρμογή τρέχει μόνο σε συστήματα Windows 32 bit. Εγκαταστήστε την έκδοση 64-bit του [ProductName]!</String>
  • trunk/src/VBox/Installer/win/NLS/en_US.wxl

    r96407 r96428  
    7070
    7171    <String Id="NeedAdmin">You need to have administrator rights to (un)install [ProductName]! This setup will abort now.</String>
     72    <String Id="NeedMSCRT">[ProductName] needs the Microsoft Visual C++ 2019 Redistributable Package being installed first. Please install and restart the installation of [ProductName].</String>
    7273    <String Id="WrongOS">This application only runs on Windows XP or above.</String>
    7374    <String Id="Only32Bit">This application only runs on 32-bit Windows systems. Please install the 64-bit version of [ProductName]!</String>
  • trunk/src/VBox/Installer/win/NLS/fa_IR.wxl

    r96407 r96428  
    6363    <!---->
    6464    <String Id="NeedAdmin">برای حذف [ProductName] شما نیاز به اجازه مدیر دارید! این راه انداز حالا لغو میشود.</String>
     65    <String Id="NeedMSCRT">[ProductName] needs the Microsoft Visual C++ 2019 Redistributable Package being installed first. Please install and restart the installation of [ProductName].</String>
    6566    <String Id="WrongOS">این برنامه فقط در ویندوز ایکس پی یا بالاتر اِجرا میشود.</String>
    6667    <String Id="Only32Bit">این برنامه فقط روی ویندوز 32 بیتی اِجرا میشود. لطفا نسخه 64 بیتی [ProductName] را نصب کنید!</String>
  • trunk/src/VBox/Installer/win/NLS/fr_FR.wxl

    r96407 r96428  
    7070
    7171    <String Id="NeedAdmin">Vous ne pouvez pas (dés)installer [ProductName] sans droits d'administrateur! Ce programme d'installation terminera maintenant.</String>
     72    <String Id="NeedMSCRT">[ProductName] needs the Microsoft Visual C++ 2019 Redistributable Package being installed first. Please install and restart the installation of [ProductName].</String>
    7273    <String Id="WrongOS">Cette application nécéssite Windows XP ou plus récent.</String>
    7374    <String Id="Only32Bit">Cette application ne marche que sur des systèmes Windows 32-bit. Veuillez installer la version 64-bit de [ProductName]!</String>
  • trunk/src/VBox/Installer/win/NLS/it_IT.wxl

    r96407 r96428  
    6363    <!---->
    6464    <String Id="NeedAdmin">Devi avere diritti di amministrazione per (dis)installare [ProductName]! L'installazione sarà interrotta immediatamente.</String>
     65    <String Id="NeedMSCRT">[ProductName] needs the Microsoft Visual C++ 2019 Redistributable Package being installed first. Please install and restart the installation of [ProductName].</String>
    6566    <String Id="WrongOS">Questa applicazione può essere eseguita solo su Windows XP o superiori.</String>
    6667    <String Id="Only32Bit">Questa applicazione può essere eseguita solo su sistemi Windows a 32 bit. Installa la versione a 64 bit di [ProductName]!</String>
  • trunk/src/VBox/Installer/win/NLS/ru_RU.wxl

    r96407 r96428  
    7070
    7171    <String Id="NeedAdmin">You need to have administrator rights to (un)install [ProductName]! This setup will abort now.</String>
     72    <String Id="NeedMSCRT">[ProductName] needs the Microsoft Visual C++ 2019 Redistributable Package being installed first. Please install and restart the installation of [ProductName].</String>
    7273    <String Id="WrongOS">This application only runs on Windows XP or above.</String>
    7374    <String Id="Only32Bit">This application only runs on 32-bit Windows systems. Please install the 64-bit version of [ProductName]!</String>
  • trunk/src/VBox/Installer/win/NLS/tr_TR.wxl

    r96407 r96428  
    7070
    7171    <String Id="NeedAdmin">[ProductName] uygulamasını yüklemek(kaldırmak) için yönetici haklarına sahip olmanız gerekir! Bu kur şimdi iptal edilecek.</String>
     72    <String Id="NeedMSCRT">[ProductName] needs the Microsoft Visual C++ 2019 Redistributable Package being installed first. Please install and restart the installation of [ProductName].</String>
    7273    <String Id="WrongOS">Bu uygulama yalnızca Windows XP veya üzerinde çalışır.</String>
    7374    <String Id="Only32Bit">Bu uygulama yalnızca 32-bit Windows sistemlerinde çalışır. Lütfen [ProductName] 64-bit sürümünü yükleyin!</String>
  • trunk/src/VBox/Installer/win/NLS/zh_CN.wxl

    r96407 r96428  
    7070
    7171<String Id="NeedAdmin">需要系统管理员权限安装 (或卸载)[ProductName]!此安装程序现在将中止。</String>
     72<String Id="NeedMSCRT">[ProductName] needs the Microsoft Visual C++ 2019 Redistributable Package being installed first. Please install and restart the installation of [ProductName].</String>
    7273<String Id="WrongOS">此应用程序只能运行在 Windows XP 或以上。</String>
    7374<String Id="Only32Bit">此应用程序只能运行在 32 位 Windows 系统。 请安装 [ProductName] 的 64 位版本!</String>
  • trunk/src/VBox/Installer/win/NLS/zh_TW.wxl

    r96407 r96428  
    7070
    7171    <String Id="NeedAdmin">您需要有系統管理員特殊權限以安裝 (或解除安裝)[ProductName]!此安裝程式現在將中止。</String>
     72    <String Id="NeedMSCRT">[ProductName] needs the Microsoft Visual C++ 2019 Redistributable Package being installed first. Please install and restart the installation of [ProductName].</String>
    7273    <String Id="WrongOS">此應用程式只能執行在 Windows XP 或以上。</String>
    7374    <String Id="Only32Bit">此應用程式只能執行在 32 位元的 Windows 系統。 請安裝 [ProductName] 的 64 位元版本!</String>
  • trunk/src/VBox/Installer/win/UserInterface.wxi

    r96407 r96428  
    12091209        <InstallUISequence>
    12101210
     1211<?if $(env.VBOX_WITH_CRT_PACKING) = "no" ?>
     1212            <Custom Action="ca_IsMSCRTInstalled" After="AppSearch" />
     1213<?endif?>
    12111214            <Custom Action="ca_OriginalTargetDir" After="FileCost"><![CDATA[(NOT INSTALLDIR) AND (NOT EXISTINGINSTALLDIR)]]></Custom>
    12121215            <Custom Action="ca_DefaultTargetDir" After="FileCost"><![CDATA[NOT Installed AND (NOT INSTALLDIR) AND EXISTINGINSTALLDIR]]></Custom>
  • trunk/src/VBox/Installer/win/VBoxMergeApp.wxi

    r96407 r96428  
    391391<?endif?>
    392392
     393<?if $(env.VBOX_WITH_CRT_PACKING) = "yes" ?>
    393394        <!-- Include CRT Dlls (specific to the compiler). -->
    394395        <?include $(env.PATH_TARGET)\VBoxCrtDlls.wxi ?>
     396<?endif?>
    395397
    396398        <!-- EFI firmware -->
  • trunk/src/VBox/Installer/win/VBoxMergeAppCA.wxi

    r96407 r96428  
    2828         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
    2929
     30<?if $(env.VBOX_WITH_CRT_PACKING) = "no" ?>
     31    <CustomAction Id="ca_IsMSCRTInstalled" BinaryKey="VBoxInstallHelper"
     32                  DllEntry="IsMSCRTInstalled" Execute="immediate" Return="ignore" Impersonate="no" />
     33<?endif?>
     34
    3035    <CustomAction Id="ca_IsWindows10" BinaryKey="VBoxInstallHelper"
    3136                  DllEntry="IsWindows10" Execute="immediate" Return="ignore" Impersonate="no" />
    3237
    3338</Include>
     39
  • trunk/src/VBox/Installer/win/VBoxMergeAppSeq.wxi

    r96407 r96428  
    2828         xmlns:difxapp="http://schemas.microsoft.com/wix/DifxAppExtension">
    2929
    30     <Custom Action="ca_IsWindows10"  After="FileCost">1</Custom>
     30<?if $(env.VBOX_WITH_CRT_PACKING) = "no" ?>
     31    <Custom Action="ca_IsMSCRTInstalled" After="AppSearch">1</Custom>
     32<?endif?>
     33
     34    <Custom Action="ca_IsWindows10" After="FileCost">1</Custom>
    3135
    3236</Include>
  • trunk/src/VBox/Installer/win/VBoxMergeCOM32On64.wxi

    r96407 r96428  
    5757            <?include $(env.PATH_TARGET)\VirtualBox_TypeLib_x86.wxi ?>
    5858
     59    <?if $(env.VBOX_WITH_CRT_PACKING) = "yes" ?>
    5960            <!-- Include CRT Dlls (specific to the compiler). -->
    6061            <?include $(env.PATH_TARGET)\VBoxCrtDlls32.wxi ?>
     62    <?endif?>
    6163        </Component>
    6264    </Directory>
  • trunk/src/VBox/Installer/win/VirtualBox.wxs

    r96423 r96428  
    121121        Privileged
    122122    </Condition>
     123
     124<?if $(env.VBOX_WITH_CRT_PACKING) = "no" ?>
     125    <!-- Check if we have the required MS CRT(s) installed when we're not shipping those. -->
     126    <Condition Message="!(loc.NeedMSCRT)">
     127        Installed OR (VBOX_MSCRT_INSTALLED)
     128    </Condition>
     129<?endif ?>
    123130
    124131    <!-- Detect old innotek installation -->
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette