VirtualBox

Ignore:
Timestamp:
May 5, 2014 12:02:02 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
93552
Message:

VBoxNetCfg: Fixed crash when rolling back in VBoxNetCfgWinInstallInfAndComponent().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/win/cfg/VBoxNetCfg.cpp

    r51153 r51181  
    277277}
    278278
    279 /** @todo r=bird: This function is not in the header file, why is it
    280  *        exported? */
    281 VBOXNETCFGWIN_DECL(HRESULT) VBoxNetCfgWinInstallInfAndComponent(IN INetCfg *pNetCfg, IN LPCWSTR pszwComponentId, IN const GUID *pguidClass,
    282                                                                 IN LPCWSTR const *apInfPaths, IN UINT cInfPaths,
    283                                                                 OUT INetCfgComponent **ppComponent)
     279static HRESULT vboxNetCfgWinInstallInfAndComponent(IN INetCfg *pNetCfg, IN LPCWSTR pszwComponentId, IN const GUID *pguidClass,
     280                                                   IN LPCWSTR const *apInfPaths, IN UINT cInfPaths,
     281                                                   OUT INetCfgComponent **ppComponent)
    284282{
    285283    HRESULT hr = S_OK;
    286     UINT i = 0;
     284    UINT cFilesProcessed = 0;
    287285
    288286    NonStandardLogFlow(("Installing %u INF files ...\n", cInfPaths));
    289287
    290     for (; i < cInfPaths; i++)
    291     {
    292         NonStandardLogFlow(("Installing INF file \"%ws\" ...\n", apInfPaths[i]));
    293         hr = VBoxDrvCfgInfInstall(apInfPaths[i]);
     288    for (; cFilesProcessed < cInfPaths; cFilesProcessed++)
     289    {
     290        NonStandardLogFlow(("Installing INF file \"%ws\" ...\n", apInfPaths[cFilesProcessed]));
     291        hr = VBoxDrvCfgInfInstall(apInfPaths[cFilesProcessed]);
    294292        if (FAILED(hr))
    295293        {
     
    308306    if (FAILED(hr))
    309307    {
    310         for (UINT j = i - 1; j != 0; j--)
    311             VBoxDrvCfgInfUninstall(apInfPaths[j], 0);
     308        NonStandardLogFlow(("Installation failed, rolling back installation set ...\n"));
     309
     310        do
     311        {
     312            HRESULT hr2 = VBoxDrvCfgInfUninstall(apInfPaths[cFilesProcessed], 0);
     313            if (FAILED(hr2))
     314                NonStandardLogFlow(("VBoxDrvCfgInfUninstall failed, hr (0x%x)\n", hr2));
     315                /* Keep going. */
     316            if (!cFilesProcessed)
     317                break;
     318        } while (cFilesProcessed--);
     319
     320        NonStandardLogFlow(("Rollback complete\n"));
    312321    }
    313322
     
    20292038    {
    20302039        NonStandardLog("NetFlt will be installed ...\n");
    2031         hr = VBoxNetCfgWinInstallInfAndComponent(pNc, VBOXNETCFGWIN_NETFLT_ID,
     2040        hr = vboxNetCfgWinInstallInfAndComponent(pNc, VBOXNETCFGWIN_NETFLT_ID,
    20322041                                                 &GUID_DEVCLASS_NETSERVICE,
    20332042                                                 apInfFullPaths,
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