VirtualBox

Changeset 35445 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Jan 10, 2011 11:05:23 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
69316
Message:

Runtime/errmsgwin: add a heuristics for providing a human readable error message in more cases, avoiding the "Unknown Status" all over the place.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/win/errmsgwin.cpp

    r28800 r35445  
    55
    66/*
    7  * Copyright (C) 2006-2007 Oracle Corporation
     7 * Copyright (C) 2006-2011 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    8181            return &g_aStatusMsgs[i];
    8282
     83    /* The g_aStatusMsgs table contains a wild mix of error codes with and
     84     * without included facility and severity. So the chance is high that there
     85     * was no exact match. Try to find a non-exact match, and include the
     86     * actual value in case we pick the wrong entry. Better than always using
     87     * the "Unknown Status" case. */
     88    for (i = 0; i < RT_ELEMENTS(g_aStatusMsgs); i++)
     89        if (g_aStatusMsgs[i].iCode == HRESULT_CODE(rc))
     90        {
     91            int32_t iMsg = (ASMAtomicIncU32(&g_iUnknownMsgs) - 1) % RT_ELEMENTS(g_aUnknownMsgs);
     92            RTStrPrintf(&g_aszUnknownStr[iMsg][0], sizeof(g_aszUnknownStr[iMsg]), "%s 0x%X", g_aStatusMsgs[i].pszDefine, rc);
     93            return &g_aUnknownMsgs[iMsg];
     94        }
     95
    8396    /*
    8497     * Need to use the temporary stuff.
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