VirtualBox

Changeset 35834 in vbox for trunk/src/VBox/Additions/WINNT


Ignore:
Timestamp:
Feb 3, 2011 2:43:20 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
69827
Message:

Fixed Win32->HRESULT conversion, logging, spaces.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Installer/VBoxDrvInst.cpp

    r35709 r35834  
    143143                      const _TCHAR *pszLogFile)
    144144{
    145     HRESULT hr = ERROR_SUCCESS;
     145    HRESULT hr = S_OK;
    146146    HMODULE hDIFxAPI = LoadLibrary(_T("DIFxAPI.dll"));
    147147    if (NULL == hDIFxAPI)
    148148    {
    149149        _tprintf(_T("ERROR: Unable to locate DIFxAPI.dll!\n"));
    150         hr = ERROR_FILE_NOT_FOUND;
     150        hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
    151151    }
    152152    else
     
    158158            {
    159159                _tprintf(_T("ERROR: Unable to retrieve entry point for DriverPackageInstallW!\n"));
    160                 hr = ERROR_PROC_NOT_FOUND;
     160                hr = HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND);
    161161            }
    162162        }
     
    167167            {
    168168                _tprintf(_T("ERROR: Unable to retrieve entry point for DriverPackageUninstallW!\n"));
    169                 hr = ERROR_PROC_NOT_FOUND;
     169                hr = HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND);
    170170            }
    171171        }
     
    177177            {
    178178                _tprintf(_T("ERROR: Unable to retrieve entry point for DIFXAPISetLogCallbackW!\n"));
    179                 hr = ERROR_PROC_NOT_FOUND;
     179                hr = HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND);
    180180            }
    181181        }
     
    184184    if (SUCCEEDED(hr))
    185185    {
    186         FILE *fh = NULL;
     186        FILE *phFile = NULL;
    187187        if (pszLogFile)
    188188        {
    189             fh = _wfopen(pszLogFile, _T("a"));
    190             if (!fh)
     189            phFile = _wfopen(pszLogFile, _T("a"));
     190            if (!phFile)
    191191                _tprintf(_T("ERROR: Unable to create log file!\n"));
    192             g_pfnDIFXAPISetLogCallback(LogCallback, fh);
     192            g_pfnDIFXAPISetLogCallback(LogCallback, phFile);
    193193        }
    194194
     
    205205        {
    206206            _tprintf(_T("ERROR: INF-Path too long / could not be retrieved!\n"));
    207             hr = ERROR_INVALID_PARAMETER;
     207            hr = HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER);
    208208        }
    209209        else
     
    301301                        break;
    302302
    303                 case ERROR_SHARING_VIOLATION:
    304                     _tprintf(_T("ERROR: A component of the driver package in the DIFx driver store is locked by a thread or process\n"));
    305                     break;
     303                    case ERROR_SHARING_VIOLATION:
     304                        _tprintf(_T("ERROR: A component of the driver package in the DIFx driver store is locked by a thread or process\n"));
     305                        break;
    306306
    307307                    /*
     
    315315                        break;
    316316
    317                 case ERROR_UNSUPPORTED_TYPE:
    318                     _tprintf(_T("ERROR: The driver package type is not supported of INF %ws!\n"), szDriverInf);
    319                     break;
     317                    case ERROR_UNSUPPORTED_TYPE:
     318                        _tprintf(_T("ERROR: The driver package type is not supported of INF %ws!\n"), szDriverInf);
     319                        break;
    320320
    321321                    default:
     
    328328                    }
    329329                }
    330                 hr = ERROR_INSTALL_FAILURE;
     330                hr = HRESULT_FROM_WIN32(dwRet);
    331331            }
    332332            g_pfnDIFXAPISetLogCallback(NULL, NULL);
    333             if (fh)
    334                 fclose(fh);
     333            if (phFile)
     334                fclose(phFile);
    335335            if (SUCCEEDED(hr))
    336336            {
     337                _tprintf(_T("Driver was installed successfully!\n"));
    337338                if (fReboot)
    338339                    _tprintf(_T("A reboot is needed to complete the driver (un)installation!\n"));
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