VirtualBox

Changeset 39003 in vbox


Ignore:
Timestamp:
Oct 17, 2011 1:16:04 PM (13 years ago)
Author:
vboxsync
Message:

Windows host installer: Added proper detection for updating an existing installation and stubs for stopping + updating host-only adapters when doing an update.

Location:
trunk/src/VBox/Installer/win
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.cpp

    r38794 r39003  
    736736    {
    737737
    738         logStringW(hModule, L"Installing NetFlt");
     738        logStringW(hModule, L"InstallNetFlt: Installing NetFlt");
    739739
    740740        uErr = doNetCfgInit(hModule, &pNetCfg, TRUE);
     
    758758            VBoxNetCfgWinReleaseINetCfg(pNetCfg, TRUE);
    759759
    760             logStringW(hModule, L"Installing NetFlt done");
     760            logStringW(hModule, L"InstallNetFlt: Done");
    761761        }
    762762        else
     
    844844    bool bSetStaticIp = true;
    845845
    846     logStringW(hModule, L"Creating host-only interface");
     846    logStringW(hModule, L"CreateHostOnlyInterface: Creating host-only interface");
    847847
    848848    HRESULT hr = VBoxNetCfgWinRemoveAllNetDevicesOfId(NETADP_ID);
     
    885885    if (pwszInfPath != NULL && bIsFile)
    886886    {
    887 logStringW(hModule, L"CreateHostOnlyInterface: Calling VBoxDrvCfgInfInstall(%s)", pwszInfPath);
     887        logStringW(hModule, L"CreateHostOnlyInterface: Calling VBoxDrvCfgInfInstall(%s)", pwszInfPath);
    888888        hr = VBoxDrvCfgInfInstall(pwszInfPath);
    889 logStringW(hModule, L"CreateHostOnlyInterface: VBoxDrvCfgInfInstall returns 0x%x", hr);
     889        logStringW(hModule, L"CreateHostOnlyInterface: VBoxDrvCfgInfInstall returns 0x%x", hr);
    890890        if (FAILED(hr))
    891891            logStringW(hModule, L"CreateHostOnlyInterface: Failed to install INF file, error = 0x%x", hr);
     
    894894    if (SUCCEEDED(hr))
    895895    {
    896 logStringW(hModule, L"CreateHostOnlyInterface: calling VBoxNetCfgWinCreateHostOnlyNetworkInterface");
     896        logStringW(hModule, L"CreateHostOnlyInterface: calling VBoxNetCfgWinCreateHostOnlyNetworkInterface");
    897897        hr = VBoxNetCfgWinCreateHostOnlyNetworkInterface(pwszInfPath, bIsFile, &guid, NULL, NULL);
    898 logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinCreateHostOnlyNetworkInterface returns 0x%x", hr);
     898        logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinCreateHostOnlyNetworkInterface returns 0x%x", hr);
    899899        if (SUCCEEDED(hr))
    900900        {
    901901            ULONG ip = inet_addr("192.168.56.1");
    902902            ULONG mask = inet_addr("255.255.255.0");
    903 logStringW(hModule, L"CreateHostOnlyInterface: calling VBoxNetCfgWinEnableStaticIpConfig");
     903            logStringW(hModule, L"CreateHostOnlyInterface: calling VBoxNetCfgWinEnableStaticIpConfig");
    904904            hr = VBoxNetCfgWinEnableStaticIpConfig(&guid, ip, mask);
    905 logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinEnableStaticIpConfig returns 0x%x", hr);
     905            logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinEnableStaticIpConfig returns 0x%x", hr);
    906906            if (FAILED(hr))
    907907                logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinEnableStaticIpConfig failed, error = 0x%x", hr);
     
    912912
    913913    if (SUCCEEDED(hr))
    914         logStringW(hModule, L"Creating host-only interface done");
     914        logStringW(hModule, L"CreateHostOnlyInterface: Creating host-only interface done");
    915915
    916916    /* Restore original setup mode. */
    917 logStringW(hModule, L"CreateHostOnlyInterface: almost done...");
     917    logStringW(hModule, L"CreateHostOnlyInterface: Almost done...");
    918918    if (bSetupModeInteractive)
    919919        SetupSetNonInteractiveMode(bSetupModeInteractive);
     
    923923#endif /* VBOX_WITH_NETFLT */
    924924
    925 logStringW(hModule, L"CreateHostOnlyInterface: returns success (ignoring all failures)");
     925    logStringW(hModule, L"CreateHostOnlyInterface: Returns success (ignoring all failures)");
    926926    /* Never fail the install even if we did not succeed. */
    927927    return ERROR_SUCCESS;
     
    933933    netCfgLoggerEnable(hModule);
    934934
    935     logStringW(hModule, L"RemoveHostOnlyInterfaces: Removing All Host-Only Interface");
     935    logStringW(hModule, L"RemoveHostOnlyInterfaces: Removing all host-only interfaces");
    936936
    937937    BOOL bSetupModeInteractive = SetupSetNonInteractiveMode(FALSE);
     
    952952    if (bSetupModeInteractive)
    953953        SetupSetNonInteractiveMode(bSetupModeInteractive);
     954
     955    netCfgLoggerDisable();
     956#endif /* VBOX_WITH_NETFLT */
     957
     958    /* Never fail the install even if we did not succeed. */
     959    return ERROR_SUCCESS;
     960}
     961
     962UINT __stdcall StopHostOnlyInterfaces(MSIHANDLE hModule)
     963{
     964#ifdef VBOX_WITH_NETFLT
     965    netCfgLoggerEnable(hModule);
     966
     967    logStringW(hModule, L"StopHostOnlyInterfaces: Stopping all host-only Interfaces");
     968
     969    /** TODO */
     970
     971    netCfgLoggerDisable();
     972#endif /* VBOX_WITH_NETFLT */
     973
     974    /* Never fail the install even if we did not succeed. */
     975    return ERROR_SUCCESS;
     976}
     977
     978UINT __stdcall UpdateHostOnlyInterfaces(MSIHANDLE hModule)
     979{
     980#ifdef VBOX_WITH_NETFLT
     981    netCfgLoggerEnable(hModule);
     982
     983    logStringW(hModule, L"UpdateHostOnlyInterfaces: Updating all host-only Interfaces");
     984
     985    WCHAR wszMpInf[MAX_PATH];
     986    DWORD cchMpInf = RT_ELEMENTS(wszMpInf) - sizeof("drivers\\network\\netadp\\VBoxNetAdp.inf") - 1;
     987    LPCWSTR pwszInfPath = NULL;
     988    bool bIsFile = false;
     989    UINT uErr = MsiGetPropertyW(hModule, L"CustomActionData", wszMpInf, &cchMpInf);
     990    if (uErr == ERROR_SUCCESS)
     991    {
     992        if (cchMpInf)
     993        {
     994            logStringW(hModule, L"UpdateHostOnlyInterfaces: NetAdpDir property = %s", wszMpInf);
     995            if (wszMpInf[cchMpInf - 1] != L'\\')
     996            {
     997                wszMpInf[cchMpInf++] = L'\\';
     998                wszMpInf[cchMpInf]   = L'\0';
     999            }
     1000
     1001            wcscat(wszMpInf, L"drivers\\network\\netadp\\VBoxNetAdp.inf");
     1002            pwszInfPath = wszMpInf;
     1003            bIsFile = true;
     1004
     1005            logStringW(hModule, L"UpdateHostOnlyInterfaces: Resulting INF path = %s", pwszInfPath);
     1006        }
     1007        else
     1008            logStringW(hModule, L"UpdateHostOnlyInterfaces: NetAdpDir property value is empty");
     1009    }
     1010    else
     1011        logStringW(hModule, L"UpdateHostOnlyInterfaces: Failed to get NetAdpDir property, error = 0x%x", uErr);
     1012
     1013    /** TODO */
    9541014
    9551015    netCfgLoggerDisable();
  • trunk/src/VBox/Installer/win/InstallHelper/VBoxInstallHelper.def

    r32112 r39003  
    2727    UninstallTAPInstances
    2828    CreateHostOnlyInterface
     29    StopHostOnlyInterfaces
     30    UpdateHostOnlyInterfaces
    2931    RemoveHostOnlyInterfaces
    3032
  • trunk/src/VBox/Installer/win/VirtualBox.wxs

    r38938 r39003  
    179179
    180180<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
    181         <CustomAction Id="ca_CreateHostOnlyInterface"  BinaryKey="VBoxInstallHelper"  DllEntry="CreateHostOnlyInterface" Execute="deferred" Return="check" Impersonate="no"/>
     181        <CustomAction Id="ca_CreateHostOnlyInterface" BinaryKey="VBoxInstallHelper"  DllEntry="CreateHostOnlyInterface" Execute="deferred" Return="check" Impersonate="no"/>
    182182        <CustomAction Id="ca_CreateHostOnlyInterfaceArgs" Property="ca_CreateHostOnlyInterface" Value="[INSTALLDIR]" Execute="immediate"/>
    183183
    184184        <CustomAction Id="ca_RemoveHostOnlyInterfaces" BinaryKey="VBoxInstallHelper"  DllEntry="RemoveHostOnlyInterfaces" Execute="deferred" Return="check" Impersonate="no"/>
     185        <CustomAction Id="ca_StopHostOnlyInterfaces" BinaryKey="VBoxInstallHelper"  DllEntry="StopHostOnlyInterfaces" Execute="deferred" Return="check" Impersonate="no"/>
     186
     187        <CustomAction Id="ca_UpdateHostOnlyInterfaces" BinaryKey="VBoxInstallHelper"  DllEntry="UpdateHostOnlyInterfaces" Execute="deferred" Return="check" Impersonate="no"/>
     188        <CustomAction Id="ca_UpdateHostOnlyInterfacesArgs" Property="ca_UpdateHostOnlyInterfaces" Value="[INSTALLDIR]" Execute="immediate"/>
    185189
    186190        <CustomAction Id="ca_InstallNetFlt" BinaryKey="VBoxInstallHelper" DllEntry="InstallNetFlt" Execute="deferred" Return="check" Impersonate="no"/>
     
    760764            <Custom Action="ca_UninstallTAPInstances" Before="InstallFiles" >1</Custom>
    761765<?if $(env.VBOX_WITH_NETFLT) = "yes" ?>
    762             <Custom Action="ca_CreateHostOnlyInterfaceArgs" Before="ca_CreateHostOnlyInterface" ><![CDATA[&VBoxNetworkAdp=3]]></Custom>
    763             <Custom Action="ca_CreateHostOnlyInterface" Before="InstallFinalize" ><![CDATA[&VBoxNetworkAdp=3]]></Custom>
    764             <Custom Action="ca_RemoveHostOnlyInterfaces" After="ca_UninstallNetFlt" ><![CDATA[REMOVE]]></Custom>
     766            <!-- Create host-only interfaces on first-time install. -->
     767            <Custom Action="ca_CreateHostOnlyInterfaceArgs" Before="ca_CreateHostOnlyInterface" ><![CDATA[&VBoxNetworkAdp=3 AND (NOT UPGRADINGPRODUCTCODE)]]></Custom>
     768            <Custom Action="ca_CreateHostOnlyInterface" Before="InstallFinalize" ><![CDATA[&VBoxNetworkAdp=3 AND (NOT UPGRADINGPRODUCTCODE)]]></Custom>
     769            <!-- Don't remove the host-only interfaces on update, only on uninstall. -->
     770            <Custom Action="ca_RemoveHostOnlyInterfaces" After="ca_UninstallNetFlt" ><![CDATA[(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")]]></Custom>
     771            <!-- First stop the existing host-only interfaces on updat ... -->
     772            <Custom Action="ca_StopHostOnlyInterfaces" Before="ca_UpdateHostOnlyInterfaces" ><![CDATA[&VBoxNetworkAdp=3 AND (UPGRADINGPRODUCTCODE)]]></Custom>
     773            <!-- ... then do the actual driver update. -->
     774            <Custom Action="ca_UpdateHostOnlyInterfacesArgs" Before="ca_UpdateHostOnlyInterfaces" ><![CDATA[&VBoxNetworkAdp=3 AND (UPGRADINGPRODUCTCODE)]]></Custom>
     775            <Custom Action="ca_UpdateHostOnlyInterfaces" Before="InstallFinalize" ><![CDATA[&VBoxNetworkAdp=3 AND (UPGRADINGPRODUCTCODE)]]></Custom>
    765776
    766777            <Custom Action="ca_RollbackInstallNetFltArgs" Before="ca_RollbackInstallNetFlt" ><![CDATA[&VBoxNetworkFlt=3]]></Custom>
     
    780791            <Custom Action="ca_InstallBranding" Before="InstallFinalize" ><![CDATA[NOT REMOVE]]></Custom>
    781792
    782             <Custom Action="ca_UninstallBrandingArgs" Before="ca_UninstallBranding" ><![CDATA[REMOVE]]></Custom>
    783             <Custom Action="ca_UninstallBranding" Before="InstallFinalize" ><![CDATA[REMOVE]]></Custom>
     793            <!-- Uninstall branding on complete uninstall, not on update. -->
     794            <Custom Action="ca_UninstallBrandingArgs" Before="ca_UninstallBranding" ><![CDATA[(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")]]></Custom>
     795            <Custom Action="ca_UninstallBranding" Before="InstallFinalize" ><![CDATA[(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")]]></Custom>
    784796
    785797        </InstallExecuteSequence>
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