VirtualBox

儲存庫 vbox 的更動 38731


忽略:
時間撮記:
2011-9-13 下午01:05:12 (13 年 以前)
作者:
vboxsync
訊息:

VBoxDrvCfg.cpp: Mark non-standard logging and assertions as such instead of wasting time figuring out why '%S' looks all wrong in this file.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/HostDrivers/win/cfg/VBoxDrvCfg.cpp

    r38636 r38731  
    101101/* we do not use IPRT Logging because the lib is used in host installer and needs to
    102102 * post its msgs to MSI logger */
    103 #define Log(_m)     do { vboxDrvCfgLogRegular _m ; } while (0)
    104 #define LogFlow(_m) do { vboxDrvCfgLogFlow _m ; } while (0)
    105 #define LogRel(_m)  do { vboxDrvCfgLogRel _m ; } while (0)
    106 #define AssertFailed() vboxDrvCfgPanic()
    107 #define Assert(_m) do { \
     103#define NonStandardLogCrap(_m)     do { vboxDrvCfgLogRegular _m ; } while (0)
     104#define NonStandardLogFlowCrap(_m) do { vboxDrvCfgLogFlow _m ; } while (0)
     105#define NonStandardLogRelCrap(_m)  do { vboxDrvCfgLogRel _m ; } while (0)
     106#define NonStandardAssertFailed() vboxDrvCfgPanic()
     107#define NonStandardAssert(_m) do { \
    108108        if (RT_UNLIKELY(!(_m))) {  vboxDrvCfgPanic(); } \
    109109    } while (0)
     
    168168HRESULT VBoxDrvCfgStringList::resize(int newSize)
    169169{
    170     Assert(newSize >= mSize);
     170    NonStandardAssert(newSize >= mSize);
    171171    if (newSize < mSize)
    172172        return E_FAIL;
     
    202202    {
    203203        DWORD winEr = GetLastError();
    204         LogRel((__FUNCTION__ ": SetupFindFirstLine failed WinEr (%d) for Section(%S), Key(%S)\n", winEr, lpszSection, lpszKey));
     204        NonStandardLogRelCrap((__FUNCTION__ ": SetupFindFirstLine failed WinEr (%d) for Section(%S), Key(%S)\n", winEr, lpszSection, lpszKey));
    205205        return HRESULT_FROM_WIN32(winEr);
    206206    }
     
    216216    {
    217217        winEr = GetLastError();
    218 //        Assert(winEr == ERROR_INSUFFICIENT_BUFFER);
     218//        NonStandardAssert(winEr == ERROR_INSUFFICIENT_BUFFER);
    219219        if (winEr != ERROR_INSUFFICIENT_BUFFER)
    220220        {
    221             LogFlow((__FUNCTION__ ": SetupGetStringField failed WinEr (%d) for iValue(%d)\n", winEr, iValue));
     221            NonStandardLogFlowCrap((__FUNCTION__ ": SetupGetStringField failed WinEr (%d) for iValue(%d)\n", winEr, iValue));
    222222            return HRESULT_FROM_WIN32(winEr);
    223223        }
     
    225225
    226226    LPWSTR lpszValue = (LPWSTR)malloc(cValue * sizeof (lpszValue[0]));
    227     Assert(lpszValue);
     227    NonStandardAssert(lpszValue);
    228228    if (!lpszValue)
    229229    {
    230         LogRel((__FUNCTION__ ": SetCoTaskMemAlloc failed to alloc mem of size (%d), for iValue(%d)\n", cValue * sizeof (lpszValue[0]), winEr, iValue));
     230        NonStandardLogRelCrap((__FUNCTION__ ": SetCoTaskMemAlloc failed to alloc mem of size (%d), for iValue(%d)\n", cValue * sizeof (lpszValue[0]), winEr, iValue));
    231231        return E_FAIL;
    232232    }
     
    235235    {
    236236        winEr = GetLastError();
    237         LogRel((__FUNCTION__ ": SetupGetStringField failed WinEr (%d) for iValue(%d)\n", winEr, iValue));
    238         Assert(0);
     237        NonStandardLogRelCrap((__FUNCTION__ ": SetupGetStringField failed WinEr (%d) for iValue(%d)\n", winEr, iValue));
     238        NonStandardAssert(0);
    239239        free(lpszValue);
    240240        return HRESULT_FROM_WIN32(winEr);
     
    263263    if (hr != S_OK)
    264264    {
    265         Log((__FUNCTION__ ": vboxDrvCfgInfQueryContext for Manufacturer failed, hr = (0x%x)\n", hr));
     265        NonStandardLogCrap((__FUNCTION__ ": vboxDrvCfgInfQueryContext for Manufacturer failed, hr = (0x%x)\n", hr));
    266266        return hr;
    267267    }
     
    270270    if (hr != S_OK)
    271271    {
    272         LogRel((__FUNCTION__ ": vboxDrvCfgRegQueryKeyValue 1 for Manufacturer failed, hr = (0x%x)\n", hr));
     272        NonStandardLogRelCrap((__FUNCTION__ ": vboxDrvCfgRegQueryKeyValue 1 for Manufacturer failed, hr = (0x%x)\n", hr));
    273273        return hr;
    274274    }
     
    352352    if (hr != S_OK)
    353353    {
    354         Log((__FUNCTION__ ": vboxDrvCfgRegQueryKeyValue for Manufacturer failed, hr = (0x%x)\n", hr));
     354        NonStandardLogCrap((__FUNCTION__ ": vboxDrvCfgRegQueryKeyValue for Manufacturer failed, hr = (0x%x)\n", hr));
    355355        return hr;
    356356    }
     
    360360    if (hr != S_OK)
    361361    {
    362         LogRel((__FUNCTION__ ": vboxDrvCfgInfQueryContext for models (%S) failed, hr = (0x%x)\n", lpszModels, hr));
     362        NonStandardLogRelCrap((__FUNCTION__ ": vboxDrvCfgInfQueryContext for models (%S) failed, hr = (0x%x)\n", lpszModels, hr));
    363363    }
    364364    else
     
    367367        if (hr != S_OK)
    368368        {
    369             LogRel((__FUNCTION__ ": vboxDrvCfgRegQueryKeyValue for models (%S) failed, hr = (0x%x)\n", lpszModels, hr));
     369            NonStandardLogRelCrap((__FUNCTION__ ": vboxDrvCfgRegQueryKeyValue for models (%S) failed, hr = (0x%x)\n", lpszModels, hr));
    370370        }
    371371    }
     
    401401        if (fCopyStyle != SP_COPY_REPLACEONLY || hr != VBOXDRVCFG_S_INFEXISTS)
    402402        {
    403             LogRel((__FUNCTION__ ": SetupCopyOEMInf fail winEr (%d)\n", winEr));
     403            NonStandardLogRelCrap((__FUNCTION__ ": SetupCopyOEMInf fail winEr (%d)\n", winEr));
    404404        }
    405405        return hr;
     
    429429        {
    430430            DWORD winEr = GetLastError();
    431             LogRel((__FUNCTION__ ": SetupUninstallOEMInf failed for file (%S), oem(%S), winEr (%d)\n", lpszInfPath, DstInfName, winEr));
    432             Assert(0);
     431            NonStandardLogRelCrap((__FUNCTION__ ": SetupUninstallOEMInf failed for file (%S), oem(%S), winEr (%d)\n", lpszInfPath, DstInfName, winEr));
     432            NonStandardAssert(0);
    433433            return HRESULT_FROM_WIN32(winEr);
    434434        }
     
    482482                            if (!wcsicmp(pHwId, pPnPId))
    483483                            {
    484                                 Assert(pDrvDetail->InfFileName[0]);
     484                                NonStandardAssert(pDrvDetail->InfFileName[0]);
    485485                                if (pDrvDetail->InfFileName)
    486486                                {
     
    493493                    {
    494494                        DWORD winEr = GetLastError();
    495                         LogRel((__FUNCTION__": SetupDiGetDriverInfoDetail fail winEr (%d), size(%d)", winEr, dwReq));
    496 //                        Assert(0);
     495                        NonStandardLogRelCrap((__FUNCTION__": SetupDiGetDriverInfoDetail fail winEr (%d), size(%d)", winEr, dwReq));
     496//                        NonStandardAssert(0);
    497497                    }
    498498
     
    506506                    }
    507507
    508                     Assert(0);
     508                    NonStandardAssert(0);
    509509                }
    510510            }
     
    518518        {
    519519            winEr = GetLastError();
    520             Assert(0);
     520            NonStandardAssert(0);
    521521        }
    522522
     
    526526    {
    527527        winEr = GetLastError();
    528         Assert(0);
     528        NonStandardAssert(0);
    529529    }
    530530
     
    538538    if (rc != VINF_SUCCESS)
    539539    {
    540         LogRel(("Could not init IPRT!, rc (%d)\n", rc));
     540        NonStandardLogRelCrap(("Could not init IPRT!, rc (%d)\n", rc));
    541541        return E_FAIL;
    542542    }
     
    573573
    574574            vboxDrvCfgInfEnumerationCallback(pRel, &Context);
    575 //            LogRel(("inf : %S\n", list.get(i)));
     575//            NonStandardLogRelCrap(("inf : %S\n", list.get(i)));
    576576        }
    577577    }
     
    604604                if (winEr != ERROR_NO_MORE_FILES)
    605605                {
    606                     LogRel((__FUNCTION__": FindNextFile fail winEr (%d)\n", winEr));
    607                     Assert(0);
     606                    NonStandardLogRelCrap((__FUNCTION__": FindNextFile fail winEr (%d)\n", winEr));
     607                    NonStandardAssert(0);
    608608                    hr = HRESULT_FROM_WIN32(winEr);
    609609                }
     
    618618        if (winEr != ERROR_NO_MORE_FILES)
    619619        {
    620             LogRel((__FUNCTION__": FindFirstFile fail winEr (%d)\n", winEr));
    621             Assert(0);
     620            NonStandardLogRelCrap((__FUNCTION__": FindFirstFile fail winEr (%d)\n", winEr));
     621            NonStandardAssert(0);
    622622            hr = HRESULT_FROM_WIN32(winEr);
    623623        }
     
    631631    PINFENUM_CONTEXT pContext = (PINFENUM_CONTEXT)pCtxt;
    632632    DWORD winEr;
    633 //    LogRel(("vboxDrvCfgInfEnumerationCallback: pFileName (%S)\n", pFileName));
     633//    NonStandardLogRelCrap(("vboxDrvCfgInfEnumerationCallback: pFileName (%S)\n", pFileName));
    634634
    635635    HINF hInf = SetupOpenInfFileW(lpszFileName, pContext->InfInfo.lpszClassName, INF_STYLE_WIN4, NULL /*__in PUINT ErrorLine */);
     
    637637    {
    638638        winEr = GetLastError();
    639 //        Assert(winEr == ERROR_CLASS_MISMATCH);
     639//        NonStandardAssert(winEr == ERROR_CLASS_MISMATCH);
    640640        if (winEr != ERROR_CLASS_MISMATCH)
    641641        {
    642             Log((__FUNCTION__ ": SetupOpenInfFileW err winEr (%d)\n", winEr));
     642            NonStandardLogCrap((__FUNCTION__ ": SetupOpenInfFileW err winEr (%d)\n", winEr));
    643643        }
    644644
     
    658658            {
    659659                winEr = GetLastError();
    660                 LogRel((__FUNCTION__ ": SetupUninstallOEMInf failed for file (%S), winEr (%d)\n", lpszFileName, winEr));
    661                 Assert(0);
     660                NonStandardLogRelCrap((__FUNCTION__ ": SetupUninstallOEMInf failed for file (%S), winEr (%d)\n", lpszFileName, winEr));
     661                NonStandardAssert(0);
    662662                hr = HRESULT_FROM_WIN32( winEr );
    663663            }
     
    668668    else
    669669    {
    670         Log((__FUNCTION__ ": vboxDrvCfgInfQueryFirstPnPId failed, hr = (0x%x)\n", hr));
     670        NonStandardLogCrap((__FUNCTION__ ": vboxDrvCfgInfQueryFirstPnPId failed, hr = (0x%x)\n", hr));
    671671    }
    672672
     
    684684            SHGFP_TYPE_CURRENT, /*DWORD dwFlags*/
    685685            InfDirPath);
    686     Assert(hr == S_OK);
     686    NonStandardAssert(hr == S_OK);
    687687    if (hr == S_OK)
    688688    {
     
    695695        Context.hr = S_OK;
    696696        hr = vboxDrvCfgEnumFiles(InfDirPath, vboxDrvCfgInfEnumerationCallback, &Context);
    697         Assert(hr == S_OK);
     697        NonStandardAssert(hr == S_OK);
    698698        if (hr == S_OK)
    699699        {
     
    702702        else
    703703        {
    704             LogRel((__FUNCTION__": vboxDrvCfgEnumFiles failed, hr = (0x%x)\n", hr));
     704            NonStandardLogRelCrap((__FUNCTION__": vboxDrvCfgEnumFiles failed, hr = (0x%x)\n", hr));
    705705        }
    706706    }
    707707    else
    708708    {
    709         LogRel((__FUNCTION__": SHGetFolderPathW failed, hr = (0x%x)\n", hr));
     709        NonStandardLogRelCrap((__FUNCTION__": SHGetFolderPathW failed, hr = (0x%x)\n", hr));
    710710    }
    711711
     
    728728    {
    729729        DWORD winEr = GetLastError();
    730         LogRel((__FUNCTION__": OpenSCManager failed, winEr (%d)\n", winEr));
     730        NonStandardLogRelCrap((__FUNCTION__": OpenSCManager failed, winEr (%d)\n", winEr));
    731731        return HRESULT_FROM_WIN32(winEr);
    732732    }
     
    743743            {
    744744                DWORD winEr = GetLastError();
    745                 LogRel((__FUNCTION__": QueryServiceStatus failed winEr (%d)\n", winEr));
     745                NonStandardLogRelCrap((__FUNCTION__": QueryServiceStatus failed winEr (%d)\n", winEr));
    746746                hr = HRESULT_FROM_WIN32(winEr);
    747747                break;
     
    750750            if (Status.dwCurrentState != SERVICE_RUNNING && Status.dwCurrentState != SERVICE_START_PENDING)
    751751            {
    752                 LogRel(("Starting service (%S)\n", lpszSvcName));
     752                NonStandardLogRelCrap(("Starting service (%S)\n", lpszSvcName));
    753753
    754754                fRc = StartService(hSvc, 0, NULL);
     
    756756                {
    757757                    DWORD winEr = GetLastError();
    758                     LogRel((__FUNCTION__": StartService failed winEr (%d)\n", winEr));
     758                    NonStandardLogRelCrap((__FUNCTION__": StartService failed winEr (%d)\n", winEr));
    759759                    hr = HRESULT_FROM_WIN32(winEr);
    760760                    break;
     
    766766            {
    767767                DWORD winEr = GetLastError();
    768                 LogRel((__FUNCTION__": QueryServiceStatus failed winEr (%d)\n", winEr));
     768                NonStandardLogRelCrap((__FUNCTION__": QueryServiceStatus failed winEr (%d)\n", winEr));
    769769                hr = HRESULT_FROM_WIN32(winEr);
    770770                break;
     
    780780                    {
    781781                        DWORD winEr = GetLastError();
    782                         LogRel((__FUNCTION__": QueryServiceStatus failed winEr (%d)\n", winEr));
     782                        NonStandardLogRelCrap((__FUNCTION__": QueryServiceStatus failed winEr (%d)\n", winEr));
    783783                        hr = HRESULT_FROM_WIN32(winEr);
    784784                        break;
     
    791791            if (hr != S_OK || Status.dwCurrentState != SERVICE_RUNNING)
    792792            {
    793                 LogRel((__FUNCTION__": Failed to start the service\n"));
     793                NonStandardLogRelCrap((__FUNCTION__": Failed to start the service\n"));
    794794                hr = E_FAIL;
    795795                break;
     
    803803    {
    804804        DWORD winEr = GetLastError();
    805         LogRel((__FUNCTION__": OpenServiceW failed, winEr (%d)\n", winEr));
     805        NonStandardLogRelCrap((__FUNCTION__": OpenServiceW failed, winEr (%d)\n", winEr));
    806806        hr = HRESULT_FROM_WIN32(winEr);
    807807    }
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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