VirtualBox

Changeset 38793 in vbox


Ignore:
Timestamp:
Sep 19, 2011 1:48:31 PM (13 years ago)
Author:
vboxsync
Message:

CreateHostOnlyInterface: Lots of logging for #5886.

File:
1 edited

Legend:

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

    r38791 r38793  
    854854
    855855    GUID guid;
    856     WCHAR MpInf[MAX_PATH];
    857     DWORD cSize = sizeof(MpInf)/sizeof(MpInf[0]);
    858     LPCWSTR pInfPath = NULL;
     856    WCHAR wszMpInf[MAX_PATH];
     857    DWORD cchMpInf = RT_ELEMENTS(wszMpInf) - sizeof("drivers\\network\\netadp\\VBoxNetAdp.inf") - 1;
     858    LPCWSTR pwszInfPath = NULL;
    859859    bool bIsFile = false;
    860     UINT uErr = MsiGetPropertyW(hModule, L"CustomActionData", MpInf, &cSize);
     860    UINT uErr = MsiGetPropertyW(hModule, L"CustomActionData", wszMpInf, &cchMpInf);
    861861    if (uErr == ERROR_SUCCESS)
    862862    {
    863         if (cSize)
    864         {
    865             logStringW(hModule, L"CreateHostOnlyInterface: NetAdpDir property = %s", MpInf);
    866             if (MpInf[cSize-1] != L'\\')
     863        if (cchMpInf)
     864        {
     865            logStringW(hModule, L"CreateHostOnlyInterface: NetAdpDir property = %s", wszMpInf);
     866            if (wszMpInf[cchMpInf - 1] != L'\\')
    867867            {
    868                 MpInf[cSize] = L'\\';
    869                 ++cSize;
    870                 MpInf[cSize] = L'\0';
     868                wszMpInf[cchMpInf++] = L'\\';
     869                wszMpInf[cchMpInf]   = L'\0';
    871870            }
    872871
    873             /** @todo r=andy Avoid wcscat, can cause buffer overruns! */
    874             wcscat(MpInf, L"drivers\\network\\netadp\\VBoxNetAdp.inf");
    875             pInfPath = MpInf;
     872            wcscat(wszMpInf, L"drivers\\network\\netadp\\VBoxNetAdp.inf");
     873            pwszInfPath = wszMpInf;
    876874            bIsFile = true;
    877875
    878             logStringW(hModule, L"CreateHostOnlyInterface: Resulting INF path = %s", pInfPath);
     876            logStringW(hModule, L"CreateHostOnlyInterface: Resulting INF path = %s", pwszInfPath);
    879877        }
    880878        else
     
    885883
    886884    /* Make sure the inf file is installed. */
    887     if (!!pInfPath && bIsFile)
    888     {
    889         hr = VBoxDrvCfgInfInstall(pInfPath);
     885    if (pwszInfPath != NULL && bIsFile)
     886    {
     887logStringW(hModule, L"CreateHostOnlyInterface: Calling VBoxDrvCfgInfInstall(%s)", pwszInfPath);
     888        hr = VBoxDrvCfgInfInstall(pwszInfPath);
     889logStringW(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         hr = VBoxNetCfgWinCreateHostOnlyNetworkInterface(pInfPath, bIsFile, &guid, NULL, NULL);
     896logStringW(hModule, L"CreateHostOnlyInterface: calling VBoxNetCfgWinCreateHostOnlyNetworkInterface");
     897        hr = VBoxNetCfgWinCreateHostOnlyNetworkInterface(pwszInfPath, bIsFile, &guid, NULL, NULL);
     898logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinCreateHostOnlyNetworkInterface returns 0x%x", hr);
    897899        if (SUCCEEDED(hr))
    898900        {
    899901            ULONG ip = inet_addr("192.168.56.1");
    900902            ULONG mask = inet_addr("255.255.255.0");
     903logStringW(hModule, L"CreateHostOnlyInterface: calling VBoxNetCfgWinEnableStaticIpConfig");
    901904            hr = VBoxNetCfgWinEnableStaticIpConfig(&guid, ip, mask);
     905logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinEnableStaticIpConfig returns 0x%x", hr);
    902906            if (FAILED(hr))
    903907                logStringW(hModule, L"CreateHostOnlyInterface: VBoxNetCfgWinEnableStaticIpConfig failed, error = 0x%x", hr);
     
    911915
    912916    /* Restore original setup mode. */
     917logStringW(hModule, L"CreateHostOnlyInterface: almost done...");
    913918    if (bSetupModeInteractive)
    914919        SetupSetNonInteractiveMode(bSetupModeInteractive);
     
    918923#endif /* VBOX_WITH_NETFLT */
    919924
     925logStringW(hModule, L"CreateHostOnlyInterface: returns success (ignoring all failures)");
    920926    /* Never fail the install even if we did not succeed. */
    921927    return ERROR_SUCCESS;
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