VirtualBox

Ignore:
Timestamp:
Apr 20, 2012 1:31:30 PM (13 years ago)
Author:
vboxsync
Message:

VBoxDrvCfg: Return proper HRESULT in VBoxDrvCfgDrvUpdate, some renaming.

File:
1 edited

Legend:

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

    r40993 r41012  
    203203    if (!SetupFindFirstLineW(hInf, lpszSection, lpszKey, pCtx))
    204204    {
    205         DWORD winEr = GetLastError();
    206         NonStandardLogRelCrap((__FUNCTION__ ": SetupFindFirstLine failed WinEr (%d) for Section(%S), Key(%S)\n", winEr, lpszSection, lpszKey));
    207         return HRESULT_FROM_WIN32(winEr);
     205        DWORD dwErr = GetLastError();
     206        NonStandardLogRelCrap((__FUNCTION__ ": SetupFindFirstLine failed WinEr (%d) for Section(%S), Key(%S)\n", dwErr, lpszSection, lpszKey));
     207        return HRESULT_FROM_WIN32(dwErr);
    208208    }
    209209    return S_OK;
     
    212212static HRESULT vboxDrvCfgInfQueryKeyValue(PINFCONTEXT pCtx, DWORD iValue, LPWSTR *lppszValue, PDWORD pcValue)
    213213{
    214     DWORD winEr;
     214    DWORD dwErr;
    215215    DWORD cValue;
    216216
    217217    if (!SetupGetStringFieldW(pCtx, iValue, NULL, 0, &cValue))
    218218    {
    219         winEr = GetLastError();
    220 //        NonStandardAssert(winEr == ERROR_INSUFFICIENT_BUFFER);
    221         if (winEr != ERROR_INSUFFICIENT_BUFFER)
    222         {
    223             NonStandardLogFlowCrap((__FUNCTION__ ": SetupGetStringField failed WinEr (%d) for iValue(%d)\n", winEr, iValue));
    224             return HRESULT_FROM_WIN32(winEr);
     219        dwErr = GetLastError();
     220//        NonStandardAssert(dwErr == ERROR_INSUFFICIENT_BUFFER);
     221        if (dwErr != ERROR_INSUFFICIENT_BUFFER)
     222        {
     223            NonStandardLogFlowCrap((__FUNCTION__ ": SetupGetStringField failed WinEr (%d) for iValue(%d)\n", dwErr, iValue));
     224            return HRESULT_FROM_WIN32(dwErr);
    225225        }
    226226    }
     
    230230    if (!lpszValue)
    231231    {
    232         NonStandardLogRelCrap((__FUNCTION__ ": SetCoTaskMemAlloc failed to alloc mem of size (%d), for iValue(%d)\n", cValue * sizeof (lpszValue[0]), winEr, iValue));
     232        NonStandardLogRelCrap((__FUNCTION__ ": SetCoTaskMemAlloc failed to alloc mem of size (%d), for iValue(%d)\n", cValue * sizeof (lpszValue[0]), dwErr, iValue));
    233233        return E_FAIL;
    234234    }
     
    236236    if (!SetupGetStringFieldW(pCtx, iValue, lpszValue, cValue, &cValue))
    237237    {
    238         winEr = GetLastError();
    239         NonStandardLogRelCrap((__FUNCTION__ ": SetupGetStringField failed WinEr (%d) for iValue(%d)\n", winEr, iValue));
     238        dwErr = GetLastError();
     239        NonStandardLogRelCrap((__FUNCTION__ ": SetupGetStringField failed WinEr (%d) for iValue(%d)\n", dwErr, iValue));
    240240        NonStandardAssert(0);
    241241        free(lpszValue);
    242         return HRESULT_FROM_WIN32(winEr);
     242        return HRESULT_FROM_WIN32(dwErr);
    243243    }
    244244
     
    265265    if (hr != S_OK)
    266266    {
    267         NonStandardLogCrap((__FUNCTION__ ": vboxDrvCfgInfQueryContext for Manufacturer failed, hr = (0x%x)\n", hr));
     267        NonStandardLogCrap((__FUNCTION__ ": vboxDrvCfgInfQueryContext for Manufacturer failed, hr=0x%x\n", hr));
    268268        return hr;
    269269    }
     
    272272    if (hr != S_OK)
    273273    {
    274         NonStandardLogRelCrap((__FUNCTION__ ": vboxDrvCfgRegQueryKeyValue 1 for Manufacturer failed, hr = (0x%x)\n", hr));
     274        NonStandardLogRelCrap((__FUNCTION__ ": vboxDrvCfgRegQueryKeyValue 1 for Manufacturer failed, hr=0x%x\n", hr));
    275275        return hr;
    276276    }
     
    354354    if (hr != S_OK)
    355355    {
    356         NonStandardLogCrap((__FUNCTION__ ": vboxDrvCfgRegQueryKeyValue for Manufacturer failed, hr = (0x%x)\n", hr));
     356        NonStandardLogCrap((__FUNCTION__ ": vboxDrvCfgRegQueryKeyValue for Manufacturer failed, hr=0x%x\n", hr));
    357357        return hr;
    358358    }
     
    362362    if (hr != S_OK)
    363363    {
    364         NonStandardLogRelCrap((__FUNCTION__ ": vboxDrvCfgInfQueryContext for models (%S) failed, hr = (0x%x)\n", lpszModels, hr));
     364        NonStandardLogRelCrap((__FUNCTION__ ": vboxDrvCfgInfQueryContext for models (%S) failed, hr=0x%x\n", lpszModels, hr));
    365365    }
    366366    else
     
    369369        if (hr != S_OK)
    370370        {
    371             NonStandardLogRelCrap((__FUNCTION__ ": vboxDrvCfgRegQueryKeyValue for models (%S) failed, hr = (0x%x)\n", lpszModels, hr));
     371            NonStandardLogRelCrap((__FUNCTION__ ": vboxDrvCfgRegQueryKeyValue for models (%S) failed, hr=0x%x\n", lpszModels, hr));
    372372        }
    373373    }
     
    399399            lpszDstNameComponent))
    400400    {
    401         DWORD winEr = GetLastError();
    402         HRESULT hr = HRESULT_FROM_WIN32(winEr);
     401        DWORD dwErr = GetLastError();
     402        HRESULT hr = HRESULT_FROM_WIN32(dwErr);
    403403        if (fCopyStyle != SP_COPY_REPLACEONLY || hr != VBOXDRVCFG_S_INFEXISTS)
    404404        {
    405             NonStandardLogRelCrap((__FUNCTION__ ": SetupCopyOEMInf fail winEr (%d)\n", winEr));
     405            NonStandardLogRelCrap((__FUNCTION__ ": SetupCopyOEMInf fail dwErr=%ld\n", dwErr));
    406406        }
    407407        return hr;
     
    430430        if (!SetupUninstallOEMInfW(DstInfName, fFlags, NULL /*__in PVOID Reserved == NULL */))
    431431        {
    432             DWORD winEr = GetLastError();
    433             NonStandardLogRelCrap((__FUNCTION__ ": SetupUninstallOEMInf failed for file (%S), oem(%S), winEr (%d)\n", lpszInfPath, DstInfName, winEr));
     432            DWORD dwErr = GetLastError();
     433            NonStandardLogRelCrap((__FUNCTION__ ": SetupUninstallOEMInf failed for file (%S), oem(%S), dwErr=%ld\n", lpszInfPath, DstInfName, dwErr));
    434434            NonStandardAssert(0);
    435             return HRESULT_FROM_WIN32(winEr);
     435            return HRESULT_FROM_WIN32(dwErr);
    436436        }
    437437    }
     
    442442static HRESULT vboxDrvCfgCollectInfsSetupDi(const GUID * pGuid, LPCWSTR pPnPId, VBoxDrvCfgStringList & list)
    443443{
    444     DWORD winEr = ERROR_SUCCESS;
     444    DWORD dwErr = ERROR_SUCCESS;
    445445    int counter = 0;
    446446    HDEVINFO hDevInfo = SetupDiCreateDeviceInfoList(
     
    494494                    else
    495495                    {
    496                         DWORD winEr = GetLastError();
    497                         NonStandardLogRelCrap((__FUNCTION__": SetupDiGetDriverInfoDetail fail winEr (%d), size(%d)", winEr, dwReq));
     496                        DWORD dwErr = GetLastError();
     497                        NonStandardLogRelCrap((__FUNCTION__": SetupDiGetDriverInfoDetail fail dwErr=%ld, size(%d)", dwErr, dwReq));
    498498//                        NonStandardAssert(0);
    499499                    }
     
    502502                else
    503503                {
    504                     DWORD winEr = GetLastError();
    505                     if (winEr == ERROR_NO_MORE_ITEMS)
     504                    DWORD dwErr = GetLastError();
     505                    if (dwErr == ERROR_NO_MORE_ITEMS)
    506506                    {
    507507                        break;
     
    519519        else
    520520        {
    521             winEr = GetLastError();
     521            dwErr = GetLastError();
    522522            NonStandardAssert(0);
    523523        }
     
    527527    else
    528528    {
    529         winEr = GetLastError();
     529        dwErr = GetLastError();
    530530        NonStandardAssert(0);
    531531    }
    532532
    533     return HRESULT_FROM_WIN32(winEr);
     533    return HRESULT_FROM_WIN32(dwErr);
    534534}
    535535
     
    603603            if (!bNext)
    604604            {
    605                 int winEr = GetLastError();
    606                 if (winEr != ERROR_NO_MORE_FILES)
     605                DWORD dwErr = GetLastError();
     606                if (dwErr != ERROR_NO_MORE_FILES)
    607607                {
    608                     NonStandardLogRelCrap((__FUNCTION__": FindNextFile fail winEr (%d)\n", winEr));
     608                    NonStandardLogRelCrap((__FUNCTION__": FindNextFile fail dwErr=%ld\n", dwErr));
    609609                    NonStandardAssert(0);
    610                     hr = HRESULT_FROM_WIN32(winEr);
     610                    hr = HRESULT_FROM_WIN32(dwErr);
    611611                }
    612612                break;
     
    617617    else
    618618    {
    619         int winEr = GetLastError();
    620         if (winEr != ERROR_NO_MORE_FILES)
    621         {
    622             NonStandardLogRelCrap((__FUNCTION__": FindFirstFile fail winEr (%d)\n", winEr));
     619        DWORD dwErr = GetLastError();
     620        if (dwErr != ERROR_NO_MORE_FILES)
     621        {
     622            NonStandardLogRelCrap((__FUNCTION__": FindFirstFile fail dwErr=%ld\n", dwErr));
    623623            NonStandardAssert(0);
    624             hr = HRESULT_FROM_WIN32(winEr);
     624            hr = HRESULT_FROM_WIN32(dwErr);
    625625        }
    626626    }
     
    632632{
    633633    PINFENUM_CONTEXT pContext = (PINFENUM_CONTEXT)pCtxt;
    634     DWORD winEr;
     634    DWORD dwErr;
    635635//    NonStandardLogRelCrap(("vboxDrvCfgInfEnumerationCallback: pFileName (%S)\n", pFileName));
    636636
     
    638638    if (hInf == INVALID_HANDLE_VALUE)
    639639    {
    640         winEr = GetLastError();
    641 //        NonStandardAssert(winEr == ERROR_CLASS_MISMATCH);
    642         if (winEr != ERROR_CLASS_MISMATCH)
    643         {
    644             NonStandardLogCrap((__FUNCTION__ ": SetupOpenInfFileW err winEr (%d)\n", winEr));
     640        dwErr = GetLastError();
     641//        NonStandardAssert(dwErr == ERROR_CLASS_MISMATCH);
     642        if (dwErr != ERROR_CLASS_MISMATCH)
     643        {
     644            NonStandardLogCrap((__FUNCTION__ ": SetupOpenInfFileW err dwErr=%ld\n", dwErr));
    645645        }
    646646
     
    659659                        ))
    660660            {
    661                 winEr = GetLastError();
    662                 NonStandardLogRelCrap((__FUNCTION__ ": SetupUninstallOEMInf failed for file (%S), winEr (%d)\n", lpszFileName, winEr));
     661                dwErr = GetLastError();
     662                NonStandardLogRelCrap((__FUNCTION__ ": SetupUninstallOEMInf failed for file (%S), dwErr=%ld\n", lpszFileName, dwErr));
    663663                NonStandardAssert(0);
    664                 hr = HRESULT_FROM_WIN32( winEr );
     664                hr = HRESULT_FROM_WIN32( dwErr );
    665665            }
    666666        }
     
    670670    else
    671671    {
    672         NonStandardLogCrap((__FUNCTION__ ": vboxDrvCfgInfQueryFirstPnPId failed, hr = (0x%x)\n", hr));
     672        NonStandardLogCrap((__FUNCTION__ ": vboxDrvCfgInfQueryFirstPnPId failed, hr=0x%x\n", hr));
    673673    }
    674674
     
    704704        else
    705705        {
    706             NonStandardLogRelCrap((__FUNCTION__": vboxDrvCfgEnumFiles failed, hr = (0x%x)\n", hr));
     706            NonStandardLogRelCrap((__FUNCTION__": vboxDrvCfgEnumFiles failed, hr=0x%x\n", hr));
    707707        }
    708708    }
    709709    else
    710710    {
    711         NonStandardLogRelCrap((__FUNCTION__": SHGetFolderPathW failed, hr = (0x%x)\n", hr));
     711        NonStandardLogRelCrap((__FUNCTION__": SHGetFolderPathW failed, hr=0x%x\n", hr));
    712712    }
    713713
     
    729729    if (hMgr == NULL)
    730730    {
    731         DWORD winEr = GetLastError();
    732         NonStandardLogRelCrap((__FUNCTION__": OpenSCManager failed, winEr (%d)\n", winEr));
    733         return HRESULT_FROM_WIN32(winEr);
     731        DWORD dwErr = GetLastError();
     732        NonStandardLogRelCrap((__FUNCTION__": OpenSCManager failed, dwErr=%ld\n", dwErr));
     733        return HRESULT_FROM_WIN32(dwErr);
    734734    }
    735735
     
    744744            if (!fRc)
    745745            {
    746                 DWORD winEr = GetLastError();
    747                 NonStandardLogRelCrap((__FUNCTION__": QueryServiceStatus failed winEr (%d)\n", winEr));
    748                 hr = HRESULT_FROM_WIN32(winEr);
     746                DWORD dwErr = GetLastError();
     747                NonStandardLogRelCrap((__FUNCTION__": QueryServiceStatus failed dwErr=%ld\n", dwErr));
     748                hr = HRESULT_FROM_WIN32(dwErr);
    749749                break;
    750750            }
     
    757757                if (!fRc)
    758758                {
    759                     DWORD winEr = GetLastError();
    760                     NonStandardLogRelCrap((__FUNCTION__": StartService failed winEr (%d)\n", winEr));
    761                     hr = HRESULT_FROM_WIN32(winEr);
     759                    DWORD dwErr = GetLastError();
     760                    NonStandardLogRelCrap((__FUNCTION__": StartService failed dwErr=%ld\n", dwErr));
     761                    hr = HRESULT_FROM_WIN32(dwErr);
    762762                    break;
    763763                }
     
    767767            if (!fRc)
    768768            {
    769                 DWORD winEr = GetLastError();
    770                 NonStandardLogRelCrap((__FUNCTION__": QueryServiceStatus failed winEr (%d)\n", winEr));
    771                 hr = HRESULT_FROM_WIN32(winEr);
     769                DWORD dwErr = GetLastError();
     770                NonStandardLogRelCrap((__FUNCTION__": QueryServiceStatus failed dwErr=%ld\n", dwErr));
     771                hr = HRESULT_FROM_WIN32(dwErr);
    772772                break;
    773773            }
     
    781781                    if (!fRc)
    782782                    {
    783                         DWORD winEr = GetLastError();
    784                         NonStandardLogRelCrap((__FUNCTION__": QueryServiceStatus failed winEr (%d)\n", winEr));
    785                         hr = HRESULT_FROM_WIN32(winEr);
     783                        DWORD dwErr = GetLastError();
     784                        NonStandardLogRelCrap((__FUNCTION__": QueryServiceStatus failed dwErr=%ld\n", dwErr));
     785                        hr = HRESULT_FROM_WIN32(dwErr);
    786786                        break;
    787787                    }
     
    804804    else
    805805    {
    806         DWORD winEr = GetLastError();
    807         NonStandardLogRelCrap((__FUNCTION__": OpenServiceW failed, winEr (%d)\n", winEr));
    808         hr = HRESULT_FROM_WIN32(winEr);
     806        DWORD dwErr = GetLastError();
     807        NonStandardLogRelCrap((__FUNCTION__": OpenServiceW failed, dwErr=%ld\n", dwErr));
     808        hr = HRESULT_FROM_WIN32(dwErr);
    809809    }
    810810
     
    828828    if (!dwChars || dwChars >= MAX_PATH)
    829829    {
    830         NonStandardLogCrap(("GetFullPathNameW failed, WinEr(%d), dwChars(%d)\n", GetLastError(), dwChars));
     830        NonStandardLogCrap(("GetFullPathNameW failed, dwErr=%ld, dwChars=%ld\n",
     831                            GetLastError(), dwChars));
    831832        return E_INVALIDARG;
    832833    }
     
    839840            &bRebootRequired))
    840841    {
    841         NonStandardLogCrap(("UpdateDriverForPlugAndPlayDevicesW failed, WinEr(%d)\n", GetLastError(), dwChars));
    842         return E_FAIL;
     842        DWORD dwErr = GetLastError();
     843        NonStandardLogCrap(("UpdateDriverForPlugAndPlayDevicesW failed, dwErr=%ld\n",
     844                            dwErr));
     845        return HRESULT_FROM_WIN32(dwErr);
    843846    }
    844847
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