VirtualBox

Changeset 52265 in vbox


Ignore:
Timestamp:
Aug 4, 2014 1:50:42 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
95362
Message:

pr5904. This fix should resolve the problem with host-only configuration on Windows(2 and more networks).

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

Legend:

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

    r51844 r52265  
    842842    logStringW(hModule, L"CreateHostOnlyInterface: Creating host-only interface");
    843843
    844     HRESULT hr = VBoxNetCfgWinRemoveAllNetDevicesOfId(NETADP_ID);
    845     if (FAILED(hr))
    846     {
    847         logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinRemoveAllNetDevicesOfId failed, error = 0x%x", hr);
    848         bSetStaticIp = false;
    849     }
     844    HRESULT hr;
    850845
    851846    GUID guid;
     
    890885    if (SUCCEEDED(hr))
    891886    {
    892         logStringW(hModule, L"CreateHostOnlyInterface: calling VBoxNetCfgWinCreateHostOnlyNetworkInterface");
    893         hr = VBoxNetCfgWinCreateHostOnlyNetworkInterface(pwszInfPath, bIsFile, &guid, NULL, NULL);
    894         logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinCreateHostOnlyNetworkInterface returns 0x%x", hr);
     887    //first, try to update Host Only Network Interface
     888        BOOL fRebootRequired = FALSE;
     889        hr = VBoxNetCfgWinUpdateHostOnlyNetworkInterface(pwszInfPath, &fRebootRequired);
    895890        if (SUCCEEDED(hr))
    896891        {
    897             ULONG ip = inet_addr("192.168.56.1");
    898             ULONG mask = inet_addr("255.255.255.0");
    899             logStringW(hModule, L"CreateHostOnlyInterface: calling VBoxNetCfgWinEnableStaticIpConfig");
    900             hr = VBoxNetCfgWinEnableStaticIpConfig(&guid, ip, mask);
    901             logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinEnableStaticIpConfig returns 0x%x", hr);
    902             if (FAILED(hr))
    903                 logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinEnableStaticIpConfig failed, error = 0x%x", hr);
     892            if (fRebootRequired)
     893            {
     894                logStringW(hModule, L"UpdateHostOnlyInterfaces: Reboot required, setting REBOOT property to force");
     895                HRESULT hr2 = MsiSetPropertyW(hModule, L"REBOOT", L"Force");
     896                if (hr2 != ERROR_SUCCESS)
     897                    logStringW(hModule, L"UpdateHostOnlyInterfaces: Failed to set REBOOT property, error = 0x%x", hr2);
     898            }
    904899        }
    905900        else
    906             logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinCreateHostOnlyNetworkInterface failed, error = 0x%x", hr);
     901            logStringW(hModule, L"UpdateHostOnlyInterfaces: VBoxNetCfgWinUpdateHostOnlyNetworkInterface failed, hr = 0x%x", hr);
     902    //in fail case call CreateHostOnlyInterface
     903        if (FAILED(hr))
     904        {
     905            logStringW(hModule, L"CreateHostOnlyInterface: calling VBoxNetCfgWinCreateHostOnlyNetworkInterface");
     906            hr = VBoxNetCfgWinCreateHostOnlyNetworkInterface(pwszInfPath, bIsFile, &guid, NULL, NULL);
     907            logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinCreateHostOnlyNetworkInterface returns 0x%x", hr);
     908            if (SUCCEEDED(hr))
     909            {
     910                ULONG ip = inet_addr("192.168.56.1");
     911                ULONG mask = inet_addr("255.255.255.0");
     912                logStringW(hModule, L"CreateHostOnlyInterface: calling VBoxNetCfgWinEnableStaticIpConfig");
     913                hr = VBoxNetCfgWinEnableStaticIpConfig(&guid, ip, mask);
     914                logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinEnableStaticIpConfig returns 0x%x", hr);
     915                if (FAILED(hr))
     916                    logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinEnableStaticIpConfig failed, error = 0x%x", hr);
     917            }
     918            else
     919                logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinCreateHostOnlyNetworkInterface failed, error = 0x%x", hr);
     920        }
    907921    }
    908922
  • trunk/src/VBox/Installer/win/VBoxMergeNetAdpSeq.wxi

    r51876 r52265  
    3535    <!-- Don't remove the host-only interfaces on update, only on uninstall -->
    3636    <Custom Action="ca_RemoveHostOnlyInterfaces" After="InstallInitialize" >
    37         <![CDATA[(NOT UPGRADINGPRODUCTCODE) AND (REMOVE="ALL")]]>
     37        <![CDATA[NOT (UPGRADINGPRODUCTCODE) AND (Installed) AND (REMOVE="ALL")]]>
    3838    </Custom>
    3939    <!-- First stop the existing host-only interfaces on update ... -->
    40     <Custom Action="ca_StopHostOnlyInterfaces" Before="ca_UpdateHostOnlyInterfaces" >
    41         <![CDATA[UPGRADINGPRODUCTCODE]]>
    42     </Custom>
    43     <!-- ... then do the actual driver update -->
    44     <Custom Action="ca_UpdateHostOnlyInterfacesArgs" Before="ca_UpdateHostOnlyInterfaces" >
    45         <![CDATA[Installed AND UPGRADINGPRODUCTCODE AND (NOT REMOVE="ALL")]]>
    46     </Custom>
    47     <Custom Action="ca_UpdateHostOnlyInterfaces" Before="InstallFiles" >
    48         <![CDATA[Installed AND UPGRADINGPRODUCTCODE AND (NOT REMOVE="ALL")]]>
     40    <Custom Action="ca_StopHostOnlyInterfaces" After="InstallInitialize" >
     41        <![CDATA[(UPGRADINGPRODUCTCODE) OR (REMOVE="ALL")]]>
    4942    </Custom>
    5043<?endif ?>
Note: See TracChangeset for help on using the changeset viewer.

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